/* --- 1. CORE LAYOUT & HERO --- */
.ssr-scroll-section {
    height: 400vh; /* This determines the length of the scroll effect */
    position: relative;
    background-color: #000;
}

.ssr-sticky-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ssr-cards-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 72rem;
    position: relative;
    gap: 0px; /* Managed by scroll timeline */
}

@media (min-width: 768px) {
    .ssr-cards-container {
        flex-direction: row;
        height: 60vh;
    }
}

/* --- 2. THE SCROLL-DRIVEN ANIMATION --- */
/* This links the animation directly to the container's scroll progress */
@keyframes ssr-fan-logic {
    0% {
        transform: rotateY(0deg) rotateZ(0deg) translateX(0%);
        border-radius: 0px;
    }
    100% {
        transform: rotateY(var(--target-rot-y)) rotateZ(var(--target-rot-z)) translateX(var(--target-x));
        border-radius: 24px;
    }
}

.ssr-card-item {
    position: relative;
    perspective: 1200px;
    width: 100%;
    flex: 1;
    /* Native Scroll Timeline */
    view-timeline-name: --card-scroll;
    animation: ssr-fan-logic linear both;
    animation-timeline: --card-scroll;
    animation-range: entry 20% exit 80%;
}

/* --- 3. INDIVIDUAL CARD CONFIGURATION --- */
/* Values extracted from your specific targets  */
.ssr-card-1 { --target-rot-y: 190deg; --target-rot-z: -15deg; --target-x: 15%; z-index: 10; }
.ssr-card-2 { --target-rot-y: 180deg; --target-rot-z: 0deg;   --target-x: 0%;  z-index: 20; }
.ssr-card-3 { --target-rot-y: 170deg; --target-rot-z: 15deg;  --target-x: -15%; z-index: 30; }

/* --- 4. FLIP & FACE STYLES --- */
.ssr-flip-layer {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.ssr-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    border-radius: inherit;
}

.ssr-face.ssr-back {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.1), 0 50px 100px -20px rgba(0,0,0,0.8);
}

/* --- 5. VISUAL THEMES --- */
.ssr-theme-zinc { background-color: #e4e4e7; color: #18181b; }
.ssr-theme-red  { background-color: #D92323; color: #fff; }
.ssr-theme-dark { background-color: #18181b; color: #f4f4f5; }

/* --- 6. MOBILE OVERRIDES --- */
@media (max-width: 767px) {
    .ssr-card-item {
        --target-rot-z: 0deg;
        --target-x: 0%;
        animation-range: entry 10% exit 50%;
    }
}