/* =========================================
   STACKED CARDS SECTION
   ======================================= */
.stacked-cards-section {
    position: relative;
    width: 100%;
}

/* Sticky viewport — stays pinned while scroll-tracker scrolls behind it */
.sticky-cards-wrapper {
    position: sticky;
    top: 64px;
    /* height of nav */
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    perspective: 1000px;
    /* Padding so content never touches nav or bottom edge */
    padding: 32px 0;
}

/* Wide container that holds all absolutely-stacked cards */
.cards-container {
    position: relative;
    width: 100%;
    max-width: 1120px;
    /* Height is derived from the stacked-card intrinsic height + stack offset */
    height: 520px;
    margin: 0 auto;
}

/* =========================================
   INDIVIDUAL CARD
   ======================================= */
.stacked-card {
    position: absolute;
    top: 0;
    left: 20%;
    width: 70%;
    height: 90%;
    border-radius: 24px;
    padding: 22px;
    display: flex;
    flex-direction: row;
    gap: 32px;
    overflow: hidden;
    /* No CSS transition — all animation is driven by JS lerp loop */
    will-change: transform, filter, opacity;

    /* Light mode card */
    background: #f8f9fa;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.07),
        0 16px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ——— Dark mode card — darker + purple shine ——— */
.dark .stacked-card {
    background: #141e2d;
    /* slightly darker than page bg */
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(99, 102, 241, 0.18);
    border: 1px solid rgba(99, 102, 241, 0.22);
}

/* Shine gradient — only dark mode */
.dark .stacked-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(135deg,
            rgba(139, 92, 246, 0.12) 0%,
            transparent 45%,
            rgba(99, 102, 241, 0.06) 100%);
}

/* =========================================
   CARD INTERNALS
   ======================================= */
.card-media {
    flex: 1.3;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

.card-media video,
.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.card-arrow-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    margin-top: 12px;
    margin-bottom: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-arrow-link .material-symbols-outlined {
    font-size: 24px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-arrow-link:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: scale(1.05);
}

.card-arrow-link:hover .material-symbols-outlined {
    transform: translateX(4px);
}

@media (max-width: 768px) {
    .card-arrow-link {
        margin-top: 4px;
        margin-bottom: 0;
        width: 40px;
        height: 40px;
    }
}

/* =========================================
   SCROLL TRACKER (invisible height driver)
   The total scroll distance for the cards to animate perfectly.
   With 3 cards (5 progress segments: 3 holds, 2 transitions),
   400vh gives a nice, even 80vh scroll per segment.
   ======================================= */
.scroll-tracker {
    height: 400vh;
}

/* =========================================
   SECTION HEADER (above the stack)
   ======================================= */
.stacked-section-header {
    width: 100%;
    max-width: 1120px;
    margin-bottom: 66px;
    flex-shrink: 0;
}

.stacked-view-all {
    margin-top: 12px;
    width: 100%;
    max-width: 1120px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

/* =========================================
   RESPONSIVE
   ======================================= */
@media (max-width: 1024px) {
    .stacked-card {
        flex-direction: column;
        height: auto;
        min-height: 480px;
    }

    .cards-container {
        height: 660px;
    }

    .sticky-cards-wrapper {
        justify-content: flex-start;
        padding-top: 30px;
    }
}

@media (max-width: 768px) {
    .stacked-card {
        padding: 24px;
        gap: 16px;
        min-height: 360px;
        left: 12px;
        width: calc(100% - 24px);
    }

    .card-media {
        flex: none;
        height: 160px;
    }

    .card-content h4 {
        font-size: 1.5rem;
        /* text-2xl equivalent for better fit */
        margin-bottom: 4px;
    }

    .card-content p {
        font-size: 0.95rem;
    }

    .cards-container {
        height: 520px;
    }

    .sticky-cards-wrapper {
        padding-top: 20px;
    }
}