/* ── Clicher Shorts Carousel — Frontend v1.4 ── */

/* Couleurs hardcodées en variables locales à .csc-section
   → immunisées contre les surcharges du thème sur :root */
.csc-section {
    --csc-gold:    #af8e67;
    --csc-navy:    #2a3846;
    --csc-nav:     #af8e67;
    --csc-dot:     #af8e67;
    --csc-white:   #ffffff;
    --csc-dark:    #2a3846;
    --csc-muted:   #6b7a94;
    --csc-radius:  18px;
    --csc-card-w:  200px;
    --csc-card-h:  355px;
    --csc-gap:     20px;

    padding: 64px 20px 72px;
    background: #fff;
    /* PAS de overflow:hidden — briserait le stacking context du modal fixed */
}

/* ── En-tête ── */
.csc-section__header { text-align: center; margin-bottom: 40px; }

.csc-section__title {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--csc-dark);
    margin: 0 0 10px;
    letter-spacing: -.02em;
}

.csc-section__subtitle {
    font-size: 1rem;
    color: var(--csc-muted);
    margin: 0;
}

/* ── Carrousel ── */
.csc-section .csc-carousel {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
}

.csc-section .csc-track {
    display: flex;
    gap: var(--csc-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 12px 8px 20px;
    justify-content: safe center;
}

.csc-section .csc-track::-webkit-scrollbar { display: none; }

/* ── Slide / Card ── */
.csc-section .csc-slide {
    flex: 0 0 var(--csc-card-w);
    scroll-snap-align: center;
    cursor: pointer;
    outline: none;
}

.csc-section .csc-card {
    position: relative;
    border-radius: var(--csc-radius);
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(42,56,70,.15);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
    background: var(--csc-dark);
    will-change: transform;
}

.csc-section .csc-slide:hover .csc-card,
.csc-section .csc-slide:focus-visible .csc-card {
    transform: translateY(-6px) scale(1.025);
    box-shadow: 0 16px 40px rgba(175,142,103,.3);
}

.csc-section .csc-card__cover {
    position: relative;
    width: var(--csc-card-w);
    height: var(--csc-card-h);
    background-size: cover;
    background-position: center top;
    background-color: var(--csc-dark);
}

/* Bouton play */
.csc-section .csc-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.csc-section .csc-play-icon {
    width: 60px;
    height: 60px;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1);
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
}

.csc-section .csc-play-btn:hover .csc-play-icon { transform: scale(1.1); }

/* Badge YT */
.csc-section .csc-yt-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255,0,0,.85);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px 3px 6px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: .03em;
}

/* Caption */
.csc-section .csc-card__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 10px 12px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(to bottom, transparent, rgba(42,56,70,.92));
    line-height: 1.4;
}

/* ── Flèches carrousel ─────────────────────────────────────────────────────
   Couleur forcée avec !important pour résister aux thèmes WP/Divi           */
.csc-section .csc-nav {
    position: absolute !important;
    top: calc(50% - 20px) !important;
    transform: translateY(-50%) !important;
    z-index: 10 !important;
    background: #ffffff !important;
    border: 2px solid #e0d5c8 !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #af8e67 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.1) !important;
    transition: background .2s, color .2s, border-color .2s, transform .2s !important;
    padding: 0 !important;
}

.csc-section .csc-nav svg { width: 20px !important; height: 20px !important; }
.csc-section .csc-nav--prev { left: -22px !important; }
.csc-section .csc-nav--next { right: -22px !important; }

.csc-section .csc-nav:hover {
    background: #af8e67 !important;
    color: #ffffff !important;
    border-color: #af8e67 !important;
    transform: translateY(-50%) scale(1.08) !important;
    box-shadow: 0 6px 20px rgba(175,142,103,.35) !important;
}

.csc-section .csc-nav:disabled {
    opacity: .3 !important;
    cursor: default !important;
    pointer-events: none !important;
}

@media (max-width: 600px) {
    .csc-section .csc-nav { display: none !important; }
}

/* ── Dots ─────────────────────────────────────────────────────────────────── */
.csc-section .csc-dots {
    display: flex !important;
    justify-content: center !important;
    gap: 7px !important;
    margin-top: 20px !important;
    flex-wrap: wrap !important;
}

.csc-section .csc-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #d0c8be !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    transition: background .25s, transform .25s !important;
}

.csc-section .csc-dot.is-active,
.csc-section .csc-dot:hover {
    background: #af8e67 !important;
    transform: scale(1.35) !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   MODAL
   z-index très élevé pour passer au-dessus de TOUT (widgets Google, Divi, etc.)
   Structure :
     .csc-modal  (fixed, inset:0)
       .csc-modal__overlay
       .csc-modal__shell  (flex-row)
         .csc-modal__nav--prev
         .csc-modal__content  (wrapper 9:16, overflow:visible pour laisser
                               sortir la croix et le compteur)
           .csc-modal__close   (croix — position:absolute, top négatif)
           .csc-modal__counter
           .csc-modal__iframe-wrap  (overflow:hidden pour clips coins)
             iframe
         .csc-modal__nav--next
   ════════════════════════════════════════════════════════════════════════════ */
.csc-modal {
    position: fixed !important;
    inset: 0 !important;
    /* 2147483647 = max int32 — au-dessus de tout widget tiers */
    z-index: 2147483647 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.csc-modal[hidden] { display: none !important; }

.csc-modal__overlay {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(5,10,22,.93) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    cursor: pointer !important;
    z-index: 0 !important;
}

.csc-modal__shell {
    position: relative !important;
    z-index: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 20px !important;
}

/* Player 9:16
   overflow:visible → la croix et le compteur (position:absolute) peuvent
   sortir physiquement du rectangle du player sans être clippés */
.csc-modal__content {
    position: relative !important;
    width: min(340px, 80vw) !important;
    aspect-ratio: 9 / 16 !important;
    max-height: 90vh !important;
    border-radius: 18px !important;
    overflow: visible !important;      /* ← CRITIQUE : permet à la croix de sortir */
    box-shadow: 0 24px 80px rgba(0,0,0,.75) !important;
    animation: csc-modal-in .28s cubic-bezier(.34,1.56,.64,1) !important;
    flex-shrink: 0 !important;
}

@keyframes csc-modal-in {
    from { opacity: 0; transform: scale(.9) translateY(16px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}

/* Wrapper iframe — c'est LUI qui clip les coins, pas le content */
.csc-modal__iframe-wrap {
    position: absolute !important;
    inset: 0 !important;
    overflow: hidden !important;
    border-radius: 18px !important;
    z-index: 1 !important;
}

.csc-modal__iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block !important;
    background: #000 !important;
}

/* ── Croix X ──
   z-index élevé pour passer au-dessus de l'iframe
   Positionnée AU-DESSUS du player (top négatif) grâce à overflow:visible */
.csc-modal__close {
    position: absolute !important;
    top: -58px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 999 !important;
    background: rgba(255,255,255,.22) !important;
    border: 2px solid rgba(255,255,255,.5) !important;
    border-radius: 50% !important;
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #fff !important;
    transition: background .2s, transform .2s !important;
    padding: 0 !important;
}

.csc-modal__close svg {
    width: 22px !important;
    height: 22px !important;
    pointer-events: none !important;
}

.csc-modal__close:hover {
    background: rgba(255,255,255,.4) !important;
    transform: translateX(-50%) scale(1.12) !important;
}

/* ── Compteur 1/N ── */
.csc-modal__counter {
    position: absolute !important;
    bottom: -36px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    color: rgba(255,255,255,.65) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: .07em !important;
    white-space: nowrap !important;
    z-index: 999 !important;
}

/* ── Flèches modal ── */
.csc-modal__nav {
    background: rgba(255,255,255,.18) !important;
    border: 2px solid rgba(255,255,255,.4) !important;
    border-radius: 50% !important;
    width: 52px !important;
    height: 52px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #fff !important;
    transition: background .2s, transform .2s !important;
    padding: 0 !important;
    z-index: 2 !important;
}

.csc-modal__nav svg { width: 24px !important; height: 24px !important; }

.csc-modal__nav:hover {
    background: rgba(255,255,255,.32) !important;
    transform: scale(1.1) !important;
}

.csc-modal__nav:disabled {
    opacity: .18 !important;
    cursor: default !important;
    pointer-events: none !important;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .csc-section {
        --csc-card-w: 160px;
        --csc-card-h: 284px;
        --csc-gap: 14px;
        padding: 40px 12px 52px;
    }
    .csc-modal__shell { gap: 10px !important; }
    .csc-modal__nav   { width: 40px !important; height: 40px !important; }
    .csc-modal__nav svg { width: 20px !important; height: 20px !important; }
    .csc-modal__content { width: min(300px, 78vw) !important; }
    .csc-modal__close { top: -52px !important; width: 42px !important; height: 42px !important; }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .csc-section {
        --csc-card-w: 180px;
        --csc-card-h: 320px;
    }
    .csc-section .csc-nav--prev { left: -18px !important; }
    .csc-section .csc-nav--next { right: -18px !important; }
}

@media (min-width: 1025px) {
    .csc-section {
        --csc-card-w: 215px;
        --csc-card-h: 382px;
        --csc-gap: 24px;
    }
}
