/**
 * Hero Block Styles - FIXED VERSION 2
 * File: assets/css/blocks/hero-block.css
 * 
 * Uses BEM naming convention to avoid conflicts
 * 
 * FIXES:
 * - No duplicate class names
 * - Proper stacking context
 * - YouTube video sizing works correctly
 * - No overlap with other blocks
 */

/* =====================================================
   CSS CUSTOM PROPERTIES
   ===================================================== */
.wpe-hero-block {
    --wpe-hero-max-width: 1280px;
    --wpe-hero-alignment: left;
    --wpe-hero-padding-top: 4rem;
    --wpe-hero-padding-bottom: 4rem;
}

/* =====================================================
   MAIN CONTAINER
   ===================================================== */
.wpe-hero-block {
    /* Layout */
    position: relative;
    display: block;
    width: 100%;
    min-height: 600px;
    
    /* Stacking context - CRITICAL */
    isolation: isolate;
    z-index: 1;
    
    /* Prevent overflow */
    overflow: hidden;
    
    /* Visual */
    color: white;
    
    /* Prevent margin collapse */
    padding: 0;
    margin: 0 0 0 0;
    
    /* Box model */
    box-sizing: border-box;
}

/* Ensure block doesn't affect siblings */
.wpe-hero-block + * {
    position: relative;
    z-index: 1;
}

/* =====================================================
   BACKGROUND LAYERS (Shared Styles)
   ===================================================== */
.wpe-hero__bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

/* =====================================================
   IMAGE BACKGROUND
   ===================================================== */
.wpe-hero__bg--image {
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
}

/* =====================================================
   VIDEO BACKGROUND (Shared)
   ===================================================== */
.wpe-hero__bg--video {
    background-color: #000;
}

/* =====================================================
   YOUTUBE VIDEO BACKGROUND
   ===================================================== */
.wpe-hero__youtube-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.wpe-hero__youtube-player {
    position: absolute;
    top: 50%;
    left: 50%;
    
    /* Oversized to cover container regardless of aspect ratio */
    width: 100vw;
    height: 100vh;
    min-width: 100%;
    min-height: 100%;
    
    /* Scale up to ensure coverage */
    transform: translate(-50%, -50%) scale(1.5);
}

.wpe-hero__youtube-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
}

/* =====================================================
   DIRECT VIDEO BACKGROUND
   ===================================================== */
.wpe-hero__video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.wpe-hero__video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

/* =====================================================
   OVERLAY
   ===================================================== */
.wpe-hero__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* =====================================================
   DECORATIVE PATTERN
   ===================================================== */
.wpe-hero__pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    opacity: 0.05;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M0,50 Q25,30 50,50 T100,50" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></svg>');
    background-repeat: repeat;
    pointer-events: none;
}

/* =====================================================
   CONTENT WRAPPER
   ===================================================== */
.wpe-hero__content-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: inherit;
    width: 100%;
    box-sizing: border-box;
}

.wpe-hero__content {
    max-width: var(--wpe-hero-max-width, 1280px);
    width: 100%;
    margin: 0 auto;
    padding: var(--wpe-hero-padding-top, 4rem) 1.5rem var(--wpe-hero-padding-bottom, 4rem);
    text-align: var(--wpe-hero-alignment, left);
    box-sizing: border-box;
}

/* =====================================================
   BADGES
   ===================================================== */
.wpe-hero__badges {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* Center alignment */
.wpe-hero-block[style*="--wpe-hero-alignment: center"] .wpe-hero__badges {
    justify-content: center;
}

/* Right alignment */
.wpe-hero-block[style*="--wpe-hero-alignment: right"] .wpe-hero__badges {
    justify-content: flex-end;
}

.wpe-hero__badge {
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.wpe-hero__badge--type {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.wpe-hero__badge--location {
    background: #ffc107;
    color: #000;
}

.wpe-hero__badge--significance {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid white;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
.wpe-hero__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin: 0 0 1rem 0;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    color: white;
}

.wpe-hero__subtitle {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
    margin: 0 0 1rem 0;
    opacity: 0.95;
    line-height: 1.4;
    color: white;
}

.wpe-hero__tagline {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-style: italic;
    margin-bottom: 3rem;
    opacity: 0.9;
    color: white;
}

/* =====================================================
   META CARDS
   ===================================================== */
.wpe-hero__meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    margin-top:3rem;
}

/* Center alignment */
.wpe-hero-block[style*="--wpe-hero-alignment: center"] .wpe-hero__meta-grid {
    justify-content: center;
}

.wpe-hero__meta-card {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease, transform 0.3s ease;
}

.wpe-hero__meta-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.wpe-hero__meta-icon {
    flex-shrink: 0;
    opacity: 0.9;
}

.wpe-hero__meta-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.wpe-hero__meta-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.wpe-hero__meta-sub {
    display: block;
    font-size: 0.875rem;
    opacity: 0.85;
}

/* =====================================================
   ACTION BUTTONS
   ===================================================== */
.wpe-hero__actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Center alignment */
.wpe-hero-block[style*="--wpe-hero-alignment: center"] .wpe-hero__actions {
    justify-content: center;
}

/* Right alignment */
.wpe-hero-block[style*="--wpe-hero-alignment: right"] .wpe-hero__actions {
    justify-content: flex-end;
}

.wpe-hero__btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.125rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.2;
}

.wpe-hero__btn--primary {
    background: white;
    color: #0f4c21;
}

.wpe-hero__btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.wpe-hero__btn--secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid white;
}

.wpe-hero__btn--secondary:hover {
    background: rgba(255, 255, 255, 0.25);
}

.wpe-hero__btn--outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.wpe-hero__btn--outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* =====================================================
   NO EVENT PLACEHOLDER
   ===================================================== */
.wpe-hero-no-event {
    padding: 3rem;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    text-align: center;
    color: #6c757d;
    font-size: 1rem;
    margin: 1rem 0;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .wpe-hero__meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .wpe-hero-block {
        min-height: 500px;
    }
    
    .wpe-hero__content {
        padding-left: 1rem;
        padding-right: 1rem;
        text-align: center;
    }

    .wpe-hero__meta-grid {
        grid-template-columns: 1fr;
    }

    .wpe-hero__actions {
        flex-direction: column;
    }

    .wpe-hero__btn {
        width: 100%;
        justify-content: center;
    }

    .wpe-hero__badges {
        justify-content: center;
    }

    .wpe-hero__meta-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    /* YouTube larger on mobile for coverage */
    .wpe-hero__youtube-player {
        transform: translate(-50%, -50%) scale(2);
    }
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */
.wpe-hero__btn:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wpe-hero__video {
        display: none;
    }
    
    .wpe-hero__youtube-wrapper {
        display: none;
    }

    .wpe-hero__meta-card,
    .wpe-hero__btn {
        transition: none;
    }
    
    /* Show fallback for video backgrounds */
    .wpe-hero-type-youtube,
    .wpe-hero-type-video {
        background: linear-gradient(135deg, #0f4c21 0%, #1a7431 50%, #2d5016 100%) !important;
    }
}

/* =====================================================
   PRINT
   ===================================================== */
@media print {
    .wpe-hero-block {
        min-height: auto !important;
        height: auto !important;
        background: #1a7431 !important;
        color: #000 !important;
        page-break-inside: avoid;
    }

    .wpe-hero__bg,
    .wpe-hero__overlay,
    .wpe-hero__pattern,
    .wpe-hero__actions {
        display: none !important;
    }

    .wpe-hero__content {
        padding: 2rem 0;
    }

    .wpe-hero__title,
    .wpe-hero__subtitle,
    .wpe-hero__tagline,
    .wpe-hero__meta-card {
        color: #000 !important;
        text-shadow: none !important;
    }

    .wpe-hero__meta-card {
        background: #f0f0f0 !important;
        border: 1px solid #ccc !important;
        backdrop-filter: none !important;
    }
}

/* =====================================================
   WORDPRESS INTEGRATION
   ===================================================== */
/* Prevent WP block wrapper interference */
.wp-block[data-type="wpe-event-manager/hero"] {
    max-width: none !important;
    margin-left: 0;
    margin-right: 0;
}

/* Full width support */
.wpe-hero-block.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

.wpe-hero-block.alignwide {
    width: calc(100% + 4rem);
    max-width: calc(100% + 4rem);
    margin-left: -2rem;
    margin-right: -2rem;
}