/* =========================================================
   HisaBooks - FAQ / Help center
   Self-contained page styles. Loads after css/hisabooks.css and
   reuses its design tokens (--ink, --primary, --line, …),
   header, and footer. All FAQ classes use the faqx- prefix.
   ========================================================= */

.faqx-page-body { background: var(--hb-mist); }

/* ── Hero ──────────────────────────────────────────────── */
.faqx-hero {
    position: relative;
    /* The navigation is fixed and reaches 94px down, so 22px of padding put the
       title underneath it. */
    padding: calc(var(--hb-nav-h) + clamp(26px, calc(3 * var(--hb-vw, 1vw)), 40px)) 0 clamp(32px, calc(3.5 * var(--hb-vw, 1vw)), 44px);
    text-align: center;
    background:
        radial-gradient(120% 90% at 50% -20%, rgba(31, 111, 255, .12), transparent 60%);
}

.faqx-hero__inner {
    width: min(720px, 88%);
    margin: 0 auto;
}

.faqx-hero .section-tag {
    margin: 0 auto;
}

.faqx-hero h1 {
    margin: 18px 0 14px;
    font-family: var(--hb-font);
    font-size: clamp(34px, calc(4.6 * var(--hb-vw, 1vw)), 52px);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--hb-ink);
}

.faqx-hero p {
    margin: 0 auto;
    max-width: 560px;
    color: var(--hb-muted);
    font-size: 17px;
    line-height: 1.6;
}

/* ── Search ────────────────────────────────────────────── */
.faqx-search {
    position: relative;
    max-width: 520px;
    margin: 30px auto 0;
}

.faqx-search__icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hb-muted);
    pointer-events: none;
}

.faqx-search input {
    width: 100%;
    height: 56px;
    margin: 0;
    padding: 0 48px;
    border: 1px solid var(--hb-line);
    border-radius: 999px;
    background: var(--hb-paper);
    color: var(--hb-ink);
    font-family: inherit;
    font-size: 15px;
    transition: border-color var(--hb-fast) var(--hb-ease);
    -webkit-appearance: none;
    appearance: none;
}

.faqx-search input::placeholder { color: var(--hb-muted); }
.faqx-search input::-webkit-search-cancel-button { display: none; }

.faqx-search input:focus {
    outline: none;
    border-color: var(--hb-blue-deep);
    outline: 3px solid var(--hb-blue-wash);
    outline-offset: 0;
}

.faqx-search__clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--hb-mist);
    color: var(--hb-muted);
    cursor: pointer;
    transition: background var(--hb-fast) var(--hb-ease), color var(--hb-fast) var(--hb-ease);
}

.faqx-search__clear:hover { background: var(--hb-line-soft); color: var(--hb-ink); }

/* ── Body layout ───────────────────────────────────────── */
.faqx-body { padding: 8px 0 72px; }

.faqx-shell {
    width: min(var(--hb-shell), 88%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 52px;
    align-items: start;
}

/* ── Sticky category nav ───────────────────────────────── */
.faqx-nav {
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.faqx-nav__label {
    padding: 0 14px 12px;
    color: var(--hb-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.faqx-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--hb-ink-soft);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    transition: background var(--hb-fast) var(--hb-ease), color var(--hb-fast) var(--hb-ease);
}

.faqx-nav a .count {
    color: var(--hb-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.faqx-nav a:hover {
    background: var(--hb-paper);
    color: var(--hb-ink);
}

.faqx-nav a.is-active {
    background: var(--hb-blue-wash);
    color: var(--hb-blue-dark);
    font-weight: 600;
}

.faqx-nav a.is-active .count { color: var(--hb-blue-deep); }

/* ── Question groups ───────────────────────────────────── */
.faqx-groups {
    display: flex;
    flex-direction: column;
    gap: 44px;
    min-width: 0;
}

.faqx-group { scroll-margin-top: 96px; }

.faqx-group__head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}

.faqx-group__eyebrow {
    flex: 0 0 auto;
    font-family: var(--hb-font);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--hb-blue-deep);
    font-variant-numeric: tabular-nums;
}

.faqx-group__head h2 {
    margin: 0;
    font-family: var(--hb-font);
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--hb-ink);
}

/* ── Accordion card ────────────────────────────────────── */
.faqx-list {
    background: var(--hb-paper);
    border: 1px solid var(--hb-line);
    border-radius: var(--hb-r-lg);
    overflow: hidden;
}

.faqx-item {
    border-top: 1px solid var(--hb-line-soft);
}

.faqx-item:first-child { border-top: 0; }

/* hidden by the search filter */
.faqx-item[hidden] { display: none; }

.faqx-item > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 19px 24px;
    color: var(--hb-ink);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    transition: color var(--hb-fast) var(--hb-ease), background var(--hb-fast) var(--hb-ease);
}

.faqx-item > summary::-webkit-details-marker { display: none; }
.faqx-item > summary:hover { color: var(--hb-blue-deep); }
.faqx-item > summary:focus-visible {
    outline: 2px solid var(--hb-blue-deep);
    outline-offset: -3px;
    border-radius: var(--hb-r-sm);
}

.faqx-item[open] > summary { color: var(--hb-ink); }

/* +/− toggle */
.faqx-item__icon {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--hb-line);
    color: var(--hb-muted);
    transition: background var(--hb-fast) var(--hb-ease), border-color var(--hb-fast) var(--hb-ease), color var(--hb-fast) var(--hb-ease);
}

.faqx-item__icon::before,
.faqx-item__icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: currentColor;
    border-radius: 2px;
    transition: transform var(--hb-fast) var(--hb-ease), opacity var(--hb-fast) var(--hb-ease);
}

.faqx-item__icon::before {
    width: 11px;
    height: 2px;
    transform: translate(-50%, -50%);
}

.faqx-item__icon::after {
    width: 2px;
    height: 11px;
    transform: translate(-50%, -50%);
}

.faqx-item[open] .faqx-item__icon {
    background: var(--hb-blue-wash);
    border-color: var(--hb-blue-deep);
    color: var(--hb-blue-deep);
}

.faqx-item[open] .faqx-item__icon::after {
    transform: translate(-50%, -50%) scaleY(0);
    opacity: 0;
}

.faqx-answer {
    padding: 0 24px 22px;
    color: var(--hb-muted);
    font-size: 15px;
    line-height: 1.7;
}

.faqx-answer p { margin: 0; }
.faqx-answer p + p { margin-top: 10px; }

/* subtle reveal */
.faqx-item[open] .faqx-answer {
    animation: faqxFade 200ms ease;
}

@keyframes faqxFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* group hidden when no item inside matches the search */
.faqx-group[hidden] { display: none; }

.faqx-empty {
    display: none;
    margin: 8px 0 0;
    padding: 40px 24px;
    text-align: center;
    color: var(--hb-muted);
    font-size: 15px;
    background: var(--hb-paper);
    border: 1px dashed var(--hb-line);
    border-radius: var(--hb-r-lg);
}

.faqx-empty a { color: var(--hb-blue-deep); font-weight: 600; }
.faqx-empty.is-visible { display: block; }

/* ── Closing CTA ───────────────────────────────────────── */
.faqx-cta {
    width: min(var(--hb-shell), 88%);
    margin: 0 auto 76px;
}

.faqx-cta__panel {
    position: relative;
    overflow: hidden;
    padding: 52px 40px;
    text-align: center;
    border-radius: var(--hb-r-xl);
    background:
        radial-gradient(120% 140% at 85% -10%, rgba(73, 148, 255, .35), transparent 55%),
        linear-gradient(150deg, #0d1b33 0%, #11264a 55%, #163663 100%);
    color: #fff;
}

/* This was a translucent white background on an inline element with no padding
   and no radius, which is exactly what selected text looks like. An eyebrow is
   set with type, not with a highlight behind it. */
.faqx-cta__panel .section-tag {
    display: block;
    background: none;
    border: 0;
    padding: 0;
    /* .62 measures 3.86:1 where the blue glow crosses the lightest end of the
       panel gradient. .82 clears AA across the whole panel. */
    color: rgba(255, 255, 255, .82);
    font-size: var(--hb-t-eyebrow);
    font-weight: 620;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.faqx-cta__panel h2 {
    margin: 16px 0 10px;
    font-family: var(--hb-font);
    font-size: clamp(26px, calc(3 * var(--hb-vw, 1vw)), 32px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #fff;
}

.faqx-cta__panel p {
    margin: 0 auto 26px;
    max-width: 540px;
    color: rgba(255, 255, 255, .72);
    font-size: 16px;
    line-height: 1.6;
}

.faqx-cta__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.faqx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 24px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--hb-fast) var(--hb-ease), color var(--hb-fast) var(--hb-ease), border-color var(--hb-fast) var(--hb-ease), transform var(--hb-fast) var(--hb-ease);
}

/* Scoped under the panel so these beat `.marketing-body a { color: inherit }`
   (otherwise the light button inherits the panel's white text → invisible). */
.faqx-cta__panel .faqx-btn--light {
    background: #fff;
    color: var(--hb-ink);
}

.faqx-cta__panel .faqx-btn--light:hover {
    transform: translateY(-1px);
    background: #eaf1ff;
}

.faqx-cta__panel .faqx-btn--ghost {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .32);
    color: #fff;
}

.faqx-cta__panel .faqx-btn--ghost:hover {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .5);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .faqx-shell {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .faqx-nav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding-bottom: 4px;
    }

    .faqx-nav__label {
        flex-basis: 100%;
        padding: 0 0 4px;
    }

    .faqx-nav a {
        border: 1px solid var(--hb-line);
        background: var(--hb-paper);
        padding: 8px 14px;
        border-radius: 999px;
    }

    .faqx-nav a.is-active {
        border-color: var(--hb-blue-deep);
        background: var(--hb-blue-wash);
    }
}

@media (max-width: 640px) {
    .faqx-hero { padding: 44px 0 32px; }
    .faqx-hero__inner { width: min(100% - 24px, 720px); }
    .faqx-hero h1 { font-size: clamp(32px, calc(10 * var(--hb-vw, 1vw)), 42px); }
    .faqx-hero p { font-size: 15px; }
    .faqx-search { margin-top: 22px; }
    .faqx-search input {
        height: 50px;
        padding-left: 44px;
        padding-right: 44px;
    }

    .faqx-item > summary {
        padding: 16px 18px;
        font-size: 15px;
        gap: 14px;
        align-items: flex-start;
    }

    .faqx-answer { padding: 0 18px 18px; }

    .faqx-cta__panel { padding: 40px 22px; }

    .faqx-cta__actions { flex-direction: column; }
    .faqx-btn { width: 100%; }
}

/* ── Search result count ──────────────────────────────────────────────────── */
.faqx-count {
    margin: 0 0 var(--hb-s4);
    font-size: var(--hb-t-xs);
    font-weight: 560;
    color: var(--hb-muted);
}
.faqx-count[hidden] { display: none; }

/* ── Permalink per answer ─────────────────────────────────────────────────────
   Support can send somebody to one answer rather than to the top of a page with
   ninety of them. Shown on hover and on keyboard focus, so it never becomes
   unreachable for anyone who does not use a pointer.
   -------------------------------------------------------------------------- */
.faqx-item__link {
    display: inline-block;
    margin-top: var(--hb-s3);
    font-size: 11px;
    font-weight: 560;
    color: var(--hb-blue-deep);
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0;
    transition: opacity var(--hb-fast) var(--hb-ease), color var(--hb-fast) var(--hb-ease);
}
.faqx-item:hover .faqx-item__link,
.faqx-item__link:focus-visible,
.faqx-item__link.is-copied { opacity: 1; }
.faqx-item__link.is-copied { color: var(--hb-success); text-decoration: none; }

/* Somebody arriving on a link should be able to see which row they were sent
   to, without it staying highlighted forever. */
.faqx-item.is-linked {
    border-color: var(--hb-blue);
    background: var(--hb-blue-wash);
}
.faqx-item { transition: border-color var(--hb-mid) var(--hb-ease), background-color var(--hb-mid) var(--hb-ease); }

/* The linked row has to clear the fixed navigation when it scrolls into view. */
.faqx-item[id] { scroll-margin-top: calc(var(--hb-nav-h) + 20px); }

@media (prefers-reduced-motion: reduce) {
    .faqx-item, .faqx-item__link { transition: none; }
}

/* Touch has no hover, so the link stays visible where there is no pointer. */
@media (hover: none) {
    .faqx-item__link { opacity: 1; }
}
