/* ==========================================================================
   PREMIUM STICKY STACKED SERVICES
   Sticky positioning provides the pinning; GSAP ScrollTrigger scrubs the
   depth / scale / opacity + image parallax. Transform & opacity only.
   ========================================================================== */

.stack-section {
    position: relative;
    padding: 3rem 0 6rem;
    background:
        radial-gradient(1200px 600px at 15% 0%, rgba(9, 101, 176, 0.06), transparent 60%),
        radial-gradient(1000px 600px at 85% 30%, rgba(241, 116, 58, 0.06), transparent 60%);
}

.stack-intro {
    max-width: 780px;
    margin: 0 auto 1rem;
    padding: 0 1.5rem;
    text-align: center;
}

.stack-intro .stack-eyebrow {
    justify-content: center;
    margin: 0 auto 0.9rem;
}

.stack-intro h2 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: clamp(1.9rem, 1rem + 3vw, 3.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #0964B0;
    margin-bottom: 0.75rem;
}

.stack-intro p {
    font-size: clamp(1rem, 0.9rem + 0.4vw, 1.2rem);
    color: #1f2937;
    font-weight: 500;
    line-height: 1.6;
}


/* The scroll track — no overflow clipping (sticky must not be clipped) */
.stack-list {
    position: relative;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Each sticky item pins just under the fixed header, then the next slides over */
.stack-item {
    position: sticky;
    top: 104px;
    height: 66vh;
    min-height: 400px;
    max-height: 520px;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1600px;
}

/* Constrain the card so it reads as a contained panel, not a full-bleed block */
.stack-item > .stack-card-inner {
    max-width: 1040px;
    margin: 0 auto;
}

.stack-item:last-child {
    margin-bottom: 0;
}

/* The premium glass card */
.stack-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1.02fr 0.98fr;
    border-radius: 28px;
    overflow: hidden;
    /* Opaque so a pinned card fully hides the card stacked behind it
       (translucent glass caused the previous card to bleed through). */
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow:
        0 32px 80px -24px rgba(15, 23, 42, 0.42),
        0 10px 30px -12px rgba(15, 23, 42, 0.20);
    transform-origin: center top;
    will-change: transform, opacity;
}

/* Media / visual panel */
.stack-media {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--g1, #0964B0), var(--g2, #06b6d4));
}

.stack-media::before {
    content: '';
    position: absolute;
    width: 130%;
    height: 130%;
    top: -30%;
    right: -35%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.28), transparent 62%);
    pointer-events: none;
}

.stack-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.10) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 78%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 78%);
    opacity: 0.5;
    pointer-events: none;
}

.stack-media-glyph {
    position: relative;
    z-index: 1;
    font-size: clamp(4rem, 11vw, 9rem);
    color: rgba(255, 255, 255, 0.96);
    filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.28));
    will-change: transform;
    transform: translateZ(0);
}

.stack-badge {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.stack-num {
    position: absolute;
    top: 1.2rem;
    right: 1.4rem;
    z-index: 2;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(15, 23, 42, 0.45);
}

/* Content panel */
.stack-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.15rem;
    padding: clamp(1.75rem, 3.5vw, 3.5rem);
}

.stack-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-start;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--g1, #0964B0), var(--g2, #06b6d4));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.stack-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: clamp(1.6rem, 1rem + 2vw, 2.6rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #333333;
}

.stack-desc {
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.18rem);
    line-height: 1.65;
    color: #333333;
    max-width: 46ch;
}

.stack-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    align-self: flex-start;
    margin-top: 0.4rem;
    padding: 0.85rem 1.6rem;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--g1, #0964B0), var(--g2, #06b6d4));
    color: #fff;
    font-weight: 700;
    font-size: 0.98rem;
    box-shadow: 0 14px 30px -10px var(--g2, rgba(6, 182, 212, 0.6));
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s;
}

.stack-cta i {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.stack-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -12px var(--g2, rgba(6, 182, 212, 0.7));
}

.stack-cta:hover i {
    transform: translateX(4px);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .stack-item {
        top: 84px;
        height: auto;
        min-height: 0;
        max-height: none;
        margin-bottom: 2rem;
    }

    .stack-card-inner {
        grid-template-columns: 1fr;
        grid-template-rows: 42vw auto;
        height: auto;
        max-height: none;
    }

    .stack-media {
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    .stack-card-inner {
        grid-template-rows: 46vw auto;
        border-radius: 22px;
    }

    .stack-media::after {
        background-size: 30px 30px;
    }
}

/* ---------- Reduced motion: plain, non-overlapping stacked list ---------- */
@media (prefers-reduced-motion: reduce) {
    .stack-item {
        position: relative;
        top: auto;
        height: auto;
        min-height: 0;
        max-height: none;
        margin-bottom: 1.75rem;
        perspective: none;
    }

    .stack-card-inner {
        transform: none !important;
        opacity: 1 !important;
    }
}
