/**
 * Block: FAQ with Topics.
 *
 * Self-contained stylesheet — every rule is scoped under .faq-topics and nothing
 * here leaks into the theme-wide style.css. Theme design tokens are used with
 * literal fallbacks so the block still renders correctly on its own.
 */

.faq-topics {
    --faq-gold: var(--gold, #BA9051);
    --faq-gold-soft: rgba(186, 144, 81, .14);
    --faq-gold-glow: rgba(186, 144, 81, .12);
    --faq-text: var(--main, #2A2A2A);
    --faq-muted: var(--grey-60, #666666);
    --faq-placeholder: var(--grey-40, #A6A6A6);
    --faq-surface: var(--grey-10, #F6F6F6);
    --faq-border: var(--grey-20, #cccccc);
    --faq-radius: 8px;
    /* Fallback header height; script.js overwrites it with the measured one. */
    --faq-header-offset: 104px;
    --faq-scroll-gap: 24px;

    font-family: "Montserrat", sans-serif;
    color: var(--faq-text);
}

/* Anchors and deep links must clear the fixed header. */
.faq-topics .faq-topics-group,
.faq-topics .faq-topics-item {
    scroll-margin-top: calc(var(--faq-header-offset) + var(--faq-scroll-gap));
}

.faq-topics .faq-topics-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------------------- search -- */

.faq-topics .faq-topics-search {
    position: relative;
    width: 100%;
    max-width: 806px;
    margin: 0 auto 56px;
}

.faq-topics .faq-topics-search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    color: var(--faq-muted);
    pointer-events: none;
}

.faq-topics .faq-topics-search-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.faq-topics .faq-topics-search-input {
    width: 100%;
    height: 64px;
    padding: 0 60px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    color: var(--faq-text);
    background: #fff;
    border: 1px solid var(--faq-border);
    border-radius: 999px;
    transition: border-color .3s, box-shadow .3s;
    -webkit-appearance: none;
    appearance: none;
}

.faq-topics .faq-topics-search-input::placeholder {
    color: var(--faq-placeholder);
    opacity: 1;
}

.faq-topics .faq-topics-search-input:focus {
    outline: none;
    border-color: var(--faq-gold);
    box-shadow: 0 0 0 3px var(--faq-gold-glow);
}

/* Hide the native clear widget — the block ships its own button. */
.faq-topics .faq-topics-search-input::-webkit-search-cancel-button,
.faq-topics .faq-topics-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.faq-topics .faq-topics-search-clear {
    position: absolute;
    right: 20px;
    top: 50%;
    width: 28px;
    height: 28px;
    padding: 4px;
    transform: translateY(-50%);
    color: var(--faq-muted);
    background: none;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: color .3s, background-color .3s;
}

.faq-topics .faq-topics-search-clear:hover {
    color: var(--faq-gold);
    background: var(--faq-surface);
}

.faq-topics .faq-topics-search-clear svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---------------------------------------------------------------- layout -- */

.faq-topics .faq-topics-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 64px;
    /*align-items: start;*/
}

/* ------------------------------------------------------------ topic list -- */

.faq-topics .faq-topics-nav {
    /*position: sticky;*/
    /*top: calc(var(--faq-header-offset) + var(--faq-scroll-gap));*/
    /*max-height: calc(100vh - var(--faq-header-offset) - var(--faq-scroll-gap) - 24px);*/
    /*overflow-y: auto;*/
    /*scrollbar-width: thin;*/
    position: relative;
}

.faq-topics .faq-topics-nav-inner {
    position: sticky;
    top: 130px;
}

.faq-topics .faq-topics-nav-title {
    margin: 0 0 22px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faq-gold);
}

.faq-topics .faq-topics-nav-title::after {
    content: '';
    display: block;
    width: 32px;
    height: 2px;
    margin-top: 10px;
    background: var(--faq-gold);
}

.faq-topics .faq-topics-nav-list {
    display: flex;
    flex-flow: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.faq-topics .faq-topics-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.35;
    color: var(--faq-text);
    text-decoration: none;
    border-radius: var(--faq-radius);
    transition: background-color .3s, color .3s;
}

.faq-topics .faq-topics-nav-link:hover {
    color: var(--faq-gold);
    background: var(--faq-surface);
}

.faq-topics .faq-topics-nav-item.is-active .faq-topics-nav-link {
    color: var(--faq-text);
    background: var(--faq-gold-soft);
}

.faq-topics .faq-topics-nav-icon {
    flex: 0 0 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.faq-topics .faq-topics-nav-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --------------------------------------------------------------- groups -- */

.faq-topics .faq-topics-group + .faq-topics-group {
    margin-top: 64px;
}

.faq-topics .faq-topics-group-title {
    margin: 0 0 24px;
    font-family: "EB Garamond", serif;
    /*font-size: 32px;*/
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--faq-text);
}

.faq-topics .faq-topics-group-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    margin-top: 14px;
    background: var(--faq-gold);
}

/* ---------------------------------------------------------------- items -- */

.faq-topics .faq-topics-items {
    display: flex;
    flex-flow: column;
    gap: 8px;
}

.faq-topics .faq-topics-item {
    background: var(--faq-surface);
    border-radius: var(--faq-radius);
    overflow: hidden;
}

.faq-topics .faq-topics-item-heading {
    margin: 0;
    font: inherit;
}

.faq-topics .faq-topics-item-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    padding: 20px 28px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    color: var(--faq-text);
    background: none;
    border: 0;
    cursor: pointer;
    transition: color .3s;
}

.faq-topics .faq-topics-item-toggle:hover,
.faq-topics .faq-topics-item.is-open .faq-topics-item-toggle {
    color: var(--faq-gold);
}

.faq-topics .faq-topics-item-marker {
    position: relative;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

.faq-topics .faq-topics-item-marker::before,
.faq-topics .faq-topics-item-marker::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    background: var(--faq-gold);
    transition: transform .3s, opacity .3s;
}

.faq-topics .faq-topics-item-marker::before {
    width: 18px;
    height: 2px;
    transform: translate(-50%, -50%);
}

.faq-topics .faq-topics-item-marker::after {
    width: 2px;
    height: 18px;
    transform: translate(-50%, -50%);
}

.faq-topics .faq-topics-item.is-open .faq-topics-item-marker::after {
    transform: translate(-50%, -50%) rotate(90deg);
    opacity: 0;
}

/* --------------------------------------------------------------- answers -- */

.faq-topics .faq-topics-item-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
}

.faq-topics .faq-topics-item-answer[hidden] {
    display: none;
}

.faq-topics .faq-topics-item-answer-inner {
    padding: 0 28px 24px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--faq-muted);
}

/* Rhythm is owned by these two rules alone — anything that re-declares a
   margin on a tag selector would win on specificity and break the spacing. */
.faq-topics .faq-topics-item-answer-inner > * {
    margin: 0;
}

.faq-topics .faq-topics-item-answer-inner > * + * {
    margin-top: 14px;
}

.faq-topics .faq-topics-item-answer-inner strong,
.faq-topics .faq-topics-item-answer-inner b {
    font-weight: 600;
    color: var(--faq-text);
}

.faq-topics .faq-topics-item-answer-inner a {
    color: var(--faq-gold);
}

/* The theme reset strips list markers globally — restore them inside answers. */
.faq-topics .faq-topics-item-answer-inner ul,
.faq-topics .faq-topics-item-answer-inner ol {
    display: flex;
    flex-flow: column;
    gap: 8px;
    padding-left: 22px;
}

.faq-topics .faq-topics-item-answer-inner ul li {
    list-style: disc outside;
}

.faq-topics .faq-topics-item-answer-inner ol li {
    list-style: decimal outside;
}

/* ---------------------------------------------------------------- search
   filtering state, driven by script.js                                  -- */

.faq-topics .faq-topics-item.is-filtered-out,
.faq-topics .faq-topics-group.is-filtered-out,
.faq-topics .faq-topics-nav-item.is-filtered-out {
    display: none;
}

.faq-topics .faq-topics-empty {
    padding: 40px 0;
    font-size: 17px;
    line-height: 1.6;
    text-align: center;
    color: var(--faq-muted);
}

/* -------------------------------------------------------------- keyboard -- */

.faq-topics .faq-topics-item-toggle:focus-visible,
.faq-topics .faq-topics-nav-link:focus-visible,
.faq-topics .faq-topics-search-clear:focus-visible {
    outline: 2px solid var(--faq-gold);
    outline-offset: 2px;
}

/* The Gutenberg preview has no fixed header to clear. */
.sws-block-preview .faq-topics .faq-topics-nav {
    /*position: static;*/
    max-height: none;
    overflow: visible;
}

/* ------------------------------------------------------------ responsive -- */

@media screen and (max-width: 1199px) {
    .faq-topics .faq-topics-layout {
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 40px;
    }

    .faq-topics .faq-topics-group-title {
        font-size: 24px;
    }

    .faq-topics .faq-topics-item-toggle {
        padding: 18px 24px;
        font-size: 16px;
    }

    .faq-topics .faq-topics-item-answer-inner {
        padding: 0 24px 20px;
    }
}

@media screen and (max-width: 1023px) {
    .faq-topics {
        --faq-header-offset: 88px;
    }

    /* Plain flow rather than grid: a sticky grid item is constrained by its own
       grid area, which browsers resolve inconsistently in a single-column grid. */
    .faq-topics .faq-topics-layout {
        display: block;
    }

    /* The topic list turns into a sticky row of chips above the content. */
    .faq-topics .faq-topics-nav {
        /*position: sticky;*/
        /*top: var(--faq-header-offset);*/
        z-index: 2;
        max-height: none;
        margin-bottom: 20px;
        overflow: visible;
        padding: 12px 0;
        background: #fff;
    }

    /* Hint that the chip strip scrolls past the container edge. */
    .faq-topics .faq-topics-nav::after {
        content: '';
        position: absolute;
        right: 0;
        top: 12px;
        bottom: 4px;
        width: 48px;
        background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff 70%);
        pointer-events: none;
    }

    .faq-topics .faq-topics-nav-title {
        /*display: none;*/
    }

    .faq-topics .faq-topics-nav-list {
        flex-flow: row;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .faq-topics .faq-topics-nav-list::-webkit-scrollbar {
        display: none;
    }

    .faq-topics .faq-topics-nav-item {
        flex: 0 0 auto;
    }

    .faq-topics .faq-topics-nav-link {
        gap: 8px;
        padding: 8px 16px;
        font-size: 14px;
        white-space: nowrap;
        border: 1px solid var(--faq-border);
        border-radius: 999px;
    }

    .faq-topics .faq-topics-nav-item.is-active .faq-topics-nav-link {
        border-color: transparent;
    }

    .faq-topics .faq-topics-nav-icon {
        flex-basis: 22px;
        width: 22px;
        height: 22px;
    }

    .faq-topics .faq-topics-group + .faq-topics-group {
        margin-top: 48px;
    }
}

@media screen and (max-width: 767px) {
    .faq-topics .faq-topics-nav-list {
        flex-flow: column;
        gap: 10px;
    }

    .faq-topics .faq-topics-nav::after {
        display: none;
    }

    .faq-topics .faq-topics-nav-link {
        font-size: 13px;
    }

    .faq-topics {
        --faq-header-offset: 72px;
    }

    .faq-topics .faq-topics-search {
        margin-bottom: 32px;
    }

    .faq-topics .faq-topics-search-input {
        height: 56px;
        padding: 0 52px;
        font-size: 15px;
    }

    .faq-topics .faq-topics-search-icon {
        left: 20px;
        width: 20px;
        height: 20px;
    }

    .faq-topics .faq-topics-search-clear {
        right: 16px;
    }

    .faq-topics .faq-topics-group-title {
        margin-bottom: 20px;
        font-size: 20px;
    }

    .faq-topics .faq-topics-group-title::after {
        margin-top: 12px;
    }

    .faq-topics .faq-topics-item-toggle {
        gap: 16px;
        padding: 16px 20px;
        font-size: 15px;
    }

    .faq-topics .faq-topics-item-answer-inner {
        padding: 0 20px 20px;
        font-size: 15px;
    }

    .faq-topics .faq-topics-item-marker {
        flex-basis: 16px;
        width: 16px;
        height: 16px;
    }

    .faq-topics .faq-topics-item-marker::before {
        width: 16px;
    }

    .faq-topics .faq-topics-item-marker::after {
        height: 16px;
    }

    .faq-topics .faq-topics-group + .faq-topics-group {
        margin-top: 40px;
    }
}

@media screen and (max-width: 500px) {
    .faq-topics .faq-topics-item-toggle {
        padding: 14px 16px;
    }

    .faq-topics .faq-topics-item-answer-inner {
        padding: 0 16px 16px;
    }

    .faq-topics .faq-topics-empty {
        padding: 32px 0;
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .faq-topics *,
    .faq-topics *::before,
    .faq-topics *::after {
        transition-duration: .01ms !important;
    }
}
