/* Stacking cards (resources/views/components/stacking-cards.blade.php)
 *
 * Each card sits in a full-viewport-tall sticky wrapper, so the next card
 * scrolls up over it; later cards paint on top by DOM order. A small top
 * offset per card (--i) leaves the edges of the cards behind visible.
 * public/js/stacking-cards.js scales the cards behind down as you scroll.
 */

.stackCards {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    margin: 0 0 150px 0;
}

.stackCardsList {
    width: 100%;
    max-width: 1400px;
}

.stackCardsItem {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
}

.stackCard {
    --stack-gap: 28px;
    position: relative;
    top: calc(-4vh + var(--i, 0) * var(--stack-gap));
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(40px, 6vw, 96px);
    padding: clamp(40px, 4.5vw, 72px);
    background: #FFFFFF;
    border: 1px solid #E6EEDD;
    border-radius: 32px;
    box-shadow: 0 -12px 40px rgba(23, 61, 44, 0.07);
    transform-origin: 50% 0;
    will-change: transform;
}

/* Zig-zag: every second card puts the image on the left. */
.stackCardReverse {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.stackCardReverse .stackCardText {
    order: 2;
}

.stackCardText h2 {
    font-family: Alan Sans, sans-serif;
    font-weight: 600;
    font-size: clamp(30px, 3vw, 44px);
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: #173D2C;
    margin: 0 0 24px 0;
}

.stackCardText p {
    font-family: Instrument Sans, sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    color: #4E5A52;
    margin: 0;
    max-width: 62ch;
}

.stackCardMedia {
    width: 100%;
    max-width: 380px;
    justify-self: center;
    aspect-ratio: 1 / 1.05;
    display: flex;
    align-items: center;
    justify-content: center;
    /* background: #F3FBE4;
    border: 1px solid #E3EFD2;
    border-radius: 20px; */
}

.stackCardMedia img {
    width: 100%;
    height: auto;
    display: block;
}

/* Short desktop viewports: keep a card inside the screen. */
@media (min-width: 901px) and (max-height: 760px) {
    .stackCard {
        padding: 66px 48px;
    }

    .stackCardText p {
        font-size: 16px;
        line-height: 1.6;
    }

    .stackCardMedia {
        max-width: 300px;
    }
}

/* Mobile: no sticking or scaling — a plain list of stacked cards. */
@media (max-width: 900px) {
    .stackCards {
        margin-bottom: 80px;
        padding: 0 24px;
    }

    .stackCardsItem {
        position: static;
        height: auto;
        display: block;
    }

    .stackCardsItem + .stackCardsItem {
        margin-top: 20px;
    }

    .stackCard,
    .stackCardReverse {
        top: 0;
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 28px 22px;
        border-radius: 24px;
        box-shadow: none;
        transform: none !important;
        will-change: auto;
    }

    /* Image first on every card. */
    .stackCardMedia,
    .stackCardReverse .stackCardMedia {
        order: -1;
        max-width: 280px;
    }

    .stackCardReverse .stackCardText {
        order: 0;
    }

    .stackCardText h2 {
        font-size: clamp(26px, 7vw, 32px);
        margin-bottom: 14px;
    }

    .stackCardText p {
        font-size: 16px;
        line-height: 1.6;
    }
}
