/* =========================================================================
   nepsi — thème "Graphite"
   Direction : sobre, neutre chaud, un seul accent bleu-acier discret.
   Pas de néon, pas de grille, pas de gadget terminal. Lisibilité d'abord.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --bg:          #16181d;
  --surface:     #1d2026;
  --surface-2:   #24272f;
  --surface-3:   #2b2f38;
  --border:      #2e323b;
  --border-soft: #262a32;

  /* Texte */
  --text:        #dcdfe5;
  --text-strong: #f2f3f5;
  --muted:       #9aa0ab;
  --muted-2:     #6c7079;

  /* Accent unique (bleu-acier sobre) */
  --accent:        #8fa0d8;
  --accent-strong: #aab6e6;
  --accent-soft:   rgba(143, 160, 216, .13);

  /* Sémantique (callouts) — versions désaturées */
  --amber:  #d8b06a;
  --danger: #d98a8a;

  /* Halo radial en haut de page (s'adapte au thème) */
  --bg-glow-top: #1b1e25;

  /* Fond des barres header/footer (contraste avec --bg, s'adapte au thème) */
  --bar-bg: #24272f;

  /* Texte du code inline `comme ceci` (s'adapte au thème, pas les blocs pre) */
  --inline-code-text: #c9cfdd;

  /* Typographie */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo,
               Consolas, monospace;

  /* Mesures */
  --maxw:      1720px;
  --readw:     72ch;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --header-h:  80px;
  --space:     clamp(1rem, 2.5vw, 1.6rem);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
  --shadow:    0 10px 30px -20px rgba(0,0,0,.7);
  --ease: cubic-bezier(.2,.6,.35,1);
}

/* ---------- Thème jour ---------- */
[data-theme="light"] {
  --bg:          #f4f6fa;
  --surface:     #ffffff;
  --surface-2:   #edf0f7;
  --surface-3:   #e2e6f0;
  --border:      #cdd3e0;
  --border-soft: #dce1ec;
  --text:        #3c4354;
  --text-strong: #111827;
  --muted:       #6b7488;
  --muted-2:     #9ba3b5;
  --accent:        #7089c9;
  --accent-strong: #5470c7;
  --accent-soft:   rgba(112, 137, 201, .12);
  --amber:  #b8862e;
  --danger: #b85252;
  --bg-glow-top: #e8ecf5;
  --bar-bg: #e2e6f0;
  --inline-code-text: #3c4354;
}

/* Transition fluide au changement de thème */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition:
    background-color .3s ease,
    color .3s ease,
    border-color .3s ease,
    box-shadow .3s ease !important;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  min-height: 100dvh;
  padding-top: var(--header-h); /* compense le header fixe */
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: clamp(15px, 1vw + 13px, 16.5px);
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-glow-top), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Le contenu grandit pour pousser le footer tout en bas de la fenetre */
#main { flex: 1 0 auto; width: 100%; }
body.is-home {
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-glow-top), transparent 70%),
    radial-gradient(1000px 700px at 50% 4vh, var(--accent-soft), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
body.is-404 {
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-glow-top), transparent 70%),
    radial-gradient(800px 560px at 50% 8vh, var(--accent-soft), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- Utilitaires ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2.5rem); }
.eyebrow {
  font-size: .76rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2);
}
.muted { color: var(--muted); }
.skip-link {
  position: absolute; left: -999px; top: .5rem;
  background: var(--accent); color: #11131a; padding: .55rem 1rem;
  border-radius: var(--radius-sm); z-index: 100; font-weight: 600;
}
.skip-link:focus { left: 1rem; }

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

/* =========================================================================
   Header — marque (g.) · nav centrée à icônes · sélecteur de langue (d.)
   ========================================================================= */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px -12px rgba(0,0,0,.45);
}
.header-inner {
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "brand nav lang";
  align-items: center;
  gap: 1rem;
  padding-block: .9rem;
}

/* Marque */
.brand {
  grid-area: brand; justify-self: start;
  display: inline-flex; align-items: center; gap: .1ch;
  font-size: 3rem; font-weight: 900; letter-spacing: -.05em; line-height: 1;
  color: var(--text-strong); text-decoration: none;
}
.brand .dot { color: var(--accent-strong); }

/* Navigation principale — segment central, plus grand */
.main-nav { grid-area: nav; justify-self: center; }
.main-nav ul {
  display: flex; align-items: center; gap: 2px; list-style: none;
  padding: 4px; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
.main-nav a {
  display: inline-flex; align-items: center; gap: .55ch;
  padding: .6rem .95rem; border-radius: var(--radius-pill);
  font-size: .95rem; font-weight: 500; color: var(--muted);
  text-decoration: none; white-space: nowrap;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.main-nav a svg { width: 18px; height: 18px; flex: none; }
.main-nav a:hover { color: var(--text-strong); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); }

/* Groupe droit du header : langue + thème */
.header-right {
  grid-area: lang; justify-self: end;
  display: inline-flex; align-items: center; gap: .45rem;
}

/* Sélecteur de langue */
.lang {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-pill);
}

/* Bascule thème */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: none;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-pill); color: var(--muted);
  transition: color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.theme-toggle:hover { color: var(--text-strong); background: var(--surface-2); }
.lang button {
  min-width: 38px; padding: .35rem .55rem; border-radius: var(--radius-pill);
  font-size: .82rem; font-weight: 600; color: var(--muted);
  transition: color .15s var(--ease), background .15s var(--ease);
}
.lang button:hover { color: var(--text-strong); }
.lang button[aria-pressed="true"] { color: #14161c; background: var(--accent); }

/* Bascule menu (non utilisée par défaut — nav reste visible et responsive) */

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5ch;
  font-size: .95rem; font-weight: 600;
  padding: .7rem 1.15rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-strong);
  text-decoration: none; transition: border-color .18s var(--ease), background .18s var(--ease), transform .1s var(--ease);
}
.btn:hover { border-color: var(--surface-3); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #12141a;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

/* ---------- 404 ---------- */
.notfound-hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: clamp(3.5rem, 10vw, 6.5rem) 1rem clamp(2.5rem, 6vw, 4rem);
  max-width: 46ch; margin-inline: auto;
}
.notfound-code {
  font-size: clamp(3.4rem, 12vw, 6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px var(--accent-soft));
}
.notfound-hero h1 {
  margin-top: 1rem;
  font-size: clamp(1.4rem, 3.6vw, 1.9rem); font-weight: 700; line-height: 1.2;
  letter-spacing: -.02em; color: var(--text-strong);
}
.notfound-hero .lede { margin-top: .8rem; font-size: 1.05rem; color: var(--muted); }
.notfound-links { margin-top: 1.9rem; display: flex; gap: .7rem; flex-wrap: wrap; justify-content: center; }

/* =========================================================================
   Cyber hero — home : mot statique + rotateur qui "tombe"
   ========================================================================= */
.cyber-hero {
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1.4rem, 3vw, 2.2rem) 1rem;
}
.cyber-hero-inner {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  width: 100%;
  text-align: center;
}
.cyber-word {
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 600; letter-spacing: .04em;
  color: var(--muted);
}
.cyber-rotator {
  position: relative;
  display: block; width: 100%;
  height: clamp(3.2rem, 7vw, 8.4rem);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%);
}
.cyber-rotator-item {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  padding-block: .2em;
  font-size: clamp(1.5rem, 4.5vw, 2.6rem);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; cursor: pointer;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px var(--accent-soft));
  opacity: 1;
  transition: transform .65s cubic-bezier(.5, 0, .2, 1), opacity .5s ease;
}
.cyber-rotator-item:hover { filter: drop-shadow(0 4px 20px var(--accent-soft)) brightness(1.15); }
.cyber-rotator-item.is-entering-start { transform: translate(-50%, calc(-50% - 2rem)); opacity: 0; }
.cyber-rotator-item.is-entering        { transform: translate(-50%, -50%);             opacity: 1; }
.cyber-rotator-item.is-current         { transform: translate(-50%, -50%);             opacity: 1; }
.cyber-rotator-item.is-leaving         { transform: translate(-50%, calc(-50% + 2rem)); opacity: 0; }


/* ---------- Home : grille articles (g.) / notes (d.) ---------- */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.6rem, 4vw, 3rem); }
.home-col .card-grid { grid-template-columns: 1fr; }
.home-col .card { --card-pad: 1rem; gap: .4rem; }
.home-col .card-img { aspect-ratio: 3 / 1; margin-bottom: 0; }
.home-col .card h3 { font-size: 1rem; }
.home-col .card p { font-size: .85rem; }
.home-col .card .read { font-size: .8rem; }
@media (max-width: 780px) {
  .home-grid { grid-template-columns: 1fr; gap: 2.2rem; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(2.2rem, 6vw, 3.6rem) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 650; letter-spacing: -.02em; color: var(--text-strong); }
.section-head .more { font-size: .9rem; font-weight: 500; color: var(--accent-strong); text-decoration: none; }
.section-head .more:hover { color: var(--accent-strong); }
.section-head.sub-head { margin-top: 2.4rem; }

/* ---------- Certifications / Réseaux ---------- */
.about-columns {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem;
}
.badge-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.badge-card {
  display: flex; align-items: center; gap: .9rem;
  padding: .9rem 1.3rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-strong); text-decoration: none;
  transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.badge-card:hover { border-color: var(--surface-3); background: var(--surface-2); transform: translateY(-2px); box-shadow: 0 8px 24px -12px var(--accent-soft); }
.badge-card .badge-icon { width: 44px; height: 44px; flex: none; color: var(--accent); }
.badge-card .badge-icon svg, .badge-card .badge-icon img { width: 100%; height: 100%; object-fit: contain; }
.badge-card .badge-name { font-weight: 600; font-size: 1.02rem; }

/* ---------- Cartes ---------- */
.card-grid { display: grid; gap: var(--space); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  --card-pad: 1.3rem;
  display: flex; flex-direction: column; gap: .55rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--card-pad); text-decoration: none; color: inherit;
  transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.card:hover { border-color: var(--surface-3); background: var(--surface-2); transform: translateY(-2px); box-shadow: 0 8px 24px -12px var(--accent-soft); }
.card-img {
  display: block; overflow: hidden;
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) .2rem;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  background: var(--surface-2);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.card:hover .card-img img { transform: scale(1.04); }
.card .meta { font-family: var(--font-mono); font-size: .74rem; color: var(--muted-2); display: flex; flex-wrap: wrap; gap: .7ch; align-items: center; }
.card .meta .tag { color: var(--accent-strong); }
.card h3 { font-size: 1.12rem; font-weight: 650; color: var(--text-strong); line-height: 1.3; letter-spacing: -.01em; }
.card p { color: var(--muted); font-size: .92rem; }
.card .read { margin-top: auto; display: inline-flex; align-items: center; gap: .4ch; font-size: .85rem; font-weight: 600; color: var(--accent-strong); }
.card .read svg { width: 14px; height: 14px; flex: none; }

/* ---------- Liste articles : 3 colonnes + recherche ---------- */
.article-grid { grid-template-columns: repeat(3, 1fr); gap: clamp(1.8rem, 2.6vw, 2.6rem); }
.article-grid .card { --card-pad: 2rem; gap: .9rem; min-height: 260px; }
.article-grid .card .meta { font-size: .82rem; }
.article-grid .card h3 { font-size: 1.4rem; }
.article-grid .card p { font-size: 1.02rem; }
.article-grid .card .read { font-size: .92rem; }
@media (max-width: 1100px) { .article-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .article-grid { grid-template-columns: 1fr; } }

.articles-search-wrap {
  display: flex; justify-content: center;
  padding: clamp(1.2rem, 3vw, 1.8rem) 0 clamp(1rem, 2.4vw, 1.4rem);
  margin-bottom: clamp(1.4rem, 3vw, 2rem);
  border-bottom: 1px solid var(--border-soft);
}
.articles-search-wrap[hidden] { display: none; }
.articles-search {
  display: flex; align-items: center; gap: .6ch;
  width: min(210px, 80vw);
  padding: .5rem .85rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 20px -16px var(--accent-soft);
  transition: width .25s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.articles-search:focus-within {
  width: min(420px, 92vw);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 10px 28px -14px var(--accent-soft);
}
.articles-search svg { width: 15px; height: 15px; flex: none; color: var(--accent); }
.articles-search-input { flex: 1; min-width: 0; background: none; border: none; outline: none; font: inherit; font-size: .86rem; color: var(--text); }
.articles-search-input::placeholder { color: var(--muted-2); }
.articles-search-input::-webkit-search-cancel-button { cursor: pointer; }

/* Barre de progression de lecture */
.read-progress {
  position: fixed; top: 0; left: 0; z-index: 200;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  pointer-events: none;
  transition: width .12s linear;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--bar-bg); border-top: 1px solid var(--border); padding: clamp(.4rem, .8vw, .6rem) 0; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: .5rem 1.8rem; justify-content: center; align-items: center; }
.site-footer .brand-group { display: flex; align-items: center; gap: .6rem; }
.site-footer .brand-sm { font-weight: 700; font-size: .98rem; color: var(--text-strong); }
.site-footer .brand-sm .dot { color: var(--accent-strong); }
.site-footer .copy { font-size: .8rem; color: var(--muted-2); }
.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); color: var(--muted);
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.social-link svg, .social-link img { width: 18px; height: 18px; object-fit: contain; }
.social-link:hover { color: var(--accent-strong); border-color: var(--surface-3); background: var(--surface-2); }

/* =========================================================================
   Guides — colonne de navigation (g.) + lecteur pleine largeur (d.)
   ========================================================================= */
.guide-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-areas: "sidebar reader";
  gap: clamp(1.4rem, 3vw, 2.4rem);
  align-items: start;
  padding-block: clamp(1.5rem, 4vw, 2.4rem);
  min-height: calc(100dvh - var(--header-h) - 4rem);
}
.guide-sidebar {
  grid-area: sidebar;
  position: sticky; top: calc(var(--header-h) + 1rem);
  max-height: calc(100dvh - var(--header-h) - 2rem); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem .75rem;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.guide-reader  { grid-area: reader; min-width: 0; }
.guide-sidebar .tree-head {
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted-2); padding: .2rem .5rem .7rem;
  border-bottom: 1px solid var(--border-soft); margin-bottom: .5rem;
}

/* Catégorie repliable */
.tree-group { margin-bottom: .2rem; }
.tree-group > summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between;
  gap: .5ch; cursor: pointer; user-select: none;
  font-size: .9rem; font-weight: 600; color: var(--text-strong);
  padding: .5rem .55rem; border-radius: var(--radius-sm);
  transition: background .15s var(--ease);
}
.tree-group > summary::-webkit-details-marker { display: none; }
.tree-group > summary:hover { background: var(--surface-2); }
/* La flèche à droite indique qu'on peut déplier */
.tree-group > summary .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .2s var(--ease); flex: none; }
.tree-group[open] > summary .chev { transform: rotate(180deg); color: var(--accent); }
.tree-group ul { list-style: none; padding: .25rem 0 .5rem; margin: 0; }
.tree-group li a {
  display: block; font-size: .88rem; color: var(--muted); text-decoration: none;
  padding: .4rem .55rem .4rem .9rem; border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.tree-group li a:hover { color: var(--text-strong); background: var(--surface-2); }
.tree-group li a[aria-current="true"] {
  color: var(--accent-strong); background: var(--accent-soft); border-left-color: var(--accent);
}

/* Sous-catégorie repliable, imbriquée dans une catégorie */
.tree-group-body { padding-left: .5rem; }
.tree-subgroup {
  margin: .1rem 0; padding-left: .3rem; border-left: 1px solid var(--border-soft);
}
.tree-subgroup > summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between;
  gap: .5ch; cursor: pointer; user-select: none;
  font-size: .84rem; font-weight: 600; color: var(--text);
  padding: .4rem .55rem; border-radius: var(--radius-sm);
  transition: background .15s var(--ease);
}
.tree-subgroup > summary::-webkit-details-marker { display: none; }
.tree-subgroup > summary:hover { background: var(--surface-2); }
.tree-subgroup > summary .chev { width: 14px; height: 14px; color: var(--muted); transition: transform .2s var(--ease); flex: none; }
.tree-subgroup[open] > summary .chev { transform: rotate(180deg); color: var(--accent); }

/* Filtre de la sidebar */
.sidebar-search {
  display: flex; align-items: center; gap: .5ch;
  margin-bottom: .6rem;
  padding: .38rem .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.sidebar-search svg { width: 13px; height: 13px; flex: none; color: var(--muted-2); }
.sidebar-search-input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  font: inherit; font-size: .85rem; color: var(--text);
}
.sidebar-search-input::placeholder { color: var(--muted-2); }
.sidebar-search-input::-webkit-search-cancel-button { cursor: pointer; }

/* Bascule de la liste (mobile uniquement) */
.sidebar-toggle {
  display: none; align-items: center; justify-content: space-between; gap: .5ch; width: 100%;
  font-size: .92rem; font-weight: 600; color: var(--text-strong);
  background: var(--surface); border: 1px solid var(--border);
  padding: .7rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
}
.sidebar-toggle .chev { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.sidebar-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* =========================================================================
   Prose (rendu Markdown)
   ========================================================================= */
.reader-header { margin-bottom: 1.7rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border-soft); }
.reader-header .meta { font-family: var(--font-mono); font-size: .78rem; color: var(--muted-2); display: flex; flex-wrap: wrap; gap: .9ch; margin-bottom: .7rem; }
.reader-header .meta .tag { color: var(--accent-strong); }
.reader-header h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); font-weight: 700; line-height: 1.15; letter-spacing: -.025em; color: var(--text-strong); }
.reader-header p.summary { margin-top: .8rem; color: var(--muted); max-width: 100%; }
.back-link {
  display: inline-flex; gap: .5ch; align-items: center;
  font-size: .88rem; font-weight: 600; color: var(--text-strong); text-decoration: none;
  margin-bottom: 1.3rem;
  padding: .5rem .9rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease), transform .15s var(--ease);
}
.back-link:hover { color: var(--accent-strong); border-color: var(--accent); background: var(--surface-2); transform: translateX(-2px); }
.back-link svg { width: 15px; height: 15px; }

.prose { max-width: 100%; }
.prose > * + * { margin-top: 1.15em; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-weight: 650; color: var(--text-strong); line-height: 1.3; letter-spacing: -.015em; margin-top: 2em; scroll-margin-top: calc(var(--header-h) + 1rem); }
.prose h2 { font-size: 1.45rem; padding-bottom: .35rem; border-bottom: 1px solid var(--border-soft); }
.prose h3 { font-size: 1.18rem; }
.prose h4 { font-size: 1.02rem; color: var(--muted); }
.prose p, .prose li { color: var(--text); }
.prose a { color: var(--accent-strong); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent-strong) 45%, transparent); }
.prose a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
.prose strong { color: var(--text-strong); font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li::marker { color: var(--muted-2); }
.prose li + li { margin-top: .35em; }
.prose blockquote { border-left: 3px solid var(--border); padding: .15em 0 .15em 1.1em; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.2em 0; }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* Images dans les articles */
.article-img {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
}
.article-img img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  box-shadow: 0 2px 18px -6px rgba(0, 0, 0, .15);
}
.article-img.img-sm img { max-width: 60%; }
.article-img.img-md img { max-width: 78%; }
.article-img.img-lg img { max-width: 90%; }
.article-img figcaption {
  font-size: .78rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}
[data-theme="dark"] .article-img img {
  border-color: var(--border);
  box-shadow: 0 4px 28px -8px rgba(0, 0, 0, .55);
}

/* Comparaison avant / après (deux captures côte à côte) */
.img-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 2rem 0; }
.img-compare-grid figure { margin: 0; display: flex; flex-direction: column; gap: .55rem; }
.img-compare-grid img {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  box-shadow: 0 2px 14px -5px rgba(0, 0, 0, .14);
}
[data-theme="dark"] .img-compare-grid img {
  border-color: var(--border);
  box-shadow: 0 4px 22px -6px rgba(0, 0, 0, .5);
}
.img-compare-grid figcaption {
  text-align: center; font-size: .74rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
@media (max-width: 640px) { .img-compare-grid { grid-template-columns: 1fr; } }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: .55rem .85rem; text-align: left; }
.prose th { background: var(--surface-2); font-weight: 650; color: var(--text-strong); }

/* Code */
.prose code { font-family: var(--font-mono); font-size: .87em; background: var(--surface-2); border: 1px solid var(--border-soft); padding: .12em .42em; border-radius: 6px; color: var(--inline-code-text); }
.prose pre { position: relative; background: #12141a; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; overflow: auto; }
.prose pre code { background: none; border: 0; padding: 0; color: #c9cfdd; font-size: .85rem; line-height: 1.65; }

/* Syntax highlighting — highlight.js tokens */
.hljs                  { background: none; padding: 0; }
.hljs-comment,
.hljs-quote            { color: #5c6780; font-style: italic; }
.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in         { color: #c792ea; }
.hljs-string,
.hljs-attr,
.hljs-selector-attr    { color: #c3e88d; }
.hljs-number,
.hljs-literal          { color: #f78c6c; }
.hljs-title,
.hljs-title.function_  { color: #82aaff; }
.hljs-type,
.hljs-class            { color: #ffcb6b; }
.hljs-variable,
.hljs-template-variable { color: #f07178; }
.hljs-params           { color: #c9cfdd; }
.hljs-operator,
.hljs-punctuation      { color: #89ddff; }
.hljs-meta,
.hljs-tag              { color: #f78c6c; }
.hljs-symbol,
.hljs-bullet           { color: #82aaff; }
.hljs-addition         { color: #c3e88d; background: rgba(195,232,141,.1); }
.hljs-deletion         { color: #f07178; background: rgba(240,113,120,.1); }
.hljs-emphasis         { font-style: italic; }
.hljs-strong           { font-weight: 700; }

/* En mode jour : fond plus clair, couleurs ajustées */
[data-theme="light"] .prose pre { background: #f6f8fa; border-color: #d0d7de; }
[data-theme="light"] .prose pre code { color: #24292f; }
[data-theme="light"] .hljs-comment  { color: #8b949e; }
[data-theme="light"] .hljs-keyword,
[data-theme="light"] .hljs-built_in { color: #cf222e; }
[data-theme="light"] .hljs-string,
[data-theme="light"] .hljs-attr     { color: #0a3069; }
[data-theme="light"] .hljs-number,
[data-theme="light"] .hljs-literal  { color: #0550ae; }
[data-theme="light"] .hljs-title,
[data-theme="light"] .hljs-title.function_ { color: #6639ba; }
[data-theme="light"] .hljs-type,
[data-theme="light"] .hljs-class    { color: #953800; }
[data-theme="light"] .hljs-variable,
[data-theme="light"] .hljs-template-variable { color: #e36209; }
[data-theme="light"] .hljs-operator,
[data-theme="light"] .hljs-punctuation { color: #24292f; }
[data-theme="light"] .hljs-params   { color: #24292f; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0, 0, 0, .88);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease);
}
.lightbox.lb-open { opacity: 1; pointer-events: all; }
.lightbox-img {
  max-width: 90vw; max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 32px 80px rgba(0, 0, 0, .6);
  transition: transform .2s var(--ease);
}
.lightbox-close {
  position: absolute; top: 1.1rem; right: 1.1rem;
  width: 38px; height: 38px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .22); }

/* Bouton copier */
.copy-btn {
  position: absolute; top: .5rem; right: .5rem;
  display: inline-flex; align-items: center; gap: .4ch;
  font-size: .74rem; font-weight: 600;
  color: var(--muted); background: var(--surface-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .28rem .6rem; cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease), opacity .15s;
  opacity: 0;
}
.prose pre:hover .copy-btn,
.prose pre:focus-within .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text-strong); background: var(--surface-2); }
.copy-btn.copied { color: var(--accent-strong); border-color: var(--accent-strong); opacity: 1; }

/* Callouts */
.callout { display: grid; grid-template-columns: 1.6rem 1fr; gap: .8rem; align-items: start;
  border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius);
  padding: .9rem 1.05rem; background: var(--surface); }
.callout .ico { font-weight: 800; font-family: var(--font-mono); text-align: center; }
.callout > div > *:first-child { margin-top: 0; }
.callout-note    { border-left-color: var(--accent); }  .callout-note .ico    { color: var(--accent-strong); }
.callout-tip     { border-left-color: var(--amber); }   .callout-tip .ico     { color: var(--amber); }
.callout-warning { border-left-color: var(--danger); }  .callout-warning .ico { color: var(--danger); }

/* États */
.state { color: var(--muted); padding: 2rem 0; }
.state.error { color: var(--danger); }

/* Temps de lecture */
.read-time { font-family: var(--font-mono); font-size: .76rem; color: var(--muted-2); }

/* Transition de contenu */
.guide-reader, #article-reader {
  transition: opacity .14s var(--ease);
}
.content-fade { opacity: 0; pointer-events: none; }

/* =========================================================================
   Articles — vue liste pleine largeur / vue lecteur deux colonnes
   ========================================================================= */
.article-reader-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
  padding-block: clamp(1.5rem, 4vw, 2.4rem);
}
.article-reader-layout[hidden] { display: none; }
#article-reader { min-width: 0; }
#article-toc {
  order: -1;
  position: sticky; top: calc(var(--header-h) + 2rem);
  max-height: calc(100dvh - var(--header-h) - 4rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: 1.1rem 1rem 1.25rem;
  box-shadow: 0 12px 30px -18px var(--accent-soft);
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.toc-head {
  font-size: .65rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1rem;
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border-soft); }
.toc > ul > li + li { margin-top: .15rem; }
.toc a {
  display: block; padding: .3rem .75rem;
  color: var(--text); text-decoration: none; line-height: 1.45;
  font-size: .875rem; font-weight: 400;
  margin-left: -2px; border-left: 2px solid transparent;
  opacity: .55;
  transition: color .16s var(--ease), border-color .16s var(--ease), opacity .16s var(--ease);
}
.toc a:hover { color: var(--text-strong); opacity: .9; border-left-color: var(--border); }
.toc a.toc-active { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; opacity: 1; }

/* Niveau 1 — titre de l'article : discret, sert de lien "retour en haut", séparé du sommaire des sections */
.toc-h1 { padding-bottom: .55rem; margin-bottom: .4rem; border-bottom: 1px solid var(--border-soft); }
.toc .toc-h1 a {
  font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); opacity: .85;
}
.toc .toc-h1 a:hover, .toc .toc-h1 a.toc-active { color: var(--text-strong); opacity: 1; }

/* Niveau 2 — grand titre : entrée principale du sommaire, toujours visible */
.toc .toc-h2 a { font-size: .87rem; font-weight: 700; color: var(--text); opacity: .8; }
.toc .toc-h2 a:hover { opacity: 1; }
.toc .toc-h2 a.toc-active { opacity: 1; }

/* Ligne d'un grand titre : lien + bouton pour déplier ses sous-titres */
.toc-row { display: flex; align-items: stretch; }
.toc-row a { flex: 1 1 auto; min-width: 0; }
.toc-toggle {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 1.9rem; margin-left: -2px; border: none; border-left: 2px solid transparent;
  background: none; color: var(--muted-2); opacity: .55; cursor: pointer;
  transition: color .16s var(--ease), opacity .16s var(--ease);
}
.toc-toggle:hover { color: var(--text-strong); opacity: .9; }
.toc-toggle svg { width: 12px; height: 12px; transition: transform .22s var(--ease); }
.toc-toggle.is-open svg { transform: rotate(90deg); }
.toc-toggle.is-open { color: var(--accent-strong); opacity: 1; }

/* Niveau 3 — sous-titre : replié par défaut, se déplie au clic ou automatiquement à la lecture */
.toc-h3-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .28s var(--ease);
}
.toc-h3-wrap.is-open { grid-template-rows: 1fr; }
.toc-h3-inner { overflow: hidden; min-height: 0; }
.toc-h3-list {
  list-style: none; margin: .15rem 0 .3rem 1.35rem; padding: 0;
  border-left: 1px dashed var(--border-soft);
}
.toc .toc-h3 a {
  padding-left: 1.05rem; font-size: .78rem; font-weight: 400;
  color: var(--muted); opacity: .8;
}
.toc .toc-h3 a:hover { color: var(--text); opacity: 1; }

/* Navigation prev/next entre articles */
.article-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}
.article-nav a {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-strong); text-decoration: none;
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.article-nav a:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); box-shadow: 0 8px 24px -14px var(--accent-soft); }
.article-nav .nav-dir { display: inline-flex; align-items: center; gap: .4ch; font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-strong); }
.article-nav .nav-dir svg { width: 14px; height: 14px; flex: none; }
.article-nav .nav-title { font-size: .95rem; font-weight: 600; }
.nav-next { text-align: right; }
.nav-next .nav-dir, .nav-next .nav-title { align-self: flex-end; }

/* Bouton retour en haut */
.back-top {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); color: var(--muted);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease), color .15s;
}
.back-top.visible { opacity: 1; transform: none; pointer-events: auto; }
.back-top:hover { color: var(--text-strong); background: var(--surface-3); }

/* =========================================================================
   Responsive
   ========================================================================= */

/* --- Grand écran : sidebar légèrement plus étroite --- */
@media (max-width: 1100px) {
  .guide-layout { grid-template-columns: 240px minmax(0, 1fr); }
}

/* --- Article reader layout : TOC disparaît sous 900px --- */
@media (max-width: 900px) {
  .article-reader-layout { grid-template-columns: 1fr; }
  #article-toc { display: none; }
}

/* --- Tablette portrait / mobile large : bascule en colonne unique --- */
@media (max-width: 860px) {
  .guide-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "reader";
    min-height: unset;
  }
  .guide-sidebar {
    position: static;
    max-height: 55dvh;
    overflow-y: auto;
    transition: max-height .35s ease, opacity .25s ease;
  }
  .guide-sidebar.sidebar-collapsed {
    max-height: 0 !important;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
  .sidebar-toggle { display: flex; }
}

/* --- Mobile : nav sur deux lignes --- */
@media (max-width: 720px) {
  :root { --header-h: 56px; }
  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand lang"
      "nav   nav";
    row-gap: .4rem;
    padding-block: .45rem;
    min-height: unset;
  }
  .brand { font-size: 1.75rem; }
  .main-nav { justify-self: center; width: 100%; }
  .main-nav ul { justify-content: center; }
  .guide-layout { gap: 1rem; padding-block: 1rem; }
  .article-reader-layout { padding-block: 1rem; }
  .hero { padding: clamp(1.8rem, 6vw, 3rem) 0 clamp(1.2rem, 3vw, 2rem); }
  .about-columns { grid-template-columns: 1fr; gap: 2.2rem; }
}

/* --- Petits mobiles : icônes seules, footer compact --- */
@media (max-width: 460px) {
  .brand { font-size: 1.45rem; }
  .main-nav a { padding: .55rem .6rem; }
  .main-nav a .label { display: none; }
  .main-nav a svg { width: 20px; height: 20px; }
  .lang button { min-width: 34px; padding: .3rem .45rem; }
  .site-footer .container { flex-direction: column; }
  .guide-sidebar { max-height: 45dvh; }
  .sidebar-toggle { font-size: .85rem; padding: .6rem .75rem; }
  .card-grid { grid-template-columns: 1fr; }
  .back-top { bottom: 1rem; right: 1rem; width: 2rem; height: 2rem; }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
