/* ════════════════════════════════════════════════════════════════════
   FAQ COMPONENT — shared by the main page and the About page.
   Linked by index-v2.html and about.html; pairs with the _faq-modal.html
   fragment (markup) and faq-modal.js (behavior).

   Dark rules below are the base; the light theme is handled by the
   html[data-theme="light"] block at the bottom (relocated from
   index-light.css). Those light selectors out-specify the dark base, so
   they win on light routes regardless of stylesheet load order — no
   dependence on whether faq.css loads before or after the theme overlay.

   Token dependencies (provided by the host page): --parchment*, --copper,
   --copper-glow, --gold, --rgb-parchment/-ink/-black, --sp-*, --radius-lg/-sm,
   --dur-micro, --font-display/-mono/-sans. Light block also uses
   --rgb-ink-dark/-peri-light/-shadow/-white from the active light overlay.
   ════════════════════════════════════════════════════════════════════ */

/* Nav-pill trigger — a <button> styled to match the .nav-pill <a>
   links so it sits flush beside the "About" anchor. */
.nav-faq-btn {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--parchment-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    transition: all var(--dur-micro) var(--ease-out);
}
.nav-faq-btn:hover {
    color: var(--parchment);
    background: rgba(var(--rgb-parchment), 0.08);
}
.nav-faq-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--copper-glow);
}

/* Full-screen dim backdrop (mirrors #play-overlay). Scrolls as a
   whole on overflow so the dialog can grow past the viewport. */
.faq-overlay {
    position: fixed;
    inset: 0;
    background: rgba(var(--rgb-ink), 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 12rem var(--sp-4) var(--sp-16);
    overflow-y: auto;
    z-index: 1200;
    opacity: 0;
}
.faq-overlay.open {
    display: flex;
    opacity: 1;
}

/* The dialog card (mirrors .rubric-card / .search-card aesthetic). */
.faq-modal {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    background: rgb(13, 13, 17);
    border: 1.5px solid rgba(var(--rgb-parchment), 0.22);
    border-radius: var(--radius-lg);
    padding: var(--sp-8);
    box-shadow: 0 8px 40px rgba(var(--rgb-black), 0.5),
                inset 0 1px 0 rgba(var(--rgb-parchment), 0.05);
}

.faq-modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--parchment);
    margin: 0 0 var(--sp-6);
}

/* Close button (mirrors .rubric-close-btn). */
.faq-close-btn {
    position: absolute;
    top: var(--sp-4);
    right: var(--sp-4);
    background: transparent;
    color: var(--parchment-muted);
    border: 0;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 2px 8px;
    opacity: 0.6;
}
.faq-close-btn:hover { opacity: 1; color: var(--parchment); }
.faq-close-btn:focus-visible {
    outline: none;
    opacity: 1;
    box-shadow: 0 0 0 3px var(--copper-glow);
    border-radius: var(--radius-sm);
}

/* Accordion */
.faq-list {
    display: flex;
    flex-direction: column;
}
.faq-item {
    border-top: 1px solid rgba(var(--rgb-parchment), 0.1);
}
.faq-item:last-child {
    border-bottom: 1px solid rgba(var(--rgb-parchment), 0.1);
}
.faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: default;
    padding: var(--sp-4) 0;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--parchment-dim);
}
.faq-q:hover { color: var(--parchment); }
.faq-q:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--copper-glow);
    border-radius: var(--radius-sm);
}
.faq-item.open .faq-q { color: var(--copper); }

/* Plus/minus toggle: two thin bars. Collapsed shows a "+"; on open the
   vertical bar rotates flat onto the horizontal one, leaving a "−". */
.faq-caret {
    position: relative;
    flex-shrink: 0;
    width: 0.625rem;
    height: 0.625rem;
}
.faq-caret::before,
.faq-caret::after {
    content: "";
    position: absolute;
    background: rgba(var(--rgb-parchment), 0.32);
}
.faq-caret::before {           /* horizontal bar */
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-50%);
}
.faq-caret::after {            /* vertical bar */
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-50%);
}
.faq-item.open .faq-caret::after { transform: translateX(-50%) rotate(90deg); }
.faq-q:hover .faq-caret::before,
.faq-q:hover .faq-caret::after { background: var(--parchment); }
.faq-item.open .faq-caret::before,
.faq-item.open .faq-caret::after {
    background: var(--copper);
}

/* Answer — instant open/close (no transition). */
.faq-a {
    overflow: hidden;
    max-height: 0;
}
.faq-item.open .faq-a { max-height: none; }
.faq-a-inner {
    padding: 0 0 var(--sp-5);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--parchment);
}
.faq-a-inner a { color: var(--copper); text-decoration: none; vertical-align: -0.5px; }
.faq-a-inner a:hover { text-decoration: underline; }
.faq-a-inner strong { color: var(--parchment); font-weight: 600; }
.faq-a-inner p { margin: 0 0 var(--sp-3); }
.faq-a-inner p:last-child { margin-bottom: 0; }
/* Placeholder marker for answers awaiting confirmed facts. */
.faq-tbd {
    display: inline-block;
    margin-top: var(--sp-2);
    color: var(--gold);
    font-style: italic;
    font-size: 0.875rem;
}

/* Mobile: render as a full-screen sheet. */
@media (max-width: 640px) {
    .faq-overlay { padding: 0; }
    .faq-modal {
        max-width: none;
        min-height: 100vh;
        margin: 0;
        border-radius: 0;
        border: 0;
        padding: var(--sp-12) var(--sp-5) var(--sp-8);
    }
}

/* ════════════════════════════════════════════════════════════════════
   LIGHT THEME — relocated from index-light.css. These selectors carry an
   html[data-theme="light"] prefix, so they out-specify the dark base and
   win on every light route (/light, /light/about) without depending on
   stylesheet order. Text / open-question / link colors flip via the
   inverted tokens for free; only the hard-coded surfaces are patched here.
   ════════════════════════════════════════════════════════════════════ */
html[data-theme="light"] .nav-faq-btn:hover {
    background: rgba(var(--rgb-ink-dark), 0.06);
}
/* Softer dark scrim (was rgba(10,10,12,0.78)) so the page reads behind it. */
html[data-theme="light"] .faq-overlay { background: rgba(var(--rgb-ink-dark), 0.5); }
/* Dialog card — matches the About page's light backdrop (rgb 237,237,237,
   the --rgb-paper grey; was rgb(248,248,250), and rgb(13,13,17) in dark). The
   literal is used rather than var(--rgb-paper) because index-light.css inlines
   this grey and doesn't define that token, so the FAQ stays correct on the
   main route too. */
html[data-theme="light"] .faq-modal {
    background: rgb(237, 237, 237);
    border: 1.5px solid rgba(var(--rgb-peri-light), 0.7);
    box-shadow:
        0 18px 50px rgba(var(--rgb-shadow), 0.22),
        inset 0 1px 0 rgba(var(--rgb-white), 0.9);
}
/* Accordion dividers + the +/- caret bars: dark hairlines (were light
   parchment). The caret's hover/open colors flip via tokens for free. */
html[data-theme="light"] .faq-item { border-top-color: rgba(var(--rgb-ink-dark), 0.1); }
html[data-theme="light"] .faq-item:last-child { border-bottom-color: rgba(var(--rgb-ink-dark), 0.1); }
html[data-theme="light"] .faq-caret::before,
html[data-theme="light"] .faq-caret::after { background: rgba(var(--rgb-ink-dark), 0.4); }
