/* ZyRompts site stylesheet.
   Design: a cool steel ground with one desaturated teal accent, frosted glass
   surfaces that lift off the ground with a specular top edge, IBM Plex Sans for
   text and IBM Plex Mono for anything the engine prints. */

@font-face {
  font-family: "Plex Sans";
  src: url("../fonts/plex-sans-latin.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  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: "Plex Sans";
  src: url("../fonts/plex-sans-latin-ext.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  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;
}

@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Native controls and scrollbars follow the light palette by default. */
  color-scheme: light;

  /* Ground and text */
  --bg: #e7edef;
  --bg-soft: #f4f7f8;
  --fg: #0d1618;
  --fg-2: #374c52;
  --muted: #465a60;
  --line: rgba(13, 22, 24, 0.12);
  --line-strong: rgba(13, 22, 24, 0.24);

  /* Accent: one teal, used for links, marks and the primary action */
  --accent: #0b6c60;
  --accent-strong: #07544a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 108, 96, 0.1);
  --accent-line: rgba(11, 108, 96, 0.32);

  /* Glass */
  --glass: rgba(255, 255, 255, 0.56);
  --glass-strong: rgba(255, 255, 255, 0.76);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-spec: rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 1px 2px rgba(8, 20, 22, 0.06),
    0 16px 40px -20px rgba(8, 20, 22, 0.35);
  --sheen: rgba(255, 255, 255, 0.5);

  /* Code surfaces stay dark in both themes: the engine prints on a terminal */
  --code-bg: #0c1416;
  --code-fg: #d9e4e6;
  --code-dim: #7d9499;
  --code-key: #6fd6c2;
  --code-ok: #6ecf94;
  --code-bad: #ef827c;
  --code-line: rgba(217, 228, 230, 0.12);

  /* Semantic */
  --ok: #166f45;

  /* Type */
  --sans: "Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.3rem;
  --fs-xl: 1.75rem;
  --fs-2xl: clamp(1.85rem, 3.6vw, 2.6rem);
  --fs-3xl: clamp(2.3rem, 5.4vw, 3.9rem);

  /* Shape and rhythm */
  --r-sm: 6px;
  --r: 12px;
  --r-lg: 18px;
  --gutter: max(20px, env(safe-area-inset-left));
  --gutter-r: max(20px, env(safe-area-inset-right));
  --measure: 68ch;
  --section: clamp(64px, 8vw, 112px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #070d0f;
    --bg-soft: #0b1417;
    --fg: #e9f0f1;
    --fg-2: #b8c8cc;
    --muted: #8ba1a7;
    --line: rgba(233, 240, 241, 0.12);
    --line-strong: rgba(233, 240, 241, 0.24);
    --accent: #5ad8c2;
    --accent-strong: #86e8d6;
    --accent-ink: #04120f;
    --accent-soft: rgba(90, 216, 194, 0.12);
    --accent-line: rgba(90, 216, 194, 0.36);
    --glass: rgba(17, 29, 33, 0.55);
    --glass-strong: rgba(20, 34, 38, 0.76);
    --glass-edge: rgba(255, 255, 255, 0.1);
    --glass-spec: rgba(255, 255, 255, 0.16);
    --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.45),
      0 20px 44px -20px rgba(0, 0, 0, 0.8);
    --sheen: rgba(255, 255, 255, 0.07);
    --ok: #55cd8e;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070d0f;
  --bg-soft: #0b1417;
  --fg: #e9f0f1;
  --fg-2: #b8c8cc;
  --muted: #8ba1a7;
  --line: rgba(233, 240, 241, 0.12);
  --line-strong: rgba(233, 240, 241, 0.24);
  --accent: #5ad8c2;
  --accent-strong: #86e8d6;
  --accent-ink: #04120f;
  --accent-soft: rgba(90, 216, 194, 0.12);
  --accent-line: rgba(90, 216, 194, 0.36);
  --glass: rgba(17, 29, 33, 0.55);
  --glass-strong: rgba(20, 34, 38, 0.76);
  --glass-edge: rgba(255, 255, 255, 0.1);
  --glass-spec: rgba(255, 255, 255, 0.16);
  --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.45),
    0 20px 44px -20px rgba(0, 0, 0, 0.8);
  --sheen: rgba(255, 255, 255, 0.07);
  --ok: #55cd8e;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-left: var(--gutter);
  padding-right: var(--gutter-r);
  overflow-x: hidden;
}

/* The ground: three wide, low-contrast light fields and a dot grid. Static by
   design; nothing here moves. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(
      58rem 34rem at 12% -8%,
      color-mix(in srgb, var(--accent) 14%, transparent),
      transparent 70%
    ),
    radial-gradient(
      46rem 30rem at 92% 6%,
      color-mix(in srgb, #4f7d8c 18%, transparent),
      transparent 72%
    ),
    radial-gradient(
      50rem 40rem at 50% 108%,
      color-mix(in srgb, #3f6d74 14%, transparent),
      transparent 70%
    );
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(
    circle at 1px 1px,
    var(--line) 1px,
    transparent 0
  );
  background-size: 26px 26px;
  opacity: 0.5;
  mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 88%);
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 42%,
    transparent 88%
  );
}

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

a {
  color: var(--accent);
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: currentColor;
}

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

/* The light accent is 2.95:1 against the dark code surface, under the 3:1
   minimum for a non-text indicator, so a focused link inside a terminal block
   lost its ring. The bright code-key tone is 10.7:1 there and is the same hue,
   so the indicator stays visible without introducing a second accent. */
.term :focus-visible,
.term-bar :focus-visible,
pre :focus-visible,
code :focus-visible {
  outline-color: var(--code-key);
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: var(--fs-3xl);
  letter-spacing: -0.035em;
}

h2 {
  font-size: var(--fs-2xl);
}

h3 {
  font-size: var(--fs-lg);
  letter-spacing: -0.012em;
}

p {
  margin: 0;
}

code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.9em;
  font-variant-ligatures: none;
}

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

.wrap {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
}

.wrap-narrow {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
}

.section {
  padding-block: var(--section);
}

.section + .section {
  padding-top: 0;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: var(--measure);
  margin-bottom: clamp(28px, 4vw, 48px);
}

.eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
}

.lede {
  font-size: var(--fs-md);
  color: var(--fg-2);
  max-width: var(--measure);
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid > * {
  min-width: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* ---------- glass ---------- */

.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-spec);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

/* A slow specular sweep on hover. One movement, on one element class. */
.card {
  position: relative;
  overflow: hidden;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition:
    transform 260ms cubic-bezier(0.2, 0.7, 0.3, 1),
    box-shadow 260ms ease,
    border-color 260ms ease;
}

.card::after {
  content: "";
  position: absolute;
  inset: -40% -60% auto -60%;
  height: 120%;
  background: linear-gradient(
    100deg,
    transparent 30%,
    var(--sheen) 48%,
    transparent 66%
  );
  transform: translateX(-55%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 720ms cubic-bezier(0.2, 0.7, 0.3, 1),
    opacity 320ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
}

.card:hover::after {
  transform: translateX(55%);
  opacity: 1;
}

/* Card headings are h2 on the 404 page (the only h1 there is the page title)
   and h3 inside sections elsewhere. Both take the same size. */
.card h2,
.card h3 {
  font-size: 1.1rem;
}

.card p {
  color: var(--fg-2);
  font-size: var(--fs-sm);
  line-height: 1.62;
}

.card .card-meta {
  margin-top: auto;
  padding-top: 10px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  padding-block: 12px;
  margin-inline: calc(-1 * var(--gutter)) calc(-1 * var(--gutter-r));
  padding-inline: var(--gutter) var(--gutter-r);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  transition:
    border-color 200ms ease,
    background 200ms ease;
}

.site-header.is-stuck {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg-2);
  text-decoration: none;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.site-nav a:hover {
  background: var(--accent-soft);
  color: var(--fg);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.site-nav a.nav-ext::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-left: 7px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(1px);
  opacity: 0.6;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--glass);
  color: var(--fg);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
}

.nav-toggle .bars {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-top: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}

.header-end {
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--fg);
}

.theme-toggle .icon {
  width: 17px;
  height: 17px;
  display: block;
}

/* System theme is the default, so show the moon (what a click switches to)
   unless an explicit theme is set. */
.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* ---------- hero ---------- */

.hero {
  padding-block: clamp(52px, 7vw, 92px) clamp(48px, 6vw, 76px);
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(32px, 4.5vw, 64px);
  align-items: center;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.hero h1 {
  max-width: 18ch;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: var(--fs-md);
  color: var(--fg-2);
  max-width: 54ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 6px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.hero-facts span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.hero-facts b {
  color: var(--fg);
  font-weight: 500;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.005em;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 10px 24px -14px var(--accent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

.btn-ghost {
  background: var(--glass);
  border-color: var(--line-strong);
  color: var(--fg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-ghost:hover {
  border-color: var(--accent-line);
  background: var(--glass-strong);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

/* ---------- terminal / code ---------- */

.term {
  border-radius: var(--r-lg);
  background: var(--code-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 24px 48px -24px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  color: var(--code-fg);
}

.term-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--code-line);
  background: rgba(255, 255, 255, 0.03);
}

.term-title {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--code-dim);
  letter-spacing: 0.02em;
}

.term-body {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.72;
  tab-size: 2;
}

.term-body code {
  font-size: inherit;
}

.copy-btn {
  flex: none;
  padding: 4px 9px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--code-dim);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 140ms ease,
    border-color 140ms ease;
}

.copy-btn:hover {
  color: var(--code-fg);
  border-color: rgba(255, 255, 255, 0.3);
}

.copy-btn.is-done {
  color: var(--code-ok);
  border-color: rgba(110, 207, 148, 0.5);
}

.c-key {
  color: var(--code-key);
}
.c-dim {
  color: var(--code-dim);
}
.c-ok {
  color: var(--code-ok);
}
.c-bad {
  color: var(--code-bad);
}

/* Inline code on prose surfaces. Scoped with :not(pre) so it never reaches
   the <code> inside a <pre>, where nowrap would collapse every newline. */
.prose :not(pre) > code,
.table-wrap :not(pre) > code,
.doc-body :not(pre) > code {
  padding: 0.12em 0.38em;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--fg);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* Full code blocks on prose pages */
pre.code {
  margin: 0;
  padding: 16px 18px;
  border-radius: var(--r);
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
}

/* ---------- flow diagram ---------- */

.d-box {
  fill: var(--glass-strong);
  stroke: var(--line-strong);
  stroke-width: 1;
}

.d-box-accent {
  fill: var(--accent-soft);
  stroke: var(--accent-line);
}

.d-line {
  fill: none;
  stroke: var(--line-strong);
}

.d-dot {
  fill: var(--accent);
}

.d-text {
  fill: var(--fg);
  font-family: var(--mono);
  font-weight: 500;
}

.d-accent {
  fill: var(--accent);
  font-family: var(--mono);
  font-weight: 500;
}

.d-ok {
  fill: var(--ok);
  font-family: var(--mono);
  font-weight: 500;
}

.d-dim {
  fill: var(--muted);
  font-family: var(--mono);
}

.pulse-v {
  animation: pulse-v 3.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.pulse-v.p2 {
  animation-delay: 0.75s;
}

.pulse-v.p3 {
  animation-delay: 1.5s;
}

@keyframes pulse-v {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  18% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(18px);
  }
}

.hero-panel {
  margin: 0;
  overflow: hidden;
}

figure {
  margin: 0;
}

.flow-panel {
  padding: 18px 18px 10px;
}

.diagram {
  display: block;
  width: 100%;
  height: auto;
}

.flow-panel svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Diagrams are drawn at a fixed unit size. Below the tablet breakpoint the
   column gets narrower than the drawing, and scaling to fit would take 10.5px
   labels under 7px. Keep each drawing at its native scale and let the panel
   scroll instead of shrinking the text. */
@media (max-width: 760px) {
  .flow-panel,
  .doc-body figure {
    overflow-x: auto;
  }

  .flow-panel svg {
    min-width: 440px;
  }

  .doc-body figure .diagram {
    min-width: 520px;
  }
}

.flow-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  padding: 4px 20px 16px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  scrollbar-width: thin;
}

/* Hint shown by site.js only when a table is wider than its column, so a
   reader on a phone knows there are more columns to the right. */
.table-hint {
  margin: 6px 2px 0;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.table-hint::after {
  content: " \2192";
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  min-width: 520px;
}

/* On a phone, let a table use the column it has. A cell whose content cannot
   break, such as a code identifier, widens the table past the column and it
   scrolls inside .table-wrap; the rest fit without scrolling for no reason. */
@media (max-width: 760px) {
  table {
    min-width: 0;
  }

  th,
  td {
    padding: 10px 12px;
  }
}

caption {
  caption-side: top;
  text-align: left;
  padding: 14px 16px 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-family: var(--mono);
}

th,
td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--accent-soft);
}

@media (min-width: 761px) {
  td code {
    white-space: nowrap;
  }
}

/* Long identifiers in running prose may break rather than widen the page. */
.doc-body p code,
.prose p code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--fg-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--accent-soft);
  color: var(--fg-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---------- page header ---------- */

.page-head {
  padding-block: clamp(44px, 6vw, 76px) clamp(28px, 3.5vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 62rem;
}

.page-head h1 {
  font-size: clamp(2rem, 4.4vw, 3rem);
}

.crumbs {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--accent);
}

.crumbs span {
  padding-inline: 8px;
  opacity: 0.6;
}

/* ---------- prose ---------- */

.prose {
  max-width: var(--measure);
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: var(--fs-md);
  color: var(--fg-2);
}

.prose h2 {
  font-size: var(--fs-xl);
  color: var(--fg);
  margin-top: 22px;
}

.prose h3 {
  font-size: 1.12rem;
  color: var(--fg);
  margin-top: 10px;
}

.prose strong {
  color: var(--fg);
  font-weight: 600;
}

.prose ul,
.prose ol {
  margin: 0;
  padding-left: 1.25em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prose li::marker {
  color: var(--accent);
}

.prose a {
  color: var(--accent);
}

/* Long-form doc pages: sidebar + article */
.doc-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
  padding-bottom: var(--section);
}

.toc {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  font-size: var(--fs-sm);
}

.toc-label {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 10px 10px;
}

.toc a {
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  text-decoration: none;
  border-left: 2px solid transparent;
}

.toc a:hover {
  color: var(--fg);
  background: var(--accent-soft);
}

.toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.doc-body {
  display: flex;
  flex-direction: column;
  gap: 30px;
  min-width: 0;
}

.doc-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-margin-top: 96px;
}

.doc-section > p {
  color: var(--fg-2);
  max-width: var(--measure);
  font-size: var(--fs-md);
}

.doc-section > h2 {
  font-size: var(--fs-xl);
}

.doc-section > h3 {
  font-size: 1.08rem;
  margin-top: 6px;
}

.callout {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: var(--fs-sm);
  color: var(--fg-2);
}

.callout b {
  color: var(--fg);
}

/* ---------- lists ---------- */

.spec-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.spec-list > div {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 18px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}

.spec-list .k {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.03em;
  padding-top: 2px;
}

.spec-list .v {
  color: var(--fg-2);
}

/* ---------- principles ---------- */

.principles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.principle {
  display: flex;
  gap: 16px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--line);
}

.principle:nth-child(odd) {
  padding-right: 28px;
}

.principle:nth-child(even) {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.principle-n {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--accent);
  padding-top: 3px;
  min-width: 1.6em;
}

.principle p {
  font-size: var(--fs-sm);
  color: var(--fg-2);
}

.principle b {
  display: block;
  color: var(--fg);
  font-size: var(--fs-base);
  font-weight: 600;
  margin-bottom: 3px;
}

/* ---------- CTA ---------- */

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(28px, 4vw, 44px);
}

.cta h2 {
  font-size: var(--fs-xl);
}

.cta p {
  color: var(--fg-2);
  margin-top: 8px;
  max-width: 46ch;
  font-size: var(--fs-sm);
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: var(--section);
  padding-block: 40px 32px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding-bottom: 32px;
}

.footer-brand p {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-top: 10px;
  max-width: 34ch;
}

/* The footer is a landmark whose column labels are headings, not body text.
   They were h4 under an h2 page heading, which skipped h3 for a screen reader;
   h2 with the label styling keeps the visual size and the document order
   correct. */
.footer-col .footer-label {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col a {
  color: var(--fg-2);
  font-size: var(--fs-sm);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--muted);
  font-family: var(--mono);
}

.footer-base a {
  color: var(--muted);
  text-decoration: none;
}

.footer-base a:hover {
  color: var(--accent);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

/* ---------- utilities ---------- */

/* Spacing helpers, used where a one-off offset would otherwise be an inline
   style. Kept to a handful so they do not become a second design system. */
.mt-sm {
  margin-top: 18px;
}
.mt-md {
  margin-top: 44px;
}
.pt-xs {
  padding-top: 6px;
}
.pad-md {
  padding: 20px;
}
.pad-page {
  padding-block: clamp(56px, 9vw, 120px);
}
.pb-section {
  padding-bottom: var(--section);
}
.stack-tight {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 40rem;
}
.fs-sm {
  font-size: var(--fs-sm);
}
.h-sm {
  font-size: 1rem;
  margin-bottom: 10px;
}
.h-404 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}
.card-link {
  text-decoration: none;
  color: inherit;
}
.plain-list {
  max-width: var(--measure);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 40;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }

  .hero h1 {
    max-width: 22ch;
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px;
  }

  .toc-label {
    width: 100%;
    padding-bottom: 4px;
  }

  .toc a {
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .toc a.is-active {
    border-left: 0;
    border-bottom-color: var(--accent);
  }
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    left: var(--gutter);
    right: var(--gutter-r);
    top: calc(100% - 4px);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px;
    border-radius: var(--r);
    border: 1px solid var(--line-strong);
    background: var(--glass-strong);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 11px 12px;
    font-size: var(--fs-base);
  }

  .header-inner {
    position: relative;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .principles {
    grid-template-columns: minmax(0, 1fr);
  }

  .principle:nth-child(odd),
  .principle:nth-child(even) {
    padding-inline: 4px;
    border-left: 0;
  }

  .spec-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .cta {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-facts {
    gap: 6px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .pulse-v {
    display: none;
  }

  .card:hover {
    transform: none;
  }

  .card::after {
    display: none;
  }
}
