/* =============================================================================
   FAQ page (Pages/Faq): topic list beside grouped questions that open in place
   (<details>), and a contact call to action at the end. Uses the theme.css tokens.
   ============================================================================= */

.rs-faq-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

/* topics: a sticky list on wide screens, wrapping chips on narrow ones */
.rs-faq-nav {
    position: sticky;
    top: calc(var(--rs-topbar-height) + 20px);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

    .rs-faq-nav a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        border-radius: var(--rs-radius-sm);
        color: var(--rs-text-muted);
        font-weight: 500;
    }

        .rs-faq-nav a:hover {
            background: var(--rs-accent-soft);
            color: var(--rs-text);
        }

        .rs-faq-nav a:focus-visible {
            outline: 2px solid var(--rs-accent);
            outline-offset: 1px;
        }

        .rs-faq-nav a .mdi {
            font-size: 17px;
            color: var(--rs-accent);
            line-height: 1;
        }

.rs-faq-group {
    margin-bottom: 32px;
    /* a topic link lands below the fixed top bar */
    scroll-margin-top: calc(var(--rs-topbar-height) + 16px);
}

.rs-faq-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 14px;
}

.rs-faq-group-icon {
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 50%;
    background: var(--rs-accent-soft);
    color: var(--rs-accent-hover);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

/* one question: the summary is the button, the answer opens underneath */
.rs-faq-item {
    background: var(--rs-surface);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius);
    margin-bottom: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

    .rs-faq-item[open] {
        border-color: var(--rs-border-strong);
        box-shadow: var(--rs-shadow-sm);
    }

    .rs-faq-item > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 16px 20px;
        font-size: 15px;
        font-weight: 600;
        color: var(--rs-text);
        cursor: pointer;
        list-style: none;
        border-radius: var(--rs-radius);
    }

        .rs-faq-item > summary::-webkit-details-marker {
            display: none;
        }

        /* chevron: points down when closed, up when open */
        .rs-faq-item > summary::after {
            content: "";
            flex: none;
            width: 8px;
            height: 8px;
            margin-right: 4px;
            border-right: 2px solid var(--rs-text-faint);
            border-bottom: 2px solid var(--rs-text-faint);
            transform: translateY(-2px) rotate(45deg);
            transition: transform 0.15s ease, border-color 0.15s ease;
        }

        .rs-faq-item > summary:hover::after {
            border-color: var(--rs-accent);
        }

        .rs-faq-item > summary:focus-visible {
            outline: 2px solid var(--rs-accent);
            outline-offset: 2px;
        }

    .rs-faq-item[open] > summary::after {
        transform: translateY(2px) rotate(-135deg);
        border-color: var(--rs-accent);
    }

.rs-faq-answer {
    padding: 0 20px 18px;
    color: var(--rs-text-muted);
    font-size: 14px;
    line-height: 1.65;
    max-width: 75ch;
}

    .rs-faq-answer p {
        margin: 0 0 10px;
    }

    .rs-faq-answer ul,
    .rs-faq-answer ol {
        padding-left: 20px;
        margin: 0 0 10px;
    }

    .rs-faq-answer li {
        margin-bottom: 4px;
    }

    .rs-faq-answer > :last-child {
        margin-bottom: 0;
    }

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

.rs-faq-item[open] .rs-faq-answer {
    animation: rs-faq-reveal 0.18s ease;
}

@keyframes rs-faq-reveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rs-faq-item[open] .rs-faq-answer {
        animation: none;
    }

    .rs-faq-item > summary::after {
        transition: none;
    }
}

/* "Still have a question?" */
.rs-faq-cta {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 8px;
    padding: 24px 28px;
    background: linear-gradient(120deg, var(--rs-accent-soft) 0%, var(--rs-surface) 70%);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius-lg);
}

.rs-faq-cta-icon {
    width: 48px;
    height: 48px;
    flex: none;
    border-radius: 50%;
    background: var(--rs-surface);
    border: 1px solid var(--rs-border);
    color: var(--rs-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.rs-faq-cta-text h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 2px;
}

.rs-faq-cta-text p {
    color: var(--rs-text-muted);
    margin: 0;
}

.rs-faq-cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

@media (max-width: 992px) {
    .rs-faq-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .rs-faq-nav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

        .rs-faq-nav a {
            padding: 6px 12px;
            background: var(--rs-surface);
            border: 1px solid var(--rs-border);
            border-radius: 999px;
            font-size: 13px;
        }

            .rs-faq-nav a .mdi {
                font-size: 15px;
            }
}

@media (max-width: 576px) {
    /* topics in one row that scrolls sideways, instead of five rows of chips */
    .rs-faq-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

        .rs-faq-nav::-webkit-scrollbar {
            display: none;
        }

        .rs-faq-nav a {
            flex: none;
            white-space: nowrap;
        }

    .rs-faq-item > summary {
        padding: 14px 16px;
        font-size: 14.5px;
    }

    .rs-faq-answer {
        padding: 0 16px 16px;
    }

    .rs-faq-cta {
        flex-direction: column;
        align-items: flex-start;
        padding: 22px 20px;
    }

    .rs-faq-cta-actions {
        margin-left: 0;
        width: 100%;
    }

        .rs-faq-cta-actions .btn {
            flex: 1 1 auto;
        }
}
