/* Open CKey design system. See DESIGN.md before changing anything here. */

/* ---- Faces (self-hosted, SIL OFL; see /fonts/OFL-*.txt) ---- */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("/fonts/Newsreader-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 300 700; font-display: swap; src: url("/fonts/Newsreader-italic.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("/fonts/PublicSans-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: italic; font-weight: 300 700; font-display: swap; src: url("/fonts/PublicSans-italic.woff2") format("woff2"); }

/* ---- Tokens ---- */
:root {
  --canvas: oklch(0.985 0.005 85);
  --stone: oklch(0.962 0.008 85);
  --stone-2: oklch(0.935 0.01 85);
  --raised: oklch(1 0 0);
  --line: oklch(0.895 0.01 85);
  --line-strong: oklch(0.82 0.012 85);
  --ink: oklch(0.235 0.018 150);
  --ink-2: oklch(0.43 0.016 150);
  --ink-3: oklch(0.52 0.014 150);
  --evergreen: oklch(0.43 0.085 155);
  --evergreen-deep: oklch(0.35 0.075 155);
  --evergreen-tint: oklch(0.95 0.022 155);
  --evergreen-soft: oklch(0.9 0.04 155);
  --brass: oklch(0.66 0.095 78);
  --brass-tint: oklch(0.955 0.03 85);
  --oxblood: oklch(0.47 0.14 25);
  --oxblood-tint: oklch(0.955 0.02 25);
  --amber: oklch(0.52 0.11 65);
  --amber-tint: oklch(0.96 0.035 80);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  --r-control: 6px; --r-panel: 12px;
  --shadow-1: 0 1px 2px oklch(0.2 0.02 150 / 0.06), 0 8px 24px -12px oklch(0.2 0.02 150 / 0.18);
  --shadow-2: 0 1px 2px oklch(0.2 0.02 150 / 0.06), 0 24px 48px -24px oklch(0.2 0.02 150 / 0.28);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --t-press: 160ms; --t-quick: 140ms; --t-ui: 220ms;

  --content: 1200px; --gutter: clamp(20px, 4vw, 48px);
  color-scheme: light;
  accent-color: var(--evergreen);
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 106.25%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 400 1rem/1.62 var(--sans); font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  caret-color: var(--evergreen);
}
::selection { background: var(--evergreen-soft); color: var(--ink); }
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); text-wrap: balance; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.25rem); line-height: 1.1; }
h2 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.25rem); line-height: 1.15; }
h3 { font: 600 1.125rem/1.35 var(--sans); letter-spacing: -0.005em; }
h1 em, h2 em, .display em { font-style: italic; color: var(--evergreen); }
p { margin: 0; text-wrap: pretty; }
a { color: var(--evergreen); text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; text-decoration-color: color-mix(in oklch, var(--evergreen) 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
strong { font-weight: 600; }
code, kbd, samp, .mono { font-family: var(--mono); font-size: 0.875em; }
code { background: var(--stone); border: 1px solid var(--line); border-radius: 4px; padding: 0.08em 0.36em; overflow-wrap: anywhere; }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.35em; background: var(--raised); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s7) 0; }
.num, table, .facts dd { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--evergreen); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.visually-hidden, input.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; border: 0 !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: var(--s4); top: -100px; z-index: 100; background: var(--ink); color: var(--canvas); padding: var(--s2) var(--s4); border-radius: var(--r-control); text-decoration: none; }
.skip-link:focus { top: var(--s3); }
html { scrollbar-color: var(--line-strong) transparent; }

.icon { width: 1.15em; height: 1.15em; flex: none; stroke-width: 1.6; }
.icon-lg { width: 28px; height: 28px; }

/* ---- Layout ---- */
.container { width: min(var(--content), 100% - 2 * var(--gutter)); margin-inline: auto; }
.section { padding-block: clamp(64px, 8vw, 112px); }
.section-quiet { background: var(--stone); }
.section + .section:not(.section-quiet) { border-top: 1px solid var(--line); }
.stack > * + * { margin-top: var(--s4); }
.stack-lg > * + * { margin-top: var(--s6); }
.lead { font-size: 1.1875rem; line-height: 1.6; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; line-height: 1.5; }
.caption { font-size: 0.8125rem; color: var(--ink-3); }
.split { display: grid; gap: var(--s7); align-items: start; }
.split > *, .ruled > li, .tool > * { min-width: 0; }
@media (min-width: 900px) { .split { grid-template-columns: 5fr 7fr; gap: var(--s8); } .split-even { grid-template-columns: 1fr 1fr; } .split-reverse { grid-template-columns: 7fr 5fr; } }
.page-intro { padding-block: clamp(56px, 7vw, 96px) clamp(32px, 4vw, 48px); }
.page-intro h1 { max-width: 20ch; }
.page-intro .lead { margin-top: var(--s4); }
.section-head { max-width: 46rem; margin-bottom: var(--s7); }
.section-head p { margin-top: var(--s3); color: var(--ink-2); }

/* ---- Header ---- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in oklch, var(--canvas) 96%, transparent); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: var(--s5); min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 500 1.25rem/1 var(--serif); letter-spacing: -0.01em; white-space: nowrap; }
.brand img { width: 30px; height: 30px; }
.nav { display: none; margin-left: auto; align-items: center; gap: var(--s1); }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; padding: 8px 12px; border-radius: var(--r-control); transition: color var(--t-quick) ease, background-color var(--t-quick) ease; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--stone-2); }
.btn.header-cta { display: none; }
@media (min-width: 960px) { .nav { display: flex; } .btn.header-cta { display: inline-flex; } .menu { display: none; } }
@media (hover: hover) and (pointer: fine) { .nav a:hover { color: var(--ink); background: var(--stone); } }
.menu { margin-left: auto; position: relative; }
.menu summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 12px; border-radius: var(--r-control); border: 1px solid var(--line-strong); background: var(--raised); font-size: 0.9375rem; min-height: 44px; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--stone-2); }
.menu nav { position: absolute; right: 0; top: calc(100% + 8px); width: min(300px, 86vw); background: var(--raised); border-radius: var(--r-panel); box-shadow: var(--shadow-2); padding: var(--s2); display: grid; transform-origin: top right; animation: menu-in var(--t-ui) var(--ease-out); }
.menu nav a { display: block; padding: 12px 14px; border-radius: var(--r-control); color: var(--ink); text-decoration: none; }
.menu nav a[aria-current="page"] { background: var(--stone-2); }
@keyframes menu-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--r-control); border: 1px solid transparent; font: 600 0.9375rem/1.2 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform var(--t-press) var(--ease-out), background-color var(--t-quick) ease, border-color var(--t-quick) ease, color var(--t-quick) ease; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--evergreen); color: oklch(0.99 0.005 85); }
.btn-secondary { background: var(--raised); color: var(--ink); border-color: var(--line-strong); }
.btn-quiet { background: transparent; color: var(--evergreen); padding-inline: 10px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
.btn-block { width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { background: var(--evergreen-deep); }
  .btn-secondary:hover:not(:disabled) { border-color: var(--ink-3); background: var(--canvas); }
  .btn-quiet:hover:not(:disabled) { background: var(--evergreen-tint); }
}
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }

/* ---- Forms ---- */
.field { display: grid; gap: 6px; }
.field + .field, .field + .field-row, .field-row + .field, .field-row + .field-row { margin-top: var(--s5); }
.field-row { display: grid; gap: var(--s4); }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field-row { align-items: start; }
.field-row > .field + .field { margin-top: 0; }
label, .label { font: 600 0.8125rem/1.3 var(--sans); color: var(--ink); }
.hint { font-size: 0.8125rem; line-height: 1.5; color: var(--ink-3); }
.field-error { font-size: 0.8125rem; color: var(--oxblood); }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: 400 1rem/1.45 var(--sans); color: var(--ink);
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--r-control);
  transition: border-color var(--t-quick) ease, box-shadow var(--t-quick) ease;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a524b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 36px; }
::placeholder { color: var(--ink-3); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--evergreen); box-shadow: 0 0 0 3px color-mix(in oklch, var(--evergreen) 22%, transparent); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--oxblood); }
input[type=color] { width: 44px; height: 44px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--raised); }
input[type=range] { width: 100%; accent-color: var(--evergreen); }
.check { display: flex; gap: 10px; align-items: flex-start; font: 400 0.9375rem/1.45 var(--sans); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--evergreen); }
.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; background: var(--stone-2); border-radius: 8px; }
.segmented button, .segmented label { min-height: 38px; padding: 6px 16px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font: 600 0.875rem/1.2 var(--sans); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background-color var(--t-quick) ease, color var(--t-quick) ease; }
.segmented [aria-selected="true"], .segmented [aria-pressed="true"], .segmented input:checked + span { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.02 150 / 0.12); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.form-status { min-height: 1.4em; font-size: 0.875rem; color: var(--ink-2); }
.form-status.is-error { color: var(--oxblood); }

details.design-options > summary { display: inline-flex; width: auto; list-style: none; padding-inline: 4px; }
details.design-options > summary::-webkit-details-marker { display: none; }

/* ---- Surfaces ---- */
.panel { background: var(--raised); border-radius: var(--r-panel); box-shadow: var(--shadow-1); padding: clamp(20px, 3vw, 32px); }
.inset { background: var(--stone); border-radius: var(--r-panel); padding: clamp(18px, 2.5vw, 28px); }
.rule-top { border-top: 1px solid var(--line); padding-top: var(--s5); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; background: var(--stone); color: var(--ink); font-size: 0.9375rem; line-height: 1.5; }
.notice .icon { margin-top: 2px; color: var(--ink-2); }
.notice.is-info { background: var(--stone); }
.notice.is-success { background: var(--evergreen-tint); } .notice.is-success .icon { color: var(--evergreen); }
.notice.is-warning { background: var(--amber-tint); } .notice.is-warning .icon { color: var(--amber); }
.notice.is-danger { background: var(--oxblood-tint); } .notice.is-danger .icon { color: var(--oxblood); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 600 0.8125rem/1.4 var(--sans); background: var(--stone-2); color: var(--ink-2); white-space: nowrap; }
.chip .icon { width: 14px; height: 14px; }
.chip.is-success { background: var(--evergreen-tint); color: var(--evergreen-deep); }
.chip.is-warning { background: var(--amber-tint); color: var(--amber); }
.chip.is-danger { background: var(--oxblood-tint); color: var(--oxblood); }
.chip.is-pending { background: var(--brass-tint); color: var(--amber); }

/* Key-value facts */
.facts { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 10px var(--s5); margin: 0; }
.facts dt { font: 600 0.8125rem/1.5 var(--sans); color: var(--ink-3); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Lists with a rule between items, instead of card grids */
.ruled { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.ruled > li { padding: var(--s5) 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
@media (min-width: 760px) { .ruled-cols > li { grid-template-columns: minmax(12rem, 1fr) 2fr; gap: var(--s6); align-items: baseline; } }
.feature-list { display: grid; gap: var(--s6) var(--s7); }
@media (min-width: 760px) { .feature-list { grid-template-columns: repeat(3, 1fr); } }
.feature { display: grid; gap: 10px; align-content: start; }
.feature .icon-lg { color: var(--evergreen); }
.feature p { color: var(--ink-2); }

/* ---- Prose and docs ---- */
.prose { max-width: 70ch; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { margin-top: 2.2em; font-size: clamp(1.45rem, 1.25rem + 0.8vw, 1.85rem); }
.prose h3 { margin-top: 1.9em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--ink-3); }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.prose th { text-align: left; font: 600 0.8125rem/1.4 var(--sans); color: var(--ink-3); border-bottom: 1px solid var(--line-strong); padding: 10px 12px 10px 0; }
.prose td { border-bottom: 1px solid var(--line); padding: 10px 12px 10px 0; vertical-align: top; }
.table-wrap { overflow-x: auto; }
pre.code, .prose pre { position: relative; margin: 0; background: var(--ink); color: oklch(0.94 0.01 120); border-radius: 10px; padding: 16px 18px; overflow-x: auto; font: 0.875rem/1.6 var(--mono); }
pre.code code, .prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.copy { position: absolute; top: 8px; right: 8px; }
.docs { display: grid; gap: var(--s7); padding-block: var(--s7) var(--s9); }
@media (min-width: 960px) { .docs { grid-template-columns: 220px minmax(0, 1fr); gap: var(--s8); } }
.docs-nav { font-size: 0.9375rem; }
@media (min-width: 960px) { .docs-nav { position: sticky; top: 92px; align-self: start; } }
.docs-nav p { font: 600 0.8125rem/1.3 var(--sans); color: var(--ink-3); margin: var(--s5) 0 var(--s2); }
.docs-nav p:first-child { margin-top: 0; }
.docs-nav a { display: block; padding: 6px 10px; margin-left: -10px; border-radius: var(--r-control); color: var(--ink-2); text-decoration: none; }
.docs-nav a[aria-current="page"] { color: var(--ink); background: var(--stone-2); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .docs-nav a:hover { color: var(--ink); background: var(--stone); } }

/* ---- Tools (render, scan, status) ---- */
.tool { display: grid; gap: var(--s6); align-items: start; padding-bottom: var(--s9); }
@media (min-width: 1000px) { .tool { grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); gap: var(--s7); } .tool-preview { position: sticky; top: 92px; } }
.stage { display: grid; place-items: center; background: var(--stone); border-radius: var(--r-panel); padding: clamp(20px, 4vw, 48px); min-height: 360px; }
.stage canvas, .stage img { width: min(100%, 460px); height: auto; image-rendering: auto; border-radius: 4px; }
.stage.is-transparent { background-color: var(--raised); background-image: conic-gradient(var(--stone-2) 25%, transparent 0 50%, var(--stone-2) 0 75%, transparent 0); background-size: 20px 20px; }
.viewfinder { position: relative; aspect-ratio: 4 / 3; background: oklch(0.2 0.01 150); border-radius: var(--r-panel); overflow: hidden; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; }
.viewfinder .reticle { position: absolute; inset: 18%; border-radius: 18px; box-shadow: 0 0 0 100vmax oklch(0.2 0.01 150 / 0.35); outline: 2px solid oklch(1 0 0 / 0.85); outline-offset: -2px; }

/* ---- Hero ---- */
.hero { padding-block: clamp(56px, 8vw, 120px) clamp(56px, 7vw, 104px); }
.hero .container { display: grid; gap: var(--s8); align-items: center; }
@media (min-width: 960px) { .hero .container { grid-template-columns: 7fr 5fr; } }
.display { font-family: var(--serif); font-weight: 400; font-size: clamp(2.6rem, 1.6rem + 4vw, 4.75rem); line-height: 1.04; letter-spacing: -0.02em; max-width: 14ch; }
.hero .lead { margin-top: var(--s5); }
.hero .btn-row { margin-top: var(--s6); }
.hero-code { justify-self: center; width: min(100%, 420px); }
.hero-code figure { margin: 0; background: var(--raised); border-radius: 20px; box-shadow: var(--shadow-2); padding: clamp(20px, 3vw, 32px); }
.hero-code figcaption { margin-top: var(--s4); display: flex; justify-content: space-between; gap: var(--s3); font-size: 0.8125rem; color: var(--ink-3); }
/* The site's single authored moment: the hero code settles into place. */
.hero-code figure { animation: settle 700ms var(--ease-out) both; }
@keyframes settle { from { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(4px); } }
.trust-strip { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--line); font-size: 0.875rem; color: var(--ink-2); }
.trust-strip span { display: inline-flex; align-items: center; gap: 8px; }
.trust-strip .icon { color: var(--evergreen); }

/* Specimens (real CKeys at several densities) */
.specimens { display: grid; gap: var(--s6); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.specimen { margin: 0; }
.specimen img { background: var(--raised); border-radius: 12px; padding: 14px; box-shadow: var(--shadow-1); }
.specimen figcaption { margin-top: var(--s3); font-size: 0.875rem; color: var(--ink-2); }
.specimen figcaption strong { display: block; color: var(--ink); font-weight: 600; }

/* FAQ */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: var(--s4); padding: 20px 0; font: 600 1.0625rem/1.4 var(--sans); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { transition: transform var(--t-ui) var(--ease-out); color: var(--ink-3); margin-top: 3px; }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details > div { padding: 0 0 22px; color: var(--ink-2); max-width: 68ch; }
.faq details > div > * + * { margin-top: 0.8em; }

/* Timeline (changelog) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; gap: var(--s3); padding: var(--s6) 0; border-top: 1px solid var(--line); }
@media (min-width: 800px) { .timeline > li { grid-template-columns: 12rem 1fr; gap: var(--s7); } }
.timeline time { font-size: 0.875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---- Footer ---- */
.site-footer { background: var(--stone); border-top: 1px solid var(--line); padding-block: var(--s8) var(--s6); margin-top: var(--s9); font-size: 0.9375rem; }
.footer-grid { display: grid; gap: var(--s6); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1.6fr repeat(4, 1fr); } }
.footer-brand p { margin-top: var(--s3); color: var(--ink-2); max-width: 30ch; font-size: 0.875rem; }
.footer-grid h2 { font: 600 0.8125rem/1.3 var(--sans); letter-spacing: 0; color: var(--ink-3); margin-bottom: var(--s3); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--ink-2); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .footer-grid a:hover { color: var(--ink); text-decoration: underline; } }
.footer-legal { margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); font-size: 0.8125rem; color: var(--ink-3); }
@media (max-width: 899px) { .footer-brand { grid-column: 1 / -1; } }

/* ---- Spacing utilities (no inline styles: the CSP forbids them) ---- */
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 20px; } .mt-5 { margin-top: 32px; } .mt-6 { margin-top: 48px; }

/* ---- Results appearing ---- */
.appear { animation: appear var(--t-ui) var(--ease-out); }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } }

/* ---- Reduced motion: keep fades and colour, remove movement ---- */
@media (prefers-reduced-motion: reduce) {
  .hero-code figure { animation: fade 300ms ease both; }
  .appear, .menu nav { animation: fade 160ms ease; }
  .btn:active:not(:disabled) { transform: none; }
  .faq summary .icon { transition: none; }
  html { scroll-behavior: auto; }
  @keyframes fade { from { opacity: 0; } }
}

/* ---- Print: the page, not the chrome ---- */
@media print {
  .site-header, .site-footer, .btn, .menu { display: none !important; }
  body { background: #fff; }
  .section { padding-block: 24px; }
}

/* ==== Page-specific styles: TOOLS (render, scan, status, report). Owned by the tools pages; add only here. ==== */

/* Shared tool pieces */
.tool-heading { font: 600 1.0625rem/1.35 var(--sans); letter-spacing: -0.005em; }
.tool-heading:focus { outline: none; }
.tool-preview { display: grid; gap: var(--s5); min-width: 0; }
.tool-preview > .notice { margin: 0; }
.notice-body { display: grid; gap: 2px; min-width: 0; }
.notice-title { font-weight: 600; }
.notice-title:focus { outline: none; }
.notice a { color: var(--evergreen-deep); }
.form-status.is-ok { color: var(--evergreen-deep); }
.inline-icon { display: inline-block; vertical-align: -0.2em; margin-right: 6px; color: var(--ink-3); }
.label-optional { font-weight: 400; color: var(--ink-3); }
.field-foot { display: flex; justify-content: space-between; gap: var(--s4); align-items: baseline; }
.field-foot .num { flex: none; }
.hint.is-near { color: var(--amber); }

/* Grouped controls (render) */
.tool-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.tool-group + .tool-group { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line); }
.tool-group > legend { float: left; width: 100%; padding: 0; margin-bottom: var(--s4); font: 600 1.0625rem/1.35 var(--sans); color: var(--ink); }
.tool-group > legend + * { clear: both; }
.tool-group .field + .field, .tool-group .field-row + .field-row, .tool-group .field-row + .field, .tool-group .field + .field-row { margin-top: var(--s4); }
.tool .field-row > .field + .field, .report-panel .field-row > .field + .field { margin-top: 0; }
.tool .field-row, .report-panel .field-row { align-items: start; }
.tool-group .hint + .field { margin-top: var(--s4); }
.tool-group .field > .hint + .hint { margin-top: -2px; }
.tool-sub { margin-top: var(--s3); padding: var(--s4); background: var(--stone); border-radius: 8px; }
.tool-sub .hint { color: var(--ink-2); }
.colour-field { display: flex; align-items: center; gap: var(--s3); }
.colour-field label { font-weight: 400; font-size: 0.9375rem; }
.tool-group .check { min-height: 32px; align-items: center; }
.tool-group .check input { margin-top: 0; }

/* Preview stage with a cross-fade between renders (opacity and filter only) */
.stage { position: relative; }
.stage.has-backdrop { background: var(--backdrop, var(--stone)); }
.stage-frame { display: grid; width: min(100%, 460px); aspect-ratio: 1; }
.stage-frame > * { grid-area: 1 / 1; }
.stage .stage-frame > canvas { width: 100%; height: 100%; opacity: 0; filter: blur(3px); transition: opacity 120ms var(--ease-out), filter 120ms var(--ease-out); }
.stage .stage-frame > canvas.is-current { opacity: 1; filter: none; transition-duration: 180ms; }
.stage-empty { place-self: center; display: grid; justify-items: center; gap: var(--s3); max-width: 30ch; text-align: center; color: var(--ink-2); font-size: 0.9375rem; }
.stage-empty .icon-lg { width: 40px; height: 40px; color: var(--ink-3); }
.stage.has-backdrop .stage-empty { background: var(--raised); padding: var(--s4); border-radius: 10px; }

.readout { display: grid; }
.cert { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2) var(--s3); }
.cert .chip { align-self: center; }
.cert p { flex: 1 1 18rem; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.5; }
.capacity { display: block; width: min(100%, 16rem); height: 4px; border-radius: 999px; background: var(--stone-2); overflow: hidden; }
.capacity > span { display: block; height: 100%; background: var(--ink-3); transform-origin: left center; transform: scaleX(var(--used, 0)); transition: transform var(--t-ui) var(--ease-out); }
.downloads { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line); }
.downloads .form-status:empty { display: none; }

/* Scan */
@media (min-width: 1000px) { .tool-scan { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); } }
.scan-camera { min-width: 0; }
.scan-camera > .notice:first-child { margin: 0; }
.viewfinder video, .viewfinder-still { position: absolute; inset: 0; width: 100%; height: 100%; }
.viewfinder-still { object-fit: contain; background: oklch(0.2 0.01 150); }
.viewfinder .reticle { inset: auto; top: 50%; left: 50%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); transition: outline-color var(--t-quick) ease; }
.viewfinder.is-found .reticle { outline-color: var(--evergreen-soft); outline-width: 3px; }
.viewfinder-idle { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: var(--s3); padding: var(--s5); text-align: center; color: oklch(0.93 0.01 120); font-size: 0.9375rem; }
.viewfinder-idle .icon-lg { width: 36px; height: 36px; color: oklch(0.85 0.012 120); }
.viewfinder-hint { position: absolute; left: 50%; bottom: var(--s3); transform: translateX(-50%); max-width: calc(100% - 2 * var(--s4)); padding: 6px 14px; border-radius: 999px; background: oklch(0.2 0.01 150 / 0.78); color: oklch(0.98 0.005 85); font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewfinder.is-live video { animation: tool-fade var(--t-ui) var(--ease-out); }
.file-pick { display: contents; }
.file-pick input.visually-hidden { width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; }
.file-pick input:focus-visible + label { outline: 2px solid var(--evergreen); outline-offset: 2px; }
.file-pick label[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.file-pick label:active:not([aria-disabled="true"]) { transform: scale(0.97); }
.scan-result { min-width: 0; }
.scan-tips { margin: var(--s4) 0 0; padding-left: 1.2em; color: var(--ink-2); font-size: 0.9375rem; display: grid; gap: 6px; }
.scan-tips li::marker { color: var(--ink-3); }
.result-target { color: var(--ink-2); overflow-wrap: anywhere; }
.result-target strong { color: var(--ink); }
.payload { margin: 0; padding: 14px 16px; max-height: 18rem; overflow: auto; background: var(--stone); border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 1rem/1.55 var(--sans); color: var(--ink); }
.payload.payload-hex { font: 0.875rem/1.7 var(--mono); font-variant-numeric: tabular-nums; }
.raw > summary { list-style: none; }
.raw > summary::-webkit-details-marker { display: none; }
.raw[open] > summary { color: var(--ink-2); }
@keyframes tool-fade { from { opacity: 0; } }

/* Status */
.status-empty { display: grid; justify-items: start; gap: var(--s3); color: var(--ink-2); }
.status-empty .icon-lg { color: var(--ink-3); }
.status-heading { font-size: clamp(1.45rem, 1.25rem + 0.8vw, 1.85rem); }
.status-heading:focus { outline: none; }
#status-out[aria-busy="true"] > :not(.notice) { opacity: 0.6; transition: opacity var(--t-quick) ease; }
.ruled-cols .chip { vertical-align: middle; }

/* Report */
.report-panel { max-width: 640px; }
.report-done .notice { font-size: 1rem; }
.report-aside h2 { font-size: clamp(1.45rem, 1.25rem + 0.8vw, 1.85rem); }
@media (min-width: 900px) { .report-aside { padding-top: var(--s4); } }
.report-layout { padding-bottom: var(--s9); }

/* ==== Page-specific styles: CONTENT (docs, about, faq, changelog, downloads, privacy, terms, 404). Add only here. ==== */
/* Docs layout: grouped side navigation, article header */
.docs-group { display: grid; align-content: start; }
.docs-nav .docs-group p { margin: 0 0 var(--s2); }
.docs-nav .docs-group + .docs-group { margin-top: var(--s5); }
@media (max-width: 959px) {
  .docs-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s3); padding: var(--s4); background: var(--stone); border-radius: var(--r-panel); }
  .docs-nav .docs-group + .docs-group { margin-top: 0; }
  .docs-nav a { margin-left: 0; padding: 10px 8px; font-size: 0.875rem; line-height: 1.35; }
  .docs-nav .docs-group p { padding-left: 8px; }
  .docs-nav a[aria-current="page"] { background: var(--raised); }
  .docs { padding-top: var(--s5); }
}
.docs-article { min-width: 0; }
.docs-head { padding-bottom: var(--s6); margin-bottom: var(--s6); border-bottom: 1px solid var(--line); }
.docs-head .lead { margin-top: var(--s4); }
.prose .docs-head + * { margin-top: 0; }
.prose > .notice { margin-top: var(--s5); }
.prose h3 code, .prose h2 code { font-size: 0.86em; background: var(--stone); }
.prose h3[id] { scroll-margin-top: 96px; }
.prose caption, .telemetry caption { caption-side: top; text-align: left; font: 600 0.875rem/1.4 var(--sans); color: var(--ink); padding-bottom: var(--s2); }
.prose var { font-style: italic; font-family: inherit; }
.docs-paths { padding-left: 1.25em; }
.docs-paths li::marker { color: var(--evergreen); }

/* Code samples: a dark block with a label bar and a Copy button (docs.js) */
.code-wrap { background: var(--ink); border-radius: 10px; overflow: hidden; min-width: 0; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; padding: 4px 6px 4px 18px; border-bottom: 1px solid oklch(1 0 0 / 0.1); font: 600 0.8125rem/1.3 var(--sans); color: oklch(0.86 0.01 120); }
.code-bar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-wrap pre.code { border-radius: 0; }
.code-wrap .copy { position: static; flex: none; color: oklch(0.95 0.01 120); background: transparent; border-color: oklch(1 0 0 / 0.22); min-width: 92px; }
.code-wrap .copy:focus-visible { outline-color: var(--evergreen-soft); }
.code-wrap .copy.is-done { border-color: oklch(0.78 0.08 155 / 0.7); }
.code-wrap .copy.is-done .icon { color: oklch(0.82 0.09 155); }
@media (hover: hover) and (pointer: fine) { .code-wrap .copy:hover { background: oklch(1 0 0 / 0.08); border-color: oklch(1 0 0 / 0.4); } }

/* Telemetry live summary */
.telemetry { margin-top: var(--s5); }
.telemetry-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s4); }
.prose .telemetry h3 { margin: 0; }
.telemetry-body { margin-top: var(--s5); min-height: 6rem; transition: opacity var(--t-ui) var(--ease-out); }
.telemetry-body.is-loading { opacity: 0.55; }
.telemetry-body > * + * { margin-top: var(--s5); }
.telemetry-range { margin: 0; }
.telemetry .facts { grid-template-columns: minmax(10rem, max-content) 1fr; }
.telemetry-empty { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); }
.telemetry-empty .icon { margin-top: 3px; color: var(--ink-3); }
.telemetry-label { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.telemetry .segmented button { min-height: 40px; }

/* About: annotated anatomy */
.anatomy { display: grid; gap: var(--s7); align-items: start; }
@media (min-width: 980px) { .anatomy { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: var(--s8); } .anatomy-figure { position: sticky; top: 92px; } }
.anatomy-figure { margin: 0; }
.anatomy-svg { width: 100%; height: auto; overflow: visible; }
.anatomy-figure figcaption { margin-top: var(--s3); text-align: center; }
.an-plate { fill: var(--raised); }
.an-halo { fill: none; stroke: var(--raised); stroke-width: 0.5; stroke-linecap: round; }
.an-leader { fill: none; stroke: var(--evergreen); stroke-width: 0.13; stroke-linecap: round; }
.an-target { fill: none; stroke: var(--evergreen); stroke-width: 0.16; }
.an-marker { fill: var(--evergreen); }
.anatomy-svg text { fill: oklch(0.99 0.005 85); font: 600 1.25px var(--sans); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
.anatomy-group { color: var(--ink-3); font-size: 0.8125rem; line-height: 1.3; }
.anatomy-group:not(:first-child) { margin-top: var(--s6); }
.anatomy-legend { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: var(--s4); }
.anatomy-legend li { display: grid; grid-template-columns: 28px 1fr; gap: 14px; align-items: start; color: var(--ink-2); }
.anatomy-legend strong { color: var(--ink); }
.an-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--evergreen); color: oklch(0.99 0.005 85); font: 600 0.8125rem/1 var(--sans); font-variant-numeric: tabular-nums; }
.an-note { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line-strong); }
.an-note p { margin-top: var(--s2); }

/* About: versions, levels, layouts */
.versions-table { max-width: 44rem; }
.versions-table table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.versions-table caption { caption-side: top; text-align: left; font: 600 0.875rem/1.4 var(--sans); padding-bottom: var(--s2); }
.versions-table th { text-align: left; font: 600 0.8125rem/1.4 var(--sans); color: var(--ink-3); border-bottom: 1px solid var(--line-strong); padding: 10px 12px 10px 0; }
.versions-table td { border-bottom: 1px solid var(--line); padding: 10px 12px 10px 0; }
.levels .level-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.level-meter { margin-left: auto; width: 120px; height: 6px; border-radius: 3px; background: var(--stone-2); overflow: hidden; }
.level-meter span { display: block; height: 100%; background: var(--evergreen); border-radius: 3px; }
.level-meter .lv-l { width: 23%; } .level-meter .lv-m { width: 47%; } .level-meter .lv-q { width: 73%; } .level-meter .lv-h { width: 100%; }
.layouts { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.about-why .notice { margin-top: var(--s5); }

/* FAQ */
.faq-jump { margin-top: var(--s4); color: var(--ink-2); }
.faq-group + .faq-group { margin-top: var(--s7); }
.faq-group h2 { font-size: clamp(1.45rem, 1.25rem + 0.8vw, 1.85rem); margin-bottom: var(--s4); scroll-margin-top: 96px; }
.faq details { scroll-margin-top: 96px; }
.faq summary { align-items: flex-start; min-height: 44px; }
.faq summary:focus-visible { outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) { .faq summary:hover { color: var(--evergreen-deep); } }
.faq-more { margin-top: var(--s8); }
.faq-more h2 { font-size: 1.5rem; }
.faq-more p { margin-top: var(--s2); }

/* Changelog */
.changelog { padding-bottom: var(--s8); }
.timeline > li { scroll-margin-top: 96px; }
.release-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); align-content: start; }
@media (min-width: 800px) { .release-meta { flex-direction: column; align-items: flex-start; } }
.release-version { font: 400 1.75rem/1.1 var(--serif); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.release-notes > h2:first-child { margin-top: 0; }
.release-notes h2 { font-size: clamp(1.35rem, 1.2rem + 0.6vw, 1.6rem); }
.release-notes h2 + * { margin-top: 0.6em; }
.core-changes { margin-top: var(--s7); max-width: 52rem; }
.core-changes h2 { font-size: 1.5rem; }
.core-changes p.muted { margin-top: var(--s2); }

/* Downloads */
.licence-line { display: flex; gap: 10px; align-items: flex-start; margin-top: var(--s5); color: var(--ink-2); max-width: 62ch; }
.licence-line .icon { margin-top: 2px; color: var(--evergreen); }
.release-meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.downloads-panel > * + * { margin-top: var(--s6); }
.empty-state { display: grid; justify-items: start; gap: var(--s3); max-width: 38rem; padding-block: var(--s3); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--stone); color: var(--ink-2); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-state .btn-row { margin-top: var(--s3); }
.file-group + .file-group { padding-top: var(--s6); border-top: 1px solid var(--line); }
.file-group p { margin-top: 4px; }
.file-list, .release-list { list-style: none; margin: var(--s4) 0 0; padding: 0; }
.file { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); padding: var(--s4) 0; border-top: 1px solid var(--line); }
.file-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s4); }
.file-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; overflow-wrap: anywhere; min-height: 44px; }
.file-name .icon { align-self: center; }
.sha { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 0.875rem; }
.sha code { font-size: 0.8125rem; overflow-wrap: anywhere; min-width: 0; }
.verify > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; color: var(--evergreen); font-weight: 600; font-size: 0.875rem; }
.verify[open] > summary { margin-bottom: var(--s2); }
.release-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.release-name { font-weight: 600; }
.install-list > li { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .install-list > li { grid-template-columns: minmax(12rem, 1fr) minmax(0, 2fr); } }
.install-list > li > * { min-width: 0; }
.install-list > li > div > p { margin-top: 6px; }
.verify-steps { margin: 0; padding-left: 1.4em; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
.verify-steps li::marker { font: 600 1rem var(--sans); color: var(--ink-3); }
.verify-steps li > * + * { margin-top: var(--s2); }
.verify-steps .code-wrap, .verify-steps pre.code { margin-top: var(--s3); }

/* Privacy and terms */
.legal { display: grid; gap: var(--s7); padding-bottom: var(--s8); align-items: start; }
@media (min-width: 1000px) { .legal { grid-template-columns: minmax(0, 70ch) minmax(260px, 1fr); gap: var(--s8); } .legal-summary { grid-column: 2; grid-row: 1; position: sticky; top: 92px; } .legal > .prose { grid-column: 1; grid-row: 1; } }
.legal > .prose > h2:first-child { margin-top: 0; }
.legal-summary h2 { font: 600 1rem/1.35 var(--sans); letter-spacing: 0; margin-bottom: var(--s4); }
.legal-summary .facts { grid-template-columns: 1fr; gap: 2px; }
.legal-summary .facts dt { margin-top: var(--s3); }
.legal-summary .facts dt:first-child { margin-top: 0; }
.legal-summary .facts dt { color: var(--ink-2); }
.legal-points { margin: 0; padding-left: 1.1em; display: grid; gap: var(--s2); color: var(--ink-2); }

/* 404 */
.notfound { padding-bottom: var(--s9); }
.notfound h1 { max-width: 16ch; }
.notfound-links .ruled > li { gap: 2px; padding: var(--s4) 0; }
.notfound-links a { font-weight: 600; }

/* Grid children that hold code or wide content must be allowed to shrink (shared .split has no min-width rule) */
.split > .prose, .split > .verify-steps, .split > .layouts, .split > .levels, .split > .stack, .split > .notfound-links { min-width: 0; }
