/* ==========================================================================
   Valence Mwigani — Design System
   Implementation of DESIGN.md. Section numbers match that document.
   ========================================================================== */

/* --- 3/4/5/6/8/9 Tokens --------------------------------------------------- */

:root {
  /* Colour */
  --canvas: #fbfbfa;
  --canvas-subtle: #f4f4f2;
  --surface: #ffffff;
  --surface-invert: #16181a;

  --ink: #16181a;
  --ink-secondary: #4a4f52;
  --ink-muted: #666d71;
  --ink-invert: #f4f4f2;
  --ink-invert-muted: #9aa1a4;

  --border: #e3e3df;
  --border-strong: #c9cac5;
  --border-control: #8b8e89;
  --border-invert: #2b2f31;

  --brand: #0f766e;
  --brand-hover: #0b5c56;
  --brand-muted: #e2f1ef;
  --brand-on-dark: #5eead4;

  --code-surface: #16181a;
  --code-ink: #e6e6e2;

  --success: #0f7b4f;
  --warning: #8a5a00;
  --error: #a3261c;

  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-display: clamp(2.4rem, 5.2vw, 4rem);
  --t-h1: clamp(2rem, 4vw, 3rem);
  --t-h2: clamp(1.5rem, 2.6vw, 2.125rem);
  --t-h3: 1.25rem;
  --t-h4: 1.0625rem;
  --t-body-lg: clamp(1.05rem, 1.5vw, 1.1875rem);
  --t-body: 1rem;
  --t-body-sm: 0.9375rem;
  --t-label: 0.6875rem;
  --t-caption: 0.8125rem;
  --t-code: 0.8125rem;

  /* Grid */
  --container: 1180px;
  --container-narrow: 760px;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-section: clamp(4rem, 9vw, 7rem);

  /* Shape */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;

  --header-h: 64px;
  --tap: 44px;
  --transition: 160ms ease;
}

/* --- Reset & base --------------------------------------------------------- */

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

/* The hidden attribute must win over any component display rule. */
[hidden] { display: none !important; }

html {
  overflow-x: clip;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-5));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--canvas);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-4);
  color: var(--ink);
  font-weight: 600;
  text-wrap: balance;
}

h1 { font-size: var(--t-h1); line-height: 1.08; letter-spacing: -0.03em; }
h2 { font-size: var(--t-h2); line-height: 1.15; letter-spacing: -0.022em; }
h3 { font-size: var(--t-h3); line-height: 1.3; letter-spacing: -0.014em; }
h4 { font-size: var(--t-h4); line-height: 1.4; letter-spacing: -0.01em; }

p { margin: 0 0 var(--space-4); max-width: 68ch; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 var(--space-4); padding-left: 1.15rem; }
li { margin-bottom: var(--space-2); }

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }

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

address { font-style: normal; }

code, kbd, samp, pre { font-family: var(--font-mono); }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

hr {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--border);
}

::selection { background: var(--ink); color: var(--canvas); }

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

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 200;
  padding: var(--space-3) var(--space-4);
  background: var(--ink);
  color: var(--canvas);
  border-radius: var(--radius-md);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- 5 Layout primitives -------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }

.section { padding-block: var(--space-section); }
.section--tight { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section--rule { border-top: 1px solid var(--border); }
.section--subtle { background: var(--canvas-subtle); }

.section--invert {
  background: var(--surface-invert);
  color: var(--ink-invert-muted);
}
.section--invert h1,
.section--invert h2,
.section--invert h3,
.section--invert h4,
.section--invert strong { color: var(--ink-invert); }
.section--invert a { color: var(--brand-on-dark); }
.section--invert .label { color: var(--ink-invert-muted); }

/* Section heading block */
.section-head { margin-bottom: var(--space-7); }
.section-head h2 { max-width: 22ch; }
.section-head p { max-width: 60ch; font-size: var(--t-body-lg); }

.section-head--split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-6);
  align-items: end;
}
.section-head--split > :last-child { margin-bottom: 0; }

/* --- 4 Type utilities ----------------------------------------------------- */

.display {
  font-size: var(--t-display);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0 0 var(--space-5);
  max-width: 17ch;
  text-wrap: balance;
}

.lead {
  font-size: var(--t-body-lg);
  line-height: 1.62;
  letter-spacing: -0.005em;
  max-width: 60ch;
}

.label {
  display: block;
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.caption { font-size: var(--t-caption); color: var(--ink-muted); }
.small { font-size: var(--t-body-sm); }
.mono { font-family: var(--font-mono); overflow-wrap: anywhere; }

/* --- 12 Buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--t-body-sm);
  font-weight: 500;
  line-height: 1;
  text-align: center;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

.btn--primary { background: var(--ink); color: var(--canvas); }
.btn--primary:hover { background: #2b2f31; color: var(--canvas); }

.btn--accent { background: var(--brand); color: #fff; }
.btn--accent:hover { background: var(--brand-hover); color: #fff; }

.btn--ghost { border-color: var(--border-control); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }

.btn--invert { border-color: var(--border-invert); color: var(--ink-invert); }
.btn--invert:hover { border-color: var(--ink-invert); color: var(--ink-invert); }

.btn--sm { min-height: 38px; padding: 0 0.85rem; font-size: var(--t-caption); }

.btn-group { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* --- 13 Links ------------------------------------------------------------- */

.prose a,
.text-link {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.prose a:hover,
.text-link:hover { color: var(--brand-hover); text-decoration-thickness: 2px; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  color: var(--ink);
  font-size: var(--t-body-sm);
  font-weight: 500;
}
.link-arrow::after {
  content: "→";
  font-family: var(--font-mono);
  color: var(--brand);
  transition: transform var(--transition);
}
.link-arrow:hover { color: var(--brand); }
.link-arrow:hover::after { transform: translateX(3px); }

/* --- 11 Header / navigation ----------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: var(--header-h);
}

.site-header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.site-header__brand:hover { color: var(--brand); }
.site-header__brand span { display: block; }
.site-header__brand small {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.site-nav { display: flex; align-items: center; gap: var(--space-5); margin-left: auto; }

.site-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav__links li { margin: 0; }
.site-nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--ink-secondary);
  font-size: var(--t-body-sm);
  font-weight: 500;
}
.site-nav__links a:hover { color: var(--ink); }
.site-nav__links a[aria-current="page"] { color: var(--ink); }

.site-nav__actions { display: flex; align-items: center; gap: var(--space-3); }

.menu-toggle {
  display: none;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  margin-left: auto;
  padding: 0 var(--space-3);
  background: none;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: var(--t-body-sm);
  font-weight: 500;
}

/* --- 14 Metadata dialect -------------------------------------------------- */

.meta { margin: 0; }

.meta__row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.meta__row:last-child { border-bottom: 1px solid var(--border); }

.meta__row dt {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  line-height: 1.6;
  padding-top: 0.15em;
}
.meta__row dd {
  margin: 0;
  font-size: var(--t-body-sm);
  color: var(--ink);
}

.section--invert .meta__row { border-color: var(--border-invert); }
.section--invert .meta__row dt { color: var(--ink-invert-muted); }
.section--invert .meta__row dd { color: var(--ink-invert); }

/* Inline stack line */
.stack-line {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

/* --- 19 Metrics ----------------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--border);
  border: 1px solid var(--border);
}
.metrics li {
  margin: 0;
  padding: var(--space-5);
  background: var(--canvas);
}
.metrics strong {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.metrics span {
  font-size: var(--t-caption);
  color: var(--ink-muted);
}
.section--invert .metrics { background: var(--border-invert); border-color: var(--border-invert); }
.section--invert .metrics li { background: var(--surface-invert); }
.section--invert .metrics strong { color: var(--ink-invert); }

/* --- 16 Featured project (editorial row) ---------------------------------- */

.work { display: grid; gap: var(--space-8); }

.work__item { display: grid; gap: var(--space-6); }

.work__media {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--canvas-subtle);
}
.work__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.work__body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-6) var(--space-7);
  align-items: start;
}

.work__title { margin-bottom: var(--space-4); }
.work__title a { color: var(--ink); }
.work__title a:hover { color: var(--brand); }

.work__aside > .meta { margin-bottom: var(--space-5); }

/* Compact variant — the homepage curates, so work rows read side-by-side.
   The full-width treatment above is kept for /projects, which expands. */
.work--compact { gap: 0; }

.work--compact .work__item {
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: var(--space-6);
  align-items: center;
  padding-block: var(--space-6);
  border-top: 1px solid var(--border);
}
.work--compact .work__item:last-child { border-bottom: 1px solid var(--border); }

.work--compact .work__body { display: block; }
.work--compact .work__title { margin-bottom: var(--space-3); }
.work--compact .work__body p { margin-bottom: var(--space-3); }

.work__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}

@media (max-width: 820px) {
  .work--compact .work__item { grid-template-columns: 1fr; gap: var(--space-5); }
}

/* --- 16 Project index ----------------------------------------------------- */

.index-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-body-sm);
}
.index-table caption { text-align: left; }
.index-table th,
.index-table td {
  padding: var(--space-4) var(--space-4) var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.index-table th {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom-color: var(--border-strong);
  white-space: nowrap;
}
.index-table td:first-child { color: var(--ink); font-weight: 500; }
.index-table .mono { font-size: var(--t-caption); color: var(--ink-muted); }
.index-table tr:hover td { background: var(--canvas-subtle); }

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* Card grid — permitted only in the project index */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-strong); }
.card__media { margin: 0; background: var(--canvas-subtle); border-bottom: 1px solid var(--border); }
.card__media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.card__body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); flex: 1; }
.card__body h3 { margin: 0; }
.card__body h3 a { color: var(--ink); }
.card__body h3 a:hover { color: var(--brand); }
.card__body p { font-size: var(--t-body-sm); margin: 0; }
.card__body .stack-line { margin-top: auto; padding-top: var(--space-3); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-6); }
.filter-btn {
  min-height: 38px;
  padding: 0 var(--space-4);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--t-caption);
  font-weight: 500;
  color: var(--ink-secondary);
  transition: border-color var(--transition), background-color var(--transition), color var(--transition);
}
.filter-btn:hover { border-color: var(--border-strong); color: var(--ink); }
.filter-btn[aria-pressed="true"] {
  background: var(--brand-muted);
  border-color: var(--brand);
  color: var(--brand-hover);
}

/* --- 17 Case study -------------------------------------------------------- */

.case-hero { padding-block: var(--space-8) var(--space-7); }
.case-hero .display { max-width: 20ch; }
.case-hero__meta { margin-top: var(--space-7); }

.case-body > * + * { border-top: 1px solid var(--border); }

.case-block { padding-block: var(--space-7); }
.case-block h2 { max-width: 24ch; }
.case-block .prose { max-width: var(--container-narrow); }

.prose > * { max-width: 68ch; }
.prose h3 { margin-top: var(--space-6); }
.prose h3:first-child { margin-top: 0; }
.prose ul { padding-left: 1.15rem; }
.prose ul li::marker { color: var(--brand); }

/* Feature list — no cards */
.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--border);
  border: 1px solid var(--border);
}
.feature-list li { margin: 0; padding: var(--space-5); background: var(--canvas); }
.feature-list h3 { font-size: var(--t-h4); margin-bottom: var(--space-2); }
.feature-list p { font-size: var(--t-body-sm); margin: 0; }
.feature-list .label { margin-bottom: var(--space-3); }

/* Numbered capability rows */
.numbered { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.numbered li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-4) var(--space-6);
  align-items: start;
  margin: 0;
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border);
}
.numbered__n {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--ink-muted);
  padding-top: 0.25em;
}
.numbered h3 { margin: 0 0 var(--space-2); }
.numbered p { margin: 0 0 var(--space-2); font-size: var(--t-body-sm); }

/* --- 18 Architecture diagram ---------------------------------------------- */

.arch {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.arch li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  flex: 1 1 190px;
}
.arch__node {
  flex: 1;
  min-width: 0;
  padding: var(--space-4);
  background: var(--canvas);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
}
.arch__node .label { margin-bottom: var(--space-1); }
.arch__node strong { display: block; font-size: var(--t-body-sm); color: var(--ink); }
.arch__node span { display: block; font-size: var(--t-caption); color: var(--ink-muted); }
.arch li:not(:last-child)::after {
  content: "→";
  flex-shrink: 0;
  font-family: var(--font-mono);
  color: var(--brand);
}

@media (max-width: 720px) {
  .arch { flex-direction: column; }
  .arch li { flex: 1 1 auto; flex-direction: column; align-items: stretch; gap: var(--space-2); }
  .arch li:not(:last-child)::after { content: "↓"; text-align: center; }
}

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

.code-block {
  margin: var(--space-5) 0;
  background: var(--code-surface);
  border: 1px solid var(--border-invert);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.code-block figcaption {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-invert);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-invert-muted);
}
.code-block pre {
  margin: 0;
  padding: var(--space-4);
  overflow-x: auto;
  color: var(--code-ink);
  font-size: var(--t-code);
  line-height: 1.6;
}

:not(pre) > code {
  padding: 0.15em 0.4em;
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875em;
  color: var(--ink);
}

/* --- 20 Experience timeline ----------------------------------------------- */

.timeline { margin: 0; border-top: 1px solid var(--border); }

.timeline__item {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--space-4) var(--space-7);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border);
}
.timeline__period {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--ink-muted);
  padding-top: 0.35em;
}
.timeline__role { margin: 0 0 var(--space-1); font-size: var(--t-h3); }
.timeline__org { margin: 0 0 var(--space-4); font-size: var(--t-body-sm); color: var(--ink-muted); }
.timeline__item ul { margin: 0 0 var(--space-4); padding-left: 1.15rem; }
.timeline__item li { font-size: var(--t-body-sm); }
.timeline__item li::marker { color: var(--brand); }

/* --- 21 Media ------------------------------------------------------------- */

.frame {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--canvas-subtle);
}
.frame img { width: 100%; object-fit: cover; }
.frame figcaption { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); font-size: var(--t-caption); color: var(--ink-muted); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-7);
  align-items: center;
}
.split--reverse > :first-child { order: 2; }
.split--top { align-items: start; }

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

.hero { padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4rem); }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-8);
  align-items: center;
}

.hero__eyebrow {
  margin-bottom: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.hero__actions { margin-top: var(--space-6); }

.hero__portrait {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.hero__portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 20%; }

/* Proof strip */
.proof {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--border);
  border-block: 1px solid var(--border);
}
.proof li { margin: 0; padding: var(--space-5) var(--space-4); background: var(--canvas); }
.proof .label { margin-bottom: var(--space-2); }
.proof p { margin: 0; font-size: var(--t-body-sm); color: var(--ink); }

/* --- Tech matrix ---------------------------------------------------------- */

.matrix { margin: 0; }
.matrix__row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--space-4) var(--space-6);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}
.matrix__row:first-child { border-top: 1px solid var(--border); }
.matrix__row dt {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-top: 0.3em;
}
.matrix__row dd { margin: 0; font-size: var(--t-body-sm); color: var(--ink); overflow-wrap: anywhere; }

/* --- Breadcrumb & page head ----------------------------------------------- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.breadcrumb li { margin: 0; }
.breadcrumb li + li::before { content: "/ "; color: var(--border-strong); }
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--ink); }

.page-head { padding-block: var(--space-8) var(--space-7); border-bottom: 1px solid var(--border); }
.page-head .lead { margin-bottom: 0; }

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

.site-footer {
  background: var(--surface-invert);
  color: var(--ink-invert-muted);
  padding-block: var(--space-8) var(--space-6);
}
.site-footer h2 {
  font-size: var(--t-label);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-invert-muted);
  margin-bottom: var(--space-4);
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) repeat(3, minmax(0, 3fr));
  gap: var(--space-7);
}
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer li { margin-bottom: var(--space-2); }
.site-footer a { color: var(--ink-invert-muted); font-size: var(--t-body-sm); }
.site-footer a:hover { color: var(--ink-invert); }
.site-footer__mark { color: var(--ink-invert); font-weight: 600; font-size: 1rem; margin-bottom: var(--space-3); }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: space-between;
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-invert);
  font-size: var(--t-caption);
}


/* --- Utilities -------------------------------------------------------------
   A deliberately small, closed set. If a layout needs something outside this,
   it needs a component in DESIGN.md — not an inline style. */

.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
.mt-8 { margin-top: var(--space-8); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.measure-xs { max-width: 34ch; }
.measure-sm { max-width: 60ch; }

.title-lg {
  font-size: var(--t-h2);
  line-height: 1.15;
  letter-spacing: -0.022em;
}

.link-plain { color: var(--ink); }
.link-plain:hover { color: var(--brand); }

.pullquote {
  margin: var(--space-6) 0;
  padding-left: var(--space-5);
  border-left: 2px solid var(--brand);
  font-size: var(--t-body-lg);
  line-height: 1.6;
  color: var(--ink);
}

/* --- 23 Responsive -------------------------------------------------------- */

@media (max-width: 900px) {
  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 0;
    z-index: 90;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: var(--space-5) var(--gutter) var(--space-8);
    background: var(--canvas);
    border-top: 1px solid var(--border);
    overflow-y: auto;
  }
  .site-nav.is-open { display: flex; }
  .site-nav__links { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav__links a {
    min-height: 52px;
    font-size: 1.0625rem;
    border-bottom: 1px solid var(--border);
  }
  .site-nav__actions { margin-top: var(--space-5); flex-direction: column; align-items: stretch; }
  .site-nav__actions .btn { width: 100%; }
  .menu-toggle { display: inline-flex; }
}

@media (max-width: 860px) {
  .site-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
}

@media (max-width: 820px) {
  .hero__grid,
  .work__body,
  .split,
  .section-head--split { grid-template-columns: 1fr; gap: var(--space-6); }
  .split--reverse > :first-child { order: 0; }
  .hero__portrait { max-width: 22rem; }
  .hero__portrait img { aspect-ratio: 3 / 2; }
  .numbered li { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .numbered li > :last-child { grid-column: 2; }
}

@media (max-width: 720px) {
  .meta__row,
  .matrix__row,
  .timeline__item { grid-template-columns: 1fr; gap: var(--space-2); }
  .timeline__item { gap: var(--space-3); }
  .timeline__period { padding-top: 0; }
  .index-table thead { display: none; }
  .index-table tr { display: block; padding: var(--space-4) 0; border-bottom: 1px solid var(--border); }
  .index-table td { display: block; padding: 0 0 var(--space-2); border: 0; }
  .index-table td:first-child { font-size: var(--t-h4); }
  .site-footer__grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  :root { --gutter: 1.125rem; }
  .btn { width: 100%; }
  .btn-group { flex-direction: column; align-items: stretch; }
  .btn-group .btn { width: 100%; }
}

/* --- 22 Motion ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Print ---------------------------------------------------------------- */

@media print {
  .site-header, .site-footer, .btn, .filters { display: none; }
  body { background: #fff; color: #000; }
}
