/**
 * BrandX Technical Works L.L.C - Hero Scroll-Driven Cinematic Animation CSS
 */

/* Fix to ensure position: sticky works by preventing overflow containers on parent */
html, body {
    overflow-x: clip !important;
}

/* Scroll Wrapper to create 400vh of scrolling pinning */
.hero-scroll-wrapper {
    position: relative;
    width: 100%;
    height: 500vh; /* 100vh viewport + 400vh of pinned scroll duration */
}

/* Sticky Pinning for Hero Section */
.hero-scroll-wrapper .hero-section {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    z-index: 5;
    background-color: #050811; /* Fallback theme dark color */
}

/* Canvas container positioned behind content */
.hero-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    background-color: #050811;
}

/* Canvas fits container exactly */
.hero-canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* 45% - 55% dark overlay to ensure readability of hero text content */
.hero-canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050811;
    opacity: 0.50; /* 50% overlay opacity */
    z-index: 1;
    pointer-events: none;
}

/* Ensure content sits above canvas layers */
.hero-grid {
    z-index: 3 !important;
}

.hero-glow-1, .hero-glow-2 {
    z-index: 2 !important; /* Glows blend over canvas, under text */
}

/* Premium Preloader Overlay */
.hero-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050811;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Sleek loading bar structure */
.hero-loader-bar-bg {
    width: 240px;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
}

.hero-loader-bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
    border-radius: 10px;
    transition: width 0.15s ease-out;
}

.hero-loader-text {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero-loader-percent {
    color: var(--primary);
    font-weight: 700;
    margin-left: 4px;
}

/* =========================================================================
   ACCESSIBILITY: REDUCED MOTION PREFERENCE
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
    /* Disable pinning, scroll wrapper handles height naturally */
    .hero-scroll-wrapper {
        height: auto !important;
    }
    
    .hero-scroll-wrapper .hero-section {
        position: relative !important;
        height: auto !important;
        min-height: 100vh;
        padding-top: 150px;
        padding-bottom: 140px;
    }
    
    /* Preloader is bypassed for static frame rendering */
    .hero-loader {
        display: none !important;
    }
    
    /* Ensure content is always visible on reduced motion */
    .hero-scroll-wrapper .hero-minimal .hero-content,
    .hero-minimal .hero-content {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }
}

/* Minimal Hero Layout to suit the background */
.hero-minimal {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    max-width: 900px !important;
    margin: 0 auto !important;
}

.hero-minimal .hero-content {
    align-items: center !important;
    text-align: center !important;
    /* Visible by default before scroll starts */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
}

/* Hide content while scroll sequence is actively playing (frames 2-159) */
.hero-scroll-wrapper.content-playing .hero-minimal .hero-content {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

/* Re-show content when animation reaches final frame */
.hero-scroll-wrapper.content-visible .hero-minimal .hero-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.hero-minimal .hero-badge {
    align-self: center !important;
}

.hero-minimal .hero-title {
    font-size: 4.8rem !important;
    max-width: 800px !important;
    margin-bottom: 24px !important;
    line-height: 1.15 !important;
}

.hero-minimal .hero-subtitle {
    font-size: 1.25rem !important;
    max-width: 650px !important;
    margin-bottom: 40px !important;
    text-align: center !important;
    line-height: 1.6 !important;
}

.hero-minimal .hero-buttons {
    justify-content: center !important;
    margin-bottom: 0 !important;
}

@media (max-width: 1200px) {
    .hero-minimal .hero-title { font-size: 3.8rem !important; }
}

@media (max-width: 767px) {
    .hero-minimal .hero-title { font-size: 2.6rem !important; }
    .hero-minimal .hero-subtitle { font-size: 1.05rem !important; }
}

