/* cookie-consent.css — the FIFTH, opt-in stylesheet (the partner-directory.css
   pattern). Linked by SiteLayout only when a page renders the consent UI:
   /cookie-policy today, every page once WebConsentPolicy.bannerEnabled flips.

   WHY A FIFTH FILE AND NOT A site.css APPEND. WEB-72 charges `/` for site.css
   byte-for-byte and the live headroom is measured in tens of bytes; the whole
   modal band is used by one page. The opt-in flag's `false` default is what
   keeps these bytes off every budgeted surface — see SiteLayout.

   Colour: monochrome zinc via var(--…) only, no literals. WEB-123 sweeps this
   file; a chromatic literal here reds it.

   Motion: WEB-61's reduced-motion contract reads site.css ONLY, so this file
   is a blind spot for it and carries its own @media guard at the tail. WEB-132
   asserts that guard is present — do not add an animation above without one. */

/* ── Banner ─────────────────────────────────────────────────────────────── */

.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    padding: 0 var(--gutter) var(--gutter);
    animation: cookie-rise var(--motion-dur-quick) var(--motion-ease);
}

.cookie-banner.is-hidden,
.cookie-prefs.is-hidden {
    display: none;
}

/* Set by cookie-consent.js while the dialog is open, so the page behind the
   backdrop cannot be scrolled away underneath it. */
.cookie-scroll-lock {
    overflow: hidden;
}

.cookie-banner-inner {
    max-width: var(--content-width-wide);
    margin: 0 auto;
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
}

.cookie-banner-copy {
    flex: 1 1 22rem;
}

.cookie-banner-copy p {
    color: var(--text-muted);
    margin: 0 0 0.4rem;
}

.cookie-banner-title {
    color: var(--text);
    font-weight: 600;
}

.cookie-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

@keyframes cookie-rise {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* ── Preferences dialog ─────────────────────────────────────────────────── */

.cookie-prefs {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gutter);
}

.cookie-prefs-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    padding: 0;
    background: var(--bg);
    opacity: 0.72;
    cursor: pointer;
}

.cookie-prefs-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 34rem;
    max-height: calc(100vh - 2 * var(--gutter));
    animation: cookie-scale var(--motion-dur-quick) var(--motion-ease);
}

.cookie-prefs-head,
.cookie-prefs-foot {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
}

.cookie-prefs-head {
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.cookie-prefs-head h2 {
    font-size: 1.15rem;
    margin: 0;
}

.cookie-prefs-foot {
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
}

.cookie-prefs-close {
    background: none;
    border: 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    padding: 0.4rem;
    cursor: pointer;
}

.cookie-prefs-close:hover {
    color: var(--text);
}

.cookie-prefs-body {
    overflow-y: auto;
    padding: 1.25rem;
}

.cookie-prefs-intro {
    color: var(--text-muted);
    margin: 0 0 1.25rem;
}

.cookie-prefs-divider {
    border-top: 1px solid var(--border);
    margin-top: 1.25rem;
    padding-top: 1.25rem;
}

@keyframes cookie-scale {
    from {
        transform: scale(0.97);
        opacity: 0;
    }
}

/* ── Toggle ─────────────────────────────────────────────────────────────── */

.cookie-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.cookie-toggle:last-child {
    margin-bottom: 0;
}

.cookie-toggle-control {
    flex: 0 0 auto;
    padding-top: 0.15rem;
}

/* Clipped, NOT display:none — the input must stay focusable and announced.
   The visible track below is its label, so a click actuates the real
   control rather than a JS simulation of it. */
.cookie-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cookie-toggle-track {
    position: relative;
    display: block;
    width: 2.6rem;
    height: 1.45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-raised);
    cursor: pointer;
    transition: background var(--motion-dur-quick) var(--motion-ease);
}

.cookie-toggle-track::after {
    content: "";
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform var(--motion-dur-quick) var(--motion-ease);
}

.cookie-toggle-input:checked + .cookie-toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}

.cookie-toggle-input:checked + .cookie-toggle-track::after {
    background: var(--bg);
    transform: translateX(1.15rem);
}

.cookie-toggle-input:disabled + .cookie-toggle-track {
    cursor: not-allowed;
    opacity: 0.55;
}

.cookie-toggle-input:focus-visible + .cookie-toggle-track {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

.cookie-toggle-title {
    display: block;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.cookie-toggle-locked {
    color: var(--text-muted);
    font-weight: 400;
}

.cookie-toggle-summary {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0.2rem 0 0;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

/* .btn-primary exists in site.css only under `.auth-form`, so the consent
   surfaces — which are not forms — declare their own. Same tokens, so the
   two read as one control family. */

.cookie-banner .btn-primary,
.cookie-prefs .btn-primary,
.notice .btn-primary {
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: var(--bg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.6rem 1.1rem;
    cursor: pointer;
}

.cookie-banner .btn-secondary,
.cookie-prefs .btn-secondary,
.cookie-banner .btn-quiet,
.cookie-prefs .btn-quiet {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.6rem 1.1rem;
    cursor: pointer;
}

.cookie-banner .btn-quiet,
.cookie-prefs .btn-quiet {
    border-color: transparent;
    color: var(--text-muted);
}

.cookie-banner .btn-primary:hover,
.cookie-prefs .btn-primary:hover,
.notice .btn-primary:hover {
    background: var(--accent-bright);
    border-color: var(--accent-bright);
}

.cookie-banner .btn-secondary:hover,
.cookie-prefs .btn-secondary:hover,
.cookie-banner .btn-quiet:hover,
.cookie-prefs .btn-quiet:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.cookie-banner button:focus-visible,
.cookie-prefs button:focus-visible,
.notice .btn-primary:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

.notice .btn-primary {
    margin-top: 0.8rem;
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */

/* This file's own guard: WEB-61 walks site.css only, so an animation added
   here is invisible to it. Everything above animates transform/opacity, none
   of it gates content visibility, so a full stop is safe. */

@media (prefers-reduced-motion: reduce) {
    .cookie-banner,
    .cookie-prefs-panel {
        animation: none;
    }

    .cookie-toggle-track,
    .cookie-toggle-track::after {
        transition: none;
    }
}
