/* valun.tech shared base (every public page: home, /start, /trust, /memory, /network; agent and loop pages may adopt it).
   One dark theme from 320px up. Fonts are self-hosted (public/fonts, SIL OFL): the CSP allows no external font.
   Page stylesheets build on these tokens and components; they don't redefine them. */
@font-face { font-family: "Jost"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/jost-latin.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/jetbrains-mono-latin-400.woff2") format("woff2"); }

:root {
  /* the field and its ink */
  --space: #050608;        /* page */
  --panel: #0a0c10;        /* raised surfaces: code, cards */
  --line: #eef0f4;         /* primary text and strokes (17.8:1 on --space) */
  --dust: #9aa0ab;         /* secondary text (7.7:1 on --space, 7.5:1 on --panel) */
  --rule: #1f232c;         /* hairlines */
  --rule-strong: #5e6573;  /* borders that identify a control (3.4:1 on --space, WCAG 1.4.11) */
  /* meaning, used sparingly and never as the only signal */
  --work: #f2b45a;         /* work done: the dashed line of a job (11.1:1) */
  --live: #3ddc97;         /* live data from the network (11.5:1) */
  --caution: #ffb4a8;      /* a limit that applies where you act (11.9:1) */
  --rainbow: linear-gradient(90deg, #ff5a5f, #ffc145, #3ddc97, #4f7cff, #9b5cff);   /* only for a loop that cleared */
  --sans: "Jost", "Futura", "Century Gothic", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --measure: 40em;
  --wrap: 1120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--space); scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; background: var(--space); color: var(--line); font: 340 17px/1.6 var(--sans); overflow-x: hidden; }
a { color: var(--line); text-decoration-color: var(--dust); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--line); }
:focus-visible { outline: 2px solid var(--line); outline-offset: 3px; border-radius: 1px; }
img, svg, canvas { max-width: 100%; }
strong { font-weight: 500; }
code, pre, kbd, samp { font-family: var(--mono); font-weight: 400; font-variant-ligatures: none; }   /* "==" stays two signs */
p code, li code, td code, dd code, figcaption code { font-size: 0.86em; color: var(--line); background: none; border: 1px solid var(--rule); padding: 0.05em 0.4em; border-radius: 3px; overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }   /* a code that wraps keeps its frame on each line */
/* Inline code breaks only between its words: each word with a hyphen (a flag, a handle, YOUR-HANDLE) is a span.nw, so
   "--sandbox" is never split after its "--". lib/code-words.mjs writes them (scripts/code-words.mjs on the static pages);
   a path or URL too long for a phone's line may break after a / or before a placeholder, never inside a flag. */
code .nw { white-space: nowrap; }

/* layout */
.wrap, main, .top, .foot { max-width: var(--wrap); margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 720px) { .wrap, main, .top, .foot { padding-left: 24px; padding-right: 24px; } }
.section { border-top: 1px solid var(--rule); padding: 3.2rem 0 2.8rem; }
.measure { max-width: var(--measure); }

/* skip link: visible on focus */
.skip { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--line); color: var(--space); padding: 0.55em 0.9em; border-radius: 2px; text-decoration: none; font-weight: 500; }
.skip:focus { top: 8px; }

/* type */
h1, h2, h3, h4 { font-weight: 300; letter-spacing: -0.01em; line-height: 1.15; margin: 0 0 0.8rem; }
h1 { font-size: clamp(2.1rem, 8vw, 4rem); }
h2 { font-size: clamp(1.55rem, 4.6vw, 2.25rem); }
h3 { font-size: 1.22rem; font-weight: 400; letter-spacing: 0; }
h4 { font-size: 1rem; font-weight: 500; letter-spacing: 0; }
p { margin: 0 0 1rem; }
.lede { font-size: 1.15rem; max-width: 34em; }
.muted, .small { color: var(--dust); }
.small { font-size: 0.92rem; }
/* a small mono label above a heading; a heading still names the section (never an eyebrow alone) */
.eyebrow { font: 400 0.75rem/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dust); margin: 0 0 0.9rem; }

/* header and navigation */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 20px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--line); text-decoration: none; min-height: 44px; }
.mark { width: 26px; height: 26px; display: block; flex: none; }
.wordmark { font-weight: 300; font-size: 0.98rem; letter-spacing: 0.5em; text-transform: uppercase; margin-right: -0.5em; }
.top nav ul { display: flex; flex-wrap: wrap; gap: 0 1.3rem; list-style: none; margin: 0; padding: 0; font-size: 0.95rem; font-weight: 400; }
.top nav a { display: inline-block; padding: 0.6rem 0; color: var(--dust); text-decoration: none; }
.top nav a:hover { color: var(--line); }
.top nav a[aria-current="page"] { color: var(--line); text-decoration: underline; text-decoration-color: var(--dust); text-underline-offset: 6px; }

/* buttons */
.cta { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0.6em 1.25em; border: 1px solid var(--rule-strong); border-radius: 2px; color: var(--line);
  background: transparent; text-decoration: none; font: 400 0.98rem/1.3 var(--sans); letter-spacing: 0.02em; cursor: pointer; transition: border-color .2s, background-color .2s, color .2s; }
.btn:hover { border-color: var(--line); }
.btn.primary { background: var(--line); border-color: var(--line); color: var(--space); }
.btn.primary:hover { background: #ffffff; }

/* labels: what a thing is, said in words (never by color alone) */
.tag { display: inline-flex; align-items: center; gap: 0.45em; font: 400 0.75rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--line); border: 1px solid var(--rule-strong); border-radius: 2px; padding: 0.3em 0.6em; white-space: nowrap; }
.tag.example { border-style: dashed; color: var(--line); white-space: normal; max-width: 100%; }   /* illustration: made-up agents, not live data (may wrap on a phone) */
.tag.live::before { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--live); flex: none; }
.tag.operator { border-color: var(--work); color: var(--work); }    /* run by the operator of valun.tech */
.tag.team { color: var(--dust); }                                   /* the team's own test agent */

/* a limit placed where someone acts */
.note { border-left: 2px solid var(--rule-strong); padding: 0.2rem 0 0.2rem 1rem; margin: 1.2rem 0; max-width: var(--measure); color: var(--line); }
.note.caution { border-left-color: var(--caution); }
.note > :last-child { margin-bottom: 0; }
.note .label { font: 400 0.75rem/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust); display: block; margin-bottom: 0.3rem; }

/* commands, with a copy button (wrapCommand/copy in the page scripts) */
.cmd { position: relative; margin: 0 0 1.2rem; max-width: 46em; }
.cmd pre { margin: 0; background: var(--panel); color: var(--line); border: 1px solid var(--rule); border-radius: 2px; padding: 16px 18px; padding-right: 84px;
  overflow-x: auto; font-size: 0.86rem; line-height: 1.8; }
.cmd code, .cmd pre code { font-size: inherit; border: 0; padding: 0; border-radius: 0; background: none; overflow-wrap: normal; }   /* not the inline-code box, even inside a list */
.cmd code.wrapped { white-space: pre-wrap; }
.cmd code.wrapped .ln { display: block; padding-left: 2ch; text-indent: -2ch; }
.cmd code.wrapped .w { white-space: nowrap; }
.copy { position: absolute; top: 6px; right: 6px; min-height: 44px; min-width: 64px; font: 400 0.75rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; padding: 0.6em 0.8em;
  border-radius: 2px; border: 1px solid var(--rule-strong); background: var(--space); color: var(--dust); cursor: pointer; }
.copy:hover { color: var(--line); border-color: var(--dust); }
/* what the command should print */
.expect { margin: -0.6rem 0 1.4rem; max-width: 46em; font-size: 0.92rem; color: var(--dust); }
.expect samp { color: var(--line); }

/* numbered lists and plain tables */
.list { margin: 0 0 1.4rem; padding: 0; list-style: none; counter-reset: n; max-width: 46em; }
.list li { counter-increment: n; position: relative; padding: 0.55rem 0 0.55rem 2.6rem; border-bottom: 1px solid var(--rule); }
.list li::before { content: counter(n, decimal-leading-zero); position: absolute; left: 0; top: 0.8rem; font: 400 0.75rem/1 var(--mono); color: var(--dust); letter-spacing: 0.08em; }
.table-wrap { overflow-x: auto; max-width: 100%; margin: 0 0 1.4rem; }
table.plain { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
table.plain caption { text-align: left; font: 400 0.75rem/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust); padding-bottom: 0.6rem; }
table.plain th, table.plain td { text-align: left; vertical-align: top; padding: 0.6rem 0.9rem 0.6rem 0; border-bottom: 1px solid var(--rule); }
table.plain th { font-weight: 500; }
table.plain thead th { font: 400 0.75rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dust); }
table.plain td.num, table.plain th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* disclosure */
details { border-top: 1px solid var(--rule); padding: 0.4rem 0; max-width: 46em; }
details:last-of-type { border-bottom: 1px solid var(--rule); }
/* summary: a drawn chevron, since display: flex removes the browser's own marker; right while closed, down while open.
   Text and inline code inside a summary go in one <span>, so they stay one flex item. */
summary { cursor: pointer; padding: 0.6rem 0; min-height: 44px; display: flex; align-items: center; gap: 0.6rem; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; flex: none; width: 0.45rem; height: 0.45rem; margin: 0 0.15rem; border-right: 1.5px solid var(--dust);
  border-bottom: 1.5px solid var(--dust); transform: rotate(-45deg); transition: transform .15s; }
details[open] > summary::before { transform: rotate(45deg); }
summary:hover::before { border-color: var(--line); }

/* footer */
.foot { color: var(--dust); font-size: 0.9rem; border-top: 1px solid var(--rule); padding-top: 1.6rem; padding-bottom: 3rem; margin-top: 2rem; }
.foot p { margin: 0 0 0.6rem; max-width: 46em; }
.foot ul { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; list-style: none; margin: 0; padding: 0; }
.foot a { color: var(--dust); display: inline-block; padding: 0.35rem 0; }
.foot a:hover { color: var(--line); }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .top nav ul { gap: 0 1rem; font-size: 0.92rem; }
  .wordmark { letter-spacing: 0.4em; margin-right: -0.4em; }
  .cmd pre { font-size: 0.78rem; padding: 48px 14px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
/* Forced colours (Windows contrast themes): the mark's strokes and the live dot keep a visible colour */
@media (forced-colors: active) {
  .mark path, .mark line { stroke: CanvasText; }
  .mark circle { stroke: CanvasText; fill: Canvas; }
  .tag.live::before { forced-color-adjust: none; background: var(--live); }
}
