/**
 * AL Header : recherche permanente + panneaux mégamenu.
 * Style des shortcodes [al_header_search] et [al_header_nav] (includes/al-header.php).
 * Charte lunaire : pilules 50px sur champs/boutons, cartes 24px, ombres violettes
 * rgba(107,50,123,…), dégradés 135°, Montserrat (servie en local par
 * al-performance.php). Fenêtres et panneaux : angles BAS CARRÉS (maquette v2).
 * Breakpoint unique : 1024px (≤1024 = mobile : feuille plein écran + accordéons).
 * La visibilité des panneaux/feuille est pilotée par JS (classes .al-ouvert /
 * body.al-nav-ouverte) : aucun :hover porteur d'état.
 * Mobile : toutes les colonnes de la rangée du champ passent en display:contents ;
 * le champ est pleine largeur quelle que soit la colonne où le module est posé.
 *
 * @version 1.0.6
 */

/* ==========================================================================
   TOKENS DE MARQUE — premier :root du site (style.css AL n'en définit aucun).
   Couleurs charte + couleurs de TEXTE relevées en prod (jamais de gris).
   --al-texte-fonce est déjà consommé par style.css (fallback #3A2E42) : on
   l'aligne ici sur le violet de texte réel de la prod.
   ========================================================================== */
:root {
    --al-violet-mystique: #6B327B;
    --al-violet-lunaire: #8B5A9B;
    --al-violet-celeste: #AB7ABB;
    --al-blanc: #ffffff;
    --al-brume: #f5f0f7;
    --al-amethyste: #D5C0DB;
    --al-texte-fonce: #5A2A6A;
    --al-texte-moyen: #8B5A9B;
    --al-glow: rgba(107, 50, 123, 0.2);
    --al-glow-fort: rgba(107, 50, 123, 0.4);
    --al-degrade-nuit: linear-gradient(135deg, #6B327B 0%, #8B5A9B 100%);
    --al-degrade-brume: linear-gradient(135deg, #f5f0f7 0%, #D5C0DB 100%);
    --al-transition: all 0.3s ease;
    --al-transition-rapide: all 0.18s ease;
}

/* ==========================================================================
   RESETS LOCAUX (neutralise la typo des wrappers Divi .et_pb_text_inner)
   ========================================================================== */
.al-search, .al-search *,
.al-nav, .al-nav * {
    box-sizing: border-box;
}
.al-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.al-nav li {
    padding-left: 0;
    position: static;
}
/* Sécurité : aucune puce décorative héritée du thème dans le header */
.al-nav li::before,
.al-nav li::after {
    content: none !important;
    display: none !important;
}
.al-nav a {
    text-decoration: none;
}

/* ==========================================================================
   INTÉGRATION DANS LA RANGÉE DIVI
   Desktop ≥1025px : [logo] [champ────────] [🔒][💜][🛍️]
   Mobile ≤1024px (plus bas) : logo + icônes en 1re ligne, champ dessous.
   Fallback sans :has() : min-width sur .al-search, layout Divi d'origine.
   ========================================================================== */
@media (min-width: 1025px) {
    .molti-header-9-10 .et_pb_row:has(.al-search) {
        display: flex;
        align-items: center;
    }
    .molti-header-9-10 .et_pb_row:has(.al-search) > .et_pb_column:first-child {
        flex: 0 0 auto;
        width: auto;
    }
    .molti-header-9-10 .et_pb_row:has(.al-search) > .et_pb_column:last-child {
        flex: 1 1 auto;
        width: auto;
        gap: 14px;
        align-items: center;
    }
    .molti-header-9-10 .et_pb_column .et_pb_module:has(.al-search) {
        flex: 1 1 auto;
        /* le champ passe en tête de colonne : [champ────][🔒][💜][🛍️] */
        order: -1;
    }

    /* Champ centré sur la PAGE, pas sur l'espace restant :
       le module passe en absolu ancré sur la RANGÉE — les colonnes Divi
       repassent en static, sinon la colonne (position:relative) sert de
       référence et fausse le centrage. */
    .molti-header-9-10 .et_pb_row:has(.al-search) {
        position: relative;
        /* fine ligne au-dessus des rubriques (cette rangée fait 100% de large) */
        border-bottom: 1px solid var(--al-brume);
    }
    .molti-header-9-10 .et_pb_row:has(.al-search) > .et_pb_column {
        position: static !important;
    }
    .molti-header-9-10 .et_pb_module:has(.al-search) {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        /* 640px maquette, réduit sur desktop étroit pour ne jamais toucher
           ni le logo ni les icônes (calage vérifié au pixel) */
        width: min(640px, calc(100vw - 700px)) !important;
        margin: 0 !important;
    }
    .molti-header-9-10 .et_pb_module:has(.al-search) .al-search {
        width: 100%;
    }
}
/* Compte : boîte FIGÉE à 40px. L'effet de survol du thème (l'emoji 🔒 glisse
   à left:25% pour laisser apparaître le titre) élargit la boîte et décale le
   champ. */
.molti-header-9-10 .et_pb_row:has(.al-search) .account-link {
    margin-left: 0 !important;
    width: 40px;
    flex: 0 0 40px;
    overflow: hidden;
}
.molti-header-9-10 .et_pb_row:has(.al-search) .account-link:hover::after {
    left: 50% !important; /* l'emoji ne glisse plus */
}
.al-search {
    min-width: 260px;
}

/* ==========================================================================
   CHAMP DE RECHERCHE [al_header_search] — pilule charte AL
   ========================================================================== */
.al-search {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}
.al-search input[type="search"] {
    width: 100%;
    padding: 12px 54px 12px 24px;
    border: 2px solid var(--al-amethyste);
    border-radius: 50px;
    background: var(--al-brume);
    font-family: 'Montserrat', sans-serif;
    font-size: 14.5px;
    color: var(--al-texte-fonce);
    outline: none;
    transition: var(--al-transition);
    -webkit-appearance: none;
    appearance: none;
}
.al-search input[type="search"]::placeholder {
    color: var(--al-violet-celeste);
}
.al-search input[type="search"]:focus {
    border-color: var(--al-violet-mystique);
    background: #fff;
    box-shadow: 0 6px 20px 0 var(--al-glow);
}
.al-search button[type="submit"] {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--al-degrade-nuit);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: var(--al-transition);
}
.al-search button[type="submit"]:hover {
    box-shadow: 0 8px 25px 0 rgba(107, 50, 123, 0.5);
}
/* Masque la croix native des champs search (WebKit) pour rester sobre */
.al-search input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* ==========================================================================
   NAV RUBRIQUES [al_header_nav] — desktop
   ========================================================================== */
.al-nav-rubriques {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.al-rubrique > a {
    display: block;
    padding: 13px 16px 15px;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 600; /* graisse du menu prod */
    letter-spacing: .4px;
    color: var(--al-texte-fonce);
    white-space: nowrap;
    position: relative;
}
/* Soulignement animé, en dégradé de charte */
.al-rubrique > a::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 9px;
    height: 2px;
    border-radius: 2px;
    background: var(--al-degrade-nuit);
    transform: scaleX(0);
    transition: transform .25s ease;
}
.al-rubrique > a:hover::after,
.al-rubrique.al-ouvert > a::after {
    transform: scaleX(1);
}
.al-chevron {
    font-size: 9px;
    color: var(--al-violet-celeste);
    margin-left: 5px;
    display: inline-block;
    transition: transform .25s ease;
}
.al-rubrique.al-ouvert .al-chevron {
    transform: rotate(180deg);
}

/* ==========================================================================
   PANNEAUX pleine largeur — desktop
   Le JS pose --al-panneau-top (bas du header sticky) sur le <nav>.
   Angles BAS CARRÉS (maquette v2).
   ========================================================================== */
.al-panneau {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--al-panneau-top, 140px);
    background: #fff;
    border-top: 1px solid var(--al-brume);
    box-shadow: 0 30px 60px rgba(107, 50, 123, 0.25);
    padding: 36px 65px 30px;
    z-index: 9998;
    max-height: calc(100vh - var(--al-panneau-top, 140px) - 20px);
    overflow-y: auto;
    /* fermé par défaut */
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .22s ease, transform .22s ease, visibility 0s .22s;
}
.al-rubrique.al-ouvert .al-panneau {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .22s ease, transform .22s ease, visibility 0s;
}
.al-panneau-inner {
    display: grid;
    grid-template-columns: repeat(var(--al-colonnes, 2), minmax(0, 1.2fr)) 320px;
    gap: 44px;
    max-width: 1400px;
    margin: 0 auto;
}
.al-panneau-inner.sans-carte {
    grid-template-columns: repeat(var(--al-colonnes, 2), minmax(0, 1fr));
}

/* Colonnes */
.al-colonne-titre {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--al-violet-lunaire);
    margin: 0 0 16px;
}
.al-entree {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    padding: 10px 14px;
    border-radius: 16px;
    transition: var(--al-transition-rapide);
}
.al-entree:hover {
    background: var(--al-brume);
}
.al-emoji {
    font-size: 20px;
    line-height: 1.35;
    flex-shrink: 0;
}
.al-entree-txt b {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.35;
    color: var(--al-texte-fonce);
}
/* L'entrée « audio offert » : le titre et sa pastille
   sur une même ligne (le <b> de .al-entree-txt est en display:block, un
   frère direct passerait à la ligne). La pastille reprend le dégradé nuit
   du site : si la charte change, elle suit les tokens. */
.al-entree-titre {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.al-badge-offert {
    display: inline-block;
    background: var(--al-degrade-nuit, linear-gradient(135deg, #6B327B 0%, #8B5A9B 100%));
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 3px 10px;
    border-radius: 20px;
}

.al-entree-txt small {
    display: block;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--al-texte-moyen);
    margin-top: 2px;
}

/* Pied du panneau : CTA 1ʳᵉ personne — pilule, casse normale (règle AL) */
.al-panneau-actions {
    grid-column: 1 / -1;
    padding-top: 6px;
}
.al-cta {
    display: inline-block;
    padding: 12px 28px;
    background: var(--al-degrade-nuit);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .5px;
    border-radius: 50px;
    transition: var(--al-transition);
}
.al-cta:hover {
    color: #fff;
    box-shadow: 0 8px 25px 0 rgba(107, 50, 123, 0.5);
}

/* Signature de panneau : ligne de réassurance valable pour tout le catalogue */
.al-signature {
    font-size: 13px;
    font-style: italic;
    color: var(--al-texte-moyen);
    border-top: 1px solid var(--al-brume);
    padding-top: 14px;
    margin: 14px 0 0;
}
.al-signature b {
    color: var(--al-texte-fonce);
    font-style: normal;
    font-weight: 600;
}

/* Carte promo (ressource/article dynamique ou carte statique) — 24px charte */
.al-carte {
    background: var(--al-degrade-brume);
    border-radius: 24px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-self: start;
}
.al-carte-etiquette {
    align-self: flex-start;
    background: var(--al-violet-mystique);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 50px;
}
.al-carte img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 16px;
}
/* Visuels produits AL : PNG carrés sur fond TRANSPARENT — image entière sur le
   dégradé de la carte, jamais recadrée (classe posée par al-header.php). */
.al-carte img.al-contain {
    height: 170px;
    object-fit: contain;
    border-radius: 0; /* aucun cadre visible sur du transparent */
}
.al-carte h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.35;
    color: var(--al-violet-mystique);
    margin: 0;
}
.al-carte p {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--al-texte-moyen);
    margin: 0;
}
.al-carte .al-carte-prix {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--al-violet-mystique);
}
.al-carte a.al-carte-lien {
    color: var(--al-violet-mystique);
    font-weight: 600;
    font-size: 14px;
}
.al-carte a.al-carte-lien:hover {
    text-decoration: underline;
}

/* Voile sous le panneau / la feuille mobile.
   pointer-events:none est VITAL : sans lui, le voile intercepte la souris sur
   la barre de rubriques → mouseleave → fermeture → réouverture en boucle
   (le « menu qui saute »). Le clic hors panneau
   ferme via le handler document de al-header.js, qui voit à travers le voile. */
.al-voile {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* Le voile démarre SOUS le header (même ancre que les panneaux) : sans ça,
       il griserait le bandeau de rubriques au survol. */
    top: var(--al-panneau-top, 0px);
    background: rgba(90, 42, 106, 0.35);
    z-index: 9997;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility 0s .25s;
}
.al-voile.al-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity .25s ease, visibility 0s;
}

/* ==========================================================================
   MOBILE ≤ 1024px : bouton ☰ Menu + feuille plein écran + accordéons
   ========================================================================== */
.al-nav-toggle,
.al-nav-fermer {
    display: none;
}

@media (max-width: 1024px) {
    .al-nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid rgba(107, 50, 123, 0.3);
        border-radius: 50px;
        background: var(--al-brume);
        padding: 9px 15px;
        font-family: 'Montserrat', sans-serif;
        font-size: 14px;
        color: var(--al-texte-fonce);
        cursor: pointer;
    }
    .al-nav-fermer {
        display: block;
        position: absolute;
        top: 14px;
        right: 16px;
        width: 42px;
        height: 42px;
        border: 1px solid rgba(107, 50, 123, 0.3);
        border-radius: 50%;
        background: var(--al-brume);
        font-size: 16px;
        color: var(--al-texte-fonce);
        cursor: pointer;
        z-index: 2;
    }

    /* Rangée du header : logo + icônes en 1re ligne, champ pleine largeur dessous.
       ⚠️ Préfixe .et-db #et-boc .et-l OBLIGATOIRE : les réglages saisis dans les
       modules Divi sortent dans et-core-unified-*.css avec cette spécificité +
       !important, et fuient en mobile. On ne les bat qu'en étant PLUS spécifique
       — parade vérifiée sur le rendu réel. */
    .et-db #et-boc .et-l .molti-header-9-10 .et_pb_row:has(.al-search) .et_pb_module {
        margin: 0 !important;
    }
    .et-db #et-boc .et-l .molti-header-9-10 .et_pb_row:has(.al-search) {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 8px 12px !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    /* TOUTES les colonnes de la rangée S'EFFACENT (display:contents) : leurs
       modules deviennent des enfants directs de la rangée flex — seul moyen
       d'avoir logo+icônes sur la 1re ligne ET le champ à 100% de la rangée.
       ⚠️ Le module [al_header_search] vit dans la PREMIÈRE colonne (3/4, avec
       le logo), pas dans celle des icônes : une règle « first-child = logo
       seul » tasserait le champ à gauche. En effaçant toutes les colonnes, la
       position du module dans l'une ou l'autre ne compte plus. */
    .et-db #et-boc .et-l .molti-header-9-10 .et_pb_row:has(.al-search) > .et_pb_column {
        display: contents !important;
    }
    /* Le logo (module Image) pousse les icônes à droite de la 1re ligne.
       (Après la remise à zéro générale des marges : l'ordre du fichier tranche.) */
    .et-db #et-boc .et-l .molti-header-9-10 .et_pb_row:has(.al-search) .et_pb_module.et_pb_image {
        margin: 0 auto 0 0 !important;
        flex: 0 0 auto !important;
    }
    .et-db #et-boc .et-l .molti-header-9-10 .et_pb_row:has(.al-search) .et_pb_module:has(.al-search) {
        order: 9 !important;
        flex: 1 1 100% !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    .al-search {
        min-width: 0;
        max-width: none;
    }
    .al-search input {
        min-width: 0;
    }
    /* Icônes nivelées (marges déjà remises à zéro par le bloc .et_pb_module) */
    .molti-header-9-10 .et_pb_row:has(.al-search) .account-link,
    .molti-header-9-10 .et_pb_row:has(.al-search) .molti-wishlist,
    .molti-header-9-10 .et_pb_row:has(.al-search) .custom-mini-cart-wrapper {
        margin: 0 !important;
        align-self: center;
    }
    .molti-header-9-10 .et_pb_row:has(.al-search) .molti-wishlist,
    .molti-header-9-10 .et_pb_row:has(.al-search) .custom-mini-cart-wrapper {
        padding: 0 !important;
    }
    /* La rangée du bouton ☰ Menu : bande propre qui ne remonte pas sous le logo */
    .molti-header-9-10 .et_pb_row:has(.al-nav) {
        margin: 0 !important;
        padding: 6px 12px !important;
        background: #fff;
        position: relative;
        z-index: 1;
    }

    /* La feuille plein écran */
    .al-nav-feuille {
        position: fixed;
        inset: 0;
        background: #fff;
        z-index: 100000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-102%);
        transition: transform .3s ease;
        /* pas d'ombre : garée à -102%, une ombre déborderait dans l'écran
           ; plein écran, elle n'a aucun sens */
        padding: 66px 0 30px; /* dégage le bouton ✕ de la 1re rubrique */
    }
    body.al-nav-ouverte .al-nav-feuille {
        transform: translateX(0);
    }
    /* Verrou de défilement quand la feuille est ouverte */
    body.al-nav-ouverte {
        overflow: hidden;
    }
    /* VITAL : la colonne Divi (z-index:2) emprisonne le z-index de la feuille,
       et la rangée du logo passerait devant (logo et champ affichés PAR-DESSUS
       la feuille). On élève la chaîne à l'ouverture. */
    body.al-nav-ouverte .molti-header-9-10 .et_pb_row:has(.al-nav),
    body.al-nav-ouverte .molti-header-9-10 .et_pb_column:has(.al-nav) {
        z-index: 100000 !important;
    }

    .al-nav-rubriques {
        display: block;
    }
    .al-rubrique {
        border-bottom: 1px solid var(--al-brume);
    }
    .al-rubrique > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 17px;
        padding: 16px 22px;
        white-space: normal;
    }
    .al-rubrique > a::after {
        display: none;
    }

    /* Panneaux → accordéons dans le flux */
    .al-panneau {
        position: static;
        max-height: none;
        overflow: visible;
        box-shadow: none;
        border-top: none;
        padding: 0 12px 18px;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
        display: none;
    }
    .al-rubrique.al-ouvert .al-panneau {
        display: block;
    }
    .al-panneau-inner,
    .al-panneau-inner.sans-carte {
        display: block;
    }
    .al-colonne {
        margin-bottom: 20px;
    }
    .al-colonne-titre {
        margin-top: 14px;
    }
    .al-carte {
        margin-top: 8px;
    }
    .al-panneau-actions {
        padding-top: 12px;
    }

    /* Le voile ne sert pas sous la feuille (elle couvre tout) */
    .al-voile {
        display: none;
    }
}

/* Desktop intermédiaire : on resserre pour que la ligne de rubriques ne casse pas */
@media (min-width: 1025px) and (max-width: 1280px) {
    .al-rubrique > a {
        padding: 13px 11px 15px;
        font-size: 14px;
    }
    .al-panneau {
        padding: 30px 30px 26px;
    }
    .al-panneau-inner {
        gap: 28px;
        grid-template-columns: repeat(var(--al-colonnes, 2), minmax(0, 1.2fr)) 280px;
    }
}

/* Respect du réglage système : pas d'animations imposées */
@media (prefers-reduced-motion: reduce) {
    .al-panneau,
    .al-nav-feuille,
    .al-voile,
    .al-chevron,
    .al-rubrique > a::after {
        transition: none;
    }
}
