/* AEM Labs → Landing → FAQ CSS
   ============================ */

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.faq-item {
    /* Allows block-size 0 ↔ auto on ::details-content where supported. */
    interpolate-size: allow-keywords;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 600;
    color: #ddd;
    background: rgba(var(--bg-color-1-rgb), 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: color 0.32s ease-in-out;
}

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

.faq-item summary::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--accent-color-2);
    border-bottom: 2px solid var(--accent-color-2);
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-top: -2px;
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item[open] summary::after {
    animation: faq-chevron-pop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.faq-item summary:hover {
    color: var(--accent-color-2);
}

.faq-item > .panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.33, 1, 0.32, 1);
}

.faq-item[open] > .panel {
    grid-template-rows: 1fr;
}

.panel > .faq-answer {
    overflow: hidden;
    min-height: 0;
}

.faq-answer {
    padding: 0 18px 16px;
    border-top: 1px dashed rgba(var(--accent-color-2-rgb), 0.2);
    background: rgba(24, 22, 18, 0.6);;
}

.faq-answer p {
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: #ddd;
    line-height: 1.6;
}

.faq-item[open] .faq-answer p {
    animation: faq-answer-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.faq-item[open] {
    animation: faq-item-ring 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Keyframes */
@keyframes faq-chevron-pop {
    0% {
        transform: rotate(45deg) scale(1);
    }
    55% {
        transform: rotate(235deg) scale(1.15);
    }
    100% {
        transform: rotate(225deg) scale(1);
    }
}

@keyframes faq-answer-in {
    0% {
        opacity: 0;
        transform: translateY(-0.4rem);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes faq-item-ring {
    0% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 0 0 rgba(var(--accent-color-1-rgb), 0);
    }
    40% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 0 4px rgba(var(--accent-color-1-rgb), 0.12);
    }
    100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 0 0 rgba(var(--accent-color-1-rgb), 0);
    }
}

/* Native disclosure box animation (Chrome 131+): height open/close without JS. */
@supports selector(details::details-content) {
    .faq-item > .panel {
        display: block;
    }

    .faq-item::details-content {
        overflow: clip;
        transition: block-size 0.4s cubic-bezier(0.33, 1, 0.32, 1),
            content-visibility 0.4s allow-discrete;
    }

    .faq-item:not([open])::details-content {
        block-size: 0;
        content-visibility: hidden;
    }

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

@media (max-width: 960px) {
    .faq-section .container {
        width: 88%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .faq-item,
    .faq-item summary::after,
    .faq-item > .panel,
    .faq-item::details-content,
    .faq-item[open] .faq-answer p {
        animation: none !important;
        transition: none !important;
    }

    .faq-item[open] summary::after {
        transform: rotate(225deg);
        margin-top: 4px;
    }

    .faq-item:not([open]) summary::after {
        transform: rotate(45deg);
        margin-top: -4px;
    }
}
