/*
 * FAQ accordion – Mask element "faq" (shared by all sites)
 *
 * Fonts, colours and sizes are CSS custom properties. Each site sets its own values on :root
 * in its provider extension: Configuration/TypoScript/Setup/Extensions/Mask/mask.typoscript
 * Without them, the element inherits the surrounding page's fonts and colours.
 *
 *   --faq-question-font, --faq-question-size, --faq-question-size-sm, --faq-question-transform
 *   --faq-answer-font, --faq-answer-size
 *   --faq-text, --faq-text-muted, --faq-accent, --faq-link, --faq-line, --faq-hover
 */
.ce-faq {
    margin: 4.5em 0;
}

/* Element header: uses the site's normal h2 styles */
.ce-faq__title {
    margin: 0 0 1em;
}

/* Topic (Thema): heading uses the site's normal h3 styles */
.ce-faq__topic + .ce-faq__topic {
    margin-top: 2.25em;
}

.ce-faq__topic-title {
    margin: 0 0 0.6em;
    font-weight: bold;
}

.ce-faq__list {
    border-top: 1px solid var(--faq-line, #e5e5e5);
}

.ce-faq__item {
    border-bottom: 1px solid var(--faq-line, #e5e5e5);
}

/* Question row */
.ce-faq__question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25em;
    padding: 1.1em 0.25em;
    list-style: none;
    cursor: pointer;
    font-family: var(--faq-question-font, inherit);
    font-size: var(--faq-question-size, 1.143em);
    font-weight: 500;
    line-height: 1.4;
    text-transform: var(--faq-question-transform, none);
    color: var(--faq-text, inherit);
    transition: color 0.2s ease, background-color 0.2s ease;
}

/* The question text is a heading (h3/h4) for the page outline, but must look like the
   question row, not like the site's heading styles */
.ce-faq .ce-faq__question .ce-faq__question-text {
    margin: 0;
    padding: 0;
    border: 0;
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-align: left;
}

.ce-faq__question::-webkit-details-marker {
    display: none;
}

.ce-faq__question:hover {
    background-color: var(--faq-hover, #f6f7f8);
}

.ce-faq__item[open] > .ce-faq__question,
.ce-faq__question:hover {
    color: var(--faq-accent, currentColor);
}

.ce-faq__question:focus-visible {
    outline: 2px solid var(--faq-accent, currentColor);
    outline-offset: 2px;
}

/* Plus / minus icon drawn with CSS (no icon font needed) */
.ce-faq__icon {
    position: relative;
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
}

.ce-faq__icon::before,
.ce-faq__icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    margin-top: -1px;
    background-color: currentColor;
    transition: transform 0.25s ease;
}

.ce-faq__icon::after {
    transform: rotate(90deg);
}

.ce-faq__item[open] .ce-faq__icon::after {
    transform: rotate(0deg);
}

/* Answer */
.ce-faq__answer {
    padding: 1em 2.5em 1.4em 0.25em;
    font-family: var(--faq-answer-font, inherit);
    font-size: var(--faq-answer-size, 1.071em);
    line-height: 1.62;
    color: var(--faq-text-muted, inherit);
}

.ce-faq__answer > :last-child {
    margin-bottom: 0;
}

.ce-faq__answer a {
    color: var(--faq-link, var(--faq-accent, inherit));
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Smooth open/close where supported (progressive enhancement) */
@supports (interpolate-size: allow-keywords) {
    .ce-faq {
        interpolate-size: allow-keywords;
    }

    .ce-faq__item::details-content {
        height: 0;
        overflow: hidden;
        transition: height 0.3s ease, content-visibility 0.3s allow-discrete;
    }

    .ce-faq__item[open]::details-content {
        height: auto;
    }
}

@media (max-width: 767px) {
    .ce-faq__question {
        font-size: var(--faq-question-size-sm, 1.071em);
        padding: 1em 0;
    }

    .ce-faq__answer {
        padding-right: 0;
        padding-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ce-faq__question,
    .ce-faq__icon::before,
    .ce-faq__icon::after,
    .ce-faq__item::details-content {
        transition: none;
    }
}
