/*
 * Epure Works — one stylesheet for the whole site.
 *
 * The look is GeoSim's own, the "situation room" direction of its theme
 * (theme/geosim.tres and data/themes/geosim.json in the game's repository):
 * warm grey panels almost opaque with a light grain, on a warm stone ground,
 * strips from edge to edge, tabs in spaced capitals, and one typeface,
 * Manrope. Every colour is a token below, taken from the game's Palette.
 *
 * The active state reads as brighter text, never as an ornament beside it:
 * no accent bar, no hover pad, no drop shadow. Corners are the game theme's
 * 4 pixels.
 */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(../fonts/manrope-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(../fonts/manrope-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* The game's Palette (theme/geosim.tres), on a ground of warm stone: in the
     game the panels float over the blurred globe, never over a flat black. */
  --background: #3b3630;
  --panel: #24211d;          /* the game's panel, #26231F at 0.92 */
  --surface: #1c1a17;        /* insets: formulas, charts */
  --surface-alt: #2a2721;
  --text: #e8e4da;
  --text-bright: #f4f1ea;
  --text-dim: #918d86;
  --text-muted: #a9a399;
  --line: rgba(232, 228, 218, 0.12);
  --line-strong: rgba(232, 228, 218, 0.22);
  --accent: #c86839;
  --live: #ffb56b;           /* the GeoSim theme's live colour: what is current */
  --positive: #6e9e6a;
  --negative: #c05a4e;
  --focus: #ffb56b;
  --radius: 4px;

  /* Chart series, validated for colour-blind separation on the dark surfaces. */
  --s1: #d27a4c;
  --s2: #5a93d4;
  --s3: #62a868;
  --s4: #a86fb0;

  /* The four statuses of a parameter, and the two that are not a source. */
  --etude-ink: #9ccf9f;   --etude-bg: rgba(110, 158, 106, 0.18);
  --plage-ink: #9dbfe8;   --plage-bg: rgba(90, 147, 212, 0.18);
  --calcul-ink: #c3adeb;  --calcul-bg: rgba(168, 111, 176, 0.2);
  --choix-ink: #ffcf9e;   --choix-bg: rgba(255, 181, 107, 0.14);
  --autre-ink: #cdc7bc;   --autre-bg: rgba(232, 228, 218, 0.08);

  /* The grain of the game's panels, held still: a page has no frame to redraw it on. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");

  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;
  --gutter: 16px;
  --edge: 16px;              /* the page runs from edge to edge, 16 pixels in */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background-color: var(--background); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  background-image: var(--grain);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.62;
  font-feature-settings: 'kern';
}

a { color: var(--text-bright); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--text-bright); letter-spacing: -0.01em; }
h1 { font-size: 2.2rem; font-weight: 800; margin: 0 0 0.35em; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; margin: 1.8em 0 0.6em; }
h3 { font-size: 1.1rem; margin: 1.6em 0 0.5em; }
h4 { font-size: 1rem; margin: 1.4em 0 0.4em; }
h2, h3, section[id] { scroll-margin-top: 16px; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin: 0.3em 0; }
li::marker { color: var(--text-dim); }
strong { font-weight: 700; color: var(--text-bright); }
sup, sub { line-height: 0; }

code {
  font-family: var(--mono);
  font-size: 0.84em;
  color: var(--text-bright);
  background: var(--surface-alt);
  padding: 0.08em 0.34em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}
pre { font-family: var(--mono); font-size: 0.86em; background: var(--surface); padding: 12px 16px; overflow-x: auto; border-radius: var(--radius); }

.dim { color: var(--text-dim); }
.num { font-variant-numeric: tabular-nums; }

/* Spaced capitals: the game's NavTab, EntityName and column headers. */
.kicker, .strip-tabs a, .sidebar h2, .rail h2, .block-kicker, .label, th, .lab-kicker, .fiche dt, .stat .l, .pager .dir, .card-codes {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

/* --- Panels -------------------------------------------------------------------- */

.block, .lab, .fiche, .card, .rail-box, .sidebar-body {
  background-color: var(--panel);
  background-image: var(--grain);
  border-radius: var(--radius);
}

/* --- The top strip ---------------------------------------------------------------- */

.strip {
  background-color: var(--panel);
  background-image: var(--grain);
  width: 100%;
}
.strip-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 var(--edge);
  min-height: 48px;
}
.wordmark {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-bright);
  text-decoration: none;
  white-space: nowrap;
}
.strip-tabs { display: flex; gap: 26px; flex-wrap: wrap; }
.strip-tabs a { color: var(--text-dim); text-decoration: none; padding: 15px 0; }
.strip-tabs a:hover, .strip-tabs a[aria-current] { color: var(--text-bright); }
.strip-status { margin-left: auto; color: var(--text-dim); white-space: nowrap; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; }
.strip-status .live { color: var(--live); }

/* --- Plain pages (home, GeoSim, credits) ------------------------------------------- */

.plain { flex: 1; width: 100%; padding: 14vh var(--edge) 18vh; }
.plain h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 800; letter-spacing: -0.03em; margin: 0 0 0.4em; }
.plain .links { display: flex; gap: 28px; flex-wrap: wrap; }
.plain .links a { color: var(--text-dim); text-decoration: none; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; }
.plain .links a:hover { color: var(--text-bright); }
.plain.credits { padding-top: 6vh; }
.plain.credits > * { max-width: 760px; }
.plain.credits h1 { font-size: 2.2rem; }
/* A licence's wording is quoted as it is: no ligature turns (c) into a sign. */
.plain.credits p { font-variant-ligatures: none; font-feature-settings: 'calt' 0; }

/* --- Documentation layout ----------------------------------------------------------- */

.docs {
  flex: 1;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 280px;
  gap: 16px;
  width: 100%;
  padding: 16px var(--edge) 32px;
  align-items: start;
}
.docs-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.sidebar { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; font-size: 0.88rem; scrollbar-width: thin; }
.sidebar-body { padding: 14px 16px 16px; }
.sidebar-toggle { display: none; }
.sidebar h2 { color: var(--text-dim); margin: 18px 0 6px; font-size: 0.66rem; }
.sidebar h2:first-child { margin-top: 2px; }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin: 0; }
.sidebar a { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; text-decoration: none; color: var(--text-dim); line-height: 1.35; }
.sidebar a:hover { color: var(--text-bright); }
.sidebar a[aria-current] { color: var(--text-bright); font-weight: 700; }
.sidebar .eq { color: var(--text-dim); opacity: 0.75; font-size: 0.8em; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }

.rail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.rail-box { padding: 14px 16px 16px; font-size: 0.84rem; }
.rail h2 { color: var(--text-dim); margin: 0 0 8px; font-size: 0.66rem; }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail li { margin: 0; }
.rail .toc a { display: block; padding: 3px 0; text-decoration: none; color: var(--text-dim); line-height: 1.35; }
.rail .toc a:hover, .rail .toc a.here { color: var(--text-bright); }
.rail .toc .level-3 { padding-left: 12px; }

/* Without the script, the fiche stays where it is written, in the page. */
.js .docs-main .fiche { display: none; }

@media (max-width: 1240px) {
  .docs { grid-template-columns: 224px minmax(0, 1fr); }
  .rail { display: none; }
  .js .docs-main .fiche { display: block; }
}
@media (max-width: 860px) {
  .docs { display: flex; flex-direction: column; align-items: stretch; padding: 12px var(--gutter) 24px; }
  .strip-inner { padding: 0 var(--gutter); gap: 18px; flex-wrap: wrap; }
  .strip-status { display: none; }
  .sidebar { position: static; max-height: none; overflow: visible; }
  .sidebar-body { padding: 0 16px; }
  .sidebar-toggle {
    display: flex; justify-content: space-between; width: 100%;
    background: none; border: 0; padding: 12px 0; font: inherit; color: var(--text-bright); cursor: pointer;
  }
  .sidebar-toggle .dim { font-size: 0.9em; }
  .sidebar .sidebar-links { display: none; padding-bottom: 12px; }
  .sidebar.open .sidebar-links { display: block; }
  h1 { font-size: 1.8rem; }
  .plain { padding: 10vh var(--gutter) 14vh; }
}

/* --- Blocks: the page head, a mechanic, a text ----------------------------------------- */

.block { padding: 22px 26px 24px; }
.block > :first-child { margin-top: 0; }
.block > :last-child { margin-bottom: 0; }
.block-head { display: flex; flex-direction: column; gap: 4px; margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.block-kicker { color: var(--text-dim); margin: 0; }
.block-kicker .code-name { font-family: var(--mono); text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 8px; }
.block-head h2 { margin: 0; font-size: 1.4rem; }
.block h3 { font-size: 1.05rem; }

.page-head { padding: 26px 26px 24px; }
.kicker { color: var(--text-dim); margin: 0 0 10px; }
.lede { font-size: 1.08rem; color: var(--text); max-width: 700px; margin-bottom: 0; }
.page-head .lede + * { margin-top: 18px; }

.notice {
  border: 1px solid rgba(255, 181, 107, 0.35);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 18px 0 0;
  font-size: 0.92rem;
}
.notice strong { color: var(--live); }

.stats { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 22px 0 0; }
.stat .n { font-size: 1.9rem; font-weight: 600; line-height: 1.1; color: var(--text-bright); font-variant-numeric: tabular-nums; }
.stat .l { color: var(--text-dim); font-size: 0.66rem; margin-top: 4px; }

/* "En clair" and "Dans la partie": what an equation says in words, and what the player sees of it. */
.plain-words { margin: 0 0 18px; }
.plain-words .label { color: var(--live); margin: 0 0 4px; }
.plain-words p { font-size: 1.02rem; color: var(--text-bright); }
.plain-words p:last-child { margin-bottom: 0; }
.in-game { margin: 0 0 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.in-game .label { color: var(--text-dim); margin: 0 0 4px; }
.in-game p:last-child { margin-bottom: 0; }

.symbols { font-size: 0.9rem; color: var(--text-muted); }
.impl { font-size: 0.88rem; color: var(--text-dim); }

/* --- Status tags ------------------------------------------------------------------------- */

.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.55;
  padding: 0 7px;
  border-radius: 3px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.tag.etude { color: var(--etude-ink); background: var(--etude-bg); }
.tag.plage { color: var(--plage-ink); background: var(--plage-bg); }
.tag.calcul { color: var(--calcul-ink); background: var(--calcul-bg); }
.tag.choix { color: var(--choix-ink); background: var(--choix-bg); }
.tag.autre { color: var(--autre-ink); background: var(--autre-bg); }
.tags { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.legend-tags { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 14px 0 20px; font-size: 0.88rem; color: var(--text-muted); }
.legend-tags span.tag { margin-right: 7px; }

/* --- Formulas, tables ----------------------------------------------------------------------- */

.formula {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin: 12px 0;
  overflow-x: auto;
  overflow-y: hidden;
  color: var(--text-bright);
}
.formula .katex-display { margin: 0.3em 0; }
.katex { font-size: 1.06em; }

.table-wrap { overflow-x: auto; margin: 12px 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: 0.84rem; line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); }
th { color: var(--text-dim); font-size: 0.64rem; white-space: nowrap; padding-top: 4px; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; overflow-wrap: normal; }
table.params td:first-child { min-width: 180px; }
table.params td:nth-child(2) { min-width: 96px; color: var(--text-bright); }

/* --- The fiche: a mechanic at a glance, 280 wide like the game's panels ---------------------- */

.fiche { padding: 16px 16px 14px; }
.fiche-kicker { color: var(--text-dim); margin: 0 0 8px; }
.fiche-name { font-size: 1rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-bright); margin: 0; line-height: 1.25; }
.fiche-code { margin: 5px 0 12px; font-size: 0.8rem; }
.fiche dl { margin: 0; font-size: 0.82rem; }
.fiche dt { color: var(--text-dim); font-size: 0.62rem; padding-top: 9px; border-top: 1px solid var(--line); margin-top: 9px; }
.fiche dt:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.fiche dd { margin: 3px 0 0; color: var(--text); line-height: 1.45; }
.fiche .lever { color: var(--live); }
.docs-main .fiche { max-width: 460px; }

/* --- Cards: the mechanics, on the documentation's front page ---------------------------------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 4px; }
.card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 16px 18px;
  text-decoration: none;
  color: var(--text);
  background-color: var(--surface-alt);
}
.card:hover .card-name { color: var(--text-bright); }
.card .icon { width: 22px; height: 22px; color: var(--text-dim); margin-bottom: 4px; }
.card:hover .icon { color: var(--live); }
.card-codes { color: var(--text-dim); font-size: 0.62rem; }
.card-name { font-weight: 700; font-size: 1.02rem; color: var(--text); }
.card-text { font-size: 0.86rem; color: var(--text-muted); line-height: 1.45; }

.icon { display: inline-block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.page-head .icon { width: 26px; height: 26px; color: var(--live); margin-bottom: 12px; display: block; }

/* The loops: a chain of causes, one link after the other. */
.loops { display: grid; gap: 10px; margin: 8px 0 0; }
.loop { background: var(--surface); border-radius: var(--radius); padding: 12px 16px 14px; }
.loop-name { font-weight: 700; color: var(--text-bright); margin: 0 0 6px; }
.chain { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0; padding: 0; list-style: none; font-size: 0.9rem; }
.chain li { margin: 0; }
.chain li + li::before { content: '→'; color: var(--live); margin-right: 8px; }
.loop-note { font-size: 0.86rem; color: var(--text-muted); margin: 8px 0 0; }

/* The lexicon. */
.terms { margin: 0; }
.terms dt { font-weight: 700; color: var(--text-bright); margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.terms dt:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.terms dt code { font-weight: 400; margin-left: 6px; }
.terms dd { margin: 4px 0 0; color: var(--text); }
.terms dd .see { color: var(--text-dim); font-size: 0.86rem; }

/* --- Labs ---------------------------------------------------------------------------------------- */

.lab { padding: 20px 24px 24px; margin: 18px 0; background-color: var(--surface-alt); }
.block .lab:last-child { margin-bottom: 0; }
.lab-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.lab-title { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--text-bright); }
.lab-kicker { color: var(--live); }
.lab-intro { font-size: 0.92rem; color: var(--text); margin: 6px 0 14px; }
.lab-note { font-size: 0.8rem; color: var(--text-dim); margin: 14px 0 0; }

.controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 28px; margin: 12px 0 18px; }
.control { min-width: 0; }
.control-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.86rem; }
.control-top label, .control-top .control-label { color: var(--text); }
.control-value { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; color: var(--text-bright); }
.control-hint { font-size: 0.76rem; color: var(--text-dim); line-height: 1.35; margin-top: 2px; }
.control.wide { grid-column: 1 / -1; }

/* The game's GlideSlider: a thin track, a paler fill up to the handle, a round handle. */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  margin: 2px 0 0;
  cursor: pointer;
  --fill: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(to right, rgba(232, 228, 218, 0.45) var(--fill), rgba(232, 228, 218, 0.12) var(--fill));
}
input[type="range"]::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(232, 228, 218, 0.12); }
input[type="range"]::-moz-range-progress { height: 5px; border-radius: 3px; background: rgba(232, 228, 218, 0.45); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; margin-top: -4.5px;
  border-radius: 50%;
  background: var(--text-bright);
  border: 0;
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text-bright); border: 0; }
input[type="range"]:disabled { cursor: default; }

.choice { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 3px; }
.choice button, .text-button {
  background: none; border: 0; padding: 2px 0; margin: 0;
  font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--text-dim); cursor: pointer;
}
.choice button:hover, .text-button:hover { color: var(--text-bright); }
.choice button[aria-pressed="true"] { color: var(--text-bright); }
.text-button { text-transform: uppercase; letter-spacing: 0.11em; font-size: 0.72rem; color: var(--live); padding-top: 18px; }

.toggle { display: flex; align-items: flex-start; gap: 8px; font-size: 0.86rem; color: var(--text); cursor: pointer; }
.toggle input { margin: 5px 0 0; accent-color: var(--live); }

.presets { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; font-size: 0.84rem; margin: 0 0 6px; }
.presets .lab-kicker { color: var(--text-dim); margin-right: 2px; }
.presets button { background: none; border: 0; border-bottom: 1px solid var(--line-strong); padding: 0; font: inherit; color: var(--text); cursor: pointer; }
.presets button:hover { color: var(--text-bright); border-bottom-color: var(--text-bright); }

.readout { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 24px; margin: 4px 0 14px; }
.readout .item .v { font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; color: var(--text-bright); }
.readout .item .k { font-size: 0.76rem; color: var(--text-dim); line-height: 1.3; }
.sentence { font-size: 0.94rem; margin: 4px 0 12px; color: var(--text-bright); }
.worked { overflow-x: auto; overflow-y: hidden; padding: 8px 12px; margin: 4px 0 10px; font-size: 0.94rem; background: var(--surface); border-radius: var(--radius); color: var(--text-bright); }
.worked .katex { font-size: 1em; }

/* --- Charts ------------------------------------------------------------------------------------------ */

.chart { position: relative; margin: 12px 0 6px; background: var(--surface); border-radius: var(--radius); padding: 12px 14px 8px; }
.chart-title { font-size: 0.8rem; font-weight: 700; margin: 0 0 4px; color: var(--text); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.76rem; color: var(--text); margin: 0 0 4px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart svg text { fill: var(--text-dim); font-family: var(--sans); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart svg text.end-label { fill: var(--text); }
.chart svg text.ref-label { fill: var(--text-dim); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--line-strong); stroke-width: 1; }
.chart .ref { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .zone { fill: var(--live); fill-opacity: 0.08; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--text-dim); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 6px 9px; font-size: 0.76rem; line-height: 1.45; white-space: nowrap;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.chart-tip .tip-x { color: var(--text-dim); }
.chart-tip .sw { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; }
.chart details { font-size: 0.76rem; color: var(--text-dim); margin-top: 4px; }
.chart details summary { cursor: pointer; }
.chart details summary:hover { color: var(--text-bright); }
.chart details table { font-size: 0.74rem; margin-top: 6px; }
.chart details th, .chart details td { padding: 3px 10px 3px 0; text-align: right; }
.chart details th:first-child, .chart details td:first-child { text-align: left; }

/* --- The bottom strip: previous, next, and the keys that lead there ----------------------------------- */

.strip.bottom .strip-inner { min-height: 52px; }
.pager { display: flex; justify-content: space-between; gap: 16px; width: 100%; }
.pager a { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--text-dim); padding: 14px 0; }
.pager a:hover { color: var(--text-bright); }
.pager a:hover .dir { color: var(--text-bright); }
.pager .next { margin-left: auto; text-align: right; }
.pager .dir { color: var(--text-dim); }
.key {
  display: inline-block; min-width: 20px; padding: 0 5px;
  border: 1px solid var(--line-strong); border-radius: 3px;
  font-size: 0.72rem; line-height: 18px; text-align: center; color: var(--text-dim);
}

.site-footer { width: 100%; padding: 18px var(--edge) 28px; font-size: 0.76rem; color: var(--text-dim); }
.site-footer a { color: var(--text-dim); }

@media (max-width: 560px) {
  .block, .page-head { padding: 18px 16px 20px; }
  .lab { padding: 16px 14px 18px; }
  .formula { padding: 10px 12px; }
  .pager .title { display: none; }
  .site-footer { padding: 16px var(--gutter) 24px; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* --- Wide screens: the page takes the whole width -------------------------------------------------- */

/* Running text keeps a line a reader can follow; tables, formulas, charts and labs take the width. */
.docs-main :is(p, li, dd) { max-width: 112ch; }
.docs-main :is(td, th) p, .docs-main .chart p { max-width: none; }

/* A lab wide enough puts its controls on the left and what they do on the right. */
.lab { container-type: inline-size; }
@container (min-width: 900px) {
  .lab-body { display: grid; grid-template-columns: minmax(280px, 34%) minmax(0, 1fr); gap: 8px 36px; align-items: start; }
  .lab-body .controls { grid-template-columns: 1fr; margin-top: 4px; }
  .lab-body .outputs { min-width: 0; }
}
@container (min-width: 1300px) {
  .lab-body .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-body { grid-template-columns: minmax(420px, 36%) minmax(0, 1fr); }
}

@media (min-width: 1600px) {
  body { font-size: 16px; }
  .docs { grid-template-columns: 260px minmax(0, 1fr) 300px; }
  /* In clear and in the game, side by side. */
  .page-head:has(.plain-words):has(.in-game) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; }
  .page-head:has(.plain-words):has(.in-game) > * { grid-column: 1 / -1; }
  .page-head:has(.plain-words):has(.in-game) > .plain-words { grid-column: 1; margin-top: 18px; }
  .page-head:has(.plain-words):has(.in-game) > .in-game { grid-column: 2; margin-top: 18px; padding-top: 0; border-top: 0; }
}
.fiche dt code, .kicker code { text-transform: none; letter-spacing: 0; }
/* Text set straight on the stone ground needs a little more light than on a panel. */
.plain .links a, .site-footer, .site-footer a { color: var(--text-muted); }
