/**
 * Hero Slideshow Styles
 * HSE Advisor Canada - Hero Background Image Slideshow
 */

.hero-slideshow {
    position: relative;
    overflow: hidden;
}

.hero-slideshow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    will-change: opacity;
}

.hero-slide.active {
    opacity: 0.3;
}

.hero-slideshow-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
}

.hero-slideshow-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    /* Increase touch target size for mobile */
    position: relative;
}

/* Create larger touch target for mobile without changing visual appearance */
@media (max-width: 767px) {
    .hero-slideshow-dot {
        /* Add padding to increase clickable area to 44px */
        padding: 16px;
        /* Compensate with negative margin to maintain layout */
        margin: -16px;
        /* Ensure the visual dot remains centered */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .hero-slideshow-dot::before {
        content: '';
        position: absolute;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        border: 2px solid rgba(255, 255, 255, 0.7);
        background: transparent;
        transition: all 0.3s ease;
    }
    
    .hero-slideshow-dot:hover::before,
    .hero-slideshow-dot.active::before {
        background: rgba(255, 255, 255, 0.9);
        border-color: rgba(255, 255, 255, 1);
        transform: scale(1.2);
    }
}

.hero-slideshow-dot:hover,
.hero-slideshow-dot.active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 1);
    transform: scale(1.2);
}

.hero-slideshow-dot:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Ensure hero content is above slideshow */
.hero .container {
    position: relative;
    z-index: 5;
}

.hero-logo,
.hero-content {
    position: relative;
    z-index: 6;
}

/* Performance optimizations */
.hero-slideshow-container,
.hero-slide {
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-slideshow-controls {
        bottom: 20px;
        gap: 8px;
    }
    
    .hero-slideshow-dot {
        width: 10px;
        height: 10px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hero-slide {
        transition: none;
    }
    
    .hero-slideshow-dot {
        transition: none;
    }
}

/* Loading state */
.hero-slideshow-container:not(.loaded) {
    background: linear-gradient(135deg, #0A2240 0%, #1a3a5c 100%);
}

/* Fallback for browsers without slideshow support */
.no-js .hero-slideshow-container {
    background-image: url('../images/optimized/hero/hero-1.webp');
    background-size: cover;
    background-position: center;
    opacity: 1;
}

/* Optimized Hero Slideshow Loader */
.hero-slide-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.hero-slide-loader:after {
    content: '';
    display: block;
    width: 30px;
    height: 30px;
    margin: 5px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.3) transparent rgba(255, 255, 255, 0.3) transparent;
    animation: hero-loader 1.2s linear infinite;
}

@keyframes hero-loader {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Hide loader when image is loaded */
.hero-slide.loaded .hero-slide-loader {
    display: none;
}

/* Error state */
.hero-slide.error {
    background: linear-gradient(135deg, #0A2240 0%, #1a3a5c 100%);
}

.hero-slide.error:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="rgba(255,255,255,0.3)" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>') center no-repeat;
    background-size: contain;
} 