/* ==========================================================================
   Maths&clic — feuille de style
   Un seul fichier, organisé en sections. Les couleurs passent toutes par des
   variables : modifier la palette se fait en un seul endroit, et le thème
   sombre se contente de redéfinir ces mêmes variables.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Variables — thème clair
   -------------------------------------------------------------------------- */
:root {
  --ground:      #F6F8FC;
  --surface:     #FFFFFF;
  --surface-2:   #F0F3F9;
  --ink:         #131A26;
  --ink-2:       #5A6780;
  --ink-3:       #8996AC;
  --line:        #E2E7F0;
  --line-strong: #CFD7E5;
  --accent:      #2F6BF0;
  --accent-2:    #6C5CE7;
  --accent-soft: #E8EFFE;
  --flag:        #C93B32;
  --flag-soft:   #FBEAE8;
  --ok:          #1E7A5A;
  --ok-soft:     #E4F3EC;
  --bar:         #0D1522;
  --bar-2:       #162034;
  --bar-ink:     #E9EDF6;
  --bar-ink-2:   #9AA7C0;
  --bar-line:    #26324B;
  --sur-accent:  #FFFFFF;

  /* Éléments non publiés dans le back-office : le jaune de l'ancien site,
     adouci pour cohabiter avec le reste de la palette. */
  --brouillon:      #FFFBE6;
  --brouillon-2:    #FAF1C8;
  --brouillon-line: #E3C862;
  --brouillon-ink:  #7C6110;

  --shadow:      0 1px 2px rgba(19,26,38,.05), 0 8px 24px -12px rgba(19,26,38,.18);
  --shadow-lift: 0 2px 4px rgba(19,26,38,.06), 0 16px 32px -16px rgba(19,26,38,.28);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:  ui-monospace, "Cascadia Mono", "Segoe UI Mono", "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1180px;
  --radius: 10px;
  --hauteur-bandeau: 62px;
}

/* --------------------------------------------------------------------------
   2. Variables — thème sombre
   Deux blocs identiques : l'un pour le réglage système, l'autre pour le choix
   explicite de l'utilisateur.
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #080C15;
    --surface:     #101827;
    --surface-2:   #172133;
    --ink:         #E8ECF5;
    --ink-2:       #94A2BA;
    --ink-3:       #6E7C95;
    --line:        #212D44;
    --line-strong: #2C3B57;
    --accent:      #6BA1FF;
    --accent-2:    #9B8BFF;
    --accent-soft: #16233C;
    --flag:        #F2776C;
    --flag-soft:   #2C1815;
    --ok:          #4DBF97;
    --ok-soft:     #12271F;
    --bar:         #070B13;
    --bar-2:       #0E1524;
    --bar-ink:     #E8ECF5;
    --bar-ink-2:   #8B99B4;
    --bar-line:    #1C2537;
    --sur-accent:  #06101F;
    --brouillon:      #1F1A0D;
    --brouillon-2:    #2B2414;
    --brouillon-line: #5E4C1F;
    --brouillon-ink:  #D8BC72;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lift: 0 2px 4px rgba(0,0,0,.45), 0 16px 32px -16px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --ground:      #080C15;
  --surface:     #101827;
  --surface-2:   #172133;
  --ink:         #E8ECF5;
  --ink-2:       #94A2BA;
  --ink-3:       #6E7C95;
  --line:        #212D44;
  --line-strong: #2C3B57;
  --accent:      #6BA1FF;
  --accent-2:    #9B8BFF;
  --accent-soft: #16233C;
  --flag:        #F2776C;
  --flag-soft:   #2C1815;
  --ok:          #4DBF97;
  --ok-soft:     #12271F;
  --bar:         #070B13;
  --bar-2:       #0E1524;
  --bar-ink:     #E8ECF5;
  --bar-ink-2:   #8B99B4;
  --bar-line:    #1C2537;
  --sur-accent:  #06101F;
  --brouillon:      #1F1A0D;
  --brouillon-2:    #2B2414;
  --brouillon-line: #5E4C1F;
  --brouillon-ink:  #D8BC72;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.45), 0 16px 32px -16px rgba(0,0,0,.7);
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* Les blocs repliés portent l'attribut « hidden ». Sans cette règle, la
   moindre classe posant un display (.arow, .btn…) l'emporte sur la feuille
   par défaut du navigateur et le bloc reste affiché malgré l'attribut. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.01em;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; }
img { max-width: 100%; height: auto; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Le sprite d'icônes n'est jamais affiché : il sert de bibliothèque de tracés. */
.sprite { display: none; }

/* Le bloc de macros LaTeX doit être traité par MathJax sans être vu.
   On l'escamote plutôt que de le masquer avec display:none, qui empêcherait
   certaines versions de MathJax de le lire. */
.macros-latex {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}
.ic { display: inline-block; vertical-align: middle; flex: none; }

.saut-contenu {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 0 0 8px 0;
}
.saut-contenu:focus { left: 0; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hint { font-size: 12.5px; color: var(--ink-3); }
.inline-form { display: inline; }

/* --------------------------------------------------------------------------
   4. Bandeau supérieur
   -------------------------------------------------------------------------- */
.topbar {
  background: linear-gradient(180deg, var(--bar) 0%, var(--bar-2) 100%);
  border-bottom: 1px solid var(--bar-line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar__inner {
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: var(--hauteur-bandeau);
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand { display: inline-flex; align-items: center; flex: none; }
.brand img { height: 34px; width: auto; display: block; }

.burger {
  display: none;
  align-items: center;
  gap: 7px;
  color: var(--bar-ink-2);
  font-size: 14px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--bar-line);
}
.burger:hover { color: var(--bar-ink); }

.nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; flex: 1 1 auto; }
.nav__site { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }

/* Les trois applications extérieures : encadrées, à l'écart des rubriques du
   site et poussées à droite, contre les boutons d'icône. Ce ne sont pas des
   pages de Maths&clic — les mêler aux niveaux et aux outils obligeait à lire
   les neuf libellés pour retrouver celui qu'on ouvre tous les jours. */
.applis {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-left: 14px;
  border-left: 1px solid var(--bar-line);
}

.applis__lien {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--bar-ink-2);
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 10px;
  border: 1px solid var(--bar-line);
  border-radius: 8px;
  transition: color .15s, background-color .15s, border-color .15s;
}
.applis__lien:hover {
  color: var(--bar-ink);
  background: rgba(255,255,255,.08);
  border-color: var(--bar-ink-2);
}
.applis__lien svg { opacity: .5; flex: none; }
.applis__lien:hover svg { opacity: .8; }

/* La marque du QCM remplace son nom. Elle est blanche sur fond transparent :
   atténuée au repos, elle s'allume au survol comme le texte des voisines. */
.applis__lien--logo { padding: 5px 9px; }
.applis__lien--logo img {
  display: block;
  height: 19px;
  width: auto;
  opacity: .82;
  transition: opacity .15s;
}
.applis__lien--logo:hover img { opacity: 1; }

.nav__link {
  font-size: 14px;
  color: var(--bar-ink-2);
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 7px;
  white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.nav__link:hover { color: var(--bar-ink); background: rgba(255,255,255,.06); }
.nav__link[aria-current="page"] { color: var(--bar-ink); background: rgba(255,255,255,.09); }
.nav__sep { width: 1px; height: 20px; background: var(--bar-line); margin: 0 8px; flex: none; }
.nav__ext { display: inline-flex; align-items: center; gap: 6px; }
.nav__ext svg { opacity: .55; }

.topbar__actions { display: flex; align-items: center; gap: 6px; flex: none; }
.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--bar-ink-2);
  text-decoration: none;
  transition: color .15s, background-color .15s;
}
.iconbtn:hover { color: var(--bar-ink); background: rgba(255,255,255,.08); }

/* --------------------------------------------------------------------------
   5. Messages
   -------------------------------------------------------------------------- */
.flashes { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; }
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14.5px;
  border: 1px solid transparent;
}
.flash--succes { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.flash--erreur { background: var(--flag-soft); color: var(--flag); border-color: var(--flag); }
.flash--info   { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* --------------------------------------------------------------------------
   6. Accueil
   -------------------------------------------------------------------------- */
.hero { padding: 68px 0 52px; border-bottom: 1px solid var(--line); }
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 60px;
  align-items: start;
}
.hero h1 { font-size: clamp(32px, 4.4vw, 48px); line-height: 1.1; margin-bottom: 20px; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(96deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--ink-2); font-size: 17px; max-width: 60ch; }
.hero p + p { margin-top: 14px; }
.hero__aparte { font-size: 15px; padding-left: 14px; border-left: 3px solid var(--accent); }
.hero__aparte a { color: var(--accent); }
.hero__stats {
  display: flex;
  gap: 32px;
  margin-top: 32px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.stat__n {
  font-family: var(--mono);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  display: block;
}
.stat__l { font-size: 13px; color: var(--ink-2); }

.aside-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.aside-card h2 { font-size: 17px; margin-bottom: 4px; }
.aside-card > .eyebrow { display: block; margin-bottom: 10px; }

.readlist { display: flex; flex-direction: column; margin-top: 14px; }
.readlist a {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  text-decoration: none;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
}
.readlist a svg { margin-top: 3px; flex: none; color: var(--ink-3); }
.readlist a:hover .readlist__t { color: var(--accent); }
.readlist__t { transition: color .15s; flex: 1 1 auto; min-width: 0; }
.readlist__t small { display: block; font-size: 12px; color: var(--ink-3); }
.readlist__m {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--mono);
  flex: none;
  padding-top: 2px;
}

.section { padding: 52px 0; }
.section--serre { padding-top: 0; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.section__head h2 { font-size: 22px; }

.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.level {
  display: block;
  position: relative;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.level::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity .18s ease;
}
.level:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.level:hover::before { opacity: 1; }
.level h3 { font-size: 20px; margin: 6px 0 10px; }
.level__meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.level__new {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
.tool {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  text-decoration: none;
  font-size: 14.5px;
  transition: border-color .15s, color .15s;
}
.tool:hover { border-color: var(--accent); color: var(--accent); }
.tool svg { flex: none; opacity: .75; }

/* Une tuile qui porte une marque au lieu d'un intitulé : le logo tient la
   hauteur d'une ligne de texte pour que la grille garde son rythme. */
.tool--marque { justify-content: center; }
.tool--marque img { display: block; height: 22px; width: auto; }

/* --------------------------------------------------------------------------
   7. Page de niveau
   -------------------------------------------------------------------------- */
.classhead { padding: 40px 0 26px; border-bottom: 1px solid var(--line); }
.classhead h1 { font-size: clamp(28px, 3.6vw, 38px); margin: 8px 0 12px; }
.classhead__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.toolbar {
  position: sticky;
  top: var(--hauteur-bandeau);
  z-index: 30;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.toolbar__inner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toolbar__compteur { font-size: 12.5px; color: var(--ink-3); margin-left: auto; font-family: var(--mono); }

.search { position: relative; flex: 1 1 280px; min-width: 200px; }
.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  padding: 9px 12px 9px 38px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search--large input { font-size: 16px; padding: 13px 14px 13px 44px; }
.search--large svg { left: 15px; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 13px;
  padding: 7px 13px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  background: var(--surface);
  transition: border-color .15s, color .15s, background-color .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--sur-accent);
}

.layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 48px;
  padding: 34px 0 80px;
  align-items: start;
}
.layout--simple { grid-template-columns: minmax(0, 1fr); }

.toc {
  position: sticky;
  top: calc(var(--hauteur-bandeau) + 70px);
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}
.toc > .eyebrow { display: block; margin-bottom: 12px; }
.toc a {
  display: block;
  text-decoration: none;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 6px 12px;
  border-left: 2px solid var(--line);
  transition: color .15s, border-color .15s;
}
.toc a:hover { color: var(--ink); border-left-color: var(--line-strong); }
.toc a.is-current { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }

/* --------------------------------------------------------------------------
   8. Chapitres et documents
   -------------------------------------------------------------------------- */
.chapters { display: flex; flex-direction: column; gap: 14px; }

.chapter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--hauteur-bandeau) + 80px);
}
.chapter__head {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  list-style: none;
  transition: background-color .15s;
}
.chapter__head::-webkit-details-marker { display: none; }
.chapter__head:hover { background: var(--surface-2); }
.chapter__head--statique { cursor: default; border-bottom-color: var(--line); }
.chapter[open] .chapter__head { border-bottom-color: var(--line); }

.chapter__code {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 5px;
  flex: none;
}
.chapter__code--dossier { color: var(--ink-2); background: var(--surface-2); }
.chapter__title {
  font-family: var(--serif);
  font-size: 18.5px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
}
.chapter__n {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  flex: none;
  font-variant-numeric: tabular-nums;
}
.chapter__lien { font-size: 12.5px; color: var(--ink-3); text-decoration: none; flex: none; }
.chapter__lien:hover { color: var(--accent); }
.chapter__chev { flex: none; color: var(--ink-3); display: inline-flex; transition: transform .2s ease; }
.chapter[open] .chapter__chev { transform: rotate(90deg); }

.docs { display: flex; flex-direction: column; }

.doc {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  transition: background-color .15s;
}
.docs > .doc:first-child { border-top: none; }
.doc:hover { background: var(--surface-2); }
.doc[hidden] { display: none; }

.doc__icon { flex: none; margin-top: 2px; color: var(--ink-3); display: inline-flex; }
/* Base flexible à zéro, et non « auto » : sinon, en petite largeur, le corps
   du document est mesuré à sa taille naturelle, ne tient pas sur la ligne et
   bascule sous l'icône au lieu de se placer à côté. */
.doc__body { flex: 1 1 0; min-width: 0; }
.doc__links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 5px;
  /* Un libellé très long ou une adresse sans espace ne doit pas élargir la ligne. */
  overflow-wrap: break-word;
  min-width: 0;
}
.doc__links a {
  text-decoration: none;
  color: var(--accent);
  font-size: 15px;
  border-bottom: 1px solid transparent;
}
.doc__links a:hover { border-bottom-color: currentColor; }
.doc__sep { color: var(--ink-3); font-size: 13px; }
.doc__texte { font-size: 15px; }

.doc__note {
  color: var(--ink-2);
  font-size: 14px;
  margin-top: 4px;
  overflow-x: auto;
  overflow-wrap: break-word;
}
/* Les contenus intégrés dans les commentaires portent souvent une largeur fixe
   héritée de l'ancien site (width="610"). On la ramène à la place disponible. */
.doc__note iframe,
.doc__note video,
.doc__note table { max-width: 100%; }
.doc__note iframe { width: 100%; }
.doc__note p { margin: 0 0 6px; }
.doc__note a { color: var(--accent); }
.doc__note img { max-width: 100%; vertical-align: middle; }
.doc__note iframe { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }

.doc__aside { flex: none; display: flex; align-items: center; gap: 10px; padding-top: 3px; }
.doc__date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--flag);
  background: var(--flag-soft);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   9. Vidéos
   -------------------------------------------------------------------------- */
.video { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; margin-top: 10px; }
.video__liste { display: flex; flex-direction: column; gap: 6px; list-style: none; }
.video__choix {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  color: var(--accent);
  text-align: left;
  text-decoration: none;
  padding: 4px 0;
}
.video__choix:hover { text-decoration: underline; }
.video__choix.is-actif { font-weight: 600; }
.video__choix svg { flex: none; opacity: .8; }

.video__cadre {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.video__cadre iframe,
.video__cadre video { width: 100%; height: 100%; border: 0; display: block; }
.video__demarrer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 13px;
  width: 100%;
}
.video__demarrer:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   10. États vides, articles, recherche
   -------------------------------------------------------------------------- */
.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 44px 28px;
  text-align: center;
  color: var(--ink-2);
}
.empty h1, .empty h2, .empty h3 { font-size: 20px; color: var(--ink); margin-bottom: 8px; }
.empty p { font-size: 14.5px; max-width: 52ch; margin: 0 auto; }
.empty a { color: var(--accent); }

.article { padding: 36px 0 80px; max-width: 76ch; }
.article h2, .article h3 { margin: 30px 0 10px; font-size: 20px; }
.article h3 { font-size: 18px; }
.article p { margin-bottom: 14px; color: var(--ink-2); }
.article a { color: var(--accent); }
.article ul, .article ol { margin: 0 0 16px 22px; }
.article li { margin-bottom: 6px; color: var(--ink-2); }
.article dl { margin: 0; }
.article dt { font-weight: 600; margin-top: 18px; }
.article dt a { text-decoration: none; }
.article dt a:hover { text-decoration: underline; }
.article dd { margin: 4px 0 0; color: var(--ink-2); }
.article figure { margin: 20px 0; overflow-x: auto; }
.article iframe { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.applet { margin: 24px 0; min-height: 400px; }

.recherche-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding-top: 8px; }
.resultats__compte { margin-top: 26px; font-size: 14.5px; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   11. Formulaires et boutons
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 13px; font-weight: 500; color: var(--ink-2); }

.input, .textarea, .select {
  font: inherit;
  font-size: 14.5px;
  width: 100%;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.select { width: auto; min-width: 170px; }
.textarea {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  min-height: 140px;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  padding: 9px 15px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  transition: border-color .15s, background-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--sur-accent);
}
.btn--primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--sur-accent);
}
.btn--danger:hover { border-color: var(--flag); color: var(--flag); }
.btn--bloc { width: 100%; justify-content: center; }
.btn--ghost { border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { color: var(--flag); border-color: var(--flag); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.fieldset {
  padding: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel > .fieldset:first-child { border-top: none; }

.connexion { max-width: 420px; padding-top: 60px; padding-bottom: 90px; }
.connexion__titre { font-size: 24px; }

/* --------------------------------------------------------------------------
   12. Pied de page
   -------------------------------------------------------------------------- */
.foot { border-top: 1px solid var(--line); margin-top: 20px; }
.foot__inner {
  padding: 28px 24px 44px;
  color: var(--ink-3);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--accent); }
.foot__right { margin-left: auto; }

/* --------------------------------------------------------------------------
   13. Adaptation aux petits écrans
   -------------------------------------------------------------------------- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .video { grid-template-columns: 1fr; }
  .video__cadre { max-width: 480px; }
}

/* Entre le grand écran et le menu replié, le bandeau tient encore sur une seule
   ligne si on resserre. Sans ce palier, il passait à deux lignes dès 1050 px et
   le bandeau collant mangeait le haut de l'écran sur une tablette. */
@media (max-width: 1080px) and (min-width: 761px) {
  .topbar__inner { gap: 16px; }
  .nav__link { padding: 7px 8px; font-size: 13.5px; }
  .applis { gap: 4px; padding-left: 10px; }
  .applis__lien { padding: 6px 8px; font-size: 13px; }
  .applis__lien--logo img { height: 17px; }
}

@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .topbar__inner { min-height: 56px; gap: 12px; flex-wrap: wrap; }
  .burger { display: inline-flex; margin-left: auto; }
  .nav {
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    display: none;
    padding: 8px 0 4px;
    border-top: 1px solid var(--bar-line);
  }
  .nav.is-ouvert { display: flex; }
  .nav__link { padding: 11px 8px; }
  .nav__sep { display: none; }
  .topbar__actions { order: 2; }

  /* Dans le menu replié, les trois applications passent en tête : ce sont
     elles qu'on vient chercher. Elles gardent leur forme de pastilles, sur une
     ou deux lignes selon la largeur, et le trait qui les séparait à gauche
     passe dessous. */
  .applis {
    order: -1;
    width: 100%;
    flex-wrap: wrap;
    margin: 0 0 6px;
    padding: 2px 0 10px;
    border-left: 0;
    border-bottom: 1px solid var(--bar-line);
  }
  .applis__lien { padding: 9px 12px; }
  .applis__lien--logo { padding: 8px 11px; }

  .nav__site { flex-direction: column; align-items: stretch; width: 100%; gap: 0; }

  .toolbar { position: static; }
  .toolbar__compteur { margin-left: 0; width: 100%; }

  .hero { padding: 42px 0 34px; }
  .hero__stats { gap: 22px; }

  .doc { flex-wrap: wrap; }
  .doc__aside { width: 100%; padding-left: 30px; padding-top: 0; }
  .chapter__title { font-size: 16.5px; }
  .chapter__n { display: none; }
  .chapter__head { padding: 14px 16px; }
  .doc { padding: 13px 16px; }

  .recherche-form { flex-direction: column; align-items: stretch; }
  .select { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

@media print {
  .topbar, .toolbar, .toc, .foot, .video__cadre { display: none; }
  .chapter { break-inside: avoid; box-shadow: none; }
  body { background: #fff; color: #000; }
}
