/* ========================================================================== */
/* CINEMATIC SCROLL STAGE                                                      */
/* Sticky scene, cross-fade, scale-back and rising content transition.         */
/* ========================================================================== */

/*
 * Sticky elements stop following the viewport when one of their ancestors
 * clips its overflow. The base NamelessMC theme applies overflow clipping to
 * both #wrapper and, depending on the Fomantic build, the sidebar pusher. Keep
 * those ancestors open so the stage never turns into an empty 185svh spacer.
 */
#wrapper,
body.pushable > .pusher {
    overflow: visible !important;
}

.vice-hero-scrollstage {
    --vi-hero-scale: 1;
    --vi-hero-radius: 0px;
    --vi-scene-primary-opacity: 1;
    --vi-scene-secondary-opacity: 0;
    --vi-scene-primary-scale: 1.035;
    --vi-scene-secondary-scale: 1.09;
    --vi-copy-opacity: 1;
    --vi-copy-y: 0px;
    --vi-server-y: 0px;
    --vi-roman-opacity: .055;
    --vi-roman-y: 0px;
    --vi-shade-opacity: 0;
    --vi-cue-opacity: 1;
    position: relative;
    z-index: 1;
    height: 185svh;
    margin: 0;
    background: var(--vi-bg, #0f0c1a);
}

.vice-hero-scrollstage > .ui.masthead.vice-hero {
    box-sizing: border-box;
    position: -webkit-sticky;
    position: sticky !important;
    top: 0;
    z-index: 1;
    min-height: 100svh;
    height: 100svh;
    margin: 0 !important;
    padding-top: 12rem;
    overflow: hidden;
    border-radius: var(--vi-hero-radius);
    background: var(--vi-bg, #0f0c1a);
    box-shadow: 0 35px 100px rgba(3, 2, 10, .4);
    transform: scale(var(--vi-hero-scale));
    transform-origin: 50% 50%;
    will-change: transform, border-radius;
}

/* Runtime safety net: collapse the artificial scroll track if sticky is
 * disabled by a browser, extension or an injected framework rule. */
.vice-hero-scrollstage.vi-sticky-fallback {
    height: auto;
    min-height: 100svh;
}

.vice-hero-scrollstage.vi-sticky-fallback > .ui.masthead.vice-hero {
    position: relative !important;
    height: auto;
    min-height: 100svh;
    transform: none;
}

.vice-hero-scrollstage.vi-sticky-fallback + .ui.container {
    margin-top: 0;
}

.vice-hero-scrollstage > .ui.masthead.vice-hero::before,
.vice-hero-scrollstage > .ui.masthead.vice-hero::after { display: none; }

.vice-hero-scene,
.vice-hero-scroll-shade {
    position: absolute;
    inset: -3%;
    pointer-events: none;
}

.vice-hero-scene {
    z-index: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    will-change: opacity, transform;
}

.vice-hero-scene-primary {
    opacity: var(--vi-scene-primary-opacity);
    background-image:
        linear-gradient(90deg, rgba(15,12,26,.94), rgba(15,12,26,.67) 35%, rgba(15,12,26,.14) 70%),
        linear-gradient(0deg, rgba(15,12,26,.8), transparent 40%),
        url('../assets/images/vice-horizon-v2.png');
    transform: scale(var(--vi-scene-primary-scale));
}

.vice-hero-scene-secondary {
    opacity: var(--vi-scene-secondary-opacity);
    background-image:
        linear-gradient(90deg, rgba(15,12,26,.88), rgba(15,12,26,.36) 58%, rgba(15,12,26,.1)),
        linear-gradient(0deg, rgba(15,12,26,.72), transparent 48%),
        url('../assets/images/vice-horizon.png');
    transform: scale(var(--vi-scene-secondary-scale));
}

.vice-hero-scroll-shade {
    inset: 0;
    z-index: 1;
    opacity: var(--vi-shade-opacity);
    background: #0f0c1a;
    will-change: opacity;
}

.vice-hero-scrollstage .vice-hero-noise { z-index: 2; }

.vice-hero-scrollstage .vice-hero-roman {
    z-index: 3;
    opacity: var(--vi-roman-opacity);
    transform: translate(-50%, calc(-50% + var(--vi-roman-y))) skew(-7deg);
    will-change: opacity, transform;
}

.vice-hero-scrollstage .vice-hero-rail { z-index: 5; }
.vice-hero-scrollstage .vice-hero > .ui.container { position: relative; z-index: 6; }

.vice-hero-scrollstage .vice-hero-copy {
    opacity: var(--vi-copy-opacity);
    transform: translate3d(0, var(--vi-copy-y), 0);
    will-change: opacity, transform;
}

.vice-hero-scrollstage .vice-server-column {
    opacity: var(--vi-copy-opacity);
    transform: translate3d(0, var(--vi-server-y), 0);
    will-change: opacity, transform;
}

.vice-scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 2rem;
    z-index: 7;
    width: 2.8rem;
    height: 2.8rem;
    opacity: var(--vi-cue-opacity);
    transform: translateX(-50%);
    pointer-events: none;
    will-change: opacity, transform;
}

.vice-scroll-cue span,
.vice-scroll-cue span::after {
    position: absolute;
    left: 50%;
    width: 1.05rem;
    height: 1.05rem;
    border-right: 3px solid var(--vi-pink, #ffb2c6);
    border-bottom: 3px solid var(--vi-pink, #ffb2c6);
    content: "";
    transform: translateX(-50%) rotate(45deg);
}

.vice-scroll-cue span { top: .35rem; animation: vi-scroll-cue 1.8s ease-in-out infinite; }
.vice-scroll-cue span::after { top: .55rem; opacity: .45; }

.vice-hero-scrollstage + .ui.container {
    position: relative;
    z-index: 8;
    margin-top: -22svh;
}

/* Stronger view reveals, similar to the large panels rising over fixed art. */
.vi-scroll-reveal {
    opacity: 0;
    filter: blur(10px);
    transform: translate3d(0, 7rem, 0) scale(.95);
    transform-origin: 50% 80%;
    transition:
        opacity .85s cubic-bezier(.2,.7,.2,1),
        transform 1s cubic-bezier(.16,.8,.2,1),
        filter .75s ease;
    will-change: opacity, transform, filter;
}

.vi-scroll-reveal.vi-in-view {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1);
}

.vi-scroll-reveal:nth-child(2n) { transition-delay: 70ms; }
.vi-scroll-reveal:nth-child(3n) { transition-delay: 130ms; }

.vice-section-heading {
    background-position: center calc(50% + var(--vi-parallax-y, 0px));
    will-change: background-position;
}

.vice-section-copy,
.vice-section-stamp {
    transform: translate3d(0, var(--vi-section-copy-y, 0px), 0);
    will-change: transform;
}

@keyframes vi-scroll-cue {
    0%, 100% { opacity: .45; transform: translate(-50%, -3px) rotate(45deg); }
    50% { opacity: 1; transform: translate(-50%, 6px) rotate(45deg); }
}

@media (max-width: 768px) {
    .vice-hero-scrollstage { height: 145svh; }

    .vice-hero-scrollstage > .ui.masthead.vice-hero {
        min-height: 100svh;
        height: 100svh;
        padding-top: 9rem;
    }

    .vice-hero-scene-primary,
    .vice-hero-scene-secondary { background-position: 68% center; }

    .vice-hero-scrollstage + .ui.container { margin-top: -12svh; }

    .vi-scroll-reveal {
        filter: blur(6px);
        transform: translate3d(0, 4rem, 0) scale(.97);
    }
}

@media (prefers-reduced-motion: reduce) {
    .vice-hero-scrollstage {
        height: auto;
    }

    .vice-hero-scrollstage > .ui.masthead.vice-hero {
        position: relative !important;
        height: auto;
        min-height: 100svh;
        border-radius: 0;
        transform: none;
    }

    .vice-hero-scene-primary { opacity: 1; transform: none; }
    .vice-hero-scene-secondary { display: none; }
    .vice-hero-scroll-shade { display: none; }
    .vice-scroll-cue { display: none; }
    .vice-hero-scrollstage + .ui.container { margin-top: 0; }

    .vi-scroll-reveal,
    .vi-scroll-reveal.vi-in-view {
        opacity: 1;
        filter: none;
        transform: none;
        transition: none;
    }
}

/* Never reserve the extended scroll track in browsers without sticky support. */
@supports not (position: sticky) {
    .vice-hero-scrollstage { height: auto; }

    .vice-hero-scrollstage > .ui.masthead.vice-hero {
        position: relative !important;
        height: auto;
        min-height: 100svh;
    }

    .vice-hero-scrollstage + .ui.container { margin-top: 0; }
}
