/* ============================================================
   SCROLL-DRIVEN ANIMATIONS
   - #showcase : pinned bento gallery that assembles on scroll
   - .rv / .rv-* : reusable scroll-reveal utilities (per section)
   ============================================================ */

/* ============================================================
   1. HERO BENTO SHOWCASE (scroll-scrubbed)
   ============================================================ */
.showcase {
    position: relative;
    /* Tall track gives the pinned grid room to animate as you scroll. */
    height: 300vh;
    background: var(--secondary-black);
    color: var(--primary-white);
    z-index: 1;
}

.showcase-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    width: 100%;
    overflow: hidden;
    display: flex;
    padding: clamp(0.75rem, 2vw, 1.25rem);
}

/* Soft red ambience so the gallery reads as part of the brand */
.showcase-sticky::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(60% 55% at 50% 0%, rgba(255, 46, 55, 0.18), transparent 65%),
        radial-gradient(50% 50% at 85% 100%, rgba(120, 20, 24, 0.28), transparent 70%);
    pointer-events: none;
}

/* ---- Bento grid ---- */
.bento {
    position: relative;
    z-index: 1;
    display: grid;
    gap: clamp(0.6rem, 1.4vw, 1rem);
    width: 100%;
    height: 100%;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: 1fr 0.5fr 0.5fr 1fr;
}

.bento-cell {
    position: relative;
    overflow: hidden;
    border-radius: clamp(12px, 1.4vw, 20px);
    box-shadow: 0 20px 45px -20px rgba(0, 0, 0, 0.7);
    /* Driven by JS via CSS custom props (set on .bento) */
    transform: translateX(var(--tx, 0%)) scale(var(--cs, 1));
    will-change: transform;
}

.bento-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Subtle darkening so the centered headline stays legible */
.bento-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 10, 12, 0.15), rgba(10, 10, 12, 0.45));
}

/* Placement (desktop) + per-cell scale origins (mirrors the reference) */
.bento-cell:nth-child(1) { grid-column: span 6; grid-row: span 3; transform-origin: top right; }
.bento-cell:nth-child(2) { grid-column: span 2; grid-row: span 2; }
.bento-cell:nth-child(3) { grid-column: span 2; grid-row: span 2; transform-origin: bottom right; }
.bento-cell:nth-child(4) { grid-column: span 3; transform-origin: top right; }
.bento-cell:nth-child(5) { grid-column: span 3; }

/* ---- Centered headline overlay (scales + fades out on scroll) ---- */
.showcase-hero {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    width: min(90%, 640px);
    text-align: center;
    transform: translate(-50%, -50%) scale(var(--hs, 1));
    opacity: var(--ho, 1);
    will-change: transform, opacity;
}

.showcase-hero .eyebrow {
    color: var(--primary-red);
}

.showcase-hero h2 {
    font-size: clamp(2.4rem, 6.5vw, 5rem);
    line-height: 1.02;
    letter-spacing: -0.03em;
    margin: 0.6rem 0 1rem;
    color: var(--primary-white);
}

.showcase-hero h2 em {
    color: var(--primary-red);
    font-style: normal;
}

.showcase-hero p {
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.6;
    color: rgba(245, 243, 242, 0.72);
    max-width: 30em;
    margin: 0 auto 1.8rem;
}

.showcase-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Ghost button variant on dark for this section */
.showcase-actions .btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.4rem;
    border-radius: 100px;
    border: 1px solid rgba(245, 243, 242, 0.28);
    color: var(--primary-white);
    font-weight: 600;
    font-size: 0.9rem;
    transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.showcase-actions .btn-outline:hover {
    border-color: var(--primary-red);
    background: rgba(255, 46, 55, 0.08);
}

/* Mobile: hide the two tall side cells, feature spans full width */
@media (max-width: 768px) {
    .showcase {
        height: 230vh;
    }

    .bento-cell:nth-child(1) { grid-column: span 8; }
    .bento-cell:nth-child(2),
    .bento-cell:nth-child(3) { display: none; }
    .bento-cell:nth-child(4) { grid-column: span 4; }
    .bento-cell:nth-child(5) { grid-column: span 4; }
}

/* ============================================================
   2. REUSABLE SCROLL-REVEAL UTILITIES
   Applied to existing sections via data/classes in the markup.
   ============================================================ */
.rv {
    opacity: 0;
    transition:
        opacity 0.85s var(--ease),
        transform 0.85s var(--ease),
        filter 0.85s var(--ease);
    will-change: opacity, transform;
}

.rv-up      { transform: translateY(52px); }
.rv-down    { transform: translateY(-52px); }
.rv-left    { transform: translateX(-64px); }
.rv-right   { transform: translateX(64px); }
.rv-zoom    { transform: scale(0.86); }
.rv-blur    { filter: blur(14px); }

.rv.in {
    opacity: 1;
    transform: none;
    filter: none;
}

/* Staggered children (e.g. product cards, stats) */
.rv-stagger > * {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    will-change: opacity, transform;
}

.rv-stagger.in > * {
    opacity: 1;
    transform: none;
}

.rv-stagger.in > *:nth-child(1) { transition-delay: 0.05s; }
.rv-stagger.in > *:nth-child(2) { transition-delay: 0.16s; }
.rv-stagger.in > *:nth-child(3) { transition-delay: 0.27s; }
.rv-stagger.in > *:nth-child(4) { transition-delay: 0.38s; }
.rv-stagger.in > *:nth-child(5) { transition-delay: 0.49s; }
.rv-stagger.in > *:nth-child(6) { transition-delay: 0.60s; }

/* Parallax elements get their transform set inline by JS */
[data-parallax] { will-change: transform; }

/* ============================================================
   3. REDUCED MOTION — everything resolves to its final state
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .showcase {
        height: auto;
    }

    .showcase-sticky {
        position: static;
        height: auto;
        min-height: 60vh;
        flex-direction: column;
        gap: 2rem;
        padding: 5rem 1.25rem;
    }

    .bento {
        height: 70vh;
        min-height: 460px;
    }

    .bento-cell {
        transform: none;
    }

    .showcase-hero {
        position: static;
        transform: none;
        opacity: 1;
        width: 100%;
        margin-bottom: 2.5rem;
    }

    .rv,
    .rv-stagger > * {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }

    [data-parallax] {
        transform: none !important;
    }
}
