.intro-overlay {
    position: relative;
    height: calc(100vh - var(--header-height) - var(--ticker-height));
    min-height: 600px; /* Prevents collapse during load */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: calc(var(--section-inner-desktop) * -1);
}

@media (max-width: 768px) {
    .intro-overlay {
        height: calc(100vh - var(--header-height) - var(--space-lg));
        /* height: calc(100vh - var(--header-height)); */
        min-height: 500px;
        margin-top: calc(var(--section-inner-mobile) * 0);
        border-radius: var(--radius-lg);
    }
}

@keyframes fadeContainer {
    0% { background-color: rgba(255, 255, 255, 1); }
    100% { background-color: rgba(255, 255, 255, 0.5); }
}

.intro-overlay.fade-out-all {
    animation: fadeOutAll 1s forwards linear;
}

.intro-overlay.slide-out {
    animation: slideOutOverlay 0.2s forwards linear;
}

@keyframes slideOutOverlay {
    0% { transform: translateY(0); }
    100% { transform: translateY(-100vh); }
}

.video-background-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background-color: #ffffff; /* Fallback color instead of poster image */
}

.background-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    opacity: 0;
    animation: fadeInZoomVideo 0.5s forwards ease-out;
    animation-delay: 4s; /* Video fades in after logo is gone (5.0s to 6.5s) */
}

/* Mobile: 16:9 aspect ratio for video */
@media (max-width: 768px) {
    video#backgroundVideo {
        /* display: none; */
    }
    .background-video {
        object-fit: cover;
    }
}
@keyframes fadeInZoomVideo {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.video-scrim {
    position: absolute;
    inset: 0;
    z-index: 10;
    /* background: linear-gradient(90deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0.18) 78%); */
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.60) 0%, rgba(0, 0, 0, 0.40) 45%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    opacity: 0;
    transform: scale(0);
    animation: fadeInZoomScrim 0.5s forwards ease-out;
    animation-delay: 4s; /* Same timing + scale/opacity curve as .background-video's fadeInZoomVideo so both zoom in together */
}

@keyframes fadeInZoomScrim {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.video-text-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: var(--space-lg);
    max-width: 1000px;
    padding: calc(var(--section-inner-desktop) + 32px) var(--section-inner-desktop);
}

.video-heading,
.video-subheading,
.hero-button {
    opacity: 0;
    transform: translateY(80px);
    animation: fadeInUp 1s forwards ease-out;
    animation-delay: 5s;
}

.video-heading,
p.video-subheading {
    color: var(--text-light-header);
    text-align: left;
    text-shadow: 1px 2px 0px #000;
    padding-bottom: 0;
}

p.video-subheading {
    font-size: clamp(16px, 1.5vw, 20px);
    font-weight: 500;
    text-shadow: 0px 1px 1px #000;
}

.hero-button {
    margin-top: auto;
    background-color: var(--color-neutral-50);
    border-color: var(--color-neutral-50);
    color: var(--color-neutral-900);
}

.hero-button::before {
    background-color: var(--color-neutral-900);
}
{#
.hero-button:hover span {
    color: var(--color-neutral-50);
}
#}
@media (max-width: 768px) {
    .video-text-overlay {
        max-width: none;
        padding: var(--section-inner-tablet) var(--card-inner-mobile);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(80px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animation-container {
    position: absolute; /* was relative */
    top: 50%; /* added top, left, transform, width and min-height */
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--card-gap-mobile);
    z-index: 25;
    /* width: 100%; */
    min-height: 250px; /* Reserve space for logo animation */
    animation: fadeOutLogo 0.5s forwards ease-out;
    animation-delay: 3.5s; /* Logo fades out from 3.5s to 5.0s */
    overflow: visible;
}
.logo-stage {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transform-style: preserve-3d;
    perspective: 600px;
    contain: layout style;
    min-height: 160px;
}
.l-shape {
    position: relative;
    width: 40px;
    height: 160px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    animation: fadeInAll 1s forwards ease-out, shrinkWidth 2s forwards ease-in-out;
    will-change: transform, width, opacity;
    z-index: auto;
}
.l-shape__vertical {
    width: 40px;
    flex: 1;
    background-color: currentColor;
}
.l-shape__horizontal {
    width: 80px;
    height: 40px;
    background-color: currentColor;
}
.l-shape--white {
    color: #000000;
}
.l-shape--grey {
    color: #cccccc;
}
.l-shape--grey .l-shape__vertical,
.l-shape--grey .l-shape__horizontal {
    animation: fadeGreyToBlack 0.3s forwards ease-out 2s;
}
.l-shape--white:last-child .l-shape__horizontal {
    transform-origin: left center;
    animation: shrinkLastHorizontal 0.3s forwards ease-out 2.5s;
}
@keyframes fadeOutAll {
    0% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes fadeInAll {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes fadeGreyToBlack {
    0% { background-color: #cccccc; }
    100% { background-color: rgba(255, 255, 255, 1); }
}
@keyframes shrinkWidth {
    0% { width: 600px; }
    100% { width: 40.1px; }
}
@keyframes shrinkLastHorizontal {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0.5); }
}
.logo-name {
    color: #000000;
    text-align: center;
    font-family: system-ui, sans-serif;
    font-size: 32px;
    margin-top: 20px;
    opacity: 0;
    animation: fadeInName 0.6s forwards ease-out;
    animation-delay: 2.8s;
}
@keyframes fadeInName {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes fadeOutLogo {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .l-shape,
    .l-shape--grey .l-shape__vertical,
    .l-shape--grey .l-shape__horizontal,
    .l-shape--white:last-child .l-shape__horizontal,
    .logo-name,
    .animation-container,
    .background-video,
    .video-heading,
    .video-subheading {
        animation: none !important;
    }
    
    .video-heading,
    .video-subheading {
        opacity: 1 !important;
        transform: none !important;
    }
    
    .animation-container {
        display: none;
    }
    
    .background-video {
        opacity: 1;
    }
  
    .video-scrim {
        transform: none !important;
    }
}


/* Hide header and ticker initially on homepage */
.ticker,
.header--desktop {
  opacity: 0;
  animation: revealHeaderElements 0.8s forwards ease-out;
  animation-delay: 5s;
}

@keyframes revealHeaderElements {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}