/**
 * ALS Video Wrapper Styles
 * Complete CSS replacement for Tailwind classes
 * Version: 1.0.0
 */

/* ============================================
   SECTION CONTAINER
   ============================================ */
[data-name="VideoHeroModule"].section.als-section-container {
    position: relative;
    overflow: hidden;
    background-color: #27e2cc; /* Updated background color */
    padding-bottom: 6.625rem;
    padding-top: 10rem;
    height: auto; /* Will be set dynamically by JavaScript on desktop */
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    [data-name="VideoHeroModule"].section.als-section-container {
        padding-bottom: 12.625rem;
        padding-top: 10rem;
    }
}

@media (min-width: 1280px) {
    [data-name="VideoHeroModule"].section.als-section-container {
        position: sticky;
        top: 0;
        padding-top: 0;
        padding-bottom: 0;
        z-index: 10; /* Ensure section stays above footer and other content */
    }
}

/* ============================================
   INNER CONTAINER
   ============================================ */
[data-name="VideoHeroModule"] .als-inner-container {
    position: relative;
    /* Ensure inner container creates positioning context for absolute children */
    isolation: isolate; /* Create new stacking context to prevent layout shifts */
}

@media (min-width: 1280px) {
    [data-name="VideoHeroModule"] .als-inner-container {
        display: flex;
        min-height: 100vh;
        height: 100vh !important; /* CRITICAL: Fix visual height to exactly 100vh */
        max-height: 100vh !important; /* CRITICAL: Constrain visual height to viewport */
        align-items: center;
        overflow: visible; /* Allow template content to be visible even if it extends beyond viewport */
        position: relative;
    }
}

/* ============================================
   BACKGROUND IMAGE
   ============================================
   Exact positioning from original Allwyn.com:
   - Base: left: 0, top: 0, height: 26rem (416px)
   - xlg (≥1280px): display: block
   - xlgDesktop (≥1194px): left: calc((100vw - 1224px) / 2 - 11.5rem), height: 31.5rem (504px)
   - Aspect ratio: 2032/1007
   ============================================ */
[data-name="VideoHeroModule"] .als-bg-image {
    position: absolute;
    left: 0; /* Base position */
    top: 0; /* Base position */
    opacity: 1;
    z-index: 1; /* Behind text (z-10) but above background */
    pointer-events: none;
    display: none; /* hidden by default - shown at xlg breakpoint */
    aspect-ratio: 2032 / 1007; /* Exact aspect ratio from original */
    height: 26rem; /* Base height: 416px */
    width: auto;
    transform: translateY(0); /* Initial position - will be animated by GSAP */
    will-change: transform, opacity; /* Optimize for animation */
    /* CRITICAL: Use transform3d to move to GPU layer and prevent layout shifts */
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

[data-name="VideoHeroModule"] .als-bg-image img {
    position: absolute;
    height: 100%;
    width: 100%;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    color: transparent;
    background-size: cover;
    background-position: 50% 50%;
    background-repeat: no-repeat;
    object-fit: cover;
}

/* xlg breakpoint (≥1280px): Show the background image */
@media (min-width: 1280px) {
    [data-name="VideoHeroModule"] .als-bg-image {
        display: block;
        /* Still at left: 0, top: 0, height: 26rem */
    }
}

/* xlgDesktop breakpoint (≥1194px): Adjust position and size */
/* Note: This breakpoint is actually smaller than xlg, but it's applied after xlg */
/* The original uses xlgDesktop which appears to be ≥1194px */
@media (min-width: 1194px) {
    [data-name="VideoHeroModule"] .als-bg-image {
        /* Position relative to container center: 
           - Container is 1224px max-width, centered
           - (100vw - 1224px) / 2 = space outside container on each side
           - Subtract 11.5rem (184px) to position image to the left of container center */
        left: calc((100vw - 1224px) / 2 - 11.5rem);
        height: 31.5rem; /* Increased height: 504px */
    }
}

/* ============================================
   DESKTOP VIDEO WRAPPER
   ============================================ */
[data-name="VideoHeroModule"] .videowrapper.als-desktop-video-wrapper {
    position: absolute;
    left: 100%; /* left-full */
    top: 50vh; /* top-[50vh] */
    height: 33.5vw; /* h-[33.5vw] */
    width: 64vw; /* w-[64vw] */
    transform-origin: center; /* origin-center */
    transform: translate(-60%, -50%); /* -translate-x-[60%] -translate-y-1/2 */
    overflow: hidden;
    border-radius: 20rem; /* rounded-[20rem] = 800px */
    display: none; /* hidden by default */
    will-change: transform, width, height, border-radius, left, top;
    z-index: 2; /* Above background image (z-1) but below text (z-10) */
    /* Ensure it doesn't affect layout */
    isolation: isolate; /* Create new stacking context */
}

@media (min-width: 1024px) {
    [data-name="VideoHeroModule"] .videowrapper.als-desktop-video-wrapper {
        display: block; /* lg:block */
    }
}

/* ============================================
   VIDEO CONTAINER
   ============================================ */
[data-name="VideoHeroModule"] .videowrapper .video.als-video-container {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.1); /* bg-video-overlay equivalent */
    min-height: 200px; /* Ensure minimum height for iframe to render */
    overflow: hidden; /* Prevent iframe overflow */
}

[data-name="VideoHeroModule"] .videowrapper .video.als-video-container > video,
[data-name="VideoHeroModule"] .videowrapper .video.als-video-container > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* YouTube iframe specific styling */
[data-name="VideoHeroModule"] .videowrapper .video.als-video-container > iframe,
[data-name="VideoHeroModule"] .videowrapper .video.als-video-container > iframe.als-video-youtube {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border: none;
    display: block;
    transform-origin: center center;
}

/* Background-style YouTube video */
[data-name="VideoHeroModule"] .videowrapper .video.als-video-container > iframe.als-video-background {
    /* Positioned like a CSS background - covers entire area */
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    pointer-events: none; /* Allow clicks to pass through */
    /* Scale will be applied via JavaScript for proper coverage */
}

/* Additional container styling to ensure proper coverage */
[data-name="VideoHeroModule"] .videowrapper .video.als-video-container {
    overflow: hidden; /* Hide any overflow from scaled iframe */
    position: relative; /* Ensure proper positioning context */
}

/* Hide YouTube title overlay using overlay cover */
[data-name="VideoHeroModule"] .videowrapper .video.als-video-container.als-youtube-container {
    position: relative;
}

[data-name="VideoHeroModule"] .videowrapper .video.als-video-container .als-youtube-overlay-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: transparent;
    z-index: 10;
    pointer-events: none;
}

/* ============================================
   WRAPPER CONTAINER (Text Content)
   ============================================ */
[data-name="VideoHeroModule"] .als-wrapper-container {
    position: relative;
    width: 100%;
    max-width: 1224px; /* container max-width */
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
    z-index: 100; /* Highest z-index to ensure text is always visible above video and background */
}

/* ============================================
   TEMPLATE CONTENT CONTAINER
   ============================================ */
[data-name="VideoHeroModule"] .als-template-content {
    position: relative;
    z-index: 100; /* Highest z-index to ensure template content is always visible */
    width: 100%;
    overflow: visible; /* Ensure all template content is visible */
    min-height: auto; /* Allow template to determine its own height */
}

/* ============================================
   TITLE MOLECULE
   ============================================ */
[data-name="VideoHeroModule"] .als-title-molecule {
    position: relative;
    z-index: 100; /* High z-index to ensure text is always visible */
    padding-bottom: 0;
}

@media (max-width: 1279px) {
    [data-name="VideoHeroModule"] .als-title-molecule {
        padding-bottom: 4rem; /* max-xlg:pb-16 */
    }
}

@media (min-width: 1280px) {
    [data-name="VideoHeroModule"] .als-title-molecule {
        max-width: 50%; /* xlg:col-span-4 = ~50% of 8-column grid */
    }
}

@media (min-width: 1194px) {
    [data-name="VideoHeroModule"] .als-title-molecule {
        max-width: 58.33%; /* mdDesktop:col-span-7 = ~58.33% of 12-column grid */
    }
}

/* ============================================
   TITLE CONTENT
   ============================================ */
[data-name="VideoHeroModule"] .als-title-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* gap-6 */
}

@media (min-width: 768px) {
    [data-name="VideoHeroModule"] .als-title-content {
        gap: 1.5rem; /* md:gap-6 */
    }
}

/* ============================================
   TEXT WRAPPER
   ============================================ */
[data-name="VideoHeroModule"] .als-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* gap-4 */
}

@media (min-width: 768px) {
    [data-name="VideoHeroModule"] .als-text-wrapper {
        gap: 1rem; /* md:gap-4 */
    }
}

@media (min-width: 1024px) {
    [data-name="VideoHeroModule"] .als-text-wrapper {
        gap: 1.5rem; /* lg:gap-6 */
    }
}

/* ============================================
   HEADING
   ============================================ */
[data-name="VideoHeroModule"] .als-heading {
    /* Remove color - let the gradient div handle it */
    font-size: 2rem; /* text-headings-h1-mobile */
    line-height: 1.2;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 101; /* Ensure heading text is always visible */
}

/* On mobile/tablet, show white text */
@media (max-width: 1279px) {
    [data-name="VideoHeroModule"] .als-heading {
        color: #ffffff; /* text-white */
    }
}

@media (min-width: 768px) {
    [data-name="VideoHeroModule"] .als-heading {
        font-size: 3.5rem; /* md:text-headings-h1 */
        line-height: 1.1;
    }
}

/* On desktop, remove color to let gradient work */
@media (min-width: 1280px) {
    [data-name="VideoHeroModule"] .als-heading {
        color: transparent; /* Let gradient div handle color */
    }
}

/* Text lines created by SplitText - these get the gradient effect */
[data-name="VideoHeroModule"] .als-text-line {
    display: inline-block;
    width: 100%;
}

/* ============================================
   DESCRIPTION
   ============================================ */
[data-name="VideoHeroModule"] .als-description {
    /* Remove color - let the gradient div handle it */
    font-size: 1rem; /* text-body-medium */
    line-height: 1.6;
    font-weight: 400;
    position: relative;
    z-index: 101; /* Ensure description text is always visible */
}

/* On mobile/tablet, show white text */
@media (max-width: 1279px) {
    [data-name="VideoHeroModule"] .als-description {
        color: #ffffff; /* text-white */
    }
}

@media (min-width: 1024px) {
    [data-name="VideoHeroModule"] .als-description {
        font-size: 1.125rem; /* lg:text-body-large */
        line-height: 1.7;
    }
}

/* On desktop, remove color to let gradient work */
@media (min-width: 1280px) {
    [data-name="VideoHeroModule"] .als-description {
        color: transparent; /* Let gradient div handle color */
    }
}

/* ============================================
   TEXT COLOR REVEAL ANIMATION
   ============================================
   Magic technique: Uses background-clip: text with a gradient
   - Creates a gradient: white (50%) → teal (50%)
   - Background is 200% width (double the text width)
   - background-position-x animates from -100% to 0
   - This reveals white text from left to right as you scroll
   ============================================ */
[data-name="VideoHeroModule"] .TitleMolecule_content__GADaf > div,
[data-name="VideoHeroModule"] .als-heading > div,
[data-name="VideoHeroModule"] .als-description > div,
[data-name="VideoHeroModule"] .als-text-line > div,
[data-name="VideoHeroModule"] .als-template-content h1,
[data-name="VideoHeroModule"] .als-template-content h2,
[data-name="VideoHeroModule"] .als-template-content h3,
[data-name="VideoHeroModule"] .als-template-content h4,
[data-name="VideoHeroModule"] .als-template-content h5,
[data-name="VideoHeroModule"] .als-template-content h6,
[data-name="VideoHeroModule"] .als-template-content p,
[data-name="VideoHeroModule"] .als-template-content .elementor-heading-title,
[data-name="VideoHeroModule"] .als-template-content .elementor-widget-text-editor {
    position: relative;
    z-index: 101; /* Ensure all text elements are always visible */
}

[data-name="VideoHeroModule"] .TitleMolecule_content__GADaf > div,
[data-name="VideoHeroModule"] .als-heading > div,
[data-name="VideoHeroModule"] .als-description > div,
[data-name="VideoHeroModule"] .als-text-line > div {
    /* Initial state: show teal color (background-position-x: -100%) */
    background: linear-gradient(90deg, #ffffff 50%, #1D4757 0);
    background-size: 200% 100%;
    background-position-x: -100%; /* Start showing teal part */
    color: transparent !important; /* Hide actual text color */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block; /* Required for background-clip to work */
}

/* Only apply on desktop (≥1280px) to match original */
/* Styles are already defined above, no need to repeat */

/* ============================================
   UTILITY CLASSES (for JavaScript selectors)
   ============================================ */
/* .TitleMolecule_content__GADaf - Keep this class for JavaScript text animation targeting */
