/* ============================================================
   HERO CAROUSEL — CineTrack
   ============================================================ */

:root {
    --hc-duration: 700ms;
    --hc-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --hc-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════════════════════════
   WRAPPER
═══════════════════════════════════════════════════════════════ */
#heroSearchWrapper {
    position: relative;
    width: 100%;
}

/* ── Carousel — règle de base ── */
#heroCarouselSection {
    position: relative;
    width: 100%;
    height: 72vh;
    min-height: 460px;
    max-height: 680px;
    overflow: hidden;          /* ← empêche le Ken Burns de déborder */
    background: #000;
    transition: height 0.5s var(--hc-ease), min-height 0.5s var(--hc-ease), opacity 0.4s ease;
}

/* ── Carousel collapse (recherche active ou mode acteurs) ── */
#heroCarouselSection.hc-hidden {
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ── La searchSection est toujours dans le flux normal sous le carousel ── */
#searchSection {
    display: block;
    visibility: visible;
    opacity: 1;
    padding: 20px 0 16px;
    text-align: center;
    background: transparent;
}

#searchSection.hc-search-hidden {
    display: none !important;
}

/* Grille collée sous la searchbar */
#heroSearchWrapper + .movies-section,
#searchSection + .movies-section {
    padding-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   SLIDES
═══════════════════════════════════════════════════════════════ */
.hc-slides { position: absolute; inset: 0; }

.hc-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    overflow: hidden;
    transition: opacity var(--hc-duration) var(--hc-ease),
                transform var(--hc-duration) var(--hc-ease);
    transform: scale(1.04);
    pointer-events: none;
    /* will-change retiré des slides inactifs */
}

.hc-slide.hc-active {
    will-change: opacity;
}

.hc-slide.hc-active { opacity: 1; transform: scale(1); pointer-events: auto; z-index: 2; }
.hc-slide.hc-prev   { opacity: 0; transform: scale(0.97); z-index: 1; }

.hc-backdrop {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transform-origin: center center;
}

/* Ken Burns actif sur le slide courant */
.hc-slide.hc-active .hc-backdrop {
    animation: hcKenBurns var(--hc-auto-duration, 9000ms) ease-out forwards;
}

/* Quand le trailer est affiché, on met le Ken Burns en pause */
.hc-slide.hc-trailer-playing .hc-backdrop {
    animation-play-state: paused;
}

/* Slides inactifs : état initial légèrement zoomé, pas d'animation */
.hc-slide:not(.hc-active) .hc-backdrop {
    animation: none;
    transform: scale(1.04);
}

@keyframes hcKenBurns {
    0%   { transform: scale(1.0) translate(0, 0); }
    50%  { transform: scale(1.05) translate(-0.5%, 0.3%); }
    100% { transform: scale(1.10) translate(-1%, 0.5%); }
}

.hc-iframe-wrapper {
    position: absolute; inset: 0;
    pointer-events: none; overflow: hidden; z-index: 1;
}

.hc-iframe-wrapper iframe {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 177.78vh; height: 100vh;
    min-width: 100%; min-height: 56.25vw;
    border: none; opacity: 0;
    transition: opacity 1.2s ease 0.4s;
}

.hc-iframe-wrapper iframe.hc-trailer-ready { opacity: 1; }

/* ── Plein écran trailer ── */
.hc-iframe-wrapper {
    cursor: default;
}


/* ═══════════════════════════════════════════════════════════════
   OVERLAYS
═══════════════════════════════════════════════════════════════ */
.hc-overlay-gradient {
    position: absolute; inset: 0; z-index: 2;
    background:
        linear-gradient(to bottom,
            rgba(6,8,15,0.72) 0%, rgba(6,8,15,0.26) 28%, transparent 52%),
        linear-gradient(to right,
            rgba(6,8,15,0.90) 0%, rgba(6,8,15,0.44) 42%, transparent 72%),
        linear-gradient(to top,
            rgba(6,8,15,0.94) 0%, rgba(6,8,15,0.54) 26%, transparent 52%);
}

.hc-overlay-grain {
    position: absolute; inset: 0; z-index: 3;
    opacity: 0.018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px;
    pointer-events: none;
    /* Pas d'animation : static grain, coût CPU = 0 */
}


.hc-bottom-fade {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 110px;
    background: linear-gradient(to top, var(--bg-dark, #14181c) 0%, transparent 100%);
    z-index: 3; pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   CONTENU TEXTE
═══════════════════════════════════════════════════════════════ */
.hc-content {
    position: absolute; inset: 0; z-index: 4;
    display: flex; flex-direction: column;
    justify-content: flex-end;
    padding: 0 5% 64px;
    max-width: 600px;
}

.hc-badge {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 12px;
    background: rgba(239,68,68,0.18);
    border: 1px solid rgba(239,68,68,0.40);
    border-radius: 4px;
    font-size: 9.5px; font-weight: 800;
    letter-spacing: 2.5px; text-transform: uppercase;
    color: #f87171; margin-bottom: 12px;
    width: fit-content;
}

.hc-badge-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #ef4444;
    animation: hcPulse 3s ease infinite;
}

@keyframes hcPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

.hc-title {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    font-weight: 900; color: #fff;
    line-height: 1.05; letter-spacing: -0.02em;
    margin-bottom: 10px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.65);
    opacity: 0; transform: translateY(22px);
    transition: opacity 0.55s var(--hc-ease-out) 0.1s,
                transform 0.55s var(--hc-ease-out) 0.1s;
}

.hc-slide.hc-active .hc-title { opacity: 1; transform: translateY(0); }

.hc-meta {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap; margin-bottom: 10px;
    opacity: 0; transform: translateY(18px);
    transition: opacity 0.55s var(--hc-ease-out) 0.18s,
                transform 0.55s var(--hc-ease-out) 0.18s;
}

.hc-slide.hc-active .hc-meta { opacity: 1; transform: translateY(0); }

.hc-year   { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.58); }
.hc-sep    { width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,0.28); }
.hc-rating { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: #fbbf24; }

.hc-genre-tag {
    padding: 3px 9px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 3px; font-size: 11px; font-weight: 600;
    color: rgba(255,255,255,0.60);
}

.hc-overview {
    font-size: 13.5px; line-height: 1.65;
    color: rgba(255,255,255,0.60); max-width: 440px;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 18px;
    opacity: 0; transform: translateY(14px);
    transition: opacity 0.55s var(--hc-ease-out) 0.26s,
                transform 0.55s var(--hc-ease-out) 0.26s;
}

.hc-slide.hc-active .hc-overview { opacity: 1; transform: translateY(0); }

/* ── Bouton "Plus d'infos" — intégré, sobre ─────────────────── */
.hc-info-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 0; background: none; border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.75);
    font-size: 13px; font-weight: 600; letter-spacing: 0.3px;
    opacity: 0; transform: translateY(12px);
    transition: opacity 0.55s var(--hc-ease-out) 0.34s,
                transform 0.55s var(--hc-ease-out) 0.34s,
                color 0.2s ease;
}

.hc-slide.hc-active .hc-info-btn { opacity: 1; transform: translateY(0); }

/* Trait décoratif avant le texte */
.hc-info-btn::before {
    content: '';
    display: block; width: 26px; height: 1.5px;
    background: rgba(255,255,255,0.45);
    flex-shrink: 0;
    transition: width 0.25s ease, background 0.2s ease;
}

.hc-info-btn:hover { color: #fff; }

.hc-info-btn:hover::before {
    width: 38px;
    background: rgba(255,255,255,0.85);
}

.hc-info-btn svg { transition: transform 0.2s ease; }
.hc-info-btn:hover svg { transform: translateX(3px); }

/* Poster miniature droite (desktop) */
.hc-poster-thumb {
    position: absolute; right: 5%; bottom: 64px; z-index: 5;
    width: clamp(80px, 10vw, 140px); aspect-ratio: 2/3;
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.07);
    transform: perspective(800px) rotateY(-4deg) translateY(0px);
    opacity: 0; cursor: pointer;
    transition: transform 0.4s var(--hc-ease), opacity 0.6s ease;
}

.hc-slide.hc-active .hc-poster-thumb {
    opacity: 1;
    transition: opacity 0.6s ease 0.4s, transform 0.4s var(--hc-ease);
    animation: hcPosterFloat 4s ease-in-out 1s infinite;
}

.hc-poster-thumb:hover {
    transform: perspective(800px) rotateY(0) scale(1.04) !important;
    animation: none !important;
}

.hc-poster-thumb img { width: 100%; height: 100%; object-fit: cover; }

@keyframes hcPosterFloat {
    0%   { transform: perspective(800px) rotateY(-4deg) translateY(0px); }
    50%  { transform: perspective(800px) rotateY(-4deg) translateY(-8px); }
    100% { transform: perspective(800px) rotateY(-4deg) translateY(0px); }
}

/* ═══════════════════════════════════════════════════════════════
   INDICATEURS — TRAITS BLANCS qui s'agrandissent
═══════════════════════════════════════════════════════════════ */
.hc-indicators {
    position: absolute; bottom: 22px; left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    display: flex; gap: 6px; align-items: center;
}

.hc-dot {
    position: relative;
    width: 22px; height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.26);
    cursor: pointer; overflow: hidden;
    padding: 0; border: none; flex-shrink: 0;
    transition: width 0.35s var(--hc-ease), background 0.35s ease;
}

.hc-dot.hc-dot-active {
    width: 50px;
    background: rgba(255,255,255,0.32);
}

/* Fill de progression animé */
.hc-dot::after {
    content: '';
    position: absolute; inset: 0;
    background: #fff;
    transform: scaleX(0); transform-origin: left;
    transition: transform linear;
}

.hc-dot.hc-dot-active::after {
    transform: scaleX(1);
    transition-duration: var(--hc-auto-duration, 9000ms);
}

.hc-dot:hover:not(.hc-dot-active) { background: rgba(255,255,255,0.48); }

/* ── Navigation (desktop) ───────────────────────────────────── */
.hc-nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 6; width: 44px; height: 44px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12); border-radius: 50%;
    color: #fff; display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    opacity: 0; pointer-events: none;
}

#heroCarouselSection:hover .hc-nav-btn { opacity: 1; pointer-events: auto; }
.hc-nav-btn:hover  { background: rgba(255,255,255,0.17); transform: translateY(-50%) scale(1.08); }
.hc-nav-btn:active { transform: translateY(-50%) scale(0.94); }
.hc-nav-prev { left: 20px; }
.hc-nav-next { right: 20px; }

/* ── Mute ───────────────────────────────────────────────────── */
.hc-mute-btn {
    position: absolute; bottom: 20px; right: 20px; z-index: 7;
    width: 34px; height: 34px;
    background: rgba(8,10,18,0.55);
    border: 1px solid rgba(255,255,255,0.13); border-radius: 50%;
    color: rgba(255,255,255,0.65);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hc-mute-btn:hover { background: rgba(8,10,18,0.82); color: #fff; transform: scale(1.1); }

/* ── Progress bar ───────────────────────────────────────────── */
.hc-progress-bar {
    position: absolute; bottom: 0; left: 0; height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    z-index: 7; width: 0%; transition: width linear; opacity: 0.5;
}

/* ── Skeleton ───────────────────────────────────────────────── */
.hc-skeleton {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #0f1117 0%, #1a1d27 50%, #0f1117 100%);
    display: flex; align-items: flex-end;
    z-index: 10; transition: opacity 0.5s ease;
    padding-bottom: 64px;
}

.hc-skeleton.hc-skeleton-hidden { opacity: 0; pointer-events: none; }

.hc-skeleton-inner {
    display: flex; flex-direction: column; gap: 14px;
    padding: 0 5%; width: 100%; max-width: 520px;
}

.hc-skel-line {
    height: 13px; border-radius: 4px;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.05) 100%);
    background-size: 200% 100%;
    animation: hcShimmer 1.4s ease infinite;
}

.hc-skel-title { height: 42px; width: 55%; border-radius: 6px; }
.hc-skel-meta  { height: 12px; width: 30%; }
.hc-skel-text1 { height: 11px; width: 85%; }
.hc-skel-text2 { height: 11px; width: 68%; }
.hc-skel-btn   { height: 13px; width: 70px; border-radius: 6px; margin-top: 4px; }

@keyframes hcShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .hc-overlay-grain { display: none; }
    .hc-slide.hc-active .hc-backdrop { animation: none; }
}

@media (max-width: 768px) {
    #heroCarouselSection {
        height: 80vh; min-height: 500px; max-height: 700px;
    }

    #searchSection {
        padding: 20px 0 14px;
    }

    #searchSection h2 {
        font-size: 22px !important;
        margin-bottom: 16px !important;
    }

    .hc-content { padding: 0 20px 76px; max-width: 100%; }

    .hc-title    { font-size: clamp(1.5rem, 7vw, 2.2rem); margin-bottom: 8px; }
    .hc-badge    { font-size: 9px; padding: 4px 10px; letter-spacing: 2px; margin-bottom: 9px; }
    .hc-genre-tag { display: none; }
    .hc-overview { -webkit-line-clamp: 2; line-clamp: 2; font-size: 12.5px; margin-bottom: 14px; }
    .hc-info-btn { font-size: 12.5px; }

    .hc-dot { width: 16px; }
    .hc-dot.hc-dot-active { width: 36px; }
    .hc-indicators { bottom: 30px; gap: 5px; }

    .hc-nav-btn       { display: none; }
    .hc-poster-thumb  { display: none; }
    .hc-mute-btn      { bottom: 11px; right: 12px; width: 30px; height: 30px; }

    .hc-overlay-gradient {
        background:
            linear-gradient(to bottom, rgba(6,8,15,0.80) 0%, rgba(6,8,15,0.36) 28%, transparent 52%),
            linear-gradient(to top,    rgba(6,8,15,0.95) 0%, rgba(6,8,15,0.60) 22%, rgba(6,8,15,0.18) 42%, transparent 58%);
    }

    .hc-bottom-fade { height: 140px; }
}

@media (max-width: 480px) {
    #heroCarouselSection { min-height: 460px; }
    #searchSection h2 { font-size: 18px !important; }
    .hc-content { padding: 0 16px 70px; }
    .hc-title   { font-size: clamp(1.4rem, 8vw, 1.9rem); }
    .hc-dot     { width: 12px; }
    .hc-dot.hc-dot-active { width: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .hc-slide, .hc-title, .hc-meta, .hc-overview, .hc-info-btn {
        transition: none; animation: none;
    }
    .hc-overlay-grain  { display: none; }
    .hc-iframe-wrapper { display: none; }
}