/* ============================================================================
   FAQ PAGE — Direction A
   ============================================================================
   Phase 3a translation of faq.jsx into vanilla CSS. All selectors prefixed
   `ps-faq-*`. Reuses `.ps-page` / `.ps-eyebrow` / `.ps-nav` / `.ps-footer`
   / `.ps-home-cta-*` from the shared layer.

   The accordion uses class `.faq-trigger` (NO `ps-` prefix) so the existing
   `script.js` accordion handler animates the panels. Visual styling for
   that trigger lives here under the `.ps-faq-item .faq-trigger` selectors.
   ============================================================================ */

/* ─────────────────────────────────────────────────────────────────────────
   HERO (left-aligned, max 820px) — mirrors pricing hero rhythm
   ───────────────────────────────────────────────────────────────────────── */

.ps-faq-hero {
    padding: 80px 48px 40px;
    background: var(--ps-bg);
}

.ps-faq-hero-inner {
    max-width: 820px;
}

.ps-faq-hero-title {
    font-family: var(--ps-font-display);
    font-size: clamp(48px, 8.5vw, 88px);
    letter-spacing: -0.032em;
    margin: 20px 0 24px;
    font-weight: 400;
    line-height: 0.96;
    color: var(--ps-ink);
}

.ps-faq-hero-title em {
    font-style: italic;
    color: var(--ps-teal);
}

.ps-faq-hero-lede {
    font-size: 19px;
    line-height: 1.55;
    color: var(--ps-ink-muted);
    margin: 0;
    max-width: 540px;
}

.ps-faq-hero-lede a {
    color: var(--ps-teal);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.ps-faq-hero-lede a:hover {
    color: var(--ps-teal-deep);
}

/* ─────────────────────────────────────────────────────────────────────────
   BODY WRAPPER (search + 2-column layout)
   ───────────────────────────────────────────────────────────────────────── */

.ps-faq-body {
    padding: 32px 48px 96px;
    background: var(--ps-bg);
}

/* ── Search bar (matches pricing search visual) ── */
.ps-faq-search-bar {
    background: var(--ps-card);
    border: 1px solid var(--ps-line);
    border-radius: 999px;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 560px;
    margin-bottom: 40px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ps-faq-search-bar:focus-within {
    border-color: var(--ps-teal);
    box-shadow: 0 8px 24px rgba(14, 93, 89, 0.10);
}

.ps-faq-search-bar > svg {
    color: var(--ps-ink-muted);
    flex-shrink: 0;
}

.ps-faq-search-bar input {
    border: none;
    outline: none;
    flex: 1;
    background: transparent;
    font-size: 15px;
    color: var(--ps-ink);
    font-family: var(--ps-font-body);
    min-height: 44px;
}

.ps-faq-search-bar input::placeholder { color: var(--ps-ink-muted); }

.ps-faq-search-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── 2-column layout ── */
.ps-faq-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 48px;
    align-items: start;
}

/* ─────────────────────────────────────────────────────────────────────────
   STICKY TOPIC NAV (left column)
   ───────────────────────────────────────────────────────────────────────── */

.ps-faq-topics {
    position: sticky;
    top: 96px;
    align-self: start;
}

.ps-faq-topics-label {
    font-size: 11px;
    color: var(--ps-ink-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin: 0 0 16px;
}

.ps-faq-topics-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ps-faq-topics-list a {
    display: block;
    font-size: 14px;
    color: var(--ps-ink);
    text-decoration: none;
    padding: 6px 0 6px 14px;
    border-left: 2px solid var(--ps-line);
    transition: color 150ms ease, border-color 150ms ease;
    line-height: 1.4;
}

.ps-faq-topics-list a:hover {
    color: var(--ps-teal);
    border-left-color: var(--ps-ink-muted);
}

.ps-faq-topics-list a:focus-visible {
    outline: 2px solid var(--ps-teal);
    outline-offset: 2px;
    border-radius: 2px;
}

.ps-faq-topics-list a[aria-current="true"] {
    color: var(--ps-teal);
    border-left-color: var(--ps-teal);
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────────
   CATEGORY SECTIONS (right column)
   ───────────────────────────────────────────────────────────────────────── */

.ps-faq-sections {
    display: flex;
    flex-direction: column;
    gap: 48px;
    min-width: 0;
}

.ps-faq-section {
    scroll-margin-top: 96px;
}

.ps-faq-section-title {
    font-family: var(--ps-font-display);
    font-size: clamp(28px, 4vw, 38px);
    letter-spacing: -0.026em;
    margin: 0 0 20px;
    font-weight: 400;
    line-height: 1.1;
    color: var(--ps-ink);
}

/* ─────────────────────────────────────────────────────────────────────────
   ACCORDION (Direction A look, driven by global .faq-trigger handler)
   ───────────────────────────────────────────────────────────────────────── */

.ps-faq-accordion {
    border: 1px solid var(--ps-line);
    border-radius: 16px;
    overflow: hidden;
    background: var(--ps-card);
}

.ps-faq-item {
    border-bottom: 1px solid var(--ps-line);
}

.ps-faq-item:last-child {
    border-bottom: none;
}

/* Accordion trigger — uses literal `.faq-trigger` so global handler binds */
.ps-faq-item .faq-trigger {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 22px 28px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    color: var(--ps-ink);
    font-family: var(--ps-font-display);
    font-size: 22px;
    letter-spacing: -0.014em;
    line-height: 1.25;
    font-weight: 400;
    min-height: 44px;
    transition: background-color 150ms ease;
}

.ps-faq-item .faq-trigger:hover {
    background: var(--ps-bg);
}

.ps-faq-item .faq-trigger:focus-visible {
    outline: 2px solid var(--ps-teal);
    outline-offset: -2px;
}

.ps-faq-item .faq-trigger-text {
    flex: 1;
}

/* Plus icon — italic serif glyph that rotates 45deg on expand */
.ps-faq-item .ps-faq-icon {
    flex-shrink: 0;
    font-family: var(--ps-font-display);
    font-style: italic;
    font-size: 26px;
    color: var(--ps-teal);
    line-height: 1;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms ease;
}

.ps-faq-item .faq-trigger[aria-expanded="true"] .ps-faq-icon {
    transform: rotate(45deg);
}

/* Panel — the global handler in script.js animates max-height inline.
   We provide the visual frame + reset max-height to 0 for the closed state. */
.ps-faq-item .faq-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease;
}

.ps-faq-panel-inner {
    padding: 0 28px 24px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--ps-ink-muted);
    max-width: 720px;
}

.ps-faq-panel-inner a {
    color: var(--ps-teal);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    font-weight: 500;
}

.ps-faq-panel-inner a:hover {
    color: var(--ps-teal-deep);
}

/* ─────────────────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────────────────── */

.ps-faq-empty {
    padding: 48px;
    text-align: center;
    color: var(--ps-ink-muted);
    background: var(--ps-card);
    border-radius: 16px;
    border: 1px dashed var(--ps-line-strong);
    font-size: 15px;
    line-height: 1.6;
}

.ps-faq-empty-query {
    color: var(--ps-ink);
    font-weight: 600;
    font-style: italic;
    font-family: var(--ps-font-display);
}

/* ─────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .ps-faq-layout {
        grid-template-columns: 180px 1fr;
        gap: 32px;
    }
}

@media (max-width: 768px) {
    .ps-faq-hero,
    .ps-faq-body {
        padding-left: 24px;
        padding-right: 24px;
    }

    .ps-faq-hero {
        padding-top: 56px;
        padding-bottom: 24px;
    }

    .ps-faq-hero-title {
        margin-bottom: 16px;
    }

    .ps-faq-body {
        padding-bottom: 64px;
    }

    /* Collapse to 1 column; sticky topic nav becomes a horizontal scroll
       strip pinned to the top of the right column. */
    .ps-faq-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .ps-faq-topics {
        position: sticky;
        top: 64px;
        z-index: 5;
        background: var(--ps-bg);
        margin: 0 -24px;
        padding: 12px 24px;
        border-bottom: 1px solid var(--ps-line);
        /* Contain the horizontal topic strip so its overflowing chips don't
           expand document scrollWidth past the viewport. Child ul still
           scrolls horizontally via overflow-x: auto below. */
        overflow: hidden;
    }

    .ps-faq-topics-label {
        display: none;
    }

    .ps-faq-topics-list {
        flex-direction: row;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .ps-faq-topics-list::-webkit-scrollbar {
        display: none;
    }

    .ps-faq-topics-list a {
        flex-shrink: 0;
        padding: 12px 18px;
        border-left: none;
        border: 1px solid var(--ps-line);
        border-radius: 999px;
        background: var(--ps-card);
        white-space: nowrap;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .ps-faq-topics-list a:hover {
        border-color: var(--ps-ink);
    }

    .ps-faq-topics-list a[aria-current="true"] {
        background: var(--ps-ink);
        border-color: var(--ps-ink);
        color: #fff;
    }

    .ps-faq-sections {
        gap: 32px;
    }

    .ps-faq-section {
        scroll-margin-top: 132px;
    }

    .ps-faq-search-bar {
        margin-bottom: 24px;
    }

    .ps-faq-item .faq-trigger {
        padding: 18px 20px;
        font-size: 19px;
        gap: 16px;
    }

    .ps-faq-panel-inner {
        padding: 0 20px 20px;
    }

    .ps-faq-empty {
        padding: 32px 20px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .ps-faq-search-bar,
    .ps-faq-topics-list a,
    .ps-faq-item .faq-trigger,
    .ps-faq-item .ps-faq-icon,
    .ps-faq-item .faq-panel {
        transition: none;
    }
}
