:root {
    --expo-transition: cubic-bezier(0.19, 1, 0.22, 1);
    --lines-opacity: 6%;
    --svh: 1svh;
}

.relative {
    position: relative;
    z-index: 2;
}

.our-selection {
    position: relative;
    background-color: #EAE1E4;
    border-top: 0 solid color-mix(in srgb, var(--text-color) 6%, transparent);
    width: 75%;
    margin: 0 auto 100px;
}

/* Shared with Keel's global.css - needed so the feature image fills the card */
.image-wrapper {
    position: absolute;
    inset: 0;
}

.image-wrapper figure::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: black;
    opacity: var(--dark-overlay-opacity);
}


/* =========================================================
   MAIN COMPONENT
   ========================================================= */

.our-selection-inner {
    position: relative;
    height: 100%;
    min-height: calc(var(--svh) * 100);
    padding: 0;
    display: flex;
    overflow: hidden;
}


/* =========================================================
   DESKTOP
   ========================================================= */

@media screen and (min-width: 1081px) {

    .our-selection-item {
        flex: 0 0 25%;
        width: 25%;
        min-width: 25%;
    }

    .our-selection-inner {
        justify-content: flex-start !important;
    }

}


/* =========================================================
   SELECTION ITEMS
   ========================================================= */

.our-selection-item {
    position: relative;
    display: flex;
    flex: 1;
    width: calc(100% / 3);
    min-width: calc(100% / 3);

    transition:
        color .2s ease,
        width .6s var(--expo-transition),
        min-width .6s var(--expo-transition),
        transform .6s var(--expo-transition);
}

our-selection-item {
    cursor: pointer;
    overflow: hidden;
}

.our-selection-item.no-image,
.our-selection-item.no-image .our-selection-title .title {
    color: var(--text-color) !important;
}

.our-selection-item p {
    color: inherit;
}

our-selection-item:hover {
    color: var(--overlay-text-color);
}


/* =========================================================
   OPENED STATE
   ========================================================= */

.our-selection-item.opened {
    width: 62.5%;
    min-width: 62.5%;
    color: var(--overlay-text-color);
    cursor: auto;
}


/* =========================================================
   DESKTOP OPENING POSITION
   ========================================================= */

@media screen and (min-width: 1081px) {

    /*
       Item 1 and 2 expand from their normal position.

       Item 3 moves left when opened so the expanded
       panel stays inside the viewport.
    */

    our-selection-item[data-index="3"].opened {
        transform: translateX(-25vw);
    }

    our-selection-item[data-index="4"].opened {
        transform: translateX(-50vw);
    }


    /* =====================================================
       IMPORTANT:
       Hide item 2's title when item 3 is open.

       The item itself remains in the layout, but its title
       is removed so it cannot remain visible underneath
       the opened third item.
    ===================================================== */

    .our-selection-inner:has(
        our-selection-item[data-index="3"].opened
    )
    our-selection-item[data-index="2"] .our-selection-title {

        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

}


/* =========================================================
   PLACEHOLDER
   ========================================================= */

.our-selection-item .placeholder-center {
    transition:
        opacity .5s ease,
        transform .6s var(--expo-transition);

    z-index: 2;
}

.our-selection-item.opened .placeholder-center {
    opacity: 0;
    transform: rotate(360deg);
}

.our-selection-item.opened .our-selection-item-inner {
    opacity: 1;
}


/* =========================================================
   ITEM DIVIDERS
   ========================================================= */

.our-selection-item::after {
    content: '';
    position: absolute;
    right: 0;
    width: 1px;
    height: 100%;
    background-color: var(--text-color);
    opacity: var(--lines-opacity);
}


/* =========================================================
   TITLE
   ========================================================= */

.our-selection-title {
    position: absolute;
    top: max(48px, calc(3.34vw * var(--scale)));
    left: max(24px, 1.67vw);
    z-index: 2;
    width: calc(100% - 48px);
}

.our-selection-title .title {
    text-decoration: none;
    color: var(--overlay-text-color);
    display: block;
    width: fit-content;
    opacity: 1;
    pointer-events: none;

    transform: translateY(10px);

    transition:
        transform 1s var(--expo-transition),
        opacity .3s var(--expo-transition);
}

.our-selection-item.opened .our-selection-title .title {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.our-selection-item.opened .our-selection-title {
    width: 60%;
    max-width: 420px;
}

.our-selection-title .number {
    position: absolute;
    opacity: 0;
    transform: translateY(0);

    transition:
        transform 1s var(--expo-transition),
        opacity .3s var(--expo-transition);
}

.our-selection-item.opened .our-selection-title .number {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}


/* =========================================================
   IMAGE / INNER
   ========================================================= */

.our-selection-item-inner {
    opacity: 1;
    transition: opacity .2s ease;

    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;

    width: 50vw;
}

our-selection-item:hover .our-selection-item-inner {
    opacity: 1;
}


/* =========================================================
   SECTION BOTTOM
   ========================================================= */

.section-bottom {
    position: relative;
    display: flex;
    gap: max(48px, 3.34vw);
}

.bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: max(12px, calc(0.83vw * var(--scale)));
}

.our-selection-item .section-bottom {
    position: absolute;

    bottom: max(18px, 1.25vw);
    left: max(24px, 1.67vw);
    right: max(24px, 1.67vw);

    opacity: 0;
    pointer-events: none;

    transition: opacity .3s var(--expo-transition);
}

.our-selection-item .section-bottom .bottom-item:nth-of-type(1) {
    flex: 5;
    max-width: max(432px, calc(30vw * var(--scale)));
}

.our-selection-item.opened .section-bottom {
    opacity: 1;
    pointer-events: auto;
}


/* =========================================================
   CLOSE BUTTON
   ========================================================= */

.our-selection-item .close-button {
    position: absolute;

    top: max(52px, calc(3.61vw * var(--scale)));
    right: max(24px, 1.67vw);

    z-index: 2;

    opacity: 0;
    pointer-events: none;

    transition: opacity .3s var(--expo-transition);

    width: fit-content !important;
    display: flex;
}

.our-selection-item.opened .close-button {
    opacity: 1;
    pointer-events: auto;
}

.our-selection-item.opened .cursor-text {
    opacity: 0 !important;
}


/* =========================================================
   HEADING
   ========================================================= */

.our-selection-heading {
    position: absolute;

    bottom: max(42px, calc(2.92vw * var(--scale)));
    left: max(24px, 1.67vw);

    background-color: transparent;

    opacity: .06;
    z-index: -1;
}


/* =========================================================
   READ STORY / LINKS
   ========================================================= */

.paragraph-bracket-link .medium-text {
    font-family: var(--font2);
    font-size: max(18px, calc(1.25vw * var(--scale)));
    font-weight: 400;
    letter-spacing: normal;
}

.read-story-link {
    margin-top: max(12px, calc(0.83vw * var(--scale)));
}

.link-button {
    display: flex;
    align-items: center;
    gap: max(6px, 0.42vw);
}

.link-circle {
    width: max(10px, calc(0.69vw * var(--scale)));
    min-width: max(10px, calc(0.69vw * var(--scale)));

    aspect-ratio: 1;
    border-radius: 100%;

    background-color: currentColor;
    margin-bottom: 1px;
}


/* =========================================================
   PLACEHOLDER LINES
   ========================================================= */

.placeholder-center {
    position: absolute;

    width: max(24px, calc(1.39vw * var(--scale)));
    height: max(24px, calc(1.39vw * var(--scale)));
}

.placeholder-line {
    position: absolute;
}

.placeholder-line.vertical {
    height: 100%;
    width: 1px;

    background-color:
        color-mix(in srgb, currentColor 40%, transparent);
}

.placeholder-line.horizontal {
    height: 1px;
    width: 100%;

    background-color:
        color-mix(in srgb, currentColor 40%, transparent);
}


/* =========================================================
   CURSOR TEXT
   ========================================================= */

.cursor-text {
    position: fixed;

    top: 0;
    left: 0;

    pointer-events: none;
    z-index: 5;

    opacity: 0;

    transition: opacity .2s ease;
}

.cursor-text.active {
    opacity: 1;
}

.cursor-text-inner {
    position: absolute;

    transform: translate(10px, 10px);

    white-space: nowrap;
}


/* =========================================================
   TABLET
   ========================================================= */

@media screen and (max-width: 1080px) {

    .relative {
        position: relative;
        z-index: 2;
    }

    .cursor-text {
        display: none !important;
    }

    .read-story-link {
        margin-top: 6px;
    }

    .paragraph-bracket-link .medium-text {
        font-size: 16px;
    }

    .our-selection-item {
        width: 50%;
        min-width: 50%;
    }

    .our-selection-item.empty {
        display: none;
    }

    our-selection-item:hover {
        color: var(--text-color);
    }

    .our-selection-item.opened {
        width: 100%;
        min-width: 100%;
        color: var(--overlay-text-color);
    }

    .our-selection-title {
        top: 38px;
        width: 66vw;
    }

    .our-selection-item-inner {
        width: 100vw;
    }

    our-selection-item:hover .our-selection-item-inner {
        opacity: 0;
    }

    .our-selection-item .section-bottom .bottom-item:nth-of-type(1) {
        flex: auto;
    }

    .our-selection-item .section-bottom .bottom-item:nth-of-type(2) {
        display: flex;
    }

    .our-selection-item .close-button {
        top: 42px;
    }


    /* Restore original tablet image positioning */

    our-selection-item[data-index="2"] .our-selection-item-inner {
        left: 0;
    }

    our-selection-item[data-index="3"] .our-selection-item-inner {
        right: 0;
    }

    .our-selection-inner.position-second {
        justify-content: flex-start;
    }

    .our-selection-inner.position-third {
        justify-content: flex-end;
    }

    .our-selection-heading {
        bottom: 32px;
    }

}


/* =========================================================
   MOBILE — 2 × 2
   ========================================================= */

@media screen and (max-width: 767px) {

    .our-selection {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }


    /* =====================================================
       CLOSED STATE — 2 × 2
    ===================================================== */

    .our-selection-inner {
        display: grid;

        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;

        height: auto;

        min-height: calc(var(--svh) * 200);

        overflow: hidden;
    }

    .our-selection-item {
        width: 100% !important;
        min-width: 0 !important;

        height: calc((var(--svh) * 200) / 2);

        min-height: 0;

        transform: none !important;
    }


    /* =====================================================
       MOBILE TITLES
    ===================================================== */

    .our-selection-title .title {
        opacity: 1;

        pointer-events: none;

        max-width: 140px;

        font-size: clamp(22px, 6vw, 30px);
    }

    .our-selection-item.opened .our-selection-title {
        width: calc(100% - 48px);
        max-width: none;
    }

    .our-selection-item.opened .our-selection-title .title {
        opacity: 1;

        pointer-events: auto;

        max-width: 320px;

        font-size: clamp(28px, 6vw, 30px);
    }


    /* =====================================================
       MOBILE OPEN STATE
    ===================================================== */

    .our-selection-item.opened {
        position: fixed !important;

        top: 0 !important;
        left: 0 !important;

        width: 100vw !important;
        height: 100vh !important;

        min-width: 100vw !important;

        z-index: 100 !important;

        transform: none !important;
    }


    /* Hide the other three when one is open */

    .our-selection-inner:has(.our-selection-item.opened)
    .our-selection-item:not(.opened) {
        display: none !important;
    }


    /* =====================================================
       OPENED IMAGE
    ===================================================== */

    .our-selection-item.opened .our-selection-item-inner {
        position: absolute !important;

        inset: 0 !important;

        width: 100% !important;
        height: 100% !important;

        left: 0 !important;
        right: auto !important;
    }


    /* =====================================================
       MOBILE BOTTOM / CLOSE / HEADING
    ===================================================== */

    .our-selection-item .close-button {
        top: 34px;
        right: 18px;
    }

    .our-selection-item .section-bottom {
        flex-direction: column;

        bottom: 16px;
        left: 18px;
        right: 18px;
    }

    .our-selection-heading {
        bottom: 24px;
        left: 18px;
    }


    /* =====================================================
       MOBILE LINKS
    ===================================================== */

    .link-button {
        font-size: 16px;
        gap: 5px;
    }

    .link-circle {
        width: 8px;
        min-width: 8px;
    }

}