/* ───────────── Tokens ───────────── */
/* Look after Linear: near-black, Inter, bold and tight, one red. */
:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);

  --gutter: 20px;
  --gap: 16px;
  --pad: 8px;
  --max: 1320px;
  --bar-h: 64px;

  /* dark is the default theme */
  --bg: #08090a;
  --surface: #0f1012;
  --tile: #141517;
  --tile-2: #1e1f22;
  --ink: #f7f8f8;
  --ink-2: #b4b7bd;
  --ink-3: #8a8f98;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .18);
  --red: #ff3b30;
  --on-red: #08090a;
  --hi: #d4261c; /* the fill of a pointed-at project row; deep enough for the white text on it */
  --on-hi: #f7f8f8;
  --bar-bg: rgba(8, 9, 10, .72);
  --float-bg: rgba(20, 21, 24, .82);
  --shadow: 0 18px 40px -14px rgba(0, 0, 0, .75), 0 2px 8px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f7f6;
  --surface: #ffffff;
  --tile: #eeeeec;
  --tile-2: #e3e3e0;
  --ink: #0b0b0c;
  --ink-2: #3c3d40;
  --ink-3: #66676b;
  --line: rgba(0, 0, 0, .11);
  --line-strong: rgba(0, 0, 0, .22);
  --red: #d4261c;
  --on-red: #ffffff;
  --hi: #d4261c;
  --on-hi: #ffffff;
  --bar-bg: rgba(247, 247, 246, .76);
  --float-bg: rgba(255, 255, 255, .86);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .08);
  color-scheme: light;
}

@media (min-width: 900px) {
  :root { --gutter: clamp(40px, 5vw, 72px); --gap: 24px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 24px);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  letter-spacing: -.011em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--red); color: var(--on-red); }

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

h1, h2, h3, h4, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: 600; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.num { font-variant-numeric: tabular-nums; }
.cover { width: 100%; height: 100%; object-fit: cover; }
.is-gray { filter: grayscale(1) contrast(1.05); }
.is-invert { filter: invert(1) grayscale(1); }
.is-pixel { image-rendering: pixelated; }
/* an app icon sits whole in the middle of the frame instead of filling it */
.is-icon { object-fit: contain; padding: 14%; }
.ico { flex: none; }
.ico-alert { color: var(--red); margin-top: 1px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-weight: 500;
}
.skip:focus { top: 12px; }

/* ───────────── Layout ───────────── */
.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

main, footer { position: relative; z-index: 1; }
main:focus { outline: none; }

/* ───────────── Type ───────────── */
h2 {
  font-size: clamp(1.75rem, 2.6vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -.025em;
}
h3 { font-size: 1.0625rem; letter-spacing: -.012em; }

.lede {
  font-size: clamp(1.125rem, 1.55vw, 1.375rem);
  line-height: 1.4;
  letter-spacing: -.015em;
  color: var(--ink-2);
  text-wrap: pretty;
}
.label { display: block; font-size: .8125rem; font-weight: 500; color: var(--ink-3); }
.small { font-size: .875rem; color: var(--ink-2); }
.lab { font-size: .6875rem; font-weight: 550; line-height: 1.2; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

.textlink {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em;
  text-decoration-color: var(--line-strong);
  transition: text-decoration-color .2s;
}
.textlink:hover { text-decoration-color: currentColor; }

/* ───────────── Small parts ───────────── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; height: 30px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: .8125rem; color: var(--ink-2); white-space: nowrap;
  background: var(--bg);
  transition: color .2s, border-color .2s, background-color .2s;
}
a.chip:hover { color: var(--ink); border-color: var(--ink-3); background: var(--tile); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px;
  font-size: .875rem; font-weight: 500; white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn .ico { width: 18px; height: 18px; }
.btn-ghost { border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--tile); border-color: var(--ink-3); }
.btn-solid { background: var(--ink); color: var(--bg); }
.btn-solid:hover { background: var(--ink-2); }

.iconbtn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--ink);
  transition: background-color .2s, border-color .2s, color .2s;
}
.iconbtn:hover { background: var(--tile); border-color: var(--ink-3); }

.go {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s;
}
.go .ico { transition: transform .35s var(--ease); }

/* Mockup-only markers */
.note {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 8px;
  border: 1px dashed var(--ink-3); border-radius: 6px;
  font-size: .6875rem; font-weight: 600; letter-spacing: 0; color: var(--ink-2);
  vertical-align: middle; white-space: nowrap;
}

.mockbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 8px var(--gutter);
  background: var(--tile); border-bottom: 1px dashed var(--line-strong);
  font-size: .8125rem; color: var(--ink-2); line-height: 1.35;
}
.mockbar strong { color: var(--ink); font-weight: 600; }
.mockbar button { flex: none; height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .75rem; }

/* ───────────── Top bar ───────────── */
/* Stays at the top while the page scrolls, over a blur of what passes under it, with one hairline beneath. */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  view-transition-name: topbar;
}
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; column-gap: 28px; min-height: var(--bar-h); }
.brand { margin-right: auto; padding-block: 10px; font-size: .9375rem; font-weight: 600; letter-spacing: -.012em; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 0 22px; font-size: .875rem; color: var(--ink-2); }
.nav a { padding-block: 10px; transition: color .15s; }
.nav a[aria-current] { color: var(--ink); }
@media (hover: hover) { .nav a:hover { color: var(--ink); } }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar .iconbtn { width: 36px; height: 36px; }
.topbar .iconbtn .ico { width: 18px; height: 18px; }
@media (max-width: 699px) {
  .topbar .wrap { padding-block: 4px 2px; }
  .nav { order: 3; width: 100%; justify-content: space-between; gap: 0 10px; font-size: .8125rem; }
}

/* ───────────── Hero ───────────── */
.hero { padding-block: clamp(64px, 10vw, 152px) clamp(80px, 11vw, 168px); }
.hero-h { max-width: 13.6em; font-size: clamp(2.5rem, 5.2vw, 4.75rem); line-height: 1.02; letter-spacing: -.035em; }

/* ───────────── The sheet ───────────── */
/* Below the headline everything sits on one sheet: a line down each side, starting at the facts. Lines belong
   to boxes and stop at their edges, except the one vertical that runs a quarter of the way in, from the facts
   down through every section, so each heading sits in its own box to the left of it. The space between
   sections is left as empty boxes. A label is locked between two lines with almost no gap. */
.sheet { position: relative; border-inline: 1px solid var(--line); }
@media (min-width: 1040px) {
  .run::before { content: ""; position: absolute; z-index: 2; top: 0; bottom: 0; left: 25%; width: 1px; background: var(--line); pointer-events: none; }
}

.band { display: block; padding-top: 1px; border-block: 1px solid var(--line); text-box: trim-both cap alphabetic; }

.sec { margin-top: clamp(96px, 12vw, 176px); }
.shead { border-top: 1px solid var(--line); padding: 2px 0 28px; }
.stitle { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1; letter-spacing: -.032em; text-box: trim-both cap alphabetic; }

/* Facts */
.facts { display: grid; border-bottom: 1px solid var(--line); }
.facts > div { display: grid; align-content: start; }
.facts dd { padding: 14px var(--pad) 26px; font-size: .9375rem; line-height: 1.45; text-wrap: pretty; overflow-wrap: anywhere; }
@media (min-width: 560px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts > div:nth-child(even) { border-left: 1px solid var(--line); }
}

/* Projects: a ruled table. Pointed at, a row fills with one colour, edge to edge and rule to rule. */
.ptable { position: relative; }
.cl, .thead { display: none; }
.trows { border-top: 1px solid var(--line); }
.trow { position: relative; z-index: 1; border-bottom: 1px solid var(--line); }
.trow-link { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 16px; align-items: baseline; padding: 22px var(--pad) 18px; }
.t-name { grid-area: 1 / 1; font-size: 1.5rem; font-weight: 600; line-height: 1.1; letter-spacing: -.025em; }
.t-period { grid-area: 1 / 2; font-size: .8125rem; color: var(--ink-3); white-space: nowrap; }
.t-what { grid-column: 1 / -1; font-size: .9375rem; line-height: 1.45; color: var(--ink-2); text-wrap: pretty; }
.t-role { grid-column: 1 / -1; font-size: .8125rem; line-height: 1.4; color: var(--ink-3); }
.t-built { display: none; }
/* The arrow says a row opens. Touch screens always show it; with a mouse it appears on the hovered row. */
.t-go { grid-area: 1 / 3; align-self: baseline; display: flex; translate: 0 3px; color: var(--ink-3); }
.t-go .ico { width: 16px; height: 16px; }
.trow:has(.trow-link:focus-visible) { z-index: 0; background: var(--hi); }
.trow-link:focus-visible { outline: 2px solid var(--on-hi); outline-offset: -4px; }
.trow:has(.trow-link:focus-visible) * { color: var(--on-hi); }

/* Skills: four plain lists */
.sgrid { display: grid; border-bottom: 1px solid var(--line); }
.sgroup { display: grid; align-content: start; }
.slist { padding: 14px var(--pad) 30px; font-size: .9375rem; line-height: 1.9; }
.slist .is-on { color: var(--red); }
@media (min-width: 560px) {
  .sgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sgroup:nth-child(even) { border-left: 1px solid var(--line); }
}

/* About: the heading, then three numbered boxes */
.abox { display: grid; border-block: 1px solid var(--line); }
.abox > .stitle { padding: 2px 0 28px; }
.aitem { display: grid; grid-template-rows: auto 1fr auto; }
.aitem p { max-width: 60ch; padding: 14px var(--pad) 22px; font-size: .9375rem; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.anum { padding: 0 var(--pad) 18px; font-size: 2.5rem; font-weight: 500; line-height: 1; letter-spacing: -.03em; color: var(--ink-3); text-box: trim-both cap alphabetic; }

/* Contact */
.cbox { display: grid; border-block: 1px solid var(--line); }
.cbox > .stitle { padding: 2px 0 28px; }
.c-mail, .c-links { display: grid; align-content: start; }
.mailrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 18px var(--pad) 28px; }
.mail { font-size: clamp(1.375rem, 2.6vw, 2.25rem); font-weight: 600; letter-spacing: -.03em; overflow-wrap: anywhere; transition: color .2s; }
.c-links ul { padding: 8px var(--pad) 20px; }
.blink { display: inline-flex; align-items: center; min-height: 40px; font-size: .9375rem; font-weight: 500; transition: color .2s; }
.blink::before { content: "( "; white-space: pre; color: var(--ink-3); }
.blink::after { content: " )"; white-space: pre; color: var(--ink-3); }
.blink.is-todo { color: var(--ink-3); }
@media (hover: hover) {
  .mail:hover, a.blink:hover { color: var(--red); }
}

/* Footer: the name between two rules, still on the sheet */
.foot-sheet { padding-top: clamp(96px, 12vw, 176px); }
.bigname { overflow: hidden; border-block: 1px solid var(--line); white-space: nowrap; font-weight: 600; line-height: 1; letter-spacing: -.045em; }
.bigname span { display: inline-block; font-size: 6.4vw; text-box: trim-both cap alphabetic; }
.colophon { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding: 16px var(--pad) 40px; font-size: .8125rem; color: var(--ink-3); }

@media (min-width: 1040px) {
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* the second column's left edge is the long vertical, so it is not drawn twice */
  .facts > div:nth-child(even) { border-left: 0; }
  .facts > div:nth-child(n + 3) { border-left: 1px solid var(--line); }
  .facts dd { padding: 18px var(--pad) 40px; }

  .shead { min-height: clamp(150px, 13.6vw, 196px); padding-bottom: 0; }

  .cl { display: block; position: absolute; z-index: 2; top: 0; bottom: 0; left: calc(var(--x) / 12 * 100%); width: 1px; background: var(--line); pointer-events: none; }
  .thead { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .thead span:nth-child(1) { grid-column: 1 / 4; }
  .thead span:nth-child(2) { grid-column: 4 / 5; }
  .thead span:nth-child(3) { grid-column: 5 / 7; }
  .thead span:nth-child(4) { grid-column: 7 / 11; }
  .thead span:nth-child(5) { grid-column: 11 / 13; text-align: right; }
  .thead span:not(:first-child) { padding-left: 0; }
  .trows { border-top: 0; }
  /* Text rests on its row's rule: the rule is the baseline. */
  .trow-link { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0; align-items: end; padding: clamp(44px, 4.4vw, 60px) 0 0; }
  .trow-link > span { padding-inline: var(--pad); text-box: trim-both cap alphabetic; }
  .t-name { grid-area: auto; grid-column: 1 / 4; font-size: clamp(1.5rem, 2.1vw, 1.875rem); }
  .t-period { grid-area: auto; grid-column: 4 / 5; white-space: normal; line-height: 1.3; }
  .t-role { grid-column: 5 / 7; line-height: 1.34; color: var(--ink-2); text-wrap: pretty; }
  .t-what { grid-column: 7 / 11; font-size: .875rem; line-height: 1.38; }
  .t-built { display: block; grid-column: 11 / 13; text-align: right; }
  .t-built b { display: block; font-size: 1.125rem; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; }
  .t-built small { display: block; margin-top: 4px; font-size: .75rem; line-height: 1.3; color: var(--ink-3); text-box: trim-both cap alphabetic; }
  /* top right corner; the glyph's own inset is taken off so it lines up with the text edge */
  .t-go { position: absolute; top: 7px; right: calc(var(--pad) - 5px); translate: none; }
  .t-go .ico { width: 18px; height: 18px; }

  .sgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sgroup:nth-child(even) { border-left: 0; }
  .sgroup:nth-child(n + 3) { border-left: 1px solid var(--line); }
  .slist { padding: 20px var(--pad) 56px; }

  .abox, .cbox { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .abox { min-height: clamp(300px, 26vw, 380px); }
  .abox > .stitle, .cbox > .stitle { grid-column: 1 / 4; grid-row: 1; padding: 2px 0 0; }
  .aitem { grid-row: 1; }
  .aitem:nth-of-type(1) { grid-column: 4 / 7; }
  .aitem:nth-of-type(2) { grid-column: 7 / 10; border-left: 1px solid var(--line); }
  .aitem:nth-of-type(3) { grid-column: 10 / 13; border-left: 1px solid var(--line); }
  /* the section's top rule is each label's upper line */
  .aitem .band, .cbox .band { border-top: 0; }
  .aitem p { padding: 18px var(--pad) 32px; font-size: .875rem; }
  .anum { align-self: end; padding: 0 var(--pad); font-size: clamp(2.25rem, 3.2vw, 3rem); }

  .cbox { min-height: clamp(200px, 16vw, 240px); }
  .c-mail { grid-column: 4 / 10; grid-row: 1; }
  .c-links { grid-column: 10 / 13; grid-row: 1; border-left: 1px solid var(--line); }
  .c-links ul { padding: 14px var(--pad) 24px; }
  .blink { min-height: 34px; }
}
@media (min-width: 1040px) and (hover: hover) {
  /* A filled row sits under its neighbours, so the tails of letters hanging over its top stay whole. */
  .trow:hover { z-index: 0; background: var(--hi); }
  .trow:hover * { color: var(--on-hi); }
  .t-go { visibility: hidden; }
  .trow:hover .t-go, .trow:has(.trow-link:focus-visible) .t-go { visibility: visible; }
}

/* ───────────── Project page ───────────── */
/* One open column after Talin's reference: wide media, generous gaps, no side rail. */
.pcol { width: min(100%, 1040px); margin-inline: auto; }

/* A project is its own page: no section links, no shared contact footer.
   The theme toggle and a close button float in the top corner; previous and next float in the bottom corner. */
#project-close { display: none; }
[data-view="project"] #project-close { display: grid; }
[data-view="project"] .nav { display: none; }
[data-view="project"] .topbar { position: relative; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 0; }
[data-view="project"] .topbar-actions {
  position: fixed; z-index: 45; gap: 10px;
  top: calc(16px + var(--mock-h, 0px));
  right: max(var(--gutter), calc((100vw - var(--max)) / 2));
}
[data-view="project"] .topbar-actions .iconbtn {
  background: var(--float-bg);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow);
}
@media (hover: hover) {
  [data-view="project"] .topbar-actions .iconbtn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .pager a:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
}
[data-view="project"] body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
[data-view="project"] .footer { padding-top: 0; }

.pfoot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px;
  padding-top: 24px; border-top: 1px solid var(--line);
  font-size: .875rem; color: var(--ink-3);
}
.pfoot-links { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-2); }

.phead { padding-top: clamp(8px, 2vw, 28px); }
.p-title { margin-top: clamp(12px, 2.6vw, 40px); font-size: clamp(2.75rem, 6.6vw, 5.5rem); line-height: 1; letter-spacing: -.035em; overflow-wrap: anywhere; }
.p-summary { margin-top: clamp(14px, 1.8vw, 22px); max-width: 40ch; }

.p-hero {
  margin-top: clamp(36px, 5.5vw, 80px);
  aspect-ratio: 4 / 3; overflow: hidden;
  border: 1px solid var(--line); border-radius: clamp(18px, 2.2vw, 32px);
  background: #000;
}
@media (min-width: 700px) { .p-hero, .p-hero.shot { aspect-ratio: 16 / 9; } }
.p-hero.shot { margin-top: clamp(36px, 5.5vw, 80px); border-radius: clamp(18px, 2.2vw, 32px); }

.p-intro {
  display: grid; gap: 1.1em;
  padding-top: clamp(36px, 5vw, 72px);
  font-size: clamp(1.125rem, 1.5vw, 1.3125rem); line-height: 1.5; letter-spacing: -.01em;
  color: var(--ink-2);
}
.p-intro p { max-width: 46rem; text-wrap: pretty; }
.p-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: .5em; }

.pmeta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px var(--gap);
  margin-top: clamp(32px, 4vw, 56px); padding-block: clamp(28px, 3.6vw, 48px);
  border-block: 1px solid var(--line-strong);
}
.pmeta dt { margin-bottom: 6px; font-size: .875rem; color: var(--ink-3); }
.pmeta dd { font-size: 1.0625rem; line-height: 1.45; text-wrap: pretty; }
.pmeta-skills { grid-column: 1 / -1; }
.pmeta-skills dd { line-height: 1.9; }
@media (min-width: 900px) {
  .pmeta { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 40px; }
  .pmeta-skills { grid-column: auto; }
  .pmeta-skills dd { line-height: 1.6; }
}

.psec { padding-top: clamp(64px, 9vw, 128px); }
.psec > h2 { margin-bottom: clamp(16px, 2vw, 28px); font-size: clamp(1.875rem, 3.2vw, 2.75rem); letter-spacing: -.03em; }
.ptext { display: grid; gap: 1.1em; font-size: 1.125rem; line-height: 1.6; color: var(--ink-2); }
.ptext p { max-width: 43rem; text-wrap: pretty; }

.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: clamp(12px, 1.4vw, 20px); margin-top: clamp(32px, 4vw, 56px); }
.shot {
  aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 16px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: clamp(16px, 1.8vw, 24px);
  font-size: .8125rem; line-height: 1.35; color: var(--ink-2);
  background:
    linear-gradient(to top right, transparent calc(50% - .5px), var(--line) calc(50% - .5px), var(--line) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(to bottom right, transparent calc(50% - .5px), var(--line) calc(50% - .5px), var(--line) calc(50% + .5px), transparent calc(50% + .5px));
  background-color: var(--bg);
}
.shot span { padding: 4px 8px; border-radius: 8px; background: var(--bg); }

/* Soft tiles: numbers and findings */
.ptiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: clamp(12px, 1.4vw, 20px); }
.ptile { padding: clamp(22px, 2.4vw, 32px); border-radius: clamp(20px, 2vw, 28px); background: var(--tile); }
.ptile b { display: block; font-size: 1.125rem; font-weight: 600; line-height: 1.3; letter-spacing: -.012em; text-wrap: balance; }
.ptile p { margin-top: 10px; color: var(--ink-2); line-height: 1.5; text-wrap: pretty; }
.ptile.is-todo { background: none; border: 1px dashed var(--line-strong); }
.ptile.is-todo .note { margin: 0; }

/* One soft panel listing each problem with what was done about it */
.ppanel { display: grid; gap: clamp(24px, 3vw, 36px); padding: clamp(24px, 3.2vw, 44px); border-radius: clamp(22px, 2.4vw, 32px); background: var(--tile); }
.ppanel li { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; }
.ppanel b { display: block; max-width: 44rem; font-size: 1.125rem; font-weight: 600; line-height: 1.35; letter-spacing: -.012em; text-wrap: pretty; }
.ppanel p { max-width: 44rem; margin-top: 6px; color: var(--ink-2); line-height: 1.55; text-wrap: pretty; }

/* Previous and next project. Wide screens: floating arrows in the corner, each naming where it goes.
   Phones: no floating arrows over the text; the same two links sit at the end of the page instead. */
.pager { display: none; }
@media (min-width: 700px) {
  .pager { position: fixed; right: clamp(14px, 2vw, 28px); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40; display: flex; gap: 10px; }
  .pager a {
    position: relative;
    display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
    border: 1px solid var(--line-strong); background: var(--float-bg);
    -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: var(--shadow);
    transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s;
  }
  .pager .tip {
    position: absolute; right: 0; bottom: calc(100% + 10px);
    padding: 7px 11px; border-radius: 10px;
    background: var(--ink); color: var(--bg);
    font-size: .8125rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
    opacity: 0; transform: translateY(4px); pointer-events: none;
    transition: opacity .2s, transform .25s var(--ease);
  }
  .pager a:focus-visible .tip { opacity: 1; transform: none; }
}
@media (min-width: 700px) and (hover: hover) {
  .pager a:hover .tip { opacity: 1; transform: none; }
}
@media (max-width: 699px) {
  [data-view="project"] body { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}

/* Flowchart */
.flow-wrap { container-type: inline-size; }
.flow { display: grid; gap: 28px; counter-reset: step; max-width: 440px; }
.flow-node {
  position: relative; counter-increment: step;
  padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface);
}
.flow-node::before {
  content: counter(step, decimal-leading-zero);
  display: block; margin-bottom: 8px;
  font-size: .75rem; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.flow-node b { display: block; font-size: .9375rem; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.flow-node > span { display: block; margin-top: 4px; font-size: .8125rem; line-height: 1.35; color: var(--ink-2); }
.flow-node .split { display: grid; gap: 6px; margin-top: 10px; }
.flow-node .split i { font-style: normal; padding: 6px 8px; border: 1px dashed var(--line-strong); border-radius: 8px; font-size: .75rem; line-height: 1.25; color: var(--ink-2); }
.flow-node + .flow-node::after {
  content: ""; position: absolute; left: 22px; top: -28px; width: 12px; height: 28px;
  background: var(--ink-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 28'%3E%3Cpath d='M6 1v25M2 21.5l4 4.5 4-4.5' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 28'%3E%3Cpath d='M6 1v25M2 21.5l4 4.5 4-4.5' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.flow-loop { display: none; }
.flow-loop-text { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: .875rem; color: var(--ink-2); }
.flow-loop-text .ico { width: 18px; height: 18px; color: var(--ink-3); }

@container (min-width: 520px) and (max-width: 739.98px) {
  .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
  .flow-node { padding: 12px; overflow-wrap: anywhere; }
  .flow-node + .flow-node::after {
    left: -28px; top: 50%; width: 28px; height: 12px; margin-top: -6px;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 12'%3E%3Cpath d='M1 6h25M21.5 2l4.5 4-4.5 4' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 12'%3E%3Cpath d='M1 6h25M21.5 2l4.5 4-4.5 4' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
  /* First step of a new row: the line leaves the bottom of the last step above, crosses back, and arrives from the top. */
  .flow-node:nth-child(3n + 1):not(:first-child)::after {
    left: calc(50% - 6px); top: -28px; margin-top: 0;
    width: calc(200% + 56px + 6.65px); height: 28px;
    -webkit-mask:
      linear-gradient(#000, #000) right top / 1.3px 14.65px no-repeat,
      linear-gradient(#000, #000) right 14px / calc(100% - 5.35px) 1.3px no-repeat,
      linear-gradient(#000, #000) 5.35px 14px / 1.3px 12.5px no-repeat,
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M2 1.5l4 4.5 4-4.5' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") left bottom / 12px 8px no-repeat;
            mask:
      linear-gradient(#000, #000) right top / 1.3px 14.65px no-repeat,
      linear-gradient(#000, #000) right 14px / calc(100% - 5.35px) 1.3px no-repeat,
      linear-gradient(#000, #000) 5.35px 14px / 1.3px 12.5px no-repeat,
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M2 1.5l4 4.5 4-4.5' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") left bottom / 12px 8px no-repeat;
  }
}

@container (min-width: 740px) {
  .flow { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); max-width: none; }
  .flow-node { padding: 12px; overflow-wrap: anywhere; }
  .flow-node + .flow-node::after {
    left: -28px; top: 50%; width: 28px; height: 12px; margin-top: -6px;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 12'%3E%3Cpath d='M1 6h25M21.5 2l4.5 4-4.5 4' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 12'%3E%3Cpath d='M1 6h25M21.5 2l4.5 4-4.5 4' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
  .flow-loop {
    --w: calc((100% - (var(--n) - 1) * 28px) / var(--n));
    display: block; position: relative; height: 30px;
    margin-left: calc((var(--from) - 1) * (var(--w) + 28px) + var(--w) / 2);
    width: calc((var(--to) - var(--from)) * (var(--w) + 28px));
    border: 1px solid var(--ink-3); border-top: 0; border-radius: 0 0 14px 14px;
  }
  .flow-loop::before {
    content: ""; position: absolute; left: -6.5px; top: -1px; width: 12px; height: 8px;
    background: var(--ink-3);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M2 6.5l4-4.5 4 4.5' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M2 6.5l4-4.5 4 4.5' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .flow-loop span {
    position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 50%);
    padding: 0 10px; background: var(--bg);
    font-size: .8125rem; color: var(--ink-2); white-space: nowrap;
  }
  .flow-loop-text { display: none; }
}

/* Timeline */
.tl { margin-top: clamp(28px, 4vw, 44px); border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.tl summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 16px; cursor: pointer; font-size: .9375rem; font-weight: 500; list-style: none; border-radius: 16px; }
.tl summary::-webkit-details-marker { display: none; }
.tl summary .ico { transition: transform .35s var(--ease); color: var(--ink-3); }
.tl[open] summary .ico { transform: rotate(180deg); }
.tl-list { padding: 0 16px 6px; }
.tl-item { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 2px 14px; padding-block: 14px; border-top: 1px solid var(--line); }
.tl-date { font-size: .8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 2px; }
.tl-item b { font-weight: 600; font-size: .9375rem; }
.tl-item p { grid-column: 2; max-width: 34rem; font-size: .875rem; line-height: 1.45; color: var(--ink-2); text-wrap: pretty; }

.pend { margin-top: clamp(64px, 9vw, 128px); border-top: 1px solid var(--line-strong); }
.prev-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 14px; font-size: .9375rem; color: var(--ink-2); }
.prev-link .ico { width: 18px; height: 18px; }
@media (min-width: 700px) { .prev-link { display: none; } }
.next {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px;
  padding-block: clamp(14px, 3.4vw, 44px) clamp(40px, 6vw, 72px);
}
.next-t { font-size: clamp(1.5rem, 3.4vw, 2.75rem); font-weight: 500; line-height: 1.05; letter-spacing: -.03em; }
.next-t .dim { color: var(--ink-3); }
.next .go { width: 52px; height: 52px; }
.next:hover .go { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.next:hover .go .ico { transform: translateX(3px); }

/* ───────────── Motion ───────────── */
@media (prefers-reduced-motion: no-preference) {
  /* One authored moment: on first load the headline settles, then the facts */
  .is-first .hero-h { animation: settle 1s var(--ease) .1s both; }
  .is-first .facts { animation: settle 1s var(--ease) .3s both; }

  ::view-transition-old(root) { animation: vt-out .16s ease both; }
  ::view-transition-new(root) { animation: vt-in .4s var(--ease) both; }
}
@keyframes settle { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

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