/* ==========================================
   BURGER SPOT - Hero Scroll-Scrub Sequence
   Loaded after css/style.css
   ========================================== */

/* ---- Scroll Track & Pinned Stage ---- */
.hero-track {
    position: relative;
    height: 300vh;
    width: 100%;
    background: var(--charcoal);
}

.hero-track.is-compact-track {
    height: 220vh;
}

.hero-track .hero {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 5rem;
    overflow: hidden;
    background: var(--charcoal);
}

/* When Locomotive Scroll is active, GSAP ScrollTrigger handles pinning via transform */
html.has-locomotive .hero-track .hero,
html.has-scroll-smooth .hero-track .hero {
    position: relative;
}

/* Static fallback when neither Locomotive nor Hero Scrub is active */
html:not(.has-locomotive):not(.has-hero-scrub) .hero-track {
    height: auto;
}

html:not(.has-locomotive):not(.has-hero-scrub) .hero-track .hero {
    position: relative;
    height: 100vh;
    height: 100dvh;
}

/* ---- Strict Layer Z-Order & Pointer Pass-Through ---- */
.hero-bg-pattern {
    z-index: 0;
    pointer-events: none;
}

.hero-flames,
.hero-smoke {
    z-index: 1;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-text {
    position: relative;
    z-index: 2;
    will-change: transform, opacity;
}

.hero-visual {
    position: relative;
    z-index: 1;
    pointer-events: none;
    animation: none;
    min-height: 520px;
}

.hero-scroll-indicator {
    z-index: 2;
    pointer-events: none;
    will-change: opacity;
}

.sauce-drip {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    z-index: 3;
    pointer-events: none;
}

.custom-cursor,
.cursor-dot,
.cursor-outline {
    pointer-events: none;
}

.cursor-outline {
    z-index: 10000;
}

.cursor-dot {
    z-index: 10001;
}

/* ---- Scrub Stage: Poster + Canvas + Fallback Video ---- */
.hero-visual .burger-3d {
    position: relative;
    width: min(100%, 440px);
    height: min(76vh, 660px);
    aspect-ratio: 9 / 16;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: none;
    pointer-events: none;
    isolation: isolate;
    -webkit-mask-image: radial-gradient(ellipse 88% 92% at 50% 50%, var(--charcoal) 64%, transparent 100%);
    mask-image: radial-gradient(ellipse 88% 92% at 50% 50%, var(--charcoal) 64%, transparent 100%);
}

.hero-poster,
#heroScrubCanvas,
.hero-fallback-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.hero-poster {
    object-fit: cover;
    object-position: center center;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.45s var(--transition);
}

#heroScrubCanvas {
    z-index: 2;
    opacity: 0;
    transition: opacity 0.35s var(--transition);
}

/* Once first frame is painted or >=60% preloaded, show canvas and fade poster */
.hero-visual.has-first-frame #heroScrubCanvas,
.hero-visual.is-ready #heroScrubCanvas {
    opacity: 1;
}

.hero-visual.is-ready .hero-poster {
    opacity: 0;
}

.hero-fallback-video {
    object-fit: cover;
    object-position: center center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.35s var(--transition);
}

.hero-visual[data-mode="video-fallback"] .hero-fallback-video {
    opacity: 1;
}

.hero-visual[data-mode="video-fallback"] #heroScrubCanvas,
.hero-visual[data-mode="video-fallback"] .hero-poster {
    opacity: 0;
}

.hero-floating-elements {
    pointer-events: none;
    z-index: 3;
}

.float-el {
    pointer-events: none;
    will-change: transform, opacity;
}

/* ---- Disable Hardcoded CSS Entrance Delays When Scrub Owns Choreography ---- */
html.has-hero-scrub .hero-badge,
html.has-hero-scrub .title-word,
html.has-hero-scrub .hero-subtitle,
html.has-hero-scrub .hero-buttons,
html.has-hero-scrub .hero-delivery-partners,
html.has-hero-scrub .hero-visual,
html.has-hero-scrub .hero-scroll-indicator {
    animation: none;
}

html.has-hero-scrub .title-word {
    transform: none;
}

html.has-hero-scrub .hero-buttons .btn {
    transition:
        background-color 0.4s var(--transition),
        border-color 0.4s var(--transition),
        color 0.4s var(--transition),
        box-shadow 0.4s var(--transition);
}

/* ---- Keyboard Accessibility & Focus Rings on CTAs ---- */
.hero-buttons .btn {
    pointer-events: auto;
}

.hero-buttons .btn:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 4px;
    box-shadow: 0 0 0 6px rgba(230, 57, 70, 0.45);
}

html.has-hero-scrub .hero-text:focus-within,
html.has-hero-scrub .hero-text:focus-within .hero-buttons {
    opacity: 1 !important;
}

/* ---- Responsive: <=1024px Single Centered Column with Burger Behind Copy ---- */
@media (max-width: 1024px) {
    .hero-track .hero {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        position: relative;
        min-height: calc(100vh - 6rem);
        min-height: calc(100dvh - 6rem);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hero-text {
        position: relative;
        z-index: 2;
        max-width: 640px;
        margin: 0 auto;
    }

    .hero-visual {
        position: absolute;
        inset: 0;
        order: 0;
        z-index: 1;
        opacity: 0.36;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
    }

    .hero-visual .burger-3d {
        width: min(84vw, 400px);
        height: min(74vh, 580px);
    }
}

@media (max-width: 768px) {
    .hero-visual {
        opacity: 0.32;
    }

    .hero-visual .burger-3d {
        width: min(88vw, 340px);
        height: min(68vh, 500px);
    }
}

@media (max-width: 480px) {
    .hero-track .hero {
        padding-top: 4rem;
    }

    .hero-visual .burger-3d {
        width: min(92vw, 300px);
        height: min(62vh, 440px);
    }
}

/* ---- Reduced Motion Fallback ---- */
@media (prefers-reduced-motion: reduce) {
    .hero-track,
    .hero-track.is-compact-track {
        height: auto !important;
    }

    .hero-track .hero {
        position: relative !important;
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
    }

    .hero-badge,
    .title-word,
    .hero-subtitle,
    .hero-buttons,
    .hero-delivery-partners,
    .hero-visual,
    .hero-text {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    #heroScrubCanvas,
    .hero-fallback-video,
    .hero-scroll-indicator {
        display: none !important;
    }

    .hero-poster {
        opacity: 1 !important;
    }

    @media (max-width: 1024px) {
        .hero-visual {
            opacity: 0.32 !important;
        }
    }
}
