/* ============================================
   COOKIE CONSENT
   Bottom band + the expandable storage table.

   Speaks the nx language: a solid ink band off
   the bottom edge, hairline rules, mono micro-
   labels, black/white pills. No accent colour,
   no glass, no drop shadow — the site has none
   of those anywhere else.

   Tokens come from nx.css (loaded on every
   page); the fallbacks keep it legible if the
   sheet ever fails to arrive.
   ============================================ */

.cc-root {
    /* Pure black, a hair under the --nx-ink used by the page's own dark
       bands, so the panel still steps forward when it lands on one. */
    --cc-bg:        var(--nx-black, #000000);
    --cc-line:      var(--nx-line-dark, rgba(255, 255, 255, .16));
    /* The band floats over arbitrary content, so its own top edge has to be
       a deliberate rule rather than the interior hairline weight. */
    --cc-edge:      rgba(255, 255, 255, .32);
    --cc-line-soft: rgba(255, 255, 255, .08);
    --cc-text:      var(--nx-white, #ffffff);
    --cc-muted:     var(--nx-mute-dark, #9a9a9a);
    --cc-dim:       rgba(255, 255, 255, .38);
    --cc-ease:      var(--nx-ease, cubic-bezier(.22, 1, .36, 1));

    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9500;
    max-height: 88svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateY(100%);
    opacity: 0;
    background: var(--cc-bg);
    border-top: 1px solid var(--cc-edge);
    color: var(--cc-text);
    font-family: var(--nx-sans, 'Switzer', 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif);
    letter-spacing: -.011em;
    transition: transform .72s var(--cc-ease), opacity .4s ease;
}

.cc-root.is-open {
    transform: translateY(0);
    opacity: 1;
}

.cc-main { padding: clamp(22px, 3.4vw, 34px) var(--nx-gutter, 20px); }

.cc-head {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 12px;
}

/* nx never decorates a heading with an icon — the mono rule below carries it */
.cc-head svg { display: none; }

.cc-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: -.02em;
    color: var(--cc-text);
}

/* Hairline running off to the edge, as on every nx section head */
.cc-head::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--cc-line);
}

.cc-text {
    margin: 0 0 22px;
    max-width: 62ch;
    font-size: .92rem;
    line-height: 1.7;
    color: var(--cc-muted);
}

.cc-text a {
    color: var(--cc-text);
    text-decoration: none;
    border-bottom: 1px solid var(--cc-line);
    transition: border-color .3s ease;
}

.cc-text a:hover { border-bottom-color: currentColor; }

/* ── Buttons ── */
.cc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.cc-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    border-radius: 999px;
    border: 1px solid var(--cc-line);
    background: none;
    font-family: var(--nx-mono, 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--cc-text);
    cursor: pointer;
    transition: background .45s var(--cc-ease), color .45s var(--cc-ease),
                border-color .45s var(--cc-ease);
}

.cc-btn:hover {
    background: var(--cc-text);
    border-color: var(--cc-text);
    color: var(--cc-bg);
}

/* The pill on a dark ground is the inverted one — see .nx-dark .nx-pill */
.cc-btn-primary {
    background: var(--cc-text);
    border-color: var(--cc-text);
    color: var(--cc-bg);
}

.cc-btn-primary:hover {
    background: none;
    border-color: var(--cc-text);
    color: var(--cc-text);
}

/* "Settings" reads as a quiet third option, not a third call to action */
.cc-btn-ghost {
    border-color: transparent;
    padding-left: 12px;
    padding-right: 12px;
    color: var(--cc-muted);
    margin-left: auto;
}

.cc-btn-ghost:hover {
    background: none;
    border-color: transparent;
    color: var(--cc-text);
}

.cc-btn-ghost svg { transition: transform .5s var(--cc-ease); }
.cc-root.is-expanded .cc-btn-ghost svg { transform: rotate(180deg); }

/* ── Details panel ── */
.cc-details {
    display: none;
    border-top: 1px solid var(--cc-line-soft);
    padding: clamp(22px, 3.4vw, 34px) var(--nx-gutter, 20px);
}

.cc-root.is-expanded .cc-details { display: block; }

.cc-details-intro {
    margin: 0 0 22px;
    max-width: 62ch;
    font-size: .88rem;
    line-height: 1.7;
    color: var(--cc-muted);
}

.cc-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--cc-line-soft);
    border-radius: 6px;
    -webkit-overflow-scrolling: touch;
}

.cc-table {
    width: 100%;
    min-width: 40rem;
    border-collapse: collapse;
    font-size: .86rem;
    line-height: 1.5;
    text-align: left;
}

.cc-table th,
.cc-table td {
    padding: 14px 16px;
    vertical-align: top;
    border-bottom: 1px solid var(--cc-line-soft);
}

/* 10px / .13em is the nx micro-label scale — see .lg-toc-label, .lg-defs dt */
.cc-table thead th {
    font-family: var(--nx-mono, 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--cc-muted);
    background: rgba(255, 255, 255, .03);
    white-space: nowrap;
}

.cc-table tbody tr:last-child th,
.cc-table tbody tr:last-child td { border-bottom: none; }

.cc-cat {
    font-weight: 500;
    color: var(--cc-text);
    white-space: nowrap;
}

.cc-cat small {
    display: block;
    margin-top: 6px;
    font-family: var(--nx-mono, 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--cc-dim);
    white-space: nowrap;
}

.cc-table td { color: var(--cc-muted); }

.cc-table code {
    font-family: var(--nx-mono, 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: .92em;
    color: var(--cc-text);
    white-space: nowrap;
}

.cc-none { color: var(--cc-dim); }

/* ── Toggles ── */
.cc-toggle-cell { width: 1%; white-space: nowrap; }

.cc-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 21px;
    flex: none;
}

.cc-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.cc-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: none;
    border: 1px solid var(--cc-line);
    transition: background .3s ease, border-color .3s ease;
    pointer-events: none;
}

.cc-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 3px;
    width: 13px;
    height: 13px;
    margin-top: -6.5px;
    border-radius: 50%;
    background: var(--cc-muted);
    transition: transform .3s var(--cc-ease), background .3s ease;
}

/* On, the switch inverts — white ground, ink knob, same move as the pill */
.cc-switch input:checked + .cc-slider {
    background: var(--cc-text);
    border-color: var(--cc-text);
}

.cc-switch input:checked + .cc-slider::before {
    transform: translateX(17px);
    background: var(--cc-bg);
}

.cc-switch input:focus-visible + .cc-slider {
    outline: 1px solid var(--cc-text);
    outline-offset: 3px;
}

.cc-switch input:disabled { cursor: not-allowed; }

.cc-switch input:disabled + .cc-slider {
    background: rgba(255, 255, 255, .4);
    border-color: rgba(255, 255, 255, .4);
}

.cc-switch input:disabled + .cc-slider::before { background: var(--cc-bg); }

.cc-details-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--cc-line-soft);
}

.cc-details-foot .cc-note {
    flex: 1 1 16rem;
    margin: 0;
    font-size: .8rem;
    line-height: 1.6;
    color: var(--cc-dim);
}

.cc-details-foot .cc-note a {
    color: var(--cc-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--cc-line);
    transition: color .3s ease, border-color .3s ease;
}

.cc-details-foot .cc-note a:hover { color: var(--cc-text); border-bottom-color: currentColor; }

@media (max-width: 640px) {
    .cc-actions { flex-direction: column; align-items: stretch; }
    .cc-btn { justify-content: center; }
    .cc-btn-ghost { margin-left: 0; order: 3; }
    .cc-details-foot { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
    .cc-root,
    .cc-btn,
    .cc-slider,
    .cc-slider::before,
    .cc-btn-ghost svg { transition: none; }
}
