:root {
  --ink: #1d2433;
  --muted: #5f6b7d;
  --line: #e3e7ee;
  --paper: #ffffff;
  --paper-2: #f5f7fa;
  --accent: #2f3f9e;
  --accent-soft: #e9ecf8;
  --green: #138a8a;
  --code: #f1f3f7;
  --max: 1000px;
  /* Juste ce qu'il faut pour que les huit onglets tiennent sur une ligne dans la
     langue la plus verbeuse (le russe en demande ~1090) : le décalage avec la
     colonne de texte reste discret. */
  --max-bandeau: 1140px;
}
@media (prefers-color-scheme: dark) {

  :root:not([data-theme="light"]) {
    --ink: #e7eaf0;
    --muted: #a3adbf;
    --line: #2b3140;
    --paper: #14171e;
    --paper-2: #1b1f28;
    --accent: #8da2ff;
    --accent-soft: #232a45;
    --green: #3ccf9f;
    --code: #1f242f;
  }
  :root:not([data-theme="light"]) img.fig { background: #ffffff; border-radius: 10px; padding: 8px; }
}

  :root[data-theme="dark"] {
    --ink: #e7eaf0;
    --muted: #a3adbf;
    --line: #2b3140;
    --paper: #14171e;
    --paper-2: #1b1f28;
    --accent: #8da2ff;
    --accent-soft: #232a45;
    --green: #3ccf9f;
    --code: #1f242f;
  }
  :root[data-theme="dark"] img.fig { background: #ffffff; border-radius: 10px; padding: 8px; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--code); padding: 14px 18px; border-radius: 10px; overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; }
kbd { background: var(--paper-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; }

header.top {
  /* Au-dessus du sommaire collant (10) et de la barre des choix (9) : l'en-tête ouvre le menu des
     langues, et ce menu est confiné dans son contexte d'empilement — son propre z-index ne le fait
     pas sortir de celui de l'en-tête. Passait sous le bandeau du sommaire en format étroit. */
  position: sticky; top: 0; z-index: 30; backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--paper) 82%, transparent); border-bottom: 1px solid var(--line);
}
/* Le bandeau a sa propre largeur : il n'a pas à s'aligner sur la colonne de texte,
   et les onglets d'une langue verbeuse (le russe) ne tiennent pas dans --max. */
header.top .bar { max-width: var(--max-bandeau); margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
header.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); font-size: 18px; }
header.top .brand img { width: 30px; height: 30px; border-radius: 7px; }
header.top nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: nowrap; align-items: center; min-width: 0; }
header.top .tabs { display: flex; gap: 4px; flex-wrap: nowrap; min-width: 0; }
header.top nav a { color: var(--muted); padding: 6px 11px; border-radius: 8px; font-size: 15px; }
header.top nav a:hover { background: var(--paper-2); text-decoration: none; color: var(--ink); }
header.top nav a.current { color: var(--accent); background: var(--accent-soft); }

main { max-width: var(--max); margin: 0 auto; padding: 24px 20px 60px; }
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 36px; align-items: center; padding: 40px 0 20px; }
.hero h1 { font-size: 44px; line-height: 1.1; margin: 0 0 14px; letter-spacing: -0.02em; }
.hero h1 small { display: block; font-size: 20px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 8px; }
.hero p.lead { font-size: 20px; color: var(--muted); margin: 0 0 22px; }
.hero .icon { width: 128px; height: 128px; margin-bottom: 18px; } /* l icône du Mac porte sa forme et son ombre */
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-block; padding: 11px 18px; border-radius: 10px; font-weight: 600; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn:hover { text-decoration: none; filter: brightness(1.04); }
.note-small { color: var(--muted); font-size: 16px; }

h2 { font-size: 30px; margin: 54px 0 14px; letter-spacing: -0.01em; }
h3 { font-size: 21px; margin: 32px 0 10px; }
h4 { font-size: 17px; margin: 22px 0 6px; }
p, li { max-width: 78ch; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
.card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 16.5px; }
figure { margin: 26px 0; }
figure img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
/* A picture alone stays the size of a page illustration, not the width of the text; pairs (.two)
   share the width, and window captures (.shot) keep it. */
figure > img.fig { max-width: min(100%, 440px); }
.two figure > img.fig { max-width: 100%; }
figure.wide > img { max-width: min(100%, 720px); }
figure.frame img { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.10); }
figcaption { color: var(--muted); font-size: 16px; text-align: center; margin-top: 10px; max-width: 70ch; margin-left: auto; margin-right: auto; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
table { border-collapse: collapse; width: 100%; font-size: 15.5px; margin: 16px 0; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
table.symbols td { vertical-align: middle; }
table.symbols img.sym { height: 30px; width: auto; display: block; background: #ffffff; border-radius: 4px; }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 18px 0; }
.callout.ok { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--paper)); }
.callout p:last-child { margin-bottom: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 46px; margin: 14px 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: white; font-weight: 700; display: grid; place-items: center; font-size: 15px;
}
.toc { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px; margin: 18px 0 30px; }
.toc ul { margin: 6px 0 0; padding-left: 18px; columns: 2; }
.toc li { margin: 3px 0; }
.ui { font-weight: 600; }
.formula { font-family: "STIX Two Text", "Times New Roman", serif; font-size: 1.1em; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
footer .bar { max-width: var(--max-bandeau); margin: 0 auto; padding: 22px 20px; display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; }
/* Le même seuil que la barre latérale : une seule idée de « format étroit » pour tout le site. En dessous,
   les onglets ne tiennent plus sur la ligne de la marque, et s'enrouler leur coûte plus haut que glisser. */
@media (max-width: 1100px) {
  /* Sept onglets sur un écran de téléphone s'enroulaient sur trois rangées : l'en-tête, collant, mangeait
     un cinquième de la hauteur avant qu'une ligne de texte paraisse. Ils prennent maintenant une ligne à
     eux, sous la marque, et se font glisser du doigt. Le menu des langues et le bouton jour/nuit restent
     hors du défilement : « overflow-x » impose un rognage vertical, qui couperait le menu déroulant. */
  header.top .bar { flex-wrap: wrap; gap: 10px; row-gap: 4px; padding-bottom: 6px; }
  header.top .langs, header.top #theme-toggle { order: 1; }
  header.top .langs { margin-left: auto; }
  header.top nav { order: 2; flex: 0 0 100%; margin-left: 0; }
  header.top .tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -ms-overflow-style: none; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    padding-bottom: 2px; }
  header.top .tabs::-webkit-scrollbar { display: none; }
  header.top .tabs a { flex: 0 0 auto; scroll-snap-align: center; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 20px; }
  .hero h1 { font-size: 34px; }
  .two { grid-template-columns: 1fr; }
  .toc ul { columns: 1; }
}
header.top nav a.lang { margin-left: 8px; border: 1px solid var(--line); padding: 5px 10px; }

/* Day/night button and lightbox */
#theme-toggle { margin-left: 6px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); border-radius: 8px; width: 34px; height: 32px; font-size: 17px; cursor: pointer; }
#theme-toggle:hover { background: var(--accent-soft); }
figure img.zoomable { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; background: rgba(10, 12, 18, 0.88); cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(96vw, 1600px); max-height: 84vh; width: auto; height: auto; background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .caption { color: #dfe3ea; font-size: 15px; text-align: center; max-width: 80ch; margin: 0; }
.lightbox .close { position: fixed; top: 16px; right: 20px; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255,255,255,.15); color: #fff; font-size: 26px; cursor: pointer; }

.btn.store { font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif; letter-spacing: 0.01em; }
.btn.store:not(.primary) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 10px; padding: 8px 16px 8px 13px; font-weight: 600; font-size: 15.5px; line-height: 1.15; letter-spacing: 0.01em; }
.badge:hover { text-decoration: none; filter: brightness(1.15); }
.badge small { display: block; font-weight: 400; font-size: 11px; opacity: .8; line-height: 1; margin-bottom: 3px; }
.badge svg { width: 24px; height: 24px; fill: currentColor; flex: none; }

.actions.badges img { height: 48px; width: auto; display: block; }
.actions.badges a:has(img) { display: inline-block; line-height: 0; }
.actions.badges .btn { padding: 12px 18px; }

/* Skip link: visible only when focused (keyboard, screen readers) */
/* Hidden by clipping rather than pushed off to the left: off to the left, a right-to-left page (Arabic) could
   be scrolled sideways to reach it. */
.skip { position: absolute; inset-inline-start: 8px; top: 8px; background: var(--accent); color: #fff; padding: 6px 10px;
  border-radius: 6px; z-index: 10; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip:focus { clip-path: none; width: auto; height: auto; overflow: visible; }

/* Choix de la langue : un menu natif, sans script — il fonctionne même si le JavaScript est refusé. */
/* Sans cela, le chevron ▾ passe seul à la ligne dès que la barre est serrée,
   et la boîte de langue double de hauteur. */
.langs { position: relative; display: inline-block; flex: none; white-space: nowrap; }
.langs > summary { cursor: pointer; list-style: none; padding: 0.15rem 0.4rem; border-radius: 6px; }
.langs > summary::-webkit-details-marker { display: none; }
.langs > summary::after { content: " ▾"; opacity: 0.6; }
.langs > summary:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.langs ul { position: absolute; right: 0; z-index: 20; margin: 0.3rem 0 0; padding: 0.35rem;
            list-style: none; min-width: 11rem; border-radius: 10px;
            background: var(--paper, #fff); border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
            box-shadow: 0 8px 28px rgba(0,0,0,0.16); }
.langs li { padding: 0.2rem 0.5rem; white-space: nowrap; }
.langs li[aria-current] { opacity: 0.55; }
.langs a { text-decoration: none; display: block; }

/* Plateforme et version. TreeLevel ne se pilote pas pareil sur les trois systèmes, et 1.2 n'apporte pas
   partout les mêmes espaces : le lecteur dit où il est, et la page s'y tient. Sans script, rien n'est caché. */
.chooser{display:flex;flex-wrap:wrap;gap:14px;align-items:center;margin:0 0 22px;padding:10px 12px;
  border:1px solid var(--line);border-radius:10px;background:var(--paper-2);font-size:14px;
  /* Elle reste sous les yeux : c'est un réglage qu'on veut pouvoir changer en lisant, pas seulement
     avant de lire. Elle se colle sous l'entête, dont la hauteur est publiée par le script. */
  position:sticky;top:calc(var(--top-h, 0px) + 8px);z-index:9;
  box-shadow:0 2px 10px color-mix(in srgb, var(--ink) 8%, transparent)}
.chooser .group{display:flex;gap:6px;align-items:center}
.chooser .label{color:var(--muted);margin-right:2px}
.chooser button{font:inherit;color:var(--ink);background:transparent;border:1px solid var(--line);
  border-radius:6px;padding:3px 10px;cursor:pointer}
.chooser button:hover:not(:disabled){border-color:var(--accent)}
.chooser button[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:#fff}
.chooser button:disabled{opacity:.4;cursor:not-allowed}

/* Le sommaire n'est plus un bloc en tête de page — il disparaissait au premier défilement, ce qui est
   exactement ce qu'un sommaire ne doit pas faire. Large, c'est une colonne qui suit le défilé sous
   l'en-tête, dont site.js mesure la hauteur réelle dans --top-h. Étroit, la colonne n'a plus la place :
   elle devient une barre repliée, collante elle aussi, qui s'ouvre en panneau par-dessus le texte. */
main.withaside { max-width: 1240px; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 38px; }
/* C'est la colonne elle-même qui colle, pas le bloc qu'elle contient. Un élément collant ne voyage que
   dans son bloc conteneur : posé sur le <nav>, il n'avait pour course que la hauteur du <nav>, c'est-à-dire
   rien, et s'en allait avec la page. Posé sur l'élément de grille, son conteneur est la zone de grille —
   toute la hauteur de la rangée —, et « align-self: start » l'empêche d'être étiré à cette hauteur. */
.sidebar { position: sticky; top: calc(var(--top-h, 0px) + 14px); align-self: start; }
.sidebar nav { font-size: 14.5px; max-height: calc(100vh - var(--top-h, 0px) - 30px); overflow-y: auto; }
.sidebar summary { list-style: none; cursor: default; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; padding: 0 8px 6px; }
.sidebar summary::-webkit-details-marker, .sidebar summary::marker { display: none; content: ""; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 1px 0; max-width: none; }
.sidebar a { display: block; padding: 4px 8px; border-radius: 7px; color: var(--muted); text-decoration: none; }
.sidebar a:hover { background: var(--paper-2); color: var(--ink); }
.sidebar .here > a { color: var(--ink); font-weight: 600; background: var(--accent-soft); }
.sidebar .here > ul { margin: 3px 0 10px 12px; border-left: 1px solid var(--line); padding-left: 6px; }
.sidebar .here > ul a { font-size: 13.5px; padding: 3px 8px; }

@media (max-width: 1080px) {
  main.withaside { display: block; max-width: var(--max); }
  .sidebar { position: sticky; top: var(--top-h, 0px); z-index: 10; margin: 0 -20px 18px; padding: 0 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .sidebar nav { position: static; max-height: none; overflow: visible; }
  .sidebar details { position: relative; }
  .sidebar summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 0; text-transform: none; font-size: 15px; color: var(--ink); font-weight: 600; }
  .sidebar summary::after { content: "▾"; color: var(--muted); font-weight: 400; transition: transform .15s; }
  .sidebar details[open] summary::after { transform: rotate(180deg); }
  /* Le panneau se pose par-dessus le texte : la barre garde ainsi la même hauteur, ouverte ou fermée,
     et la barre des choix qui la suit n'a pas à se déplacer. */
  .sidebar details[open] > ul { position: absolute; left: -20px; right: -20px; top: 100%; z-index: 11;
    background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 16px 34px rgba(0,0,0,.14);
    max-height: 60vh; overflow-y: auto; padding: 10px 20px 16px; }
  .sidebar .here > ul { columns: 2; margin-left: 10px; }
  .chooser { top: calc(var(--top-h, 0px) + var(--toc-h, 0px) + 8px); }
}
@media (max-width: 700px) { .sidebar .here > ul { columns: 1; } }

/* Accueil : l'encadré qui mène à Laue Plan, la version 2D. */
.plan-callout { display: flex; align-items: center; gap: 14px; margin: 18px 0 0; padding: 12px 16px; max-width: 580px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.plan-callout:hover { border-color: var(--accent); }
.plan-callout img { width: 52px; height: 52px; flex: none; }
.plan-callout strong { color: var(--accent); }
.plan-callout .go { margin-inline-start: auto; padding-inline-start: 8px; color: var(--accent); font-size: 22px; }
[dir="rtl"] .plan-callout .go { transform: scaleX(-1); }

/* Accueil : les trois gestes, numérotés. */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; margin: 20px 0; }
.step { background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; counter-increment: step; }
.step h3 { margin: 0 0 8px; font-size: 18px; }
.step h3::before { content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px; margin-inline-end: 10px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 15px; vertical-align: 2px; }
.step p { margin: 0 0 12px; color: var(--muted); font-size: 16.5px; }
.step img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.why { font-size: 19px; line-height: 1.6; max-width: 70ch; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.hero-actions .badges { margin-top: 0; }
figure.shot { margin: 10px 0 30px; }
figure.shot img { width: 100%; }

/* The names of the apps in the running text: « Laue », « Laue Plan ». */
strong.app em { font-style: italic; }

/* Le sommaire de chaque page (sauf l'accueil), repris du site de TreeLevel. Large, c'est une colonne qui
   suit le défilé sous l'en-tête, dont site.js mesure la hauteur dans --top-h ; étroit, une barre repliée,
   collante elle aussi, qui s'ouvre en panneau par-dessus le texte. La colonne elle-même colle (pas le
   <nav>), et « align-self: start » l'empêche d'être étirée à la hauteur de la rangée. */
main.withaside { max-width: 1240px; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 38px; }
.pagebody { min-width: 0; }
.sidebar { position: sticky; top: calc(var(--top-h, 0px) + 14px); align-self: start; }
.sidebar nav { font-size: 14.5px; max-height: calc(100vh - var(--top-h, 0px) - 30px); overflow-y: auto; }
.sidebar summary { list-style: none; cursor: default; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; padding: 0 8px 6px; }
.sidebar summary::-webkit-details-marker, .sidebar summary::marker { display: none; content: ""; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 1px 0; max-width: none; }
.sidebar a { display: block; padding: 4px 8px; border-radius: 7px; color: var(--muted); text-decoration: none; }
.sidebar a:hover { background: var(--paper-2); color: var(--ink); }
.sidebar a.here { color: var(--ink); font-weight: 600; background: var(--accent-soft); }
.sidebar li > ul { margin: 2px 0 6px 12px; border-left: 1px solid var(--line); padding-left: 6px; }
.sidebar li > ul a { font-size: 13.5px; padding: 3px 8px; }
/* Une ancre atteinte ne doit pas finir sous l'en-tête collant. */
.pagebody h2[id], .pagebody h3[id] { scroll-margin-top: calc(var(--top-h, 60px) + 16px); }

@media (max-width: 1080px) {
  main.withaside { display: block; max-width: var(--max); }
  .sidebar { position: sticky; top: var(--top-h, 0px); z-index: 10; margin: 0 -20px 18px; padding: 0 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .sidebar nav { position: static; max-height: none; overflow: visible; }
  .sidebar details { position: relative; }
  .sidebar summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 0; text-transform: none; font-size: 15px; color: var(--ink); font-weight: 600; }
  .sidebar summary::after { content: "▾"; color: var(--muted); font-weight: 400; transition: transform .15s; }
  .sidebar details[open] summary::after { transform: rotate(180deg); }
  .sidebar details[open] > ul { position: absolute; left: -20px; right: -20px; top: 100%; z-index: 11;
    background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 16px 34px rgba(0,0,0,.14);
    max-height: 60vh; overflow-y: auto; padding: 10px 20px 16px; }
  .pagebody h2[id], .pagebody h3[id] { scroll-margin-top: calc(var(--top-h, 60px) + 64px); }
}

/* Formulas: a folding box per section, and a switch at the top of the page that opens or closes them all. */
.formula-switch { margin: 4px 0 18px; font-size: 15px; color: var(--muted); }
.sidebar .formula-switch { margin: 14px 8px 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
@media (max-width: 1080px) {
  .sidebar nav { display: flex; align-items: center; gap: 12px; }
  .sidebar nav > details { flex: 1; }
  .sidebar .formula-switch { margin: 0; padding: 0; border: 0; white-space: nowrap; }
}
.formula-switch label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
details.formulas { margin: 18px 0 26px; border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; }
details.formulas > summary { cursor: pointer; padding: 8px 0; font-weight: 600; color: var(--muted); font-size: 15px; }
details.formulas[open] { padding-bottom: 12px; }
details.formulas .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
details.formulas p { margin: 10px 0; }

/* A gallery of patterns: four across, two on a narrow screen. */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 22px 0 30px; }
.gallery figure { margin: 0; }
.gallery figure > img.fig { max-width: 100%; border-radius: 10px; }
.gallery figcaption { font-size: 13.5px; }
@media (max-width: 760px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
/* Formulas read left to right, even on a right-to-left page. */
.katex, .katex-display { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .katex-display { text-align: center; }

.gallery.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .gallery.three { grid-template-columns: 1fr 1fr; } }

/* The manual: each chapter goes from the theory to the app, marked by a small heading that stays out of the contents. */
p.kicker { margin: 26px 0 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent, var(--muted)); }
h2 + p.kicker { margin-top: 4px; }

/* The three guides: one per use of the app, as a segmented switch under the lead. */
nav.public-switch { display: inline-flex; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 15px; }
nav.public-switch > a, nav.public-switch > span { padding: 6px 16px; text-decoration: none; color: var(--ink); }
nav.public-switch > a + *, nav.public-switch > span + * { border-left: 1px solid var(--line); }
nav.public-switch > a:hover { background: var(--paper-2); }
nav.public-switch > span[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
/* « En classe » : an activity and the usual difficulties, beside the theory. */
aside.classe { margin: 18px 0 22px; padding: 10px 16px; border-left: 3px solid var(--green); background: var(--paper-2); border-radius: 0 10px 10px 0; }
aside.classe p { margin: 6px 0; }
ul.refs li { margin: 6px 0; font-size: 15px; }

/* Un badge de magasin où rien n'est encore publié : l'image reste, le lien non — un badge qui mène à
   une page d'erreur vaut moins que pas de badge. La ligne datée dit quand il s'allumera. */
.actions.badges span.soon { display: inline-block; line-height: 0; opacity: .4; filter: grayscale(1); cursor: default; }
.note-small.soon-line { font-weight: 600; margin-bottom: 2px; }

/* RPad : l'emplacement d'une capture pas encore faite (tools/build.py) — visible en aperçu local,
   refusé à la publication par tools/maintenance.php. */
.capture-a-faire { display: grid; place-items: center; aspect-ratio: 4 / 3; max-width: 100%; margin: 0 auto;
  border: 2px dashed var(--muted); border-radius: 14px; background: var(--paper-2); color: var(--muted);
  font: 600 16px/1.4 "SF Mono", Menlo, Consolas, monospace; }
.capture-a-faire span::before { content: "📷 "; }
figure.shot .capture-a-faire { aspect-ratio: 4 / 3; width: min(100%, 900px); }

/* Les formules de prix. */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin: 26px 0; }
.plan { background: var(--paper-2); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; }
.plan.best { border: 2px solid var(--accent); }
.plan h3 { margin: 0 0 6px; font-size: 20px; }
.plan .price { font-size: 30px; font-weight: 700; margin: 4px 0 10px; color: var(--ink); }
.plan p { margin: 0 0 8px; color: var(--muted); font-size: 16.5px; }
.pkgs { columns: 3 14em; column-gap: 28px; padding-inline-start: 18px; }
.pkgs li { break-inside: avoid; }
