/* ==========================================================================
   MÉGA MENU (maquette client « mega-menu », validée le 30/07)

   Complète agent.css : la palette de marque (--coral, --dark, --text, --bg,
   --white...) y est déjà déclarée en :root avec exactement les mêmes valeurs,
   elle n'est donc pas redéclarée ici.

   Ce que ce fichier ajoute :
   - --hdr-h en :root, parce que c'est une dimension de mise en page dont les
     barres collantes des autres feuilles auront besoin ;
   - les teintes de sections et de rôles, SCOPÉES sur .site-header et .scrim :
     « --setup » vaut ici #b44ddf alors qu'agent.css a un --setup-accent bleu,
     et les couleurs de rôles n'existent nulle part ailleurs en CSS (les pages
     rôles les injectent depuis la base). Rien ne doit fuir en :root.
   ========================================================================== */

  :root {
    --hdr-h: 72px;
  }

  .site-header,
  .scrim {
    --duelist: #e8637e;
    --sentinel: #4cc9b0;
    --controller: #5c8ee6;
    --initiator: #e6b44d;
    --lore: #7c5cbf;
    --setup: #b44ddf;
    --news: #4cc9b0;
  }

  /* ========== BARRE ========== */
  .site-header {
    position: sticky; top: 0; z-index: 200;
    background: var(--white);
    border-bottom: 1px solid #ececec;
  }
  .hdr-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 32px;
    height: var(--hdr-h);
    display: flex; align-items: center; gap: 28px;
  }
  .logo {
    display: flex; align-items: center; gap: 7px;
    font-family: 'Bebas Neue', sans-serif; font-size: 1.55rem;
    color: var(--dark); text-decoration: none; letter-spacing: 1px;
    flex-shrink: 0;
  }
  .logo .heart { color: var(--coral); font-size: 1.25rem; }

  .main-nav { display: flex; align-items: center; gap: 2px; height: 100%; }
  .nav-item {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    /* 20 px : les 30 du 30/07 (paliers 15, 18, 22, 30) resserrés le 05/08
       (24 puis 20), l'écart entre intitulés était jugé trop large. Les insets
       du soulignement ci-dessous suivent la même valeur pour rester calés sur
       le texte. Attention, la barre n'a plus de mou sous environ 980 px : en
       dessous le flex rogne ce padding jusqu'à la bascule mobile de 900 px. */
    height: 100%; padding: 0 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem; font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text); background: none; border: none;
    cursor: pointer; text-decoration: none;
    transition: color 0.18s;
  }
  .nav-item .chev {
    width: 9px; height: 9px; margin-top: 1px;
    border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    opacity: 0.4; transition: transform 0.25s ease, opacity 0.2s;
  }
  .nav-item::after {
    content: ''; position: absolute; left: 20px; right: 20px; bottom: 0;
    height: 2px; border-radius: 2px 2px 0 0;
    background: var(--accent, var(--coral));
    transform: scaleX(0); transform-origin: center;
    transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
  }
  .nav-item:hover, .nav-item[aria-expanded="true"] { color: var(--dark); }
  .nav-item:hover .chev { opacity: 0.8; }
  .nav-item[aria-expanded="true"] .chev { transform: rotate(-135deg) translateY(-2px); opacity: 0.9; }
  .nav-item:hover::after, .nav-item[aria-expanded="true"]::after { transform: scaleX(1); }
  .nav-item:focus-visible { outline: 2px solid var(--coral); outline-offset: -4px; border-radius: 4px; }

  .nav-item[data-accent="progresser"] { --accent: var(--duelist); }
  .nav-item[data-accent="setup"]      { --accent: var(--setup); }
  .nav-item[data-accent="lore"]       { --accent: var(--lore); }
  .nav-item[data-accent="news"]       { --accent: var(--news); }

  .hdr-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
  .icon-btn {
    width: 36px; height: 36px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); border: 1px solid #eee; color: var(--text-light);
    text-decoration: none; font-size: 0.85rem; cursor: pointer;
    transition: all 0.18s;
  }
  .icon-btn:hover { background: var(--coral-light); border-color: transparent; color: var(--coral-dark); transform: translateY(-1px); }
  /* Le bouton « Télécharger » (.hdr-cta) de la maquette a été retiré le 30/07
     sur décision du client : ses règles sont parties avec lui. */

  .burger { display: none; width: 40px; height: 40px; border-radius: 9px; background: var(--bg); border: 1px solid #eee; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
  .burger span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.3s cubic-bezier(0.22,1,0.36,1); }
  .burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* ========== HÔTE DES PANNEAUX ========== */
  .mega-host { position: absolute; top: 100%; left: 0; right: 0; }
  .mega-panel {
    position: absolute; top: 0; left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid #ececec;
    box-shadow: 0 24px 48px -20px rgba(20,20,40,0.18);
    opacity: 0; visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22,1,0.36,1), visibility 0.22s;
    pointer-events: none;
  }
  .mega-panel::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--pa, var(--coral)), transparent 65%);
  }
  .mega-panel.open { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
  .mega-inner {
    max-width: 1280px; margin: 0 auto; padding: 34px 32px 30px;
    display: grid; grid-template-columns: 1fr 1fr 1fr 320px; gap: 34px;
  }
  .mega-inner.cols-3 { grid-template-columns: 1fr 1fr 340px; }
  .mega-inner.cols-full { grid-template-columns: 1fr; }

  /* Colonnes : apparition décalée */
  .mega-panel .col, .mega-panel .feat { opacity: 0; transform: translateY(8px); }
  .mega-panel.open .col, .mega-panel.open .feat { animation: colIn 0.42s cubic-bezier(0.22,1,0.36,1) forwards; }
  .mega-panel.open .col:nth-child(1) { animation-delay: 0.03s; }
  .mega-panel.open .col:nth-child(2) { animation-delay: 0.07s; }
  .mega-panel.open .col:nth-child(3) { animation-delay: 0.11s; }
  .mega-panel.open .feat { animation-delay: 0.15s; }
  @keyframes colIn { to { opacity: 1; transform: translateY(0); } }

  .col-head {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.72rem; letter-spacing: 2.5px; text-transform: uppercase;
    color: var(--text-light); margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
  }
  .col-head .ch-dot { width: 7px; height: 7px; border-radius: 50%; }

  .m-link {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 9px 10px; margin: 0 -10px;
    border-radius: 10px; text-decoration: none; color: inherit;
    transition: background 0.16s, transform 0.16s;
  }
  .m-link:hover { background: var(--bg); transform: translateX(3px); }
  .m-link:focus-visible { outline: 2px solid var(--coral); outline-offset: -2px; }
  .m-link .ml-ico {
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem; background: var(--bg);
    transition: background 0.16s;
  }
  .m-link:hover .ml-ico { background: var(--white); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
  .m-link .ml-txt strong { display: block; font-size: 0.83rem; font-weight: 600; color: var(--dark); margin-bottom: 2px; }
  .m-link .ml-txt span { font-size: 0.72rem; color: var(--text-light); line-height: 1.45; }
  .m-link .ml-tag {
    display: inline-block; margin-left: 7px; vertical-align: 1px;
    font-size: 0.55rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 2px 6px; border-radius: 4px; background: var(--coral-light); color: var(--coral-dark);
  }

  /* Lignes rôles */
  .role-link { position: relative; overflow: hidden; }
  .role-link .ml-ico { color: white; }
  .role-link.d .ml-ico { background: linear-gradient(140deg, #200e16, #a8344e); }
  .role-link.i .ml-ico { background: linear-gradient(140deg, #201a0e, #c49a3a); }
  .role-link.c .ml-ico { background: linear-gradient(140deg, #0e1420, #3a6cc4); }
  .role-link.s .ml-ico { background: linear-gradient(140deg, #0e2018, #2a9478); }
  .role-link .ml-count {
    margin-left: auto; align-self: center; flex-shrink: 0;
    font-family: 'Bebas Neue', sans-serif; font-size: 0.95rem; letter-spacing: 0.5px;
    color: #d8d8d8; transition: color 0.18s;
  }
  .role-link:hover .ml-count { color: var(--dark); }

  /* La rangée de pastilles agents (.agent-strip, .agent-pill, .ap-dot) de la
     maquette a été retirée le 30/07 sur décision du client : ses règles sont
     parties avec elle. Les règles .ml-ico juste au-dessus restent en service,
     elles portent les tuiles de rôles. */

  /* ========== COLONNE VEDETTE ========== */
  /* La carte vedette porte l'agent de la semaine : son dégradé et son halo
     sont teintés par les variables --fa-* posées en ligne depuis
     ColorPalette. Les valeurs de repli sont celles de la maquette, elles
     servent au bloc statique quand aucun agent n'est éligible. Noms propres à
     la carte : les --agent-* de la palette de page ne doivent pas déteindre. */
  .feat {
    border-radius: 16px; overflow: hidden; position: relative;
    text-decoration: none; color: inherit; display: block;
    background: linear-gradient(150deg,
      var(--fa-1, #12091e) 0%, var(--fa-2, #24123a) 55%, var(--fa-3, #3a1c56) 100%);
    min-height: 100%;
  }
  .feat::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 70% 20%, var(--fa-glow, rgba(180,77,223,0.28)) 0%, transparent 62%);
    transition: opacity 0.3s;
  }
  .feat.f-setup { background: linear-gradient(150deg, #0f0a18 0%, #241238 55%, #40206a 100%); }
  .feat.f-lore  { background: linear-gradient(150deg, #0d0a1c 0%, #1d1440 55%, #33265e 100%); }
  .feat-body { position: relative; z-index: 2; padding: 24px 24px 26px; display: flex; flex-direction: column; height: 100%; }
  .feat-badge {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 12px; border-radius: 6px; margin-bottom: 14px;
    font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
    background: rgba(255,255,255,0.09); color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.1);
  }
  .feat-badge .pulse { width: 5px; height: 5px; border-radius: 50%; background: var(--coral); animation: pulse 2.2s infinite; }
  @keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(1.6); } }
  .feat-art {
    height: 118px; border-radius: 12px; margin-bottom: 16px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; letter-spacing: 1.5px; text-transform: uppercase;
    color: rgba(255,255,255,0.18); font-weight: 600;
    overflow: hidden;
  }
  /* Portrait de l'agent : cadré tête et buste, comme les vignettes du bloc
     « agents du même rôle » des fiches. Le cadre est large et bas, un cover
     centré couperait au niveau des jambes. */
  .feat-art img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
  /* Photo du produit à la une du panneau Setup (03/08) : contain sur fond
     blanc, comme les cartes produit de l'index Setup. Les visuels des bandeaux
     sont détourés sur fond blanc et non cadrés comme un portrait ; un cover
     centré en haut leur couperait la moitié du produit. La classe n'est posée
     que si le bandeau a bien une photo : sans photo, le cadre garde le fond
     sombre et son libellé d'emplacement. */
  .feat-art.is-produit { background: #ffffff; border-color: rgba(255,255,255,0.14); padding: 10px; }
  .feat-art.is-produit img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
  /* Bornage du texte, motif du catalogue matériel : la carte du panneau Setup
     porte le titre du bandeau vedette, souvent un titre de vendeur à rallonge,
     et il est rendu en Bebas 1.35rem. Sans borne, il pousse la photo et l'appel
     à l'action hors du panneau. Le flex:1 de la description est conservé, c'est
     lui qui colle l'appel à l'action au bas de la carte. */
  .feat h3 {
    font-family: 'Bebas Neue', sans-serif; font-size: 1.35rem; color: white; letter-spacing: 1px; line-height: 1.1; margin-bottom: 7px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .feat p {
    font-size: 0.76rem; color: rgba(255,255,255,0.42); line-height: 1.6; margin-bottom: 16px; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .feat .feat-cta {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
    color: white; align-self: flex-start;
    padding-bottom: 3px; border-bottom: 1.5px solid rgba(255,255,255,0.25);
    transition: border-color 0.2s, gap 0.2s;
  }
  .feat:hover .feat-cta { border-color: var(--coral); gap: 12px; }
  .feat:hover::after { opacity: 0.75; }

  /* ========== PIED DE PANNEAU ========== */
  .mega-foot {
    border-top: 1px solid #f0f0f0; background: var(--bg);
  }
  .mega-foot-inner {
    max-width: 1280px; margin: 0 auto; padding: 13px 32px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
  }
  /* Les mentions des pieds de panneaux (.mf-hint, et les <kbd>Échap</kbd> /
     <kbd>Tab</kbd> qu'elles portaient) ont disparu par étapes le 30/07 sur
     décision du client, la dernière étant « Mis à jour à chaque patch » côté
     Actus. Leurs règles sont parties avec elles : les quatre pieds ne
     contiennent plus que leur lien, calé à droite par le margin-left des
     .mf-all ci-dessous. */
  .mega-foot .mf-all {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--coral-dark); text-decoration: none; transition: gap 0.2s;
    display: inline-flex; align-items: center; gap: 7px;
    /* Reste calé à droite même quand il est seul dans le pied : le
       space-between du conteneur ramènerait sinon l'unique enfant à gauche. */
    margin-left: auto;
  }
  .mega-foot .mf-all:hover { gap: 11px; }

  /* Actus : grille pleine largeur */
  /* Panneau actus branché sur la base (05/08) : une colonne de rubriques et
     les trois derniers articles resserrés, chacun sa colonne (la colonne des
     rubriques est bornée pour leur laisser la place). L'image à la une
     remplit la vignette ; les dégradés nt-* restent le repli des articles
     sans visuel. .news-row (grille de la maquette à 3 cartes) n'a plus
     d'usage mais reste pour mémoire de la créa. */
  .mega-inner.cols-news { grid-template-columns: 220px repeat(3, 1fr); }
  .news-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

  .news-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .news-item { text-decoration: none; color: inherit; display: block; border-radius: 14px; overflow: hidden; border: 1px solid #eee; background: var(--white); transition: all 0.22s; }
  .news-item:hover { transform: translateY(-4px); box-shadow: 0 14px 32px rgba(0,0,0,0.07); border-color: transparent; }
  .news-thumb { height: 108px; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,0.35); font-weight: 600; }
  .nt-1 { background: linear-gradient(135deg, #1a0e2e, #b44ddf); }
  .nt-2 { background: linear-gradient(135deg, #0e1a2e, #4d9edf); }
  .nt-3 { background: linear-gradient(135deg, #2e1a0e, #dfb44d); }
  .news-body { padding: 14px 16px 16px; }
  .news-body .nb-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
  .news-body .nb-tag { font-size: 0.55rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 3px 7px; border-radius: 4px; background: var(--coral-light); color: var(--coral-dark); }
  .news-body .nb-date { font-size: 0.65rem; color: #bbb; }
  .news-body h3 { font-size: 0.85rem; font-weight: 700; color: var(--dark); line-height: 1.35; }

  /* ========== VOILE ========== */
  .scrim {
    position: fixed; inset: var(--hdr-h) 0 0 0; z-index: 150;
    background: rgba(16,14,26,0.34);
    backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s;
  }
  .scrim.on { opacity: 1; visibility: visible; }

  /* Titre de panneau (mobile uniquement) */
  .panel-title { display: none; }
  /* Le tiroir mobile porte depuis le 05/08 un .panel-title qui est une ANCRE
     (« Crosshair », entrée provisoire, lien direct sans contenu à déplier). Le
     gabarit était écrit pour des <button>, qui ne se soulignent pas : seule
     cette ligne est ajoutée, le reste de l'apparence est celui des autres
     en-têtes du tiroir. */
  a.panel-title { text-decoration: none; }

  /* ========== RESPONSIVE ========== */
  @media (max-width: 1150px) {
    .mega-inner { grid-template-columns: 1fr 1fr 300px; }
    .mega-inner .col.hide-md { display: none; }
  }

  @media (max-width: 900px) {
    :root { --hdr-h: 62px; }
    .hdr-inner { padding: 0 18px; gap: 14px; }
    .main-nav, .icon-btn.opt { display: none; }
    .burger { display: flex; }
    .hdr-actions { margin-left: auto; }

    /* Le host devient un tiroir plein écran */
    .mega-host {
      position: fixed; top: var(--hdr-h); left: 0; right: 0; bottom: 0;
      background: var(--white);
      overflow-y: auto; -webkit-overflow-scrolling: touch;
      transform: translateX(100%);
      transition: transform 0.34s cubic-bezier(0.22,1,0.36,1);
      z-index: 210;
    }
    .mega-host.drawer-open { transform: translateX(0); }

    .mega-panel {
      position: static; opacity: 1; visibility: visible; transform: none;
      pointer-events: auto; box-shadow: none; border-bottom: 1px solid #f0f0f0;
    }
    .mega-panel::before { display: none; }
    .mega-panel .col, .mega-panel .feat { opacity: 1; transform: none; animation: none !important; }

    .panel-title {
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
      width: 100%; padding: 18px 20px;
      background: none; border: none; cursor: pointer;
      font-family: 'Bebas Neue', sans-serif; font-size: 1.05rem; letter-spacing: 1.5px;
      color: var(--dark); text-align: left;
    }
    .panel-title .pt-left { display: flex; align-items: center; gap: 11px; }
    .panel-title .pt-dot { width: 9px; height: 9px; border-radius: 50%; }
    .panel-title .pt-chev { width: 9px; height: 9px; border-right: 2px solid #c4c4c4; border-bottom: 2px solid #c4c4c4; transform: rotate(45deg); transition: transform 0.28s; }
    .mega-panel.acc-open .panel-title .pt-chev { transform: rotate(-135deg); }

    .mega-inner, .mega-inner.cols-3, .mega-inner.cols-full {
      grid-template-columns: 1fr; gap: 22px;
      padding: 0 20px 22px;
      max-height: 0; overflow: hidden; opacity: 0;
      transition: max-height 0.4s cubic-bezier(0.22,1,0.36,1), opacity 0.3s, padding 0.3s;
    }
    .mega-panel.acc-open .mega-inner { max-height: 1600px; opacity: 1; }
    .mega-foot { display: none; }
    .news-row { grid-template-columns: 1fr; }
    .feat { min-height: auto; }
  }

  /* La maquette coupait animations et transitions sur TOUTE la page. Ici la
     règle est bornée au menu : agent.css a déjà sa propre gestion du sujet et
     le reste du site n'entre pas dans le périmètre de cette brique. */
  @media (prefers-reduced-motion: reduce) {
    .site-header, .site-header *, .site-header *::before, .site-header *::after,
    .scrim {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }
