/**
 * Homepage-specific Hero styles
 * 
 * NOTE: This file depends on hero.css for base hero styling.
 * Homepage hero has unique components including video support and card grid.
 */

/* =========================================
   1. HOMEPAGE HERO SECTION
   ========================================= */

body.home section.hero.homepage-hero {
    /* Base positioning and background */
    position: relative;
    margin: 0 !important;
    min-height: 80rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Dark overlay */
    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
        background-color: rgba(0, 0, 0, 0.2); /* 20% dark overlay */
    }
    
    /* Mobile height adjustments */
    @media (max-width: 992px) {
        min-height: 50rem;
    }
    

    
    /* Hero wrapper */
    .hero-wrapper {
        &.has-image {
            flex-direction: column;
            min-height: 80rem !important;
            display: flex;
            align-items: center;
            justify-content: center;
            
            @media (max-width: 992px) {
                min-height: 50rem;
            }
        }
    }
    
    /* Hero content */
    .hero-content {
        &.has-image {
            margin: 4.8rem 0 0 0;
            text-align: center;
            background-color: transparent !important; /* Override base hero style */
            @media(max-width:992px){
                margin-top: 9.8rem;
            }
            @media(max-width:659px){
                margin-top: 4.8rem;
            }
            @media(max-width:549px){
                margin-top: 0rem;
            }
        }
    }
    
    /* Hero content doublebag */
    .hero-content-doublebag {
        &.has-image {
            top: 0;
            transform: none;
            margin: 0 auto;
            background-color: transparent !important;
            text-align: center;
            max-width: 80rem;
            
            @media (min-width: 992px) {
                margin-top: 2rem;
            }
            
            
            .hero-description {
                margin: 0 auto 3.6rem;
                max-width: 70rem;
            }
            
            .hero-content-wrapper {
                display: flex;
                flex-direction: column;
                align-items: center;
                text-align: center;
            }
            
            .btn {
                display: inline-block;
                margin: 0 auto;
            }
        }
    }
    
    /* Video background */
    .hero-video-background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 0;
        overflow: hidden;
        pointer-events: none; 
        opacity: 0; 
        transition: opacity 1s ease-in-out;
        
        /* Loaded state - activated by JS */
        &.loaded {
            opacity: 1;
        }
        
        /* Mobile hiding for performance */
        @media (max-width: 767px) {
            display: none;
        }
        
        /* iframes and videos */
        iframe,
        video.self-hosted-video {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 100vw;
            height: 56.25vw; /* 16:9 aspect ratio */
            min-height: 100%;
            min-width: 177.77vh; /* Ensures 16:9 video covers container height */
            background: transparent; 
            object-fit: cover;
            
            /* Desktop sizing adjustments */
            @media (min-width: 992px) {
                width: 100%;
                height: 100%;
                min-width: 100%;
                object-position: center center;
            }
        }
    }

    .hero-title {
        text-shadow: 1px 1px 5px rgb(0 0 0 / 30%);
    }
}

/* =========================================
   2. HOMEPAGE HERO CARDS COMPONENT
   ========================================= */

body.home #home-hero-cards.home-hero-cards {
    /* Position and z-index */
    position: relative;
    margin-top: -25rem;
    z-index: 9;
  

    
  
    /* Hide arrows for homepage hero */
    .glide__arrows {
        display: none;
    }
    
    /* Glide slider styling */
    .glide {
        width: 100%;
        overflow: visible;
        
        /* Desktop specific styling - centered cards */
        @media (min-width: 992px) {
            max-width: 1140px;
            margin: 0 auto;
            
            .glide__track {
                display: flex;
                justify-content: center;
                margin-left: -2.4rem; /* THIS is the key fix - match container padding */
                margin-right: -2.4rem; /* THIS is the key fix - match container padding */
            }
            
            .glide__slides {
                justify-content: center;
                width: 100%;
            }
            
            .glide__slide {
                margin: 0 1.5rem;
                
                .card-item {
                    min-width: 32rem;
                    max-width: 32rem;
                }
            }
        }
        
        /* Mobile styling - peek effect */
        @media (max-width: 991px) {
            .glide__track {
                overflow: visible;
                width: 100%;
                margin-left: -2.4rem; /* THIS is the key fix - match container padding */
                margin-right: -2.4rem; /* THIS is the key fix - match container padding */
            }
            
            .glide__slides {
                overflow: visible;
                display: flex;
                align-items: stretch;
                margin-right: 0;
                padding-left: 2.4rem; /* Add padding to first slide to compensate */
            }
            
            .glide__slide {
                height: auto;
                overflow: visible;
                transition: transform 0.3s ease;
                
                /* First slide styles - position adjusted by JavaScript */
                &:first-child {
                    position: relative;
                    /* No custom margin needed anymore - container padding is handled by track */
                }
                
                .card-item {
                    min-width: 28rem;
                    max-width: 28rem;
                    
                    /* Reduced width on very small screens */
                    @media (max-width: 475px) {
                        min-width: 25rem;
                        max-width: 25rem;
                    }
                    
                    /* Extra small screens need even smaller cards */
                    @media (max-width: 375px) {
                        min-width: 22rem;
                        max-width: 22rem;
                    }
                }
            }
        }
        
        /* Common slide styling */
        .glide__slide {
            height: auto;
            transition: transform 0.3s ease;
            
            .card-item {
                width: 100%;
                height: 100%;
                margin: 0 !important;
            }
        }
    }
    .card-item {
        .card-item-title {
            text-wrap: balance;
        }
    }
}
