/* ============================================================================
   How It Works page — long-form explainer with collapsible FAQ sections.
   Uses native <details>/<summary> for collapse so the page works without
   JS once hydrated. Visual language matches the rest of the app: --surface
   cards, --accent for emphasis, Rajdhani for headings, Inter for body.
   ============================================================================ */

#page-how-it-works {
    overflow-y: auto;
}

.hiw-page {
    max-width: 880px;
    margin: 0 auto;
    padding: 48px 32px 96px;
    color: var(--text);
    font-family: var(--ui);
    line-height: 1.6;
}

/* ---------- Hero ---------- */

.hiw-hero {
    text-align: center;
    padding: 32px 0 56px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 48px;
}

.hiw-hero-eyebrow {
    display: inline-block;
    font-family: var(--display);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 16px;
    padding: 4px 12px;
    border: 1px solid var(--accent-dim);
    border-radius: 999px;
    background: var(--accent-dim);
}

.hiw-hero-title {
    font-family: var(--display);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.1;
    margin-bottom: 20px;
    color: var(--text);
}

.hiw-hero-lead {
    font-size: 1.08rem;
    color: var(--text-dim);
    max-width: 680px;
    margin: 0 auto 32px;
}

.hiw-hero-lead code {
    font-family: var(--mono);
    font-size: 0.92em;
    background: var(--surface);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--accent);
}

.hiw-hero-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.hiw-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 20px;
    min-width: 110px;
    text-align: center;
}

.hiw-stat-value {
    font-family: var(--display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 4px;
}

.hiw-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ---------- Table of contents ---------- */

.hiw-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 56px;
    justify-content: center;
}

.hiw-toc-link {
    display: inline-block;
    padding: 8px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.hiw-toc-link:hover {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* ---------- Sections ---------- */

.hiw-section {
    margin-bottom: 64px;
    scroll-margin-top: 24px;
}

.hiw-section-head {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.hiw-section-title {
    font-family: var(--display);
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
    margin-bottom: 12px;
}

.hiw-section-intro {
    color: var(--text-dim);
    font-size: 1rem;
    max-width: 720px;
}

/* ---------- FAQ collapsible items ---------- */

.hiw-faqs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hiw-faq {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.hiw-faq:hover {
    border-color: var(--border-strong);
}

.hiw-faq[open] {
    border-color: var(--accent-dim);
    background: var(--surface-alt);
}

/* Native <summary> styling */
.hiw-faq-q {
    list-style: none;
    cursor: pointer;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-weight: 600;
    color: var(--text);
    font-size: 1.02rem;
    user-select: none;
}

.hiw-faq-q::-webkit-details-marker { display: none; }
.hiw-faq-q::marker { content: ''; }

.hiw-faq-q-text {
    flex: 1;
}

.hiw-faq-q-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-hi);
    color: var(--accent);
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
    transition: transform var(--transition-normal);
}

.hiw-faq[open] .hiw-faq-q-icon {
    transform: rotate(45deg);
    background: var(--accent-dim);
}

.hiw-faq-q:hover .hiw-faq-q-icon {
    background: var(--accent);
    color: var(--bg);
}

/* Answer body */
.hiw-faq-a {
    padding: 4px 20px 20px;
    color: var(--text-dim);
    font-size: 0.96rem;
    line-height: 1.65;
    border-top: 1px solid var(--border);
    margin-top: -1px;
}

.hiw-faq-a > p {
    margin-bottom: 12px;
}

.hiw-faq-a > p:last-child {
    margin-bottom: 0;
}

.hiw-faq-a ul {
    margin: 12px 0 12px 22px;
    padding: 0;
}

.hiw-faq-a li {
    margin-bottom: 8px;
    color: var(--text-dim);
}

.hiw-faq-a li::marker {
    color: var(--accent);
}

.hiw-faq-a strong {
    color: var(--text);
    font-weight: 600;
}

.hiw-faq-a em {
    color: var(--text);
    font-style: italic;
}

.hiw-faq-a code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--accent);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* ---------- Footer ---------- */

.hiw-footer {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
    .hiw-page {
        padding: 32px 16px 64px;
    }

    .hiw-hero {
        padding: 16px 0 40px;
        margin-bottom: 32px;
    }

    .hiw-hero-stats {
        gap: 12px;
    }

    .hiw-stat {
        min-width: 90px;
        padding: 10px 14px;
    }

    .hiw-stat-value {
        font-size: 1.3rem;
    }

    .hiw-toc {
        margin-bottom: 32px;
    }

    .hiw-section {
        margin-bottom: 48px;
    }

    .hiw-faq-q {
        padding: 14px 16px;
        font-size: 0.96rem;
    }

    .hiw-faq-a {
        padding: 4px 16px 16px;
        font-size: 0.92rem;
    }
}
