/* =====================================================================
   Scroll Expansion Hero Polish
   Native Razor Pages / CSS / JavaScript tuning inspired by the 21st.dev
   ScrollExpandMedia behavior.

   Goals:
   - Keep the existing Evorix hero markup/assets.
   - Make the expansion feel controlled, smooth, and intentional.
   - Avoid the old 250svh runway feeling.
   - Use a wheel/touch progress engine like the original React component.
   - Keep the ripple background and footer ripple from the previous patch.
   ===================================================================== */

/* The original implementation used a long sticky runway. The polished engine
   drives the expansion with wheel/touch progress, so the section behaves like
   a clean opening viewport and then releases the page once expanded. */
.scroll-expand-hero[data-scroll-expand-hero] {
    height: 100svh;
    min-height: 720px;
    overflow: clip;
    isolation: isolate;
    background: #000;
    --scroll-polish-progress: 0;
    --scroll-ripple-opacity: 0.7;
    --scroll-background-opacity: 1;
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__sticky {
    position: relative;
    top: auto;
    height: 100svh;
    min-height: 720px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #000;
}

/* Fade the interactive ripple/background in the same clean way as the original
   component fades its background image while the media becomes dominant. */
.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__stage-ripple {
    opacity: var(--scroll-ripple-opacity, 0.7);
    transition: none;
}

.scroll-expand-hero[data-scroll-expand-hero].is-expanded .scroll-expand-hero__stage-ripple {
    opacity: var(--scroll-ripple-opacity, 0.06);
}

/* Opening title: less blur, cleaner split, and no harsh jump. */
.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__intro {
    top: clamp(6.4rem, 15svh, 9.8rem);
    opacity: var(--scroll-title-opacity, 1);
    translate: 0 var(--scroll-title-y, 0px);
    filter: blur(var(--scroll-title-blur, 0px));
    will-change: opacity, translate, filter;
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__title {
    font-size: clamp(2.9rem, 4.65vw, 5.55rem);
    line-height: 0.92;
    letter-spacing: -0.078em;
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__title-row {
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__title-row--left {
    transform: translate3d(var(--scroll-title-left-x, 0px), 0, 0);
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__title-row--right {
    transform: translate3d(var(--scroll-title-right-x, 0px), 0, 0);
}

/* Media card: this now follows the original component sizing behavior:
   about 300x400 at rest, expanding toward 1550x800 but clamped to 95vw/85vh. */
.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media {
    width: var(--scroll-media-width, 300px);
    height: var(--scroll-media-height, 400px);
    min-width: 0;
    max-width: 95vw;
    max-height: 85svh;
    border-radius: var(--scroll-media-radius, 18px);
    transform: translate3d(0, var(--scroll-media-y, 0px), 0) scale(var(--scroll-media-scale, 1));
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.34), 0 28px 90px -58px rgba(255, 255, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    will-change: width, height, border-radius, transform, box-shadow;
    contain: layout paint;
}

.scroll-expand-hero[data-scroll-expand-hero].is-expanded .scroll-expand-hero__media {
    border-color: transparent;
    box-shadow: 0 34px 96px -74px rgba(0, 0, 0, 0.9);
}

/* The original media itself remains stable during expansion. We keep your
   portrait-to-wide artwork, but make the morph calmer and less noisy. */
.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__art {
    background: #000;
    border-radius: inherit;
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__art-image {
    backface-visibility: hidden;
    transform-origin: center center;
    will-change: opacity, transform, clip-path, filter;
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__art::after {
    opacity: var(--scroll-morph-sweep-opacity, 0);
    filter: blur(0.4px);
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media::before {
    background:
        linear-gradient(90deg, rgba(0, 0, 0, var(--scroll-overlay-left, 0.56)) 0%, rgba(0, 0, 0, var(--scroll-overlay-mid, 0.34)) 42%, rgba(0, 0, 0, var(--scroll-overlay-right, 0.18)) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, var(--scroll-overlay-bottom, 0.42)));
}

/* Keep text from appearing too early. In the original component, content only
   becomes visible once the media is basically expanded. */
.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media-inner {
    opacity: var(--scroll-hero-content-opacity, 0);
    transform: translate3d(0, var(--scroll-hero-content-y, 28px), 0);
    pointer-events: none;
    will-change: opacity, transform;
}

.scroll-expand-hero[data-scroll-expand-hero].is-expanded .scroll-expand-hero__media-inner {
    pointer-events: auto;
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media .hero-split__copy {
    transform: scale(var(--scroll-content-scale, 0.96));
    transform-origin: left center;
    will-change: transform;
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__hint {
    right: 1.15rem;
    bottom: 1rem;
    opacity: var(--scroll-hint-opacity, 1);
    transform: translate3d(0, var(--scroll-hint-y, 0px), 0);
    will-change: opacity, transform;
}

.scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__subtitle--below-card {
    opacity: var(--scroll-subtitle-opacity, 1);
    translate: 0 var(--scroll-subtitle-y, 0px);
    filter: blur(var(--scroll-subtitle-blur, 0px));
    will-change: opacity, translate, filter;
}

/* A tiny indicator that the hero is currently holding wheel/touch progress.
   It does not change the layout; it only improves perceived responsiveness. */
.scroll-expand-hero[data-scroll-expand-hero].is-scroll-locked {
    cursor: default;
}

html[data-theme="light"] .scroll-expand-hero[data-scroll-expand-hero] {
    background: #fafafa;
}

html[data-theme="light"] .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__sticky {
    background: #fafafa;
}

html[data-theme="light"] .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media {
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.14), 0 24px 86px -58px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

@media (max-width: 1023px) {
    .scroll-expand-hero[data-scroll-expand-hero],
    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__sticky {
        min-height: 680px;
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media-inner {
        padding: 1.4rem;
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media .hero-split__copy {
        transform: none;
    }
}

@media (max-width: 767px) {
    .scroll-expand-hero[data-scroll-expand-hero],
    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__sticky {
        min-height: 660px;
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__intro {
        top: 5.9rem;
        width: min(100%, calc(100vw - 1.25rem));
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__title {
        font-size: clamp(2.2rem, 10.5vw, 3.6rem);
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__subtitle--below-card {
        top: min(calc(50% + 252px), calc(100% - 4.3rem));
        font-size: 0.88rem;
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__hint {
        display: block;
        right: 0.9rem;
        bottom: 0.75rem;
        font-size: 0.68rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-expand-hero[data-scroll-expand-hero] {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__sticky {
        height: auto;
        min-height: 100svh;
        padding: 7rem 1rem 4rem;
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media {
        width: min(1120px, 100%);
        height: auto;
        min-height: 560px;
        max-height: none;
        transform: none;
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__intro,
    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__subtitle--below-card {
        opacity: 1;
        filter: none;
        translate: 0 0;
    }

    .scroll-expand-hero[data-scroll-expand-hero] .scroll-expand-hero__media-inner {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
}
