/* ── Background variants ── */

.exp-sections--bg-transparent {
    background-color: transparent;
}

.exp-sections--bg-white {
    background-color: var(--color-white);
}

.exp-sections {
    padding: var(--section-pad-y) var(--section-pad-x);

    & .exp-sections__inner {
        max-width: var(--container-max-width);
        margin: 0 auto;
        display: grid;
        grid-template-columns: 1fr;
        gap: 3.5rem;
        align-items: start;

        @media (min-width: 768px) {
            grid-template-columns: 1fr 1fr;
        }
    }

    /* Media
       ====================================================================== */

    & .exp-sections__images {
        position: sticky;
        top: 2rem;
        width: 100%;
        aspect-ratio: 4 / 3;
        overflow: hidden;
        /* Clean backdrop — only visible behind centered (contain) images;
           cover images fill the pane and hide it. */
        background-color: var(--color-white);
    }

    & .exp-sections__section-image {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0;
        transition: opacity 0.4s ease;

        &.is-active {
            opacity: 1;
        }
    }

    /* Centered (contain) variant — showcases badges, logos, awards, etc.
       fully visible and centered in the pane instead of cover-cropped. */
    & .exp-sections__section-image--centered {
        box-sizing: border-box;
        object-fit: contain;
        object-position: center;
        /* Keeps the image clear of the top/bottom & side edges. The element's
           background-color (set per-section inline) fills the padded area. */
        padding: 2.5rem;
    }

    /* Linked sections — the whole image pane is clickable. Only the layer whose
       image is currently active receives clicks; the rest sit inert underneath. */
    & .exp-sections__image-link {
        position: absolute;
        inset: 0;
        display: block;
        pointer-events: none;
        cursor: pointer;

        &:has(.is-active) {
            pointer-events: auto;
        }
    }

    /* Body
       ====================================================================== */

    & .exp-sections__header {
        margin-bottom: 2.5rem;
    }

    & .exp-sections__subhead {
        font-size: 18px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.2em;
        color: var(--color-gold);
        margin: 0 0 0.75rem;
    }

    & .exp-sections__title {
        font-size: 2.25rem;
        font-weight: 700;
        color: var(--color-navy);
        margin: 0;
        line-height: 1.2;
    }

    /* Accordion
       ====================================================================== */

    & .exp-sections__accordion {
        display: flex;
        flex-direction: column;
    }

    & .exp-sections__item {
        @media (min-width: 768px) {
            background-image: none !important;
        }
    }

    & .exp-sections__trigger {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 1.25rem 0 0.5rem;
        background: none;
        border: none;
        cursor: pointer;
        text-align: left;
        font-family: 'Domine', serif;
        font-size: 32px;
        font-weight: 600;
        color: var(--color-navy);
        transition: color 0.2s ease;

        &:focus-visible {
            outline: 3px solid var(--color-gold);
            outline-offset: 2px;
        }
    }

    & .exp-sections__timer-bar {
        display: block;
        width: 0;
        height: 2px;
        background-color: var(--color-navy);
        pointer-events: none;
    }

    & .exp-sections__item.is-open .exp-sections__timer-bar {
        animation: exp-timer-fill 8s linear forwards;
    }

    & .exp-sections__item.is-open {
    }

    & .exp-sections__panel {
        overflow: hidden;

        &[hidden] {
            display: none;
        }
    }

    & .exp-sections__panel-inner {
        padding: 0.5rem 0 1.5rem;
        font-size: 1rem;
        line-height: 1.75;
        color: #444;

        & p:first-child { margin-top: 0; }
        & p:last-child  { margin-bottom: 0; }

        & a:not(.exp-sections__arrow-link) {
            color: #0000EE;
        }
    }

    & .exp-sections__panel-inner--linked {
        position: relative;
        cursor: pointer;
    }

    & .exp-sections__arrow-link {
        display: inline-flex;
        align-self: flex-start;
        color: var(--color-navy);
        text-decoration: none;
        margin-top: 0.75rem;
        padding: 5px;
        border-radius: 6px;
        background-color: transparent;
        transition: color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;

        /* Stretched link — covers the whole panel-inner */
        &::after {
            content: '';
            position: absolute;
            inset: 0;
        }

        &:hover {
            color: var(--color-white);
            transform: translateX(4px);
            background-color: var(--color-navy);
        }
    }

    /* Keep the arrow in its hover (navy) state while hovering the linked
       panel or the image pane, mirroring the tab sections. */
    & .exp-sections__panel-inner--linked:hover .exp-sections__arrow-link {
        color: var(--color-white);
        background-color: var(--color-navy);
    }

    /* Mobile card elements (hidden / transparent on desktop)
       ====================================================================== */

    & .exp-sections__item-header {
        display: contents;
    }

    & .exp-sections__item-image {
        display: none;
    }

    & .exp-sections__item-icon {
        display: none;
    }

    & .exp-sections__plus-icon {
        display: block;
        flex-shrink: 0;
        transition: transform 0.2s ease;
    }

    & .exp-sections__item.is-open .exp-sections__plus-icon {
        transform: rotate(45deg);
    }

    /* Mobile layout
       ====================================================================== */

    @media (max-width: 767px) {

        padding: 3rem 1.25rem;

        & .exp-sections__inner {
            gap: 2rem;
        }

        & .exp-sections__media {
            display: none;
        }

        & .exp-sections__header {
            text-align: center;
        }

        & .exp-sections__accordion {
            gap: 0.75rem;
        }

        & .exp-sections__item {
            border-radius: 12px;
            overflow: hidden;
            background-size: cover;
            background-position: center;
            min-height: 250px;
            display: flex;
            flex-direction: column;
            position: relative;
        }

        & .exp-sections__item-header {
            display: flex;
            position: relative;
            align-items: stretch;
            flex: 1;

            &::before {
                content: '';
                position: absolute;
                inset: 0;
                background: rgba(19, 41, 75, 0.85);
                z-index: 1;
            }
        }

        & .exp-sections__item-image {
            display: none;
        }

        & .exp-sections__trigger {
            position: relative;
            z-index: 2;
            color: var(--color-white);
            padding: 1rem;
            font-family: 'Domine', serif;
            justify-content: center;
            align-items: center;
            text-align: center;
            flex: 1;
        }

        /* Hide trigger icon on mobile — standalone icon used instead */
        & .exp-sections__plus-icon {
            display: none;
        }

        /* Standalone icon: anchored to bottom-right of the item */
        & .exp-sections__item-icon {
            display: block;
            position: absolute;
            right: 1rem;
            bottom: 1rem;
            z-index: 4;
            color: var(--color-white);
            flex-shrink: 0;
            transition: transform 0.2s ease;
            pointer-events: none;
        }

        & .exp-sections__item.is-open .exp-sections__item-icon {
            transform: rotate(45deg);
        }

        & .exp-sections__timer-bar {
            display: none;
        }

        /* Panel expand animation */
        & .exp-sections__panel {
            display: block !important;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.4s ease;
        }

        & .exp-sections__panel:not([hidden]) {
            max-height: 800px;
        }

        & .exp-sections__panel-inner {
            padding: 1rem 1.25rem 1.25rem;
            background: rgba(19, 41, 75, 0.85);
            color: var(--color-white);
            text-align: center;

            & a {
                color: var(--color-gold-light);
            }
        }

        & .exp-sections__arrow-link {
            color: rgba(255, 255, 255, 0.85);

            &:hover {
                color: var(--color-white);
            }
        }
    }
}

@keyframes exp-timer-fill {
    from { width: 0; }
    to   { width: 100%; }
}