/* ============================================================
   RESPONSIVE — Lexique Wow (écran uniquement)
   Reflow pleine largeur sur mobile / petite tablette.
   Tout est scopé en @media screen → le PDF (print) est intact.
   Chargé seulement par Lexique Wow.html.
   ============================================================ */

/* ---- Menu hamburger (Lexique) — masqué sur ordinateur ----- */
.nav-burger { display: none; }
.nav-scrim  { display: none; }

/* ---- MOBILE & PETITE TABLETTE (≤ 760px) ------------------- */
@media screen and (max-width: 760px) {

  :root {
    --page-w: 100%;
    --page-h: 600px;          /* sert d'appui aux héros d'ouverture */
    --page-pad-x: 20px;
    --page-pad-y: 74px;
  }

  /* On neutralise la mise à l'échelle JS : la page se lit en pleine taille */
  .stage {
    padding: 64px 0 72px !important;
    align-items: stretch;
  }
  .book {
    width: 100% !important;
    transform: none !important;
    margin-bottom: 0 !important;
  }

  .page {
    width: 100% !important;
    min-height: 0 !important;
    padding: 70px 20px 76px !important;
    margin: 0 0 14px !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25) !important;
  }
  .page-header { top: 16px !important; }
  .page-footer { bottom: 14px !important; }

  /* ---- Titres surdimensionnés domptés ---- */
  h1.display, .display       { font-size: 52px !important; line-height: 0.92 !important; }
  h2.chapter-title           { font-size: 40px !important; line-height: 0.96 !important; }
  h3.section-title           { font-size: 25px !important; }
  .lead                      { font-size: 16px !important; }

  /* Héros de couverture : germes mis à l'échelle de l'écran */
  .page img[src*="germi-3d"]      { width: 38vw !important; }
  .page img[src*="germinette-3d"] { width: 34vw !important; }

  /* ---- Grilles : on empile ce qui doit l'être ---- */
  .page [style*="grid-template-columns"][style*="1fr 1fr"],
  .page [style*="grid-template-columns"][style*="1fr 1.2fr"],
  .page [style*="grid-template-columns"][style*="1.05fr 1fr"],
  .page [style*="grid-template-columns"][style*="1.1fr 1fr"],
  .page [style*="grid-template-columns"][style*="repeat(2, 1fr)"],
  .page .grid-2 {
    grid-template-columns: 1fr !important;
  }
  /* Petites tuiles : 2 colonnes au lieu de 3 / 4 */
  .page [style*="grid-template-columns"][style*="repeat(3, 1fr)"],
  .page [style*="grid-template-columns"][style*="repeat(4, 1fr)"],
  .page .grid-3 {
    grid-template-columns: 1fr 1fr !important;
  }

  /* ---- Barre de navigation : logo + hamburger + Académie ---- */
  .nav-bar {
    padding: 10px 12px !important;
    gap: 10px;
    flex-wrap: wrap !important;
  }
  .nav-brand { gap: 8px; flex: 0 0 auto; }
  .nav-brand span { display: none; }     /* « · Lexique 2026 » masqué */
  .acad-full { display: none; }
  .acad-short { display: inline; }

  /* Bouton hamburger : poussé à droite, à côté du lien Académie */
  .nav-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px; height: 38px;
    margin-left: auto;
    padding: 9px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 9px;
    cursor: pointer;
    flex: 0 0 auto;
  }
  .nav-burger span {
    display: block; width: 100%; height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* ===== MENU MOBILE : carte simple, on neutralise les effets "wow" ===== */

  /* L'indicateur magique (balayage coloré) n'a aucun sens en vertical : masqué */
  body .magic-indicator { display: none !important; }

  /* La barre ne doit PAS rogner le menu déroulant (sinon menu invisible et non cliquable) */
  html body nav.nav-bar { overflow: visible !important; }

  /* Panneau des chapitres : carte sombre opaque, pleine largeur sous la barre */
  html body nav.nav-bar > .nav-chapters {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100vh - 96px) !important;
    display: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 8px !important;
    background: #0f1c32 !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    z-index: 2000 !important;
  }
  html body nav.nav-bar > .nav-chapters.open {
    display: flex !important;
  }

  /* Chaque chapitre : ligne pleine, lisible, cliquable, sans dégradé ni masque */
  html body nav.nav-bar > .nav-chapters > .nav-chapter {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    flex: 0 0 auto !important;
    white-space: normal !important;
    text-align: left !important;
    opacity: 1 !important;
    color: #fbf8f2 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    letter-spacing: 0.04em !important;
    padding: 14px 16px !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    transform: none !important;
  }
  html body nav.nav-bar > .nav-chapters > .nav-chapter.active {
    background: rgba(225, 37, 27, 0.20) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
  }

  /* Tableaux de données : défilables horizontalement si trop larges */
  .page table.data {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 11.5px;
  }
}

/* ---- TRÈS PETITS ÉCRANS (≤ 440px) ------------------------- */
@media screen and (max-width: 440px) {
  h1.display, .display { font-size: 44px !important; }
  h2.chapter-title     { font-size: 34px !important; }
  .page                { padding: 66px 16px 72px !important; }

  /* Sur les plus petits écrans, tout passe en une colonne */
  .page [style*="grid-template-columns"][style*="repeat(3, 1fr)"],
  .page [style*="grid-template-columns"][style*="repeat(4, 1fr)"],
  .page .grid-3 {
    grid-template-columns: 1fr 1fr !important;
  }
}
