/* =========================================================================
   MondeIT — direction « baie de brassage »
   Neutres acier froid, accent cuivre (contact RJ45), secondaire fibre (cyan).
   Signature : le rail de baie — gouttière gauche numérotée en U, qui devient
   la barre de progression de lecture sur la page article.
   ========================================================================= */

/* --- 1. Jetons ---------------------------------------------------------- */

:root {
  color-scheme: dark;

  /* Plans */
  --void: #0e1113;
  --panel: #14181b;
  --panel-2: #191e22;
  --rail: #232a2f;
  --line: #272e33;
  --line-soft: rgba(232, 236, 238, 0.09);

  /* Encres */
  --ink: #e8ecee;
  --ink-2: #a3aeb4;
  --ink-3: #717f86;

  /* Accent cuivre + secondaire fibre */
  --copper: #cd824a;
  --copper-hi: #e29a63;
  --copper-wash: rgba(205, 130, 74, 0.13);
  --fiber: #56b6cc;
  --fiber-wash: rgba(86, 182, 204, 0.12);

  /* Statuts — réservés, jamais réutilisés comme accent */
  --good: #35b06a;
  --warn: #d99a2b;
  --crit: #d9584f;

  /* Surfaces de graphique (cf. validation palette) */
  --chart-surface: #1a1a19;
  --series-1: #3987e5;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, 0.7);

  /* Typographie */
  --font-display: "DejaVu Sans Condensed", "Liberation Sans Narrow",
    "Roboto Condensed", "Archivo Narrow", "Arial Narrow", ui-sans-serif,
    system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans",
    "DejaVu Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Mono",
    "DejaVu Sans Mono", "Liberation Mono", Menlo, Consolas, monospace;

  --t-xs: 0.6875rem;
  --t-sm: 0.8125rem;
  --t-base: 1.0625rem;
  --t-md: 1.1875rem;
  --t-lg: clamp(1.3rem, 1.9vw, 1.55rem);
  --t-xl: clamp(1.65rem, 3vw, 2.15rem);
  --t-2xl: clamp(2rem, 4.4vw, 2.9rem);
  --t-3xl: clamp(2.4rem, 6vw, 3.9rem);

  /* Rythme */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;

  --shell: 1180px;
  --measure: 68ch;
  --rail-w: 3.5rem;
  --radius: 2px;
  --radius-lg: 3px;
}

/* Mode clair : appliqué si l'OS le demande, sauf bascule explicite en sombre. */
@media (prefers-color-scheme: light) {
  :root:where(:not([data-theme="dark"])) {
    color-scheme: light;
    --void: #eff1f0;
    --panel: #ffffff;
    --panel-2: #f7f9f8;
    --rail: #dee3e2;
    --line: #d7dddc;
    --line-soft: rgba(18, 23, 26, 0.1);
    --ink: #12171a;
    --ink-2: #4d585e;
    --ink-3: #6c7a80;
    --copper: #9c5a26;
    --copper-hi: #7f4719;
    --copper-wash: rgba(156, 90, 38, 0.1);
    --fiber: #12657a;
    --fiber-wash: rgba(18, 101, 122, 0.1);
    --good: #12813f;
    --warn: #8a5c00;
    --crit: #b3231a;
    --chart-surface: #fcfcfb;
    --series-1: #2a78d6;
    --shadow-1: 0 1px 2px rgba(18, 23, 26, 0.07);
    --shadow-2: 0 12px 32px -14px rgba(18, 23, 26, 0.28);
  }
}

/* La bascule manuelle l'emporte dans les deux sens. */
:root[data-theme="light"] {
  color-scheme: light;
  --void: #eff1f0;
  --panel: #ffffff;
  --panel-2: #f7f9f8;
  --rail: #dee3e2;
  --line: #d7dddc;
  --line-soft: rgba(18, 23, 26, 0.1);
  --ink: #12171a;
  --ink-2: #4d585e;
  --ink-3: #6c7a80;
  --copper: #9c5a26;
  --copper-hi: #7f4719;
  --copper-wash: rgba(156, 90, 38, 0.1);
  --fiber: #12657a;
  --fiber-wash: rgba(18, 101, 122, 0.1);
  --good: #12813f;
  --warn: #8a5c00;
  --crit: #b3231a;
  --chart-surface: #fcfcfb;
  --series-1: #2a78d6;
  --shadow-1: 0 1px 2px rgba(18, 23, 26, 0.07);
  --shadow-2: 0 12px 32px -14px rgba(18, 23, 26, 0.28);
}

/* --- 2. Réinitialisation & socle ---------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--fiber);
  text-decoration-color: color-mix(in srgb, var(--fiber) 40%, transparent);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: currentColor;
}

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

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--s-6) 0;
}

::selection {
  background: var(--copper-wash);
  color: var(--ink);
}

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

/* --- 3. Typographie ----------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.005em;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: var(--t-2xl);
}
h2 {
  font-size: var(--t-xl);
}
h3 {
  font-size: var(--t-lg);
}

p {
  margin: 0 0 1.15em;
}

/* Étiquette de matériel : petites capitales monospace, très espacées. */
.label {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.meta {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -10rem;
  z-index: 200;
  background: var(--copper);
  color: #0e1113;
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: var(--s-4);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- 4. Coquille -------------------------------------------------------- */

.shell {
  width: min(100% - 2.5rem, var(--shell));
  margin-inline: auto;
}

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

main {
  display: block;
  min-height: 60vh;
  padding-bottom: var(--s-8);
}

/* --- 5. En-tête & navigation -------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--void) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.masthead__bar {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  height: 4.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

/* Le sigle reprend le pas de brassage : deux ports, un actif. */
.brand__mark {
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--rail);
  background: var(--panel);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius);
}

.brand__mark i {
  background: var(--rail);
  display: block;
}

.brand__mark i:first-child {
  background: var(--copper);
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}

.brand__name b {
  color: var(--copper);
  font-weight: 700;
}

.brand__tagline {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 3px;
}

.nav {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.nav__liens {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

.nav__link {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav__link:hover,
.nav__link:focus-visible {
  color: var(--ink);
  background: var(--panel);
}

.nav__link[aria-current="page"] {
  color: var(--copper);
  box-shadow: inset 0 -2px 0 var(--copper);
}

/* Bloc réservé au menu déroulant en petite largeur. */
.nav__mobile {
  display: none;
}

.nav__groupe {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: var(--s-4) 0 var(--s-2);
  padding: 0 var(--s-1);
}

.masthead__tools {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--copper);
  border-color: var(--rail);
}

.icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: block;
}
:root[data-theme="light"] .theme-toggle .icon-sun,
.theme-toggle[data-mode="light"] .icon-sun {
  display: block;
}
:root[data-theme="light"] .theme-toggle .icon-moon,
.theme-toggle[data-mode="light"] .icon-moon {
  display: none;
}

/* Bandeau de catégories : rangée d'étiquettes de port sous l'en-tête. */
/* Pas d'overflow ici : un conteneur défilant rogne les sous-menus positionnés
   en absolu. Le défilement horizontal n'est rétabli qu'en petite largeur, où
   les sous-menus s'affichent en flux plutôt qu'en surimpression. */
/* La barre vit hors du bandeau collant : les catégories restent pleine taille
   en tête de page, sans amputer la fenêtre pendant toute la lecture. */
.portbar {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: relative;
  z-index: 50;
}

/* Grille plutôt que flex : les colonnes font toutes la même largeur, donc une
   rangée incomplète se répartit proprement au lieu de laisser un item orphelin
   collé à gauche. */
.portbar__inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
  align-items: stretch;
}

/* Une cellule par rubrique : elle porte le sous-menu des sous-rubriques.
   `flex: 1` répartit l'espace restant sur chaque ligne, ce qui évite qu'un
   item isolé se retrouve orphelin en bout de rangée. */
.portbar__cell {
  position: relative;
  display: flex;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: -1px;
}

.portbar__cell:first-child {
  border-left: 1px solid var(--line);
}

.portbar__chevron {
  width: 0.6rem;
  height: 0.6rem;
  color: var(--ink-3);
  flex-shrink: 0;
}

.submenu {
  position: absolute;
  top: 100%;
  left: -1px;
  min-width: 15rem;
  background: var(--panel);
  border: 1px solid var(--rail);
  border-top: 2px solid var(--cat-color, var(--copper));
  box-shadow: var(--shadow-2);
  display: none;
  flex-direction: column;
  z-index: 70;
}

/* Le survol n'ouvre le menu que là où un survol existe vraiment. Sur écran
   tactile il n'y a pas de survol : c'est le bouton chevron qui bascule
   l'attribut, géré en JavaScript. */
@media (hover: hover) {
  .portbar__cell--parent:hover .submenu {
    display: flex;
  }
}

/* Ouverture au clavier et au clic, quel que soit le périphérique. */
.portbar__cell--parent:focus-within .submenu,
.portbar__cell--parent[data-ouvert="true"] .submenu {
  display: flex;
}

.submenu__item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  /* Le retrait matérialise la profondeur dans l'arbre. */
  padding: 0.65rem var(--s-4) 0.65rem calc(var(--s-4) + var(--niveau, 0) * 0.9rem);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.submenu__item:last-child {
  border-bottom: 0;
}

.submenu__item:hover {
  background: var(--panel-2);
  color: var(--ink);
}

.portbar__item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  /* Cible confortable : 44 px de haut, taille de texte lisible sans effort. */
  min-height: 2.9rem;
  padding: 0 var(--s-4);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.portbar__item:hover {
  background: var(--panel-2);
  color: var(--ink);
}

.portbar__item[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--cat-color, var(--copper));
}

.portbar__dot {
  width: 7px;
  height: 7px;
  background: var(--cat-color, var(--copper));
  border-radius: 1px;
  flex-shrink: 0;
}

.portbar__count {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Menu mobile */
.nav-toggle {
  display: none;
}

/* --- Arborescence du menu déroulant -------------------------------------- */

.nav-arbre,
.nav-arbre ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-arbre__enfants {
  /* Décalage et filet : la filiation reste lisible sans indentation profonde. */
  margin-left: var(--s-3);
  border-left: 1px solid var(--line);
}

.nav-arbre__ligne {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.nav-arbre__ligne a {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: 1;
  min-height: 2.9rem;
  padding: 0 var(--s-3);
  font-size: 1rem;
  color: var(--ink-2);
  text-decoration: none;
}

.nav-arbre__ligne a:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.nav-arbre__compte {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Le dépliage est un bouton distinct du lien : toucher la rubrique y va,
   toucher le chevron ouvre la branche. Deux intentions, deux cibles. */
.nav-arbre__bascule {
  width: 2.9rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
}

.nav-arbre__bascule:hover {
  color: var(--copper);
  background: var(--panel-2);
}

.nav-arbre__bascule svg {
  width: 0.85rem;
  height: 0.85rem;
  transition: transform 0.15s ease;
}

.nav-arbre__bascule[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.nav-arbre__bascule[aria-expanded="true"] {
  color: var(--copper);
}

/* --- 6. Le rail de baie (signature) ------------------------------------- */

.rack {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  position: relative;
}

/* La glissière verticale, avec ses perçages réguliers. */
.rack::before {
  content: "";
  position: absolute;
  inset-block: 0;
  left: calc(var(--rail-w) - 1.5rem);
  width: 1px;
  background: var(--rail);
}

.rack-slot {
  display: contents;
}

.rack-slot__rail {
  position: relative;
  padding-top: var(--s-5);
  display: flex;
  justify-content: flex-end;
  padding-right: var(--s-5);
}

/* Le repère U : la position réelle de l'article dans la liste. */
.rack-slot__u {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  background: var(--void);
  padding: 2px 0 2px 4px;
  position: relative;
  z-index: 1;
}

/* Perçage de montage, aligné sur le haut de chaque emplacement. */
.rack-slot__rail::after {
  content: "";
  position: absolute;
  left: calc(var(--rail-w) - 1.5rem - 2.5px);
  top: calc(var(--s-5) + 0.45rem);
  width: 6px;
  height: 6px;
  border: 1px solid var(--rail);
  background: var(--void);
  border-radius: 1px;
}

.rack-slot__body {
  padding: var(--s-5) 0 var(--s-5) var(--s-2);
  border-bottom: 1px solid var(--line);
}

.rack-slot:last-child .rack-slot__body {
  border-bottom: 0;
}

/* Barre de progression de lecture : le même rail, rempli en cuivre. */
/* Le rail vit dans la marge, à gauche de la coquille : posé à l'intérieur, il
   recouvrirait le texte et les blocs de code. */
.reading-rail {
  position: fixed;
  left: calc((100vw - var(--shell)) / 2 - 1.75rem);
  top: 8rem;
  bottom: 4rem;
  width: 1px;
  background: var(--rail);
  z-index: 20;
}

.reading-rail__fill {
  position: absolute;
  inset-inline: -1px;
  top: 0;
  height: 0;
  background: var(--copper);
  box-shadow: 0 0 8px var(--copper-wash);
}

.reading-rail__pct {
  position: absolute;
  right: 0.6rem;
  top: 0;
  text-align: right;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  background: var(--void);
  padding: 2px 4px;
  white-space: nowrap;
}

@media (max-width: 1400px) {
  .reading-rail {
    display: none;
  }
}

/* --- 7. Étiquettes, pastilles ------------------------------------------- */

/* Étiquette de port de brassage : l'identité d'une catégorie. */
.port-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.3rem 0.55rem 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cat-color, var(--copper));
  background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.port-tag:hover {
  color: var(--ink);
  border-color: var(--rail);
  border-left-color: var(--cat-color, var(--copper));
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.06em;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip::before {
  content: "#";
  color: var(--ink-3);
}

.chip:hover {
  color: var(--ink);
  border-color: var(--copper);
}

.chip--plain::before {
  content: none;
}

/* Niveau de difficulté : encodé par la forme (barres) autant que le mot. */
.level {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.level__bars {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
}

.level__bars i {
  width: 3px;
  background: var(--rail);
  display: block;
}

.level__bars i:nth-child(1) {
  height: 5px;
}
.level__bars i:nth-child(2) {
  height: 8px;
}
.level__bars i:nth-child(3) {
  height: 11px;
}

.level[data-level="debutant"] .level__bars i:nth-child(1),
.level[data-level="intermediaire"] .level__bars i:nth-child(-n + 2),
.level[data-level="avance"] .level__bars i {
  background: var(--copper);
}

/* --- 8. Une : l'emplacement d'en-tête de baie --------------------------- */

.hero {
  border: 1px solid var(--line);
  border-left: 3px solid var(--cat-color, var(--copper));
  background: var(--panel);
  margin: var(--s-6) 0;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  position: relative;
  overflow: hidden;
}

.hero__body {
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.hero__title {
  font-size: var(--t-2xl);
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.hero__title a {
  color: var(--ink);
  text-decoration: none;
}

.hero__title a:hover {
  color: var(--copper);
}

.hero__summary {
  color: var(--ink-2);
  font-size: var(--t-md);
  max-width: 46ch;
  margin: 0;
}

.hero__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

.hero__media {
  position: relative;
  min-height: 18rem;
  background: var(--panel-2);
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sans illustration : un panneau de brassage dessiné en CSS. Trois ports
   actifs suffisent à animer la surface — cuivre, fibre, lien établi. */
.hero__media--panel {
  display: grid;
  place-items: center;
  padding: var(--s-6);
  background: var(--panel-2);
}

.patch {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.4rem;
  width: 100%;
  max-width: 22rem;
}

.patch__port {
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 1px 1px 2px 2px;
  background: var(--void);
  position: relative;
}

/* La diode du port, en bas à gauche comme sur un vrai panneau. */
.patch__port::after {
  content: "";
  position: absolute;
  left: 1px;
  bottom: 1px;
  width: 2px;
  height: 2px;
  background: var(--line);
}

.patch__port--copper {
  border-color: var(--copper);
}
.patch__port--copper::after {
  background: var(--copper);
  box-shadow: 0 0 4px var(--copper);
}

.patch__port--fiber {
  border-color: var(--fiber);
}
.patch__port--fiber::after {
  background: var(--fiber);
  box-shadow: 0 0 4px var(--fiber);
}

.patch__port--live::after {
  background: var(--good);
  box-shadow: 0 0 4px var(--good);
}

/* --- 9. Carte d'article ------------------------------------------------- */

.post-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-5);
  align-items: start;
}

.post-card__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.post-card__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.post-card__title {
  font-size: var(--t-lg);
  text-transform: uppercase;
  letter-spacing: 0.005em;
}

.post-card__title a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--copper), var(--copper));
  background-size: 0 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.25s ease, color 0.15s ease;
}

.post-card__title a:hover {
  color: var(--copper);
  background-size: 100% 2px;
}

.post-card__summary {
  color: var(--ink-2);
  margin: 0;
  max-width: 62ch;
}

.post-card__foot {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.post-card__thumb {
  width: 11rem;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  filter: saturate(0.85);
  transition: filter 0.2s ease;
}

.post-card:hover .post-card__thumb {
  filter: saturate(1);
}

/* --- 10. Mise en page à deux colonnes ----------------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  gap: var(--s-7);
  align-items: start;
  margin-top: var(--s-5);
}

.sidebar {
  position: sticky;
  top: 6rem;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel__head {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.panel__title {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0;
  font-weight: 500;
}

.panel__body {
  padding: var(--s-4);
}

.panel__body--flush {
  padding: 0;
}

/* Classement : le numéro porte l'information de rang. */
.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rank-list li {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}

.rank-list li:last-child {
  border-bottom: 0;
}

.rank-list__n {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--copper);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.rank-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1.4;
  display: block;
}

.rank-list a:hover {
  color: var(--copper);
}

.rank-list small {
  display: block;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* --- 11. Recherche ------------------------------------------------------ */

.search {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

.search:focus-within {
  border-color: var(--copper);
}

.search input {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  padding: 0.55rem var(--s-3);
  width: 100%;
  min-width: 0;
}

.search input::placeholder {
  color: var(--ink-3);
}

.search input:focus {
  outline: none;
}

.search button {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0 var(--s-3);
  display: grid;
  place-items: center;
  height: 100%;
}

.search button:hover {
  color: var(--copper);
}

.search svg {
  width: 1rem;
  height: 1rem;
}

.search--inline {
  max-width: 15rem;
}

/* --- 12. Titre de page -------------------------------------------------- */

.page-head {
  padding: var(--s-7) 0 var(--s-5);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.page-head__title {
  font-size: var(--t-2xl);
  text-transform: uppercase;
}

.page-head__desc {
  color: var(--ink-2);
  max-width: 62ch;
  margin: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--ink-3);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--copper);
}

.breadcrumb span[aria-hidden] {
  color: var(--rail);
}

/* --- 13. Article -------------------------------------------------------- */

.article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  gap: var(--s-7);
  align-items: start;
  margin-top: var(--s-6);
}

.article__head {
  padding: var(--s-7) 0 var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  border-bottom: 1px solid var(--line);
}

.article__title {
  font-size: var(--t-3xl);
  text-transform: uppercase;
  max-width: 22ch;
}

.article__summary {
  font-size: var(--t-md);
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 0;
}

.article__byline {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  padding-top: var(--s-3);
}

.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--copper);
  flex-shrink: 0;
  object-fit: cover;
}

.article__cover {
  width: 100%;
  max-height: 26rem;
  object-fit: cover;
  border: 1px solid var(--line);
  margin: var(--s-6) 0 0;
}

/* Sommaire collant */
.toc {
  position: sticky;
  top: 6rem;
  border-left: 1px solid var(--line);
  padding-left: var(--s-4);
}

.toc__title {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 var(--s-3);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc ul ul {
  padding-left: var(--s-3);
  margin-top: 2px;
}

.toc a {
  display: block;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.35;
  padding: 0.3rem 0;
  border-left: 2px solid transparent;
  margin-left: calc(var(--s-4) * -1 - 1px);
  padding-left: var(--s-4);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc a:hover {
  color: var(--ink);
}

.toc a.is-active {
  color: var(--copper);
  border-left-color: var(--copper);
}

/* --- 14. Prose ---------------------------------------------------------- */

.prose {
  max-width: var(--measure);
  font-size: var(--t-base);
  line-height: 1.75;
  color: var(--ink);
  padding-top: var(--s-6);
  /* Contient les images flottantes : sans contexte de formatage de bloc, une
     image habillée en fin d'article déborderait sur la carte auteur et les
     articles liés. */
  display: flow-root;
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h2,
.prose h3,
.prose h4 {
  text-transform: uppercase;
  letter-spacing: 0.01em;
  scroll-margin-top: 6rem;
}

.prose h2 {
  font-size: var(--t-xl);
  margin-top: 2.4em;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}

.prose h3 {
  font-size: var(--t-lg);
  margin-top: 2em;
}

.prose h4 {
  font-size: var(--t-md);
  margin-top: 1.8em;
  color: var(--ink-2);
}

.prose .headerlink {
  opacity: 0;
  margin-left: 0.4em;
  color: var(--copper);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.7em;
  transition: opacity 0.15s ease;
}

.prose h2:hover .headerlink,
.prose h3:hover .headerlink,
.prose .headerlink:focus-visible {
  opacity: 1;
}

.prose ul,
.prose ol {
  padding-left: 1.35em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li::marker {
  color: var(--copper);
}

.prose blockquote {
  margin: 1.6em 0;
  padding: var(--s-2) 0 var(--s-2) var(--s-5);
  border-left: 2px solid var(--copper);
  color: var(--ink-2);
  font-style: normal;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

/* --- Images de l'article : largeur et habillage ---------------------------
   Ces règles servent aussi l'éditeur (voir admin.css), pour que ce qui est
   composé corresponde à ce qui sera publié. */

.prose img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-inline: auto;
  display: block;
}

/* Texte à droite de l'image. */
.prose img.img--gauche {
  float: left;
  margin: 0.35rem var(--s-5) var(--s-4) 0;
}

/* Texte à gauche de l'image. */
.prose img.img--droite {
  float: right;
  margin: 0.35rem 0 var(--s-4) var(--s-5);
}

/* Déborde de la colonne de lecture, sans dépasser la coquille. */
.prose img.img--pleine {
  float: none;
  width: min(100vw - 2.5rem, var(--shell));
  max-width: none;
  margin-inline: calc(50% - min(100vw - 2.5rem, var(--shell)) / 2);
}

/* Un titre ne doit jamais chevaucher une image flottante restée au-dessus. */
.prose h2,
.prose h3,
.prose .highlight,
.prose table {
  clear: both;
}

@media (max-width: 720px) {
  /* En colonne étroite, l'habillage devient illisible : tout repasse en bloc. */
  .prose img.img--gauche,
  .prose img.img--droite,
  .prose img.img--pleine {
    float: none;
    width: 100%;
    margin: var(--s-4) 0;
  }
}

.prose figure {
  margin: 1.8em 0;
}

.prose figcaption {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-3);
  text-align: center;
  margin-top: var(--s-2);
}

/* Code en ligne */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--copper-wash);
  color: var(--copper-hi);
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
  word-break: break-word;
}

/* Bloc de code : un module monté en baie, avec sa plaque d'identification. */
.prose .highlight,
.code-block {
  position: relative;
  margin: 1.7em 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--rail);
  background: var(--panel-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
}

/* Bande haute réservée : elle accueille l'étiquette de langage à gauche et le
   bouton de copie à droite. Sans elle, le bouton se pose sur la première ligne
   de code au survol. */
.prose .highlight pre,
.code-block pre {
  margin: 0;
  padding: 2.2rem var(--s-4) var(--s-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

.code-copy {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.prose .highlight:hover .code-copy,
.code-block:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}

.code-copy:hover {
  color: var(--copper);
  border-color: var(--copper);
}

.code-copy[data-state="done"] {
  color: var(--good);
  border-color: var(--good);
  opacity: 1;
}

/* Tableaux */
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 1.7em 0;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: var(--s-2) var(--s-3);
  text-align: left;
}

.prose th {
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 500;
}

.prose td {
  font-variant-numeric: tabular-nums;
}

/* Encarts (extension admonition) */
.prose .admonition {
  margin: 1.7em 0;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--fiber);
  background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.prose .admonition-title {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fiber);
  margin: 0 0 var(--s-2);
}

.prose .admonition.warning,
.prose .admonition.attention {
  border-left-color: var(--warn);
}
.prose .admonition.warning .admonition-title,
.prose .admonition.attention .admonition-title {
  color: var(--warn);
}

.prose .admonition.danger,
.prose .admonition.error {
  border-left-color: var(--crit);
}
.prose .admonition.danger .admonition-title,
.prose .admonition.error .admonition-title {
  color: var(--crit);
}

.prose .admonition.tip,
.prose .admonition.success {
  border-left-color: var(--good);
}
.prose .admonition.tip .admonition-title,
.prose .admonition.success .admonition-title {
  color: var(--good);
}

.prose .footnote {
  font-size: 0.9375rem;
  color: var(--ink-2);
  border-top: 1px solid var(--line);
  margin-top: 2.5em;
  padding-top: var(--s-4);
}

/* --- 15. Bas d'article -------------------------------------------------- */

.article__tags {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  max-width: var(--measure);
}

.author-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-left: 3px solid var(--copper);
  background: var(--panel);
  margin-top: var(--s-6);
  max-width: var(--measure);
}

.author-card .avatar {
  width: 3rem;
  height: 3rem;
  font-size: var(--t-base);
}

.author-card__name {
  font-family: var(--font-display);
  font-size: var(--t-md);
  text-transform: uppercase;
  margin: 0;
}

.author-card__role {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--copper);
  margin: 2px 0 var(--s-2);
}

.author-card p {
  color: var(--ink-2);
  font-size: 0.9375rem;
  margin: 0;
}

.related {
  margin-top: var(--s-7);
}

.related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-4);
}

.related__item {
  border: 1px solid var(--line);
  border-top: 2px solid var(--cat-color, var(--copper));
  background: var(--panel);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.related__item:hover {
  border-color: var(--rail);
  border-top-color: var(--cat-color, var(--copper));
  transform: translateY(-2px);
}

.related__item h3 {
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}

/* --- 16. Commentaires --------------------------------------------------- */

.comments {
  margin-top: var(--s-8);
  max-width: var(--measure);
  scroll-margin-top: 6rem;
}

.comments__title {
  font-size: var(--t-xl);
  text-transform: uppercase;
  margin-bottom: var(--s-5);
}

.comment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line);
}

.comment__head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-2);
}

.comment__author {
  font-family: var(--font-display);
  font-size: var(--t-md);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.comment__body {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.comment__body p:last-child {
  margin-bottom: 0;
}

.comment__body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--panel-2);
  padding: 0.1em 0.3em;
  border-radius: var(--radius);
}

/* --- 17. Formulaires ---------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.field > label {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.field__hint {
  font-size: var(--t-sm);
  color: var(--ink-3);
}

.field__error {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--crit);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
select,
textarea {
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  width: 100%;
  transition: border-color 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 8rem;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow: 0 0 0 3px var(--copper-wash);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--crit);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 0.9375rem;
  color: var(--ink-2);
  cursor: pointer;
}

.checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--copper);
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--s-4);
}

.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* --- 18. Boutons -------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--copper);
  background: var(--copper);
  color: #14100c;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--copper-hi);
  border-color: var(--copper-hi);
}

.btn svg {
  width: 1rem;
  height: 1rem;
}

.btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}

.btn--ghost:hover {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--rail);
}

.btn--danger {
  background: transparent;
  color: var(--crit);
  border-color: color-mix(in srgb, var(--crit) 45%, transparent);
}

.btn--danger:hover {
  background: var(--crit);
  border-color: var(--crit);
  color: #fff;
}

.btn--sm {
  font-size: var(--t-xs);
  padding: 0.35rem 0.6rem;
  letter-spacing: 0.1em;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- 19. Pagination ----------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-7);
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  min-width: 2.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pagination a:hover {
  border-color: var(--copper);
  color: var(--copper);
}

.pagination .is-current {
  background: var(--copper);
  border-color: var(--copper);
  color: #14100c;
}

.pagination .is-gap {
  border-color: transparent;
  color: var(--ink-3);
}

/* --- 20. Messages flash ------------------------------------------------- */

.flashes {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin: var(--s-5) 0 0;
  padding: 0;
  list-style: none;
}

.flash {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9375rem;
}

.flash::before {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-shrink: 0;
}

.flash--success {
  border-left-color: var(--good);
}
.flash--success::before {
  content: "ok";
  color: var(--good);
}

.flash--error {
  border-left-color: var(--crit);
}
.flash--error::before {
  content: "échec";
  color: var(--crit);
}

.flash--warning {
  border-left-color: var(--warn);
}
.flash--warning::before {
  content: "attention";
  color: var(--warn);
}

.flash--info {
  border-left-color: var(--fiber);
}
.flash--info::before {
  content: "info";
  color: var(--fiber);
}

/* --- 21. Grille de catégories ------------------------------------------- */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-6);
}

.cat-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cat-color, var(--copper));
  border-radius: 0 var(--radius) var(--radius) 0;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.cat-card:hover {
  transform: translateX(3px);
  border-color: var(--rail);
  border-left-color: var(--cat-color, var(--copper));
}

.cat-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.cat-card__name {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}

.cat-card__count {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--cat-color, var(--copper));
  font-variant-numeric: tabular-nums;
}

/* Carte de rubrique contenant des sous-rubriques : le lien principal reste
   cliquable, la liste des enfants vit en dessous avec ses propres liens. */
.cat-card--tree {
  padding: 0;
}

.cat-card--tree:hover {
  transform: none;
}

.cat-card__link {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
  text-decoration: none;
}

.cat-card__link:hover .cat-card__name {
  color: var(--cat-color, var(--copper));
}

.cat-card__children {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--s-3);
  border-top: 1px solid var(--line);
}

.cat-card__children ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cat-card__children a {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  /* Le retrait dit la profondeur. */
  padding: 0.4rem var(--s-5) 0.4rem calc(var(--s-5) + var(--niveau, 0) * 0.9rem);
  font-size: 0.9375rem;
  color: var(--ink-2);
  text-decoration: none;
}

.cat-card__children a:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.cat-card__bullet {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--cat-color, var(--copper));
  flex-shrink: 0;
}

.cat-card__children .meta {
  margin-left: auto;
}

/* Rappel des sous-catégories en tête de page de rubrique. */
.subcats {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding-top: var(--s-2);
}

.cat-card p {
  color: var(--ink-2);
  font-size: 0.9375rem;
  margin: 0;
}

/* --- 22. Archives ------------------------------------------------------- */

.archive-year {
  margin-top: var(--s-7);
}

.archive-year__label {
  font-family: var(--font-display);
  font-size: var(--t-xl);
  text-transform: uppercase;
  color: var(--copper);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--s-2);
  font-variant-numeric: tabular-nums;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-list li {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) auto;
  gap: var(--s-4);
  align-items: baseline;
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
}

.archive-list a {
  color: var(--ink);
  text-decoration: none;
}

.archive-list a:hover {
  color: var(--copper);
}

/* --- 23. État vide ------------------------------------------------------ */

.empty {
  border: 1px dashed var(--rail);
  padding: var(--s-7) var(--s-5);
  text-align: center;
  color: var(--ink-2);
  border-radius: var(--radius);
  margin-top: var(--s-6);
}

.empty__code {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: var(--s-3);
}

.empty h2 {
  font-size: var(--t-lg);
  text-transform: uppercase;
  margin-bottom: var(--s-3);
}

/* --- 24. Pied de page --------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  margin-top: var(--s-8);
  padding: var(--s-7) 0 var(--s-5);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--s-6);
}

.footer__title {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 var(--s-3);
}

.footer__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.footer__links a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.9375rem;
}

.footer__links a:hover {
  color: var(--copper);
}

.footer__about p {
  color: var(--ink-2);
  font-size: 0.9375rem;
  max-width: 40ch;
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.footer__bottom a {
  color: var(--ink-3);
  text-decoration: none;
}

.footer__bottom a:hover {
  color: var(--copper);
}

/* --- 25. Adaptatif ------------------------------------------------------ */

@media (max-width: 1080px) {
  .layout,
  .article {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
  }

  .toc {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: var(--s-4);
    order: -1;
  }

  .toc a {
    margin-left: 0;
    padding-left: var(--s-3);
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__media {
    min-height: 12rem;
    order: -1;
  }

  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Navigation en petite largeur ---------------------------------------
   Sous 900 px, la barre de catégories cède la place : huit rubriques sur
   plusieurs lignes de libellés minuscules ne se lisent pas et n'invitent pas au
   toucher. L'arborescence est reprise dans le menu déroulant, dépliable. */

@media (max-width: 900px) {
  /* `backdrop-filter` crée un bloc conteneur : un descendant en
     `position: fixed` s'y trouve enfermé au lieu de couvrir la fenêtre. Le
     panneau de navigation en dépend, et le flou n'apporte rien ici. */
  .masthead {
    backdrop-filter: none;
    background: var(--void);
  }

  .portbar {
    display: none;
  }

  /* Le panneau passe en `position: fixed` : il sort du flux et ne pousse plus
     les outils vers le bord. On les y plaque explicitement. */
  .masthead__tools {
    margin-left: auto;
  }

  .nav-toggle {
    display: grid;
  }

  .search--inline {
    display: none;
  }

  .nav {
    position: fixed;
    inset: 4.25rem 0 0 auto;
    width: min(22rem, 100vw);
    background: var(--panel);
    border-left: 1px solid var(--rail);
    box-shadow: var(--shadow-2);
    flex-direction: column;
    align-items: stretch;
    padding: var(--s-4) var(--s-4) var(--s-7);
    margin: 0;
    display: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 80;
  }

  .nav[data-open="true"] {
    display: flex;
  }

  /* Voile : fermer en touchant à côté est le geste attendu. */
  .nav[data-open="true"]::before {
    content: "";
    position: fixed;
    inset: 4.25rem 0 0 0;
    background: color-mix(in srgb, var(--void) 65%, transparent);
    z-index: -1;
  }

  .nav__liens {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav__link {
    /* 48 px de haut : une cible confortable au pouce. */
    display: flex;
    align-items: center;
    min-height: 3rem;
    padding: 0 var(--s-3);
    font-size: 1.125rem;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }

  .nav__link[aria-current="page"] {
    box-shadow: none;
    border-left: 2px solid var(--copper);
  }

  .nav__mobile {
    display: block;
  }

  .nav__search {
    margin-bottom: var(--s-3);
  }

  .nav__search input {
    font-size: 1rem;
    padding: 0.7rem var(--s-3);
  }
}

@media (max-width: 720px) {
  :root {
    --rail-w: 2.5rem;
    --s-7: 2.25rem;
    --s-8: 3rem;
  }

  .masthead__bar {
    height: 4rem;
    gap: var(--s-3);
  }

  .nav {
    inset: 4rem 0 0 auto;
    width: 100vw;
    border-left: 0;
  }

  .nav[data-open="true"]::before {
    inset: 4rem 0 0 0;
  }

  .post-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-card__thumb {
    width: 100%;
    order: -1;
  }

  .brand__tagline {
    display: none;
  }

  .archive-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-1);
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--s-5);
  }

  .comment {
    grid-template-columns: minmax(0, 1fr);
  }

  .comment .avatar {
    display: none;
  }
}

@media print {
  .masthead,
  .portbar,
  .sidebar,
  .toc,
  .comments,
  .footer,
  .reading-rail,
  .code-copy {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .prose {
    max-width: none;
  }
}
