/* =============================================================================
 * ActiveManage Consent Manager — styles
 *
 * Loaded by AMcc_renderFooter(). Paired with js/am-cookieconsent.js.
 *
 * THREE RULES THIS FILE HAS TO KEEP
 *
 * 1. "Accept all" and "Reject all" are visually identical. They share .am-cc-choice
 *    and there is no rule anywhere that makes one louder than the other. Regulators
 *    treat a bright accept beside a grey reject as invalid consent, and the easiest
 *    way to accidentally break that is in CSS, so it is pinned here rather than left
 *    to whoever edits the theme next.
 *
 * 2. It cannot inherit from, or leak into, the host site. Every selector is under
 *    #am-cc-root or .am-cc-*, and the root resets the properties a site theme is most
 *    likely to have set globally.
 *
 * 3. Contrast passes WCAG 2.1 AA at every size used here, in both schemes, and focus
 *    is always visible. A control the visitor cannot see they have focused is a
 *    control a keyboard user cannot use.
 * ========================================================================== */

#am-cc-root {

    /* Light scheme (the default). */
    --am-cc-bg: #ffffff;
    --am-cc-fg: #1c1f23;
    --am-cc-muted: #55595e;
    --am-cc-border: #d7dade;
    --am-cc-panel: #f5f6f8;
    --am-cc-accent: #0d6efd;
    --am-cc-accent-fg: #ffffff;
    --am-cc-track: #b9bec4;
    --am-cc-focus: #1c1f23;
    --am-cc-shadow: 0 4px 24px rgba(0, 0, 0, .18);
    --am-cc-radius: 10px;

    position: relative;
    z-index: 2147483000;                 /* above a site's own overlays, below nothing */

    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--am-cc-fg);
    text-align: left;
    letter-spacing: normal;
    text-transform: none;
}

#am-cc-root[data-theme="dark"] {
    --am-cc-bg: #1b1e21;
    --am-cc-fg: #f2f4f6;
    --am-cc-muted: #b6bcc3;
    --am-cc-border: #3a3f45;
    --am-cc-panel: #24282c;
    --am-cc-accent: #4c8dff;
    --am-cc-accent-fg: #10131a;
    --am-cc-track: #5a6169;
    --am-cc-focus: #ffffff;
    --am-cc-shadow: 0 4px 24px rgba(0, 0, 0, .55);
}

@media (prefers-color-scheme: dark) {
    #am-cc-root[data-theme="auto"] {
        --am-cc-bg: #1b1e21;
        --am-cc-fg: #f2f4f6;
        --am-cc-muted: #b6bcc3;
        --am-cc-border: #3a3f45;
        --am-cc-panel: #24282c;
        --am-cc-accent: #4c8dff;
        --am-cc-accent-fg: #10131a;
        --am-cc-track: #5a6169;
        --am-cc-focus: #ffffff;
        --am-cc-shadow: 0 4px 24px rgba(0, 0, 0, .55);
    }
}

#am-cc-root *,
#am-cc-root *::before,
#am-cc-root *::after {
    box-sizing: border-box;
}

#am-cc-root button,
#am-cc-root input,
#am-cc-root a {
    font: inherit;
    color: inherit;
}

/* Visible focus, everywhere, at a size that survives a busy background. */
#am-cc-root :focus-visible {
    outline: 3px solid var(--am-cc-focus);
    outline-offset: 2px;
    border-radius: 4px;
}

.am-cc-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------------------------------
 * Backdrop
 * ------------------------------------------------------------------------ */

.am-cc-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease;
    z-index: 1;
}

.am-cc-backdrop.am-cc-visible {
    opacity: 1;
    visibility: visible;
}

/* ---------------------------------------------------------------------------
 * Banner
 * ------------------------------------------------------------------------ */

.am-cc-banner {
    position: fixed;
    z-index: 3;
    background: var(--am-cc-bg);
    color: var(--am-cc-fg);
    box-shadow: var(--am-cc-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
}

.am-cc-banner.am-cc-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.am-cc-banner-inner {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 18px 22px;
    max-width: 1280px;
    margin: 0 auto;
}

.am-cc-banner-copy { flex: 1 1 380px; min-width: 0; }
.am-cc-banner-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Bar — full width, edge to edge. */
.am-cc-bar { left: 0; right: 0; border-top: 1px solid var(--am-cc-border); }
.am-cc-bar.am-cc-bottom { bottom: 0; }
.am-cc-bar.am-cc-top { top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--am-cc-border); transform: translateY(-12px); }
.am-cc-bar.am-cc-top.am-cc-visible { transform: none; }

/* Box — a card in a corner. */
.am-cc-box {
    max-width: 440px;
    border: 1px solid var(--am-cc-border);
    border-radius: var(--am-cc-radius);
    margin: 20px;
}

.am-cc-box .am-cc-banner-inner { flex-direction: column; align-items: stretch; gap: 16px; padding: 20px; }
.am-cc-box .am-cc-banner-actions { flex-direction: column; align-items: stretch; }

.am-cc-box.am-cc-bottom, .am-cc-box.am-cc-bottom-left { bottom: 0; left: 0; }
.am-cc-box.am-cc-bottom-right { bottom: 0; right: 0; }
.am-cc-box.am-cc-top, .am-cc-box.am-cc-top-left { top: 0; left: 0; }
.am-cc-box.am-cc-top-right { top: 0; right: 0; }
.am-cc-box.am-cc-middle { top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; }
.am-cc-box.am-cc-middle.am-cc-visible { transform: translate(-50%, -50%); }

/* Centre dialog — modal-shaped first layer. */
.am-cc-centre {
    top: 50%; left: 50%;
    transform: translate(-50%, -48%);
    width: min(560px, calc(100vw - 32px));
    border: 1px solid var(--am-cc-border);
    border-radius: var(--am-cc-radius);
}

.am-cc-centre.am-cc-visible { transform: translate(-50%, -50%); }
.am-cc-centre .am-cc-banner-inner { flex-direction: column; align-items: stretch; gap: 18px; padding: 24px; }
.am-cc-centre .am-cc-banner-actions { flex-direction: column; align-items: stretch; }

.am-cc-title { margin: 0 0 6px; font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.am-cc-body { margin: 0; color: var(--am-cc-muted); font-size: .94rem; }
.am-cc-body p { margin: 0 0 8px; }
.am-cc-body p:last-child { margin-bottom: 0; }

.am-cc-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }

.am-cc-link {
    color: var(--am-cc-accent);
    text-decoration: underline;
    font-size: .88rem;
}

.am-cc-linkbtn { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }

/* ---------------------------------------------------------------------------
 * Buttons
 *
 * .am-cc-choice is the parity class: accept and reject both carry it, and there is
 * no selector below that distinguishes them. Do not add one.
 * ------------------------------------------------------------------------ */

.am-cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;                     /* WCAG 2.5.5 target size */
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: .94rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

.am-cc-btn-primary {
    background: var(--am-cc-accent);
    color: var(--am-cc-accent-fg);
    border-color: var(--am-cc-accent);
}

.am-cc-btn-primary:hover { filter: brightness(.93); }

.am-cc-btn-secondary {
    background: transparent;
    color: var(--am-cc-fg);
    border-color: var(--am-cc-border);
}

.am-cc-btn-secondary:hover { background: var(--am-cc-panel); }

.am-cc-btn-save {
    background: var(--am-cc-panel);
    color: var(--am-cc-fg);
    border-color: var(--am-cc-border);
}

.am-cc-btn-save:hover { background: var(--am-cc-border); }

/* Same width in the stacked layouts, so neither reads as the "main" one. */
.am-cc-box .am-cc-choice,
.am-cc-centre .am-cc-choice { width: 100%; }

/* ---------------------------------------------------------------------------
 * Preferences dialog
 * ------------------------------------------------------------------------ */

.am-cc-dialog {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -48%);
    width: min(720px, calc(100vw - 24px));
    max-height: min(86vh, 900px);
    background: var(--am-cc-bg);
    border: 1px solid var(--am-cc-border);
    border-radius: var(--am-cc-radius);
    box-shadow: var(--am-cc-shadow);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 4;
}

.am-cc-dialog.am-cc-visible { opacity: 1; visibility: visible; transform: translate(-50%, -50%); }

.am-cc-dialog-inner { display: flex; flex-direction: column; max-height: inherit; }

.am-cc-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 12px;
    border-bottom: 1px solid var(--am-cc-border);
}

.am-cc-close {
    background: none;
    border: 0;
    font-size: 1.6rem;
    line-height: 1;
    width: 44px; height: 44px;
    flex: 0 0 44px;
    cursor: pointer;
    color: var(--am-cc-muted);
    border-radius: 8px;
}

.am-cc-close:hover { background: var(--am-cc-panel); color: var(--am-cc-fg); }

.am-cc-dialog-body { padding: 16px 22px; overflow-y: auto; flex: 1 1 auto; }

.am-cc-dialog-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 22px 18px;
    border-top: 1px solid var(--am-cc-border);
    background: var(--am-cc-panel);
    border-radius: 0 0 var(--am-cc-radius) var(--am-cc-radius);
}

.am-cc-dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }

.am-cc-notice {
    margin: 14px 0;
    padding: 12px 14px;
    background: var(--am-cc-panel);
    border-left: 4px solid var(--am-cc-accent);
    border-radius: 6px;
    font-size: .9rem;
}

/* ---------------------------------------------------------------------------
 * Categories
 * ------------------------------------------------------------------------ */

.am-cc-categories { margin-top: 14px; }

.am-cc-category {
    padding: 16px 0;
    border-top: 1px solid var(--am-cc-border);
}

.am-cc-category:first-child { border-top: 0; }

.am-cc-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.am-cc-category-name { margin: 0; font-size: 1rem; font-weight: 600; }
.am-cc-category-desc { margin: 6px 0 0; color: var(--am-cc-muted); font-size: .9rem; }

.am-cc-always {
    font-size: .82rem;
    font-weight: 600;
    color: var(--am-cc-muted);
    padding: 6px 10px;
    background: var(--am-cc-panel);
    border-radius: 999px;
    white-space: nowrap;
}

/* Switch — a real checkbox with the box moved off-screen, so it keeps every
   keyboard and screen-reader behaviour a checkbox already has. */
.am-cc-switch {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 52px;
    height: 30px;
    cursor: pointer;
}

.am-cc-switch-input {
    position: absolute;
    opacity: 0;
    width: 52px;
    height: 30px;
    margin: 0;
    cursor: pointer;
}

.am-cc-switch-track {
    position: absolute;
    inset: 0;
    background: var(--am-cc-track);
    border-radius: 999px;
    transition: background .18s ease;
    pointer-events: none;
}

.am-cc-switch-track::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 24px; height: 24px;
    background: #fff;
    border-radius: 50%;
    transition: transform .18s ease;
}

.am-cc-switch-input:checked + .am-cc-switch-track { background: var(--am-cc-accent); }
.am-cc-switch-input:checked + .am-cc-switch-track::after { transform: translateX(22px); }
.am-cc-switch-input:focus-visible + .am-cc-switch-track { outline: 3px solid var(--am-cc-focus); outline-offset: 2px; }

/* Forced-colours mode strips background colours, which would make the two switch
   states identical. A border keeps them distinguishable. */
@media (forced-colors: active) {
    .am-cc-switch-track { border: 2px solid CanvasText; }
    .am-cc-switch-input:checked + .am-cc-switch-track { background: Highlight; }
}

/* ---------------------------------------------------------------------------
 * Vendors and the cookie tables
 * ------------------------------------------------------------------------ */

.am-cc-subhead { margin: 14px 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--am-cc-muted); }

.am-cc-vendor-list { list-style: none; margin: 0; padding: 0; }
.am-cc-vendor-list li { padding: 8px 0; border-bottom: 1px solid var(--am-cc-border); font-size: .88rem; }
.am-cc-vendor-list li:last-child { border-bottom: 0; }
.am-cc-vendor-purpose { color: var(--am-cc-muted); margin-top: 2px; }
.am-cc-vendor-meta { color: var(--am-cc-muted); font-size: .82rem; margin-top: 2px; }

.am-cc-disclosure {
    margin-top: 10px;
    background: none;
    border: 0;
    padding: 6px 0;
    min-height: 32px;
    color: var(--am-cc-accent);
    text-decoration: underline;
    font-size: .86rem;
    cursor: pointer;
}

.am-cc-cookiepanel { margin-top: 8px; }

.am-cc-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.am-cc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
    min-width: 560px;
}

.am-cc-table th,
.am-cc-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--am-cc-border);
    vertical-align: top;
}

.am-cc-table th { background: var(--am-cc-panel); font-weight: 600; white-space: nowrap; }
.am-cc-table code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }

.am-cc-empty { color: var(--am-cc-muted); font-size: .88rem; font-style: italic; }

.am-cc-meta { margin-top: 18px; color: var(--am-cc-muted); font-size: .8rem; }
.am-cc-meta-line { word-break: break-all; }

/* ---------------------------------------------------------------------------
 * Floating button
 * ------------------------------------------------------------------------ */

.am-cc-fab {
    position: fixed;
    z-index: 2;
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 1px solid var(--am-cc-border);
    background: var(--am-cc-bg);
    color: var(--am-cc-fg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s;
}

.am-cc-fab.am-cc-visible { opacity: 1; visibility: visible; }
.am-cc-fab:hover { background: var(--am-cc-panel); }
.am-cc-fab-icon { display: flex; }

.am-cc-fab-bl { bottom: 18px; left: 18px; }
.am-cc-fab-br { bottom: 18px; right: 18px; }
.am-cc-fab-tl { top: 18px; left: 18px; }
.am-cc-fab-tr { top: 18px; right: 18px; }

/* ---------------------------------------------------------------------------
 * Blocked embed placeholder
 * ------------------------------------------------------------------------ */

.am-cc-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: var(--am-cc-panel, #f5f6f8);
    border: 1px dashed var(--am-cc-border, #d7dade);
    border-radius: var(--am-cc-radius, 10px);
    color: var(--am-cc-fg, #1c1f23);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: .9rem;
}

.am-cc-placeholder p { margin: 0; }

/* ---------------------------------------------------------------------------
 * Declaration, when embedded in a page of the site
 *
 * Outside #am-cc-root, so it needs its own variables. Kept deliberately plain: it is
 * body copy on somebody's cookie policy page and should look like the rest of it.
 * ------------------------------------------------------------------------ */

.am-cc-declaration {
    --am-cc-border: #d7dade;
    --am-cc-panel: #f5f6f8;
    --am-cc-muted: #55595e;
}

.am-cc-declaration h3 { margin: 24px 0 6px; }
.am-cc-declaration .am-cc-count { color: var(--am-cc-muted); font-weight: 400; }
.am-cc-declaration .am-cc-table { min-width: 560px; }

/* ---------------------------------------------------------------------------
 * Small screens
 * ------------------------------------------------------------------------ */

@media (max-width: 640px) {

    .am-cc-banner-inner { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
    .am-cc-banner-actions { flex-direction: column; align-items: stretch; }
    .am-cc-box { margin: 0; max-width: none; left: 0; right: 0; border-radius: var(--am-cc-radius) var(--am-cc-radius) 0 0; }
    .am-cc-box.am-cc-middle { top: auto; bottom: 0; transform: none; }
    .am-cc-box.am-cc-middle.am-cc-visible { transform: none; }

    .am-cc-dialog { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: 0; }
    .am-cc-dialog.am-cc-visible { transform: none; }
    .am-cc-dialog-inner { height: 100%; }
    .am-cc-dialog-actions { width: 100%; flex-direction: column; }
    .am-cc-dialog-actions .am-cc-btn { width: 100%; }

}

/* Respect a visitor who has asked for less movement. */
@media (prefers-reduced-motion: reduce) {
    #am-cc-root *,
    .am-cc-banner,
    .am-cc-dialog,
    .am-cc-backdrop,
    .am-cc-fab { transition: none !important; }
}
