/* Odomachines: the shared system.
   A night sky with nothing in it. Pure black, square corners, one sans family set very large
   and very tight, ghost-grey body copy, and one warm colour: ochre, the colour of ore. Ochre
   marks where you are (the active nav item) and what the colony eats (ore in the sim). The
   machine view is the same site as text, for agents and for people who prefer it raw. */

:root {
  --void: #000;
  --chalk: #fff;
  --ash: #c4c4c4;      /* body copy under headlines */
  --graphite: #757575; /* labels, captions */
  --carbon: #454545;   /* tile borders */
  --soot: #1c1c1c;     /* hairlines inside panels */
  --cinder: #111;      /* the one raised surface: hover, inputs */
  --edge: #e5e7eb;     /* interactive borders */
  --ochre: #d39a4a;    /* ore, and where you are */
  --paper: #e8e2d6;    /* machine-view text */

  --sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --mono: "Martian Mono", ui-monospace, Menlo, monospace;

  --gutter: clamp(16px, 3vw, 32px);
  --max: 1280px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
html, body { background: var(--void); color: var(--chalk); }
body { margin: 0; font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, svg, canvas { display: block; max-width: 100%; }
:focus-visible { outline: 1px solid var(--ochre); outline-offset: 3px; }
::selection { background: var(--ochre); color: var(--void); }
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- type */
.display {
  font-weight: 600; font-size: clamp(44px, 7.4vw, 104px); line-height: .9;
  letter-spacing: -0.045em; margin: 0; text-wrap: balance;
}
.h-lg { font-weight: 600; font-size: clamp(30px, 3.4vw, 40px); line-height: 1; letter-spacing: -0.03em; margin: 0; text-wrap: balance; }
.h-md { font-weight: 600; font-size: 24px; line-height: 1.07; letter-spacing: -0.02em; margin: 0; }
.h-sm { font-weight: 600; font-size: 20px; line-height: 1.2; letter-spacing: -0.02em; margin: 0; }
.label { font-size: 13px; color: var(--graphite); margin: 0; }
.body { color: var(--ash); font-size: 15px; line-height: 1.5; }
.num { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; color: var(--graphite); font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- nav */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20; height: 52px;
  display: flex; align-items: center; gap: 24px; padding-inline: var(--gutter);
  background: rgba(0,0,0,.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--soot);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.brand svg { width: 34px; height: auto; }
.nav .links { display: flex; gap: 22px; margin: 0 auto; }
.nav .links a { font-size: 13px; font-weight: 500; text-decoration: none; color: var(--chalk); }
.nav .links a:hover { color: var(--ash); }
.nav .links a[aria-current] { color: var(--ochre); }
.nav .links sup { font-family: var(--mono); font-size: 9px; color: var(--graphite); margin-left: 3px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 500 13px/1 var(--sans);
  color: var(--chalk); background: var(--void); border: 1px solid var(--edge);
  padding: 7px 10px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--chalk); color: var(--void); }
@media (max-width: 860px) { .nav .links { display: none; } .nav .btn { margin-left: auto; } }

/* -------------------------------------------------------------- views */
/* The switch is fixed bottom right. The machine view is written by site.js from the page itself,
   so the two views can never disagree. */
.view-switch {
  position: fixed; right: var(--gutter); bottom: 16px; z-index: 30; display: flex;
  font: 500 11px/1 var(--mono); letter-spacing: .04em; border: 1px solid var(--carbon); background: var(--void);
}
.view-switch button {
  font: inherit; letter-spacing: inherit; color: var(--graphite); background: none; border: 0;
  padding: 9px 12px; cursor: pointer; text-transform: lowercase;
}
.view-switch button + button { border-left: 1px solid var(--carbon); }
.view-switch button[aria-pressed="true"] { color: var(--void); background: var(--paper); }
#machine { display: none; }
html[data-view="machine"] body > :not(#machine):not(.view-switch) { display: none !important; }
html[data-view="machine"] #machine {
  display: block; margin: 0 auto; max-width: 920px; padding: 40px var(--gutter) 96px;
  font: 400 12.5px/1.75 var(--mono); color: var(--paper); white-space: pre-wrap; overflow-wrap: anywhere;
}
#machine .k { color: var(--ochre); }
#machine .d { color: var(--graphite); }
#machine a { color: var(--paper); text-decoration-color: var(--carbon); text-underline-offset: 3px; }
#machine a:hover { color: var(--ochre); }
#machine .face { color: var(--ochre); font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: 12px; line-height: 1; letter-spacing: 0; display: block; margin-bottom: 22px; }

/* ---------------------------------------------------------- page tiles */
/* Collapsed borders, no gaps: a catalogue drawer, not a card grid. */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--carbon); border-left: 1px solid var(--carbon); }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px; min-height: 148px;
  padding: 14px 16px 16px; text-decoration: none; border-right: 1px solid var(--carbon); border-bottom: 1px solid var(--carbon);
  min-width: 0;
}
.tile .meta { display: flex; justify-content: space-between; gap: 12px; }
.tile .meta span:last-child { font-size: 12px; color: var(--graphite); }
.tile .h-sm { transition: color .2s; }
.tile .go { font-size: 13px; color: var(--graphite); opacity: 0; transform: translateX(-4px); transition: opacity .2s, transform .2s; }
.tile:hover { background: var(--cinder); }
.tile:hover .go { opacity: 1; transform: none; }
.tile:hover .num { color: var(--ochre); }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile { min-height: 132px; } }
@media (max-width: 440px) { .tiles { grid-template-columns: 1fr; } .tile { min-height: 0; gap: 18px; } }

/* -------------------------------------------------------------- article */
.page-head { padding: 132px 0 40px; border-bottom: 1px solid var(--soot); }
.page-head .label { margin-bottom: 18px; display: flex; align-items: baseline; gap: 10px; }
.page-head .label a { text-decoration: none; }
.page-head .label a:hover { color: var(--chalk); }
.page-head h1 { max-width: 16ch; }
.page-head .dek { color: var(--ash); font-size: clamp(17px, 1.6vw, 20px); line-height: 1.4; max-width: 38em; margin: 22px 0 0; }
.prose { max-width: 640px; padding: 40px 0 24px; }
.prose p, .prose li { color: var(--ash); font-size: 16px; line-height: 1.65; }
.prose p { margin: 0 0 18px; }
.prose strong { color: var(--chalk); font-weight: 600; }
.prose a { color: var(--chalk); text-decoration-color: var(--carbon); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--ochre); }
.prose h2 { font-weight: 600; font-size: 24px; line-height: 1.1; letter-spacing: -0.02em; margin: 40px 0 14px; scroll-margin-top: 64px; }
.prose ul { padding-left: 18px; margin: 0 0 18px; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--graphite); }
.prose table { width: 100%; border-collapse: collapse; margin: 8px 0 22px; font-size: 14px; }
.prose th, .prose td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--soot); vertical-align: top; color: var(--ash); }
.prose th { font-weight: 500; font-size: 12px; color: var(--graphite); border-bottom-color: var(--carbon); }
.prose .table { overflow-x: auto; }
.cite {
  max-width: 640px;
  padding: 40px 0 0;
  border-top: 1px solid var(--soot);
  margin-top: 24px;
}
.cite .label { margin-bottom: 14px; }
.cite dl { margin: 0; }
.cite dt {
  font-size: 12px; color: var(--graphite); font-weight: 500;
  margin: 16px 0 6px;
}
.cite dt:first-child { margin-top: 0; }
.cite dd { margin: 0; color: var(--ash); font-size: 14px; line-height: 1.55; }
.cite pre, .cite code { font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--ash); }
.cite pre {
  margin: 0; padding: 12px 14px; border: 1px solid var(--soot);
  overflow-x: auto; white-space: pre-wrap;
}
.cite p {
  color: var(--ash); font-size: 16px; line-height: 1.65; margin: 14px 0 0;
}
.cite a {
  color: var(--chalk); text-decoration-color: var(--carbon); text-underline-offset: 3px;
}
.cite a:hover { text-decoration-color: var(--ochre); }
.next-up { padding: 48px 0 0; }
.next-up .label { margin-bottom: 14px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--carbon); border-left: 1px solid var(--carbon); margin-top: 48px; }
.pager a { padding: 18px 16px; text-decoration: none; border-right: 1px solid var(--carbon); border-bottom: 1px solid var(--carbon); }
.pager a:hover { background: var(--cinder); }
.pager a:last-child { text-align: right; }
.pager span { display: block; font-size: 12px; color: var(--graphite); margin-bottom: 6px; }

/* --------------------------------------------------------------- footer */
.foot { border-top: 1px solid var(--soot); margin-top: 128px; padding: 28px 0 88px; }
.foot .wrap { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; }
.foot p { margin: 0; font-size: 13px; color: var(--graphite); max-width: 60em; }
.foot p b { color: var(--ash); font-weight: 500; }
.foot nav { display: flex; gap: 18px; font-size: 13px; }
.foot nav a { color: var(--ash); text-decoration: none; }
.foot nav a:hover { color: var(--chalk); }
@media (max-width: 720px) { .foot .wrap { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
