/* ===== COOKIE CONSENT =====================================================
   The banner and the preferences dialog, in their own sheet. Everything below
   reads style.css's :root — no colour, font or radius is invented here.
   The three answers are deliberately the same ghost button at the same size:
   that is the compliance position, so do not weight one over another.
   ========================================================================= */

/* ===== BANNER ===== */
/* Above the nav (1000) because it is the page's one open question. The wrapper
   spans the viewport so the card can centre itself in it, and passes clicks
   straight through: only the card is a target. */
.consent-banner {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1200;
    padding: 16px;
    pointer-events: none;
}

.consent-banner[hidden] { display: none; }

.consent-banner-inner {
    pointer-events: auto;
    position: relative;
    overflow: hidden;   /* the lit top edge below is drawn to the card's corners */
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px clamp(28px, 4vw, 52px);
    padding: 22px 26px;
    border-radius: 16px;
    /* A violet wash over a near-opaque panel, the way .hero-badge tints over an
       opaque base rather than letting the tint reach the backdrop: on first load this
       card sits over the hero's particle field, and at any real transparency the
       sphere reads straight through the copy. */
    background:
        linear-gradient(180deg, rgba(var(--accent-violet-rgb), 0.09), rgba(var(--accent-violet-rgb), 0.02)),
        rgba(var(--panel-rgb), 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(var(--accent-violet-rgb), 0.3);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6),
                0 6px 34px rgba(var(--accent-violet-rgb), 0.1);
}

/* Lit from above: the border at 0.3 all round, and the top edge alone at full
   strength, fading out before the corners. */
.consent-banner-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
                transparent,
                rgba(var(--accent-violet-rgb), 0.75) 20%,
                rgba(var(--accent-violet-rgb), 0.75) 80%,
                transparent);
    pointer-events: none;
}

/* The site's mono eyebrow at its smallest size. Full-strength violet, not knocked
   back: 11px mono needs the contrast (same call as .how-step-num). */
.consent-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-violet);
    margin-bottom: 8px;
}

.consent-text {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-body);
    /* Held to a measure rather than to the column: on a 1400px screen the paragraph
       would otherwise run to two very long lines. */
    max-width: 78ch;
}

/* Prose links in style.css are scoped to .simple-doc, so the one link in this
   paragraph is dressed here, to the same recipe. */
.consent-text a {
    color: var(--accent-violet);
    text-decoration-color: rgba(var(--accent-violet-rgb), 0.45);
    text-underline-offset: 3px;
    transition: color 0.3s ease, text-decoration-color 0.3s ease;
}

.consent-text a:hover {
    color: var(--violet-hover);
    text-decoration-color: var(--violet-hover);
}

/* Three equal tracks, not a flex row: in an auto-width grid the 1fr tracks all
   take the width of the widest label, so no answer comes out wider than another. */
.consent-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* .btn's geometry, stepped down to banner scale. The class in the markup is
   .btn .btn-secondary, so the fill, the border, the hover and the reduced-motion
   exemption all come from style.css and cannot drift from the site's own buttons.
   min-width is what makes three answers of different label lengths read as a set. */
.consent-btn {
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 9px;
    justify-content: center;
    white-space: nowrap;
    min-width: 152px;
}

/* ===== PREFERENCES DIALOG ===== */
.consent-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(var(--dark-rgb), 0.74);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* display:flex outranks the hidden attribute's UA rule, so it has to be said. */
.consent-overlay[hidden] { display: none; }

/* Nothing scrolls behind an open modal. */
.consent-locked { overflow: hidden; }

.consent-panel {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: min(88vh, 780px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(var(--accent-violet-rgb), 0.32);
    /* Sealed, not translucent: a surface that covers the page has to occlude it. The
       wash is the banner's, so the two read as one object opening into another. */
    background:
        linear-gradient(180deg, rgba(var(--accent-violet-rgb), 0.07), rgba(var(--accent-violet-rgb), 0.02)),
        var(--panel-bg);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7),
                0 8px 50px rgba(var(--accent-violet-rgb), 0.12);
}

.consent-panel:focus { outline: none; }   /* focused on open; the title is the feedback */

.consent-panel-head {
    position: relative;
    padding: 26px 28px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.consent-panel-title {
    font-family: var(--font-sans);
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.25;
    color: var(--text-primary);
}

.consent-panel-intro {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-top: 8px;
    max-width: 46ch;
}

/* Sized off the eyebrow's line, so the glyph sits level with it rather than
   floating in the corner. */
.consent-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-muted);
    transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.consent-close:hover {
    color: var(--accent-violet);
    border-color: var(--accent-violet);
    background: rgba(var(--accent-violet-rgb), 0.08);
}

.consent-close svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

/* The list scrolls, not the dialog: the head and the three answers stay put at any
   height, which is what keeps a short phone screen usable. */
.consent-cats {
    list-style: none;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 2px 28px;
}

.consent-cat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 18px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.consent-cat:last-child { border-bottom: none; }

.consent-cat-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.consent-cat-desc {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-top: 4px;
}

.consent-cat-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* aria-hidden: role="switch" already announces the state, and this would only say
   it twice. Fixed width so the switch does not shift as the label changes. */
.consent-state {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    text-align: right;
    white-space: nowrap;
    min-width: 62px;
    color: var(--text-dim);
    transition: color 0.3s ease;
}

.consent-cat.is-on .consent-state { color: var(--violet-pale); }

/* ---- the switch ---- */
/* Built rather than borrowed: there is no toggle anywhere else on the site, so
   this is the layers pill's vocabulary shrunk to a control. */
.consent-switch {
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
    padding: 0;
    border-radius: 999px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.consent-knob {
    position: absolute;
    top: 50%;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: var(--text-secondary);
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.consent-switch:hover { border-color: rgba(var(--accent-violet-rgb), 0.65); }

.consent-switch[aria-checked="true"] {
    background:
        linear-gradient(rgba(var(--accent-violet-rgb), 0.24), rgba(var(--accent-violet-rgb), 0.24)),
        var(--panel-bg);
    border-color: var(--accent-violet);
}

.consent-switch[aria-checked="true"] .consent-knob {
    transform: translate(20px, -50%);
    background: var(--violet-pale);
    box-shadow: 0 0 12px rgba(var(--accent-violet-rgb), 0.8);
}

/* Strictly necessary: on, and not a control. Still drawn, because hiding it would
   hide the fact that these cookies exist; the "Always on" label says why. */
.consent-switch:disabled {
    cursor: default;
    border-color: rgba(var(--accent-violet-rgb), 0.35);
    background: rgba(var(--accent-violet-rgb), 0.1);
}

.consent-switch:disabled .consent-knob {
    background: rgba(var(--accent-violet-rgb), 0.55);
    box-shadow: none;
}

.consent-cat.is-locked .consent-state { color: var(--text-dim-aa); }

/* ---- the three answers, again ---- */
.consent-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 28px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Equal weight here too, and equal width: the row is three tracks, so no answer
   is the wide one. */
.consent-panel-actions .consent-btn {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 12px;
}

/* ===== ENTRANCE ===== */
/* Motion only on arrival — nothing here loops. Buttons carry no hover motion,
   only style.css's colour feedback. */
@media (prefers-reduced-motion: no-preference) {
    .consent-banner-inner { animation: consentRise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
    .consent-overlay { animation: consentFade 0.2s ease both; }
    .consent-panel { animation: consentOpen 0.28s cubic-bezier(0.16, 1, 0.3, 1) both; }
}

@keyframes consentRise {
    from { opacity: 0; transform: translateY(20px); }
}

@keyframes consentFade {
    from { opacity: 0; }
}

@keyframes consentOpen {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
}

/* A toggle answers a press, so its state has to land; under reduced motion it
   lands instead of sliding. Same rule the chain follows in style.css. */
@media (prefers-reduced-motion: reduce) {
    .consent-switch,
    .consent-knob,
    .consent-state,
    .consent-close { transition: none; }
}

/* ===== FOOTER LINK ===== */
/* A button, because it opens a dialog rather than going anywhere — dressed as the
   footer link beside it. Ships hidden; consent.js reveals it, so it never appears
   where it cannot work. */
.consent-footer-link {
    font-family: inherit;
    font-size: 12px;
    line-height: inherit;
    text-align: left;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.3s ease;
}

.consent-footer-link:hover { color: var(--accent-violet); }

/* ===== NARROW ===== */
/* One column, and the answers stop being a row of three fixed widths: at 390px
   "Manage preferences" alone is most of the screen. They stack full width, in the
   same order. */
@media (max-width: 860px) {
    .consent-banner { padding: 12px; }

    .consent-banner-inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
        padding: 20px;
    }

    .consent-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .consent-btn { min-width: 0; }

    .consent-panel-actions {
        display: grid;
        grid-template-columns: 1fr;
        padding: 18px 20px 20px;
    }

    .consent-panel-head { padding: 22px 22px 18px; }
    .consent-cats { padding-inline: 22px; }
}

/* Below this the switch and its label no longer fit beside the copy without
   squeezing the description to three words a line: the control drops under the
   text, label first. */
@media (max-width: 420px) {
    .consent-cat {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .consent-cat-control { flex-direction: row-reverse; justify-content: flex-end; }
    .consent-state { min-width: 0; text-align: left; }
}
