/**
 * Core Details block (core/details) — AU-style FAQ accordion.
 * Visually identical to the Yoast FAQ skin (assets/css/faq-yoast.css), but
 * driven entirely by CSS: <details> keeps its own open state, so there is no
 * JS and the block degrades to a plain, fully readable Q&A list.
 *
 * Numbering comes from a CSS counter, so questions must NOT be numbered by
 * hand in the editor.
 */

.page-content,
.entry-content,
.site-main {
    counter-reset: faq-counter;
}

.wp-block-details {
    --faq-line: var(--color-lighter-blue, #b7c9db);
    --faq-accent: var(--color-light-blue, #3c7dbf);
    --faq-fg: var(--color-navy-blue, #002244);

    counter-increment: faq-counter;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    border-top: 1px solid var(--faq-line);
}

.wp-block-details:first-of-type {
    margin-top: 2.5rem;
}

.wp-block-details:last-of-type {
    border-bottom: 1px solid var(--faq-line);
}

.wp-block-details[open] {
    padding-bottom: 2.25rem;
}

/* Question row: 01 | question | + ------------------------------------------ */

.wp-block-details > summary {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin: 0;
    padding: 2.25rem 0;
    cursor: pointer;
    list-style: none;
    color: var(--faq-fg);
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.3;
}

.wp-block-details[open] > summary {
    padding-bottom: .9rem;
}

/* both are needed: Safari still ships the legacy marker pseudo-element */
.wp-block-details > summary::-webkit-details-marker {
    display: none;
}

.wp-block-details > summary:focus-visible {
    outline: 2px solid var(--faq-accent);
    outline-offset: 4px;
}

/* editors tend to leave a trailing <br> inside the summary */
.wp-block-details > summary br {
    display: none;
}

.wp-block-details > summary > * {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 80%;
    font-weight: inherit;
}

.wp-block-details > summary::before {
    content: counter(faq-counter, decimal-leading-zero);
    flex: 0 0 auto;
    min-width: 65px;
    color: var(--faq-line);
    font-size: 36px;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    transition: color .25s ease, font-size .25s ease;
}

.wp-block-details[open] > summary::before {
    color: var(--faq-accent);
    font-size: 48px;
}

/* "+" drawn with two gradients so it follows currentColor and turns into "x" */
.wp-block-details > summary::after {
    content: "";
    flex: 0 0 auto;
    margin-left: auto;
    width: 48px;
    height: 48px;
    border: 1px solid var(--faq-line);
    border-radius: 50%;
    background-image:
        linear-gradient(currentColor, currentColor),
        linear-gradient(currentColor, currentColor);
    background-size: 14px 2px, 2px 14px;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform .25s ease, background-color .25s ease, border-color .25s ease, color .25s ease;
}

.wp-block-details[open] > summary::after {
    transform: rotate(45deg);
    background-color: var(--faq-accent);
    border-color: var(--faq-accent);
    color: #fff;
}

/* Answer ---------------------------------------------------------------- */

.wp-block-details > :not(summary) {
    margin: 0 0 0 calc(65px + 1.25rem);
    color: var(--faq-fg);
    font-size: 1.125rem;
    line-height: 1.6;
}

.wp-block-details > :not(summary) + :not(summary) {
    margin-top: .9rem;
}

/* Open/close animation where the browser supports it; elsewhere it snaps. */
@supports (interpolate-size: allow-keywords) {
    html {
        interpolate-size: allow-keywords;
    }

    .wp-block-details::details-content {
        block-size: 0;
        overflow: hidden;
        content-visibility: hidden;
        transition:
            block-size .3s ease,
            content-visibility .3s allow-discrete;
    }

    .wp-block-details[open]::details-content {
        block-size: auto;
        content-visibility: visible;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wp-block-details,
    .wp-block-details > summary::before,
    .wp-block-details > summary::after,
    .wp-block-details::details-content {
        transition: none;
    }
}

@media (max-width: 768px) {
    .wp-block-details > summary {
        gap: .9rem;
        padding: 1.5rem 0;
        font-size: 1.125rem;
    }

    .wp-block-details[open] {
        padding-bottom: 1.5rem;
    }

    .wp-block-details > summary::before {
        min-width: 34px;
        font-size: 20px;
    }

    .wp-block-details[open] > summary::before {
        font-size: 28px;
    }

    .wp-block-details > summary::after {
        width: 40px;
        height: 40px;
    }

    .wp-block-details > :not(summary) {
        margin-left: calc(34px + .9rem);
        font-size: 1rem;
    }
}
