/* ==========================================================================
   Reels Section Styles - Classense
   ========================================================================== */

:root {
    --reels-aspect-ratio: 9/16;
    --reels-border-color: #D4AF37; /* Golden */
    --reels-bg-dark: #000000;
    --reels-glass-bg: rgba(255, 255, 255, 0.1);
    --reels-glass-border: rgba(255, 255, 255, 0.15);
}

/* 1. Homepage Carousel Section */
.reels-section {
    margin-top: 4rem;
    margin-bottom: 4rem;
}

.reels-section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.reels-section-header h2 {
    font-family: var(--font-heading), 'Cinzel', serif;
    color: var(--reels-border-color);
    font-size: 1.8rem;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.reels-section-header p {
    color: var(--color-text-muted, #888);
    font-size: 0.95rem;
    font-family: var(--font-primary), 'Lato', sans-serif;
}

/* Carousel Track */
.reels-carousel {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE/Edge */
    padding: 0.5rem 1rem;
}

.reels-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Card */
.reel-card {
    flex: 0 0 calc(25% - 1.125rem); /* 4 cards on desktop */
    min-width: 240px;
    aspect-ratio: 9/16;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background-color: #111;
    scroll-snap-align: start;
    cursor: pointer;
    border: 1px solid #222;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), 
                box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
                border-color 0.4s;
}

.reel-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(212, 175, 55, 0.15);
    border-color: var(--reels-border-color);
}

/* Thumbnail */
.reel-card-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.reel-card:hover .reel-card-thumbnail {
    transform: scale(1.05);
}

/* Gradient Overlay */
.reel-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 50%, rgba(0,0,0,0.85) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.25rem;
    z-index: 2;
}

/* Play Icon Overlay */
.reel-card-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 54px;
    height: 54px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    z-index: 3;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.reel-card-play-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    margin-left: 3px; /* Center triangular play icon */
}

.reel-card:hover .reel-card-play-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    background: rgba(212, 175, 55, 0.85);
    color: #000;
    border-color: var(--reels-border-color);
}

/* Text Overlay info */
.reel-card-title {
    font-family: var(--font-heading), 'Cinzel', serif;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 1;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.reel-card-desc {
    color: #ccc;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

/* Responsive adjustments for homepage cards */
@media (max-width: 1024px) {
    .reel-card {
        flex: 0 0 calc(33.333% - 1rem); /* 3 cards */
    }
}

@media (max-width: 768px) {
    .reel-card {
        flex: 0 0 calc(50% - 0.75rem); /* 2 cards */
    }
    .reels-section-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .reel-card {
        flex: 0 0 75%; /* 1.3 cards showing peek */
        min-width: auto;
    }
}


/* ==========================================================================
   2. Full-Screen Viewer Modal
   ========================================================================== */
.reel-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--reels-bg-dark);
    z-index: 9999;
    display: none; /* Activated via JS */
    color: #ffffff;
    overflow: hidden;
}

/* Close button */
.close-reel-btn {
    position: absolute;
    top: 25px;
    left: 25px;
    z-index: 10005;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.close-reel-btn:hover {
    background: rgba(212, 175, 55, 0.85);
    color: #000;
    transform: scale(1.05);
}

.close-reel-btn svg {
    width: 22px;
    height: 22px;
}

/* Slides Container (Scroll snapping container) */
.reel-slides-container {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hide scrollbars */
}

.reel-slides-container::-webkit-scrollbar {
    display: none;
}

/* Individual slide */
.reel-viewer-slide {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--reels-bg-dark);
    position: relative;
}

/* Video wrapper - 9:16 aspect ratio on desktop, full on mobile */
.reel-video-wrapper {
    width: 100%;
    height: 100%;
    max-width: 56.25vh; /* 9:16 aspect ratio relative to height */
    aspect-ratio: var(--reels-aspect-ratio);
    background: #000000;
    position: relative;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* YouTube Iframe element */
.reel-video-wrapper .video-container {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2; /* Display above the poster fallback (z-index: 1) once iframe is loaded */
    overflow: hidden; /* Crop the overflowing sides of the landscape video */
}

.reel-video-wrapper .video-container iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 177.78vh; /* 16:9 aspect ratio relative to 100vh height */
    height: 100%;
    transform: translate(-50%, -50%);
    border: none;
    pointer-events: auto; /* Allow interacting with player if needed */
}

/* Fallback Poster (before loading iframe) */
.reel-poster-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Slide Overlay Elements (Title, desc, actions) */
.reel-slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,0.5) 100%);
    pointer-events: none; /* Let clicks pass to iframe/controls */
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    box-sizing: border-box;
}

/* Top bar details (Header) */
.reel-slide-header {
    margin-top: 15px;
    margin-left: 60px; /* shift to avoid overlaying close button */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: calc(100% - 60px);
}

.reel-brand-tag {
    font-family: var(--font-heading), 'Cinzel', serif;
    font-size: 0.95rem;
    color: var(--reels-border-color);
    letter-spacing: 0.1em;
    font-weight: 700;
    text-transform: uppercase;
}

/* Bottom details info */
.reel-slide-details {
    pointer-events: auto; /* Clickable elements */
    margin-bottom: 20px;
    max-width: 85%;
}

.reel-slide-details h3 {
    font-family: var(--font-heading), 'Cinzel', serif;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.reel-slide-details p {
    color: #e5e5e5;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1.25rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Golden Call-To-Action Button inside Details */
.reel-cta-btn {
    background-color: var(--reels-border-color);
    color: #000000 !important;
    text-decoration: none;
    font-family: var(--font-primary), 'Lato', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    transition: all 0.3s ease;
}

.reel-cta-btn:hover {
    background-color: #fff;
    color: #000000 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

/* Interactive Controls (Speaker Mute toggle, Swipe Guide) */
.reel-side-controls {
    position: absolute;
    bottom: 2rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    z-index: 5;
    pointer-events: auto;
}

/* Circular Control Button styling */
.reel-control-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.reel-control-btn:hover {
    background: var(--reels-border-color);
    color: #000000;
    border-color: var(--reels-border-color);
    transform: scale(1.05);
}

.reel-control-btn svg {
    width: 20px;
    height: 20px;
}

/* Pulsing audio reminder if muted on startup */
.reel-mute-btn.pulsing {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(212, 175, 55, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

/* Vertical indicator overlaying the slider helper */
.reel-swipe-indicator {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.6;
    animation: floatArrow 2s infinite;
    pointer-events: none;
    z-index: 4;
}

.reel-swipe-indicator span {
    font-size: 0.7rem;
    font-family: var(--font-primary), 'Lato', sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.reel-swipe-indicator svg {
    width: 14px;
    height: 14px;
}

@keyframes floatArrow {
    0%, 100% {
        transform: translate(-50%, 0);
    }
    50% {
        transform: translate(-50%, -6px);
    }
}

/* Thin Top Progress bar indicating length of slide/active state */
.reel-progress-tracker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 10;
}

.reel-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--reels-border-color);
    box-shadow: 0 0 8px var(--reels-border-color);
}

.reel-viewer-slide.active-slide .reel-progress-bar {
    width: 100%;
    transition: width 15s linear; /* Estimated average duration visualizer */
}

/* Mobile full-bleed overrides */
@media (max-width: 480px) {
    .reel-video-wrapper {
        max-width: 100%;
        border-radius: 0;
    }
    
    .reel-slide-overlay {
        padding: 1rem;
    }
    
    .reel-slide-details {
        max-width: 80%;
        margin-bottom: 30px;
    }
    
    .close-reel-btn {
        top: 15px;
        left: 15px;
        width: 38px;
        height: 38px;
    }
    
    .reel-side-controls {
        right: 1rem;
        bottom: 3rem;
    }
}
