/* Styles for the FAQ page. */

/* The search box on the dark title band. */
.faq-search {
    color-scheme: dark;
    width: 100%;
    max-width: 560px;
    margin-top: var(--space-3);
}

.faq-search[hidden] {
    display: none;
}

.faq-search .field__input {
    height: 52px;
    border-color: var(--color-hero-line);
    background: var(--color-hero-chip);
    color: var(--color-hero-text);
}

.faq-search .field__input::placeholder {
    color: inherit;
    opacity: 0.7;
}

.faq {
    padding-block: var(--space-2) var(--space-8);
}

/* Only says something while searching. */
.faq-count {
    min-height: 1.5em;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* Each topic: its title beside its questions on a wide screen, above them on a narrow one. */
.faq-topic {
    display: grid;
    gap: var(--space-4);
    padding-block: var(--space-6);
    border-top: 1px solid var(--color-border);
    scroll-margin-top: calc(var(--header-height) + 48px);
}

.faq-topic:first-of-type {
    border-top: 0;
}

.faq-topic[hidden] {
    display: none;
}

.faq-topic__title {
    font-size: var(--text-xl);
}

@media (min-width: 900px) {
    .faq-topic {
        grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
        gap: var(--space-7);
        padding-block: var(--space-7);
    }

    /* The topic's title stays in view beside its questions. */
    .faq-topic__title {
        position: sticky;
        top: calc(var(--header-height) + 48px + var(--space-5));
        align-self: start;
    }
}


/* A question: components/ui/faq-item
   ========================================================================== */

.faq-topic__items {
    border-top: 1px solid var(--color-border);
}

.faq-item {
    border-bottom: 1px solid var(--color-border);
    scroll-margin-top: calc(var(--header-height) + 48px + var(--space-3));
}

.faq-item[hidden] {
    display: none;
}

.faq-item__question {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding-block: var(--space-4);
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: 1.4;
    list-style: none;
    cursor: pointer;
}

.faq-item__question::-webkit-details-marker {
    display: none;
}

.faq-item__question:hover {
    color: var(--color-accent-text);
}

.faq-item__question:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

/* A plus that turns into a minus when the answer is open. */
.faq-item__icon {
    position: relative;
    flex: none;
    width: 28px;
    height: 28px;
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    color: var(--color-accent-text);
}

.faq-item__icon::before,
.faq-item__icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.faq-item__icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.faq-item[open] .faq-item__icon {
    border-color: var(--color-primary);
}

.faq-item[open] .faq-item__icon::after {
    transform: translate(-50%, -50%) rotate(0deg);
}

.faq-item[open] .faq-item__question {
    color: var(--color-accent-text);
}

.faq-item__answer {
    padding-bottom: var(--space-5);
    font-size: var(--text-md);
    line-height: 1.65;
}

.faq-item__answer a {
    color: var(--color-accent-text);
}

@media (prefers-reduced-motion: no-preference) {
    .faq-item__icon::after {
        transition: transform 0.2s;
    }
}

.faq-empty[hidden] {
    display: none;
}
