/* Header compact et dynamique */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  max-width: 1260px;
  height: 100px;
  margin: 0 auto;
  padding: 8px 20px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  background: linear-gradient(135deg, #15162a, #23244a);
  transition:
    background-color 0.3s,
    box-shadow 0.3s;
}

header::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.header-content {
  flex: 1;
}

header h1 {
  font-size: clamp(0.375rem, 0.2rem + 2vw, 2.3rem);
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #f5e27a;
  text-align: center;
  margin-top: 6px;
  line-height: 1.1;
}

.page-title {
  font-size: clamp(0.275rem, 0.2rem + 1.2vw, 1.5rem);
  text-align: center;
  text-transform: uppercase;
  color: #9fe870;
  margin-top: -3px;
  opacity: 0.9;
}

header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.dark-mode .sect_page {
  background: black;
}

.light-mode .sect_page {
  background: white;
}
.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode h5,
.dark-mode h6 {
  font-weight: 500;
  line-height: 1.2;
  color: var(--blanc-3);
}

.light-mode h2,
.light-mode h3,
.light-mode h4,
.light-mode h5,
.light-mode h6 {
  font-weight: 500;
  line-height: 1.2;
  color: var(--noir-2);
}
.dark-mode .ligne {
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.5),
    transparent
  );
}

.light-mode .ligne {
  background: linear-gradient(
    to right,
    transparent,
    rgba(0, 114, 253, 0.5),
    transparent
  );
}
.dark-mode ol,
.dark-mode ul,
.dark-mode p {
  color: var(--blanc-1);
}
.light-mode ul,
.light-mode p {
  color: var(--noir);
}
.light-mode ol,
.light-mode ul,
.light-mode p {
  color: var(--noir);
}
.blockquote cite {
  font-size: var(--fs-2);
}
.dark-mode .blockquote {
  color: var(--bleu-1);
}
.light-mode .blockquote {
  color: var(--bleu-4);
}
.dark-mode .blockquote cite {
  color: var(--blanc);
}
.light-mode .blockquote cite {
  color: var(--noir);
}
.dark-mode .source,
.dark-mode .sourceCentre,
.dark-mode .sourceGauche {
  color: var(--gris-1);
}
.light-mode .source,
.light-mode .sourceCentre,
.light-mode .sourceGauche {
  color: var(--gris-5);
}
.dark-mode .badge-blanc h2 {
  color: #c1a400;
}
/* Bouton de basculement du mode */
.theme-toggle {
  width: 60px;
  height: 30px;
  margin-left: 20px;
  border-radius: 15px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;

  background: rgba(255, 255, 255, 0.2);
  transition: background-color 0.3s;
}

.dark-mode .theme-toggle {
  background: rgba(255, 255, 255, 0.1);
}
.dark-mode .bord-gauche,
.light-mode .bord-gauche {
  color: #000;
}

.theme-toggle::before {
  content: "☀️";
  position: absolute;
  inset: 3px auto auto 3px;
  width: 24px;
  height: 24px;

  display: grid;
  place-items: center;

  background: white;
  border-radius: 50%;
  font-size: 14px;

  transition: transform 0.3s;
}

.dark-mode .theme-toggle::before {
  content: "🌙";
  transform: translateX(30px);
  background: #2d2d44;
}

/* Progress bar */
.progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: #333;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.content-page {
  max-width: 1260px;
  margin: 0 auto;
}
.page-section {
  min-height: 400px;
  margin-bottom: 50px;
}

.page-section:empty::before {
  content: "Chargement du chapitre...";
  color: #666;
  font-style: italic;
  display: block;
  padding: 20px;
}

#menu-nav {
  max-width: 1260px;
  margin: 0 auto;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 40px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#menu-nav.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.sommaire {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}
.footer-nav{
      margin-top: 2rem;
 border-top:solid 2px #6bc9fb;
 padding: .5em 0;
 width: 100%;
 height: 320px;
 display: grid;
grid-template-columns: 2fr 3fr 2fr;
}

.footer-nav .licence {
line-height: 1.2;
font-size: 10px;
}
.menu-title {
  margin-left: 0.5rem;
  font-size: 18px;
  text-transform: uppercase;
  color: #ffd700;
}
.sub-title {
  color: #6bc9fb;
  font-size: 13px;
  color: #bcbddc;
  font-weight: 200;
  position: relative;
  margin-left: 0.8em;
  padding-left: 0.8em;
  line-height: 1.2;
}
.sub-title:hover {
  color: var(--blanc);
}

.sub-title::before {
  content: "–";
  color: #ffd700;
  position: absolute;
  left: 0;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  transform: translateX(-5px);
}

.sub-title:hover::before {
  opacity: 1;
  transform: translateX(0);
}
/* Bouton animé  */
.btnFermeAnime {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  background: red;
  border-radius: 5px;
}

.btnFermeAnime .inner {
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
}

.btnFermeAnime .inner::before,
.btnFermeAnime .inner::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 2px;
  background: #fff;
  left: 50%;
  top: 50%;
  transition: 0.2s;
}

.btnFermeAnime .inner::before {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.btnFermeAnime .inner::after {
  transform: translate(-50%, -50%) rotate(45deg);
}

.btnFermeAnime:hover .inner::before {
  top: 15%;
  transform: translate(-50%, 0);
}
.btnFermeAnime:hover .inner::after {
  top: 76%;
  transform: translate(-50%, 0);
}

.btnFermeAnime .label {
  margin: auto;
  color: #fff;
  opacity: 0;
  transition: 0.2s;
}

.btnFermeAnime:hover .label {
  opacity: 1;
}

.somCol {
  background: #1a1a1a;
  padding: 5px;
  border-radius: 8px;
  border: 1px solid #333;
}
.somCol {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.btn-toggle {
  font-size: clamp(1.13rem, calc(0.61rem + 2.56vw), 2.44rem);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  padding: 8px 15px;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}
.loading-indicator {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--accent);
  color: black;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  display: none;
}

@media print {
  /* 1. Configuration de la page (Marges réduites pour gagner de l'espace) */
  @page {
    margin: 1.5cm;
    size: A4;
  }

  /* 2. Reset global pour le papier */
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
    /* Taille de police standard pour l'impression */
    line-height: 1.4;
  }

  /* 3. Masquage des éléments inutiles */
  header,
  .theme-toggle,
  .no-print,
  footer button,
  .loading,
  #menuNav {
    display: none !important;
  }

  /* 4. Optimisation de l'espace de contenu */
  .container,
  .layout,
  main,
  .content {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  /* 5. Gestion intelligente des sauts de page */
  .page-section {
    opacity: 1 !important;
    page-break-after: auto;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    /* Séparateur léger entre sections */
  }

  /* Saut de page OBLIGATOIRE avant chaque grand chapitre (optionnel) */
  /* .section-title-in-content { page-break-before: always; } */

  /* Empêche de couper un titre ou une image en deux */
  h1,
  h2,
  h3,
  img,
  .licence {
    page-break-inside: avoid;
  }

  /* Évite d'avoir une seule ligne isolée en haut ou en bas de page */
  p {
    orphans: 3;
    widows: 3;
  }

  /* 6. Mise en forme des liens (pour qu'ils restent lisibles) */
  a {
    text-decoration: none;
    color: black;
    font-weight: bold;
  }

  /* Affiche l'URL entre parenthèses après le texte du lien */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    font-weight: normal;
    opacity: 0.7;
  }
}
