/*
 * jg-hero.css
 * JG Audio Player — Section Hero : slideshow, Ken Burns, flèches, scroll chevron
 * @package JG Audio Player
 */

/* ── Hero section (jg-hero.php lignes 258–369) ── */
#jg-hero {
    position: relative;
    width: 100%;
    overflow: hidden;
    z-index: 0;
    display: block;
}
.wp-site-blocks:has(#jg-hero),
main:has(#jg-hero) {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
#jg-hero-track {
    position: absolute;
    inset: 0;
}
/* ── Slide de base : invisible, sans transition (le JS gère tout) ── */
.jg-slide {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* État initial : caché, prêt à recevoir transforms via JS */
    opacity: 0;
    transform: none;
    /* La transition est injectée par JS en fonction des effets actifs */
}
.jg-slide.jg-slide-active {
    pointer-events: auto;
    opacity: 1;
    transform: none;
}
/* Ken Burns : animation CSS sur le fond, active uniquement sur le slide actif */
.jg-slide-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-repeat: no-repeat;
    will-change: transform;
    transform-origin: center center;
}
.jg-slide.jg-kb-active .jg-slide-bg {
    animation: jgKenBurns var(--jg-hero-duration, 5s) ease-in-out forwards;
}
@keyframes jgKenBurns {
    from { transform: scale(1); }
    to   { transform: scale(1.08); }
}
.jg-slide-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
}
/* Contenu centré verticalement, Gutenberg gère le reste */
.jg-slide-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* align-items ici (dans le <head>) évite le saut visuel des boutons
       qui survenait quand la règle était uniquement dans le <style> inline
       de render.php (parsé après le HTML initial). La variable --jg-content-align
       est injectée en PHP inline sur <section #jg-hero> avant tout JS. */
    align-items: var(--jg-content-align, center);
    width: 100%;
    box-sizing: border-box;
    padding: 0 40px;
    text-align: center;
}
/* Neutraliser les marges Gutenberg qui cassent le centrage */
.jg-slide-content > * { margin-top: 0; margin-bottom: 0; }
@media (max-width: 768px) {
    .jg-slide-content { padding: 0 20px; }
}
/* Fallback no-JS : premier slide visible avant exécution du script */
.jg-slide:first-child {
    opacity: 1;
    pointer-events: auto;
}
.jg-slide-content .wp-block-group,
.jg-slide-content .wp-block-cover,
.jg-slide-content .is-layout-flow { height: auto; }
/* Flèches prev / next */
#jg-hero-prev,
#jg-hero-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    opacity: 0.85;
    transition: opacity 0.2s, background 0.2s;
    line-height: 0;
    /* Zone de clic élargie — touch target min 44×44px déjà couvert par SVG 64px + padding */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
#jg-hero-prev { left: 20px; }
#jg-hero-next { right: 20px; }
#jg-hero-prev:hover,
#jg-hero-next:hover { opacity: 1; background: rgba(184, 184, 184, 0); }
/* Flèche scroll */
#jg-hero-scroll {
    position: absolute;
    padding: 8px;
    border-radius: 50%;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    color: #fff;
    display: flex;
    text-decoration: none;
    opacity: 0.7;
    animation: jgHeroBounce 1.8s ease-in-out infinite;
    transition: opacity 0.2s;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
#jg-hero-scroll:hover { opacity: 1; background: rgba(184, 184, 184, 0);}
@keyframes jgHeroBounce {
    0%, 100% { transform: translateX(-50%) translateY(0);   }
    50%       { transform: translateX(-50%) translateY(10px); }
}

/* ── M2 : Hero mobile — flèches (jg-player-front.php lignes 1040–1057) ── */
/* ── M2 : Hero ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Flèches prev/next : plus visibles, cibles 44px min */
    #jg-hero-prev,
    #jg-hero-next {
        opacity: 0.7;
        padding: 8px;
        width: 44px; height: 44px;
        display: flex; align-items: center; justify-content: center;
    }
    #jg-hero-prev svg,
    #jg-hero-next svg { width: 28px; height: 28px; }
    #jg-hero-prev { left: 8px; }
    #jg-hero-next { right: 8px; }
    /* Chevron scroll : plus proche du bas */
    #jg-hero-scroll { bottom: 16px; }
    #jg-hero-scroll svg { width: 40px; height: 40px; }
}

/* ── S12a : Action buttons (jg/action-button) dans les slides hero ── */
/* Remplace les anciens .jg-slide-cta (supprimés de render.php) */
#jg-hero .jg-action-btn-wrap {
    margin-top:  0;
    text-align:  center;
}
#jg-hero .jg-action-btn {
    display:              inline-block;
    padding:              12px 32px;
    background:           transparent;
    border:               2px solid rgba(255,255,255,0.75);
    border-radius:        0;
    color:                #fff;
    font-size:            15px;
    font-weight:          300;
    letter-spacing:       0.04em;
    cursor:               pointer;
    text-decoration:      none;
    text-transform:       uppercase;
    transition:           background 0.25s, border-color 0.25s;
    backdrop-filter:      blur(4px);
    -webkit-backdrop-filter: blur(4px);
    min-width:            44px;
    min-height:           44px;
    line-height:          1.4;
}
#jg-hero .jg-action-btn:hover,
#jg-hero .jg-action-btn:focus {
    background:   rgba(255,255,255,0.1);
    border-color: #fff;
    outline:      none;
}
@media (max-width: 768px) {
    #jg-hero .jg-action-btn {
        font-size: 14px;
        padding:   10px 24px;
    }
}

/* ── S3c : Hero — hauteur 100svh sur mobile (exclut la barre navigateur) ── */
/* Remplace 100vh par 100svh si supporté — cible l'attribut inline généré par render.php */
@supports (height: 100svh) {
    #jg-hero[style*="height:100vh"],
    #jg-hero[style*="height: 100vh"] {
        height: 100svh !important;
    }
}

/* ── S3c : Hero mobile ≤600px — ajustements contenu ── */
@media (max-width: 600px) {
    /* Réduire padding latéral */
    .jg-slide-content {
        padding: 0 16px;
    }

    /* Titres adaptés à la largeur mobile */
    .jg-slide-content h1 {
        font-size: clamp(1.2rem, 6.5vw, 1.8rem);
    }
    .jg-slide-content h2 {
        font-size: clamp(1rem, 5.5vw, 1.5rem);
    }
    .jg-slide-content p {
        font-size: clamp(0.8rem, 3.5vw, 0.95rem);
    }

    /* Flèches nav réduites */
    #jg-hero-prev svg,
    #jg-hero-next svg { width: 28px; height: 28px; }
}
/* ══════════════════════════════════════════════════════════════════
   HERO — Correctifs centrage & responsive
   Ajouté manuellement — à coller en fin de jg-hero.css
   ══════════════════════════════════════════════════════════════════ */

/* 1. Centrage forcé — neutralise les dérives Gutenberg et le réglage
      contentAlign éventuel sur "left" dans l'éditeur de blocs */
.jg-slide-content {
    align-items: center !important;
    text-align: center !important;
}

/* 2. Blocs enfants Gutenberg : centrage + contrainte de largeur max */
.jg-slide-content h1,
.jg-slide-content h2,
.jg-slide-content h3,
.jg-slide-content p,
.jg-slide-content .wp-block-heading,
.jg-slide-content .wp-block-paragraph,
.jg-slide-content .wp-block-group,
.jg-slide-content .wp-block-buttons {
    text-align: center;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* 3. Tailles fluides pour tous les écrans (clamp universel) */
.jg-slide-content h1 { font-size: clamp(1.4rem, 4vw, 3rem); }
.jg-slide-content h2 { font-size: clamp(1.1rem, 3vw, 2rem); }
.jg-slide-content h3 { font-size: clamp(0.95rem, 2.5vw, 1.5rem); }

/* 4. Tablette ≤768px — padding qui respecte les flèches nav (44px + 8px = 52px)
      + typos réduites */
@media (max-width: 768px) {
    .jg-slide-content {
        padding: 0 60px !important;
    }
    .jg-slide-content h1 { font-size: clamp(1.3rem, 5.5vw, 2rem); }
    .jg-slide-content h2 { font-size: clamp(1rem, 4.5vw, 1.5rem); }
    .jg-slide-content h3 { font-size: clamp(0.85rem, 3.5vw, 1.1rem); }
}

/* 5. Mobile ≤600px — padding serré, typos clamp agressif,
      boutons empilés pleine largeur */
@media (max-width: 600px) {
    .jg-slide-content {
        padding: 0 56px !important;
    }
    .jg-slide-content h1 { font-size: clamp(1.1rem, 5vw, 1.6rem); }
    .jg-slide-content h2 { font-size: clamp(0.95rem, 4.5vw, 1.3rem); }
    .jg-slide-content p  { font-size: clamp(0.75rem, 3.5vw, 0.9rem); }

    /* Boutons empilés + pleine largeur */
    #jg-hero .jg-action-btn-wrap {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }
    #jg-hero .jg-action-btn {
        display: block;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 12px 16px;
    }
}