/* ==========================================================================
   PAD Forge — public one-pager
   Every token below comes from brand-tokens.md and is used verbatim.
   Dark only. One radius. No gradient, no blur, no shadow, no pulse.
   ========================================================================== */

/* --- Self-hosted type. No third-party request, by requirement. ------------ */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/space-grotesk-latin-400-normal.woff2") format("woff2");
  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+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/space-grotesk-latin-600-normal.woff2") format("woff2");
  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+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* --- The contract in one place ------------------------------------------- */

:root {
  /* Forge ramp — emerald */
  --forge-200: #aeefb9;
  --forge-500: #3fcf6a;
  --forge-600: #1b8a42;
  --forge-800: #115c2b;

  /* Dark neutrals — shared base of the PAD suite */
  --background: #0d1117;
  --surface: #161b22;
  --border: #21262d;
  --border-strong: #30363d;
  --border-input: #6e7681;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --text-subtle: #484f58;
  --heading: #ffffff;

  /* Semantic */
  --danger: #f87171;
  --danger-bg: #3d1111;
  --warning: #e3b341;
  --warning-bg: #2b2111;
  --focus-ring: #3fcf6a;

  /* Type scale — weights and tracking are the product's; heading sizes go
     up one notch, as brand-tokens.md allows for a presentation site. */
  --font: "Space Grotesk", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --size-body: 13px;
  --leading-body: 1.45;
  --size-lead: 17px;
  --size-h1: 34px;
  --size-h2: 26px;
  --size-h3: 17px;
  --size-label: 11px;
  --track-heading: -0.01em;
  --track-label: 0.06em;

  /* Shape — one radius */
  --radius: 6px;
  --radius-bar: 3px;

  /* Rhythm */
  --gutter: 16px;
  --measure: 66ch;
  --column: 760px;
}

/* --- Reset ---------------------------------------------------------------- */

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

html {
  background: var(--background);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* .topbar is sticky at 48px: an anchored heading must land below it. */
  scroll-padding-top: 64px;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--size-body);
  font-weight: 400;
  line-height: var(--leading-body);
  overflow-wrap: break-word;
}

h1, h2, h3 {
  color: var(--heading);
  font-weight: 600;
  letter-spacing: var(--track-heading);
  line-height: 1.2;
  margin: 0;
}
h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }

p { margin: 0 0 12px; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

ul { margin: 0; padding-left: 18px; }
li { margin-bottom: 8px; max-width: var(--measure); }
li:last-child { margin-bottom: 0; }

strong { color: var(--heading); font-weight: 600; }

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-input);
}
a:hover { color: var(--heading); text-decoration-color: var(--text-muted); }

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

img, svg { max-width: 100%; }

/* Monospace carries every path, identifier, duration, percentage and code
   fragment — and nothing else. */
code, kbd, samp, .mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

/* --- Language layer ------------------------------------------------------
   FR and EN copy live adjacent in the source and both ship in the served
   HTML. Only the inactive one is hidden; the active one keeps its own
   natural display value. French is the default, fixed in index.html. */

html[lang|="en"] .t[lang="fr"] { display: none; }
html:not([lang|="en"]) .t[lang="en"] { display: none; }

/* --- Layout --------------------------------------------------------------- */

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--heading);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 12px;
  z-index: 10;
}
.skip:focus { left: var(--gutter); top: 8px; }

.section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}
.section > .wrap > * + * { margin-top: 20px; }

.label {
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.lead {
  font-size: var(--size-lead);
  line-height: 1.4;
  color: var(--heading);
  max-width: 54ch;
}

.note {
  color: var(--text-muted);
  max-width: var(--measure);
}

/* --- Header --------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}
.topbar-mark { display: flex; align-items: center; }
.topbar-mark img { display: block; height: 26px; width: auto; }

/* The switch is a JS affordance: hidden unless i18n.js has run, so it is
   absent rather than inert when scripting is off. */
.langswitch { display: none; }
html.js .langswitch { display: inline-flex; }

.langswitch {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
/* The pill keeps its shape from the buttons' own corners rather than from
   overflow: hidden, which clipped the focus ring. */
.langswitch button:first-child { border-radius: 5px 0 0 5px; }
.langswitch button:last-child { border-radius: 0 5px 5px 0; }
.langswitch button {
  font: inherit;
  font-weight: 600;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  padding: 6px 10px;
  cursor: pointer;
}
.langswitch button + button { border-left: 1px solid var(--border-strong); }
.langswitch button:hover { color: var(--text); }
/* --forge-500 here means "active" — one of its two allowed meanings. */
.langswitch button[aria-pressed="true"] {
  background: var(--forge-500);
  color: var(--background);
}

/* --- Hero ----------------------------------------------------------------- */

.hero {
  padding: 64px 0 56px;
  border-top: 0;
}
.hero-mark { display: block; width: 262px; max-width: 100%; height: auto; }
.hero h1 { margin-top: 28px; max-width: 24ch; }
.hero .definition { margin-top: 20px; }
.hero .subtitle { margin-top: 12px; color: var(--text-muted); max-width: 54ch; }

.actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 9px 14px;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 120ms linear, color 120ms linear,
    border-color 120ms linear;
}
.btn:hover { color: var(--heading); border-color: var(--border-input); }
.btn-primary {
  background: var(--forge-500);
  border-color: var(--forge-500);
  color: var(--background);
}
.btn-primary:hover {
  background: var(--forge-200);
  border-color: var(--forge-200);
  color: var(--background);
}

/* --- Cards, chips, grids -------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.grid > .card > * { max-width: none; }

.op {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.op .name {
  font-family: var(--mono);
  font-size: var(--size-body);
  color: var(--heading);
  align-self: flex-start;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 2px 7px;
}

.invariants { counter-reset: inv; list-style: none; padding-left: 0; }
.invariants > li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
}
.invariants > li::before {
  counter-increment: inv;
  content: counter(inv);
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%; /* count badge — an allowed exception to the one radius */
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: var(--size-label);
  font-weight: 600;
  display: grid;
  place-items: center;
}

/* Status lists: a dot carries "running" / "not there yet". --forge-500 means
   alive; the other dot is structural, never red — nothing here is an error. */
.status { list-style: none; padding-left: 0; }
.status > li { position: relative; padding-left: 20px; }
.status > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.status-live > li::before { background: var(--forge-500); }
.status-todo > li::before {
  background: transparent;
  border: 1px solid var(--border-input);
}

.two-col {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* --- Tables --------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--size-body);
}
caption {
  caption-side: bottom;
  text-align: left;
  color: var(--text-muted);
  padding-top: 10px;
  max-width: var(--measure);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--text-muted);
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
}
/* A row header names a layer — it is content, not a label, so it stays
   sentence case. The label token is the only uppercase on the page. */
tbody th {
  color: var(--heading);
  font-size: var(--size-body);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding-right: 20px;
}
td .mono { color: var(--heading); }
.figure-cell { white-space: nowrap; }

/* --- Code ----------------------------------------------------------------- */

.codeblock {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.codeblock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--border);
}
.codeblock-title {
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
/* Copy is a clipboard affordance: hidden when the API is unavailable, so the
   block stays plainly selectable instead of offering a dead control. */
.copy { display: none; }
html.clipboard .copy { display: inline-flex; }

.codeblock pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;      /* the block scrolls inside its own box */
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  tab-size: 2;
}

/* Highlighting stays inside the neutral ramp: no new hue, and no --forge-500
   spent on decoration. */
.c-cmd { color: var(--heading); font-weight: 600; }
.c-key { color: var(--heading); }
.c-str { color: var(--text); }
.c-num { color: var(--text-muted); }
.c-flag { color: var(--text-muted); }
.c-punct { color: var(--text-muted); }

/* A scrollable region carries tabindex="0" so a keyboard reader can reach
   what is off to the right. */
.codeblock pre:focus-visible,
.table-scroll:focus-visible { outline-offset: -2px; }

/* --- Figures -------------------------------------------------------------- */

figure { margin: 0; }
figcaption {
  color: var(--text-muted);
  padding-top: 10px;
  max-width: var(--measure);
}

.diagram {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}
.diagram svg { display: block; width: 100%; height: auto; }
.diagram .stacked { display: none; }

@media (max-width: 700px) {
  .diagram .wide { display: none; }
  .diagram .stacked { display: block; }
}

/* Diagram type, set on the SVG so the boxes read at any width. */
.d-box { fill: var(--background); stroke: var(--border-strong); }
.d-box-soft { fill: var(--surface); stroke: var(--border); }
.d-line { stroke: var(--border-input); fill: none; }
.d-arrow { fill: var(--border-input); }
.d-title { fill: var(--heading); font-weight: 600; font-size: 13px; }
.d-text { fill: var(--text); font-size: 12px; }
.d-muted { fill: var(--text-muted); font-size: 11px; }
.d-mono { font-family: var(--mono); fill: var(--text); font-size: 12px; }
.diagram text { font-family: var(--font); }

/* --- Screenshots and prepared slots --------------------------------------- */

.shot {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  display: block;
}
.shot img { display: block; width: 100%; height: auto; }

/* A prepared slot is a neutral labelled frame at the final aspect ratio.
   It is never a drawn interface: no rows, no bars, no chips. */
.slot {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  aspect-ratio: 1406 / 758;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
}
.slot span {
  color: var(--text-muted);
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

/* --- Footer --------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 56px;
}
.footer-mark { display: block; height: 30px; width: auto; }
.footer p { margin-top: 16px; }
.footer .colophon { color: var(--text-muted); }

/* --- Narrow viewports ----------------------------------------------------- */

@media (max-width: 600px) {
  :root {
    --size-h1: 27px;
    --size-h2: 21px;
  }
  .section { padding: 40px 0; }
  .hero { padding: 40px 0; }
  .hero-mark { width: 210px; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* --- Reduced motion ------------------------------------------------------- */

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

/* --- Diagram strokes ------------------------------------------------------ */

.d-box, .d-box-soft { stroke-width: 1; }
.d-line { stroke-width: 1.5; stroke-linecap: square; }
.d-hair { stroke: var(--border); stroke-width: 1; fill: none; }
.d-step {
  font-family: var(--mono);
  fill: var(--text-muted);
  font-size: 11px;
}

/* ---- Plain-language overview (section 2) -----------------------------
   Deliberately NOT a card grid: the five-operations section below already
   uses one, and two near-identical grids in a row read as the same content
   twice. This is the one place a non-technical reader is asked to stop and
   read, so it is set as a numbered list with a longer measure and no boxes. */
.plainly .lead { max-width: 54ch; font-size: 15px; }

.plain-grid {
  list-style: none;
  padding: 0;
  margin-top: 28px !important;
  counter-reset: plain;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  column-gap: 40px;
  row-gap: 26px;
}
.plain-grid > li {
  counter-increment: plain;
  padding-left: 30px;
  position: relative;
}
.plain-grid > li::before {
  content: counter(plain);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-subtle);   /* structural glyph, carries no information */
}
.plain-grid h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--heading);
  margin: 0 0 5px;
}
.plain-grid p {
  margin: 0;
  color: var(--text-muted);
}
.bridge {
  margin-top: 30px !important;
  border-left: 2px solid var(--border-strong);
  padding-left: 14px;
}
