/* starter-portfolio. One stylesheet, no build step.
   Order: fonts, tokens, base, buttons, header, hero, work list, marquee, grid, about, contact, footer, case study, motion. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --paper: #ebedea;
  --raised: #f6f7f4;
  --ink: #11131a;
  --muted: #555a63;
  --line: #c6cac7;
  --accent: #2733d9;
  --on-accent: #f6f7f4;
  --dock: #11131a;
  --on-dock: #ebedea;
  --dock-muted: #a9adb8;
  --dock-line: #30333f;
  --err: #a8231b;

  --display: "Bricolage Grotesque", "Arial Narrow", Arial, sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --pad: clamp(20px, 4.2vw, 64px);
  --ease: cubic-bezier(0.2, 0.9, 0.2, 1);
  --focus: var(--accent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1124;
    --raised: #181b36;
    --ink: #e7e9e4;
    --muted: #a4a9bf;
    --line: #2c3054;
    --accent: #969fff;
    --on-accent: #0f1124;
    --dock: #181b36;
    --on-dock: #e7e9e4;
    --dock-muted: #a4a9bf;
    --dock-line: #313663;
    --err: #ffa196;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1124;
  --raised: #181b36;
  --ink: #e7e9e4;
  --muted: #a4a9bf;
  --line: #2c3054;
  --accent: #969fff;
  --on-accent: #0f1124;
  --dock: #181b36;
  --on-dock: #e7e9e4;
  --dock-muted: #a4a9bf;
  --dock-line: #313663;
  --err: #ffa196;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--display);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset, pre { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
svg { display: block; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.sprite { position: absolute; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: fixed; top: 10px; left: 10px; z-index: 30;
  padding: 12px 18px; border-radius: 999px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; color: var(--paper); }

.cover { width: 100%; height: 100%; }
.cv-type { font-family: var(--display); font-weight: 800; font-stretch: 75%; letter-spacing: -0.04em; }

/* A masked line: the inner span rises into an overflow-hidden slot. */
.line { display: block; overflow: hidden; padding-block: 0.08em; margin-block: -0.08em; }
.line__in { display: block; }

.sec-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px;
  padding-bottom: clamp(20px, 3vw, 36px);
}
.sec-head h2 {
  font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 650; font-stretch: 75%;
  line-height: 0.95; letter-spacing: -0.03em;
}
.sec-head p { color: var(--muted); }

/* ---------- buttons: the fill slides up from below ---------- */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 24px;
  border: 1.5px solid var(--ink); border-radius: 999px;
  background: none; color: var(--ink);
  font-weight: 550; font-size: 1rem; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color 0.3s var(--ease);
}
.btn::before {
  content: ""; position: absolute; inset: -1px; z-index: -1;
  background: var(--ink);
  transform: translateY(102%);
  transition: transform 0.45s var(--ease);
}
.btn:hover, .btn:focus-visible { color: var(--paper); }
.btn:hover::before, .btn:focus-visible::before { transform: none; }
.btn--solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--solid:hover, .btn--solid:focus-visible { border-color: var(--ink); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- pill header: hides on the way down, returns on the way up ---------- */
.pill {
  position: fixed; top: 12px; left: 50%; z-index: 20;
  display: flex; align-items: center; gap: 2px;
  max-width: calc(100vw - 20px);
  padding: 4px 4px 4px 18px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 999px;
  white-space: nowrap;
  transform: translate(-50%, 0);
  transition: transform 0.5s var(--ease);
  view-transition-name: pill;
}
.pill.is-away { transform: translate(-50%, -180%); }
.pill a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.pill__name { font-weight: 700; font-stretch: 85%; letter-spacing: -0.01em; padding-right: 10px; }
.pill__nav { display: flex; }
.pill__nav a { padding: 0 9px; color: var(--muted); font-size: 0.95rem; }
.pill__nav a:hover, .pill__name:hover { color: var(--ink); }
.pill__theme {
  display: grid; place-items: center; width: 44px; height: 44px; margin-left: 2px;
  border: 0; border-radius: 50%; background: var(--paper); cursor: pointer;
}
.pill__theme svg { transition: transform 0.6s var(--ease); }
:root[data-theme="dark"] .pill__theme svg { transform: rotate(180deg); }
@media (min-width: 700px) {
  .pill { top: 18px; padding-left: 22px; }
  .pill__nav a { padding: 0 14px; }
  .pill__name { padding-right: 18px; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 100svh;
  padding: 92px var(--pad) 0;
  overflow: hidden;
}
.hero__meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 0.95rem; }
.hero__title {
  margin-top: clamp(18px, 4vh, 44px);
  font-size: min(16vw, 11.5rem);
  font-weight: 700; font-stretch: 75%;
  line-height: 0.88; letter-spacing: -0.035em;
  white-space: nowrap;
}
.hero__foot { margin-top: clamp(22px, 4vh, 40px); }
.hero__intro { max-width: 34rem; font: 400 1.19rem/1.45 var(--text); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.now { display: flex; align-items: center; gap: 10px; margin-top: 22px; color: var(--muted); font-size: 0.95rem; }
.now__dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

/* Card fan: three covers dealt like a hand. */
.fan { position: relative; height: 47vw; margin: 34px 0 0; flex: none; }
.fan__card {
  position: absolute; left: 50%; top: 8vw;
  box-shadow: 0 0 0 1px var(--line);
  width: 46vw; aspect-ratio: 4 / 3; margin-left: -23vw;
  border-radius: 8px; overflow: hidden;
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  transition: transform 0.6s var(--ease);
}
.fan__card:nth-child(1) { --x: -52%; --y: 6%; --r: -9deg; }
.fan__card:nth-child(2) { --x: 0%; --y: -6%; --r: 2deg; z-index: 1; }
.fan__card:nth-child(3) { --x: 52%; --y: 8%; --r: 10deg; }

@media (min-width: 900px) {
  .hero { padding-top: 112px; padding-bottom: clamp(28px, 5vh, 52px); }
  .hero__title { font-size: min(10.9vw, 19.5vh, 13rem); }
  .hero__foot { margin-top: auto; padding-top: 36px; max-width: 31rem; }
  .fan { position: absolute; right: calc(var(--pad) + 8vw); bottom: clamp(48px, 9vh, 96px); width: 23vw; height: 17.25vw; margin: 0; }
  .fan__card { left: 0; top: 0; width: 100%; margin: 0; }
  .fan__card:nth-child(1) { --x: -58%; --y: 10%; --r: -11deg; }
  .fan__card:nth-child(2) { --x: -6%; --y: -12%; --r: -1deg; }
  .fan__card:nth-child(3) { --x: 38%; --y: 14%; --r: 9deg; }
  .fan:hover .fan__card:nth-child(1) { --x: -78%; --r: -15deg; }
  .fan:hover .fan__card:nth-child(2) { --y: -20%; }
  .fan:hover .fan__card:nth-child(3) { --x: 58%; --r: 13deg; }
}

/* ---------- selected work ---------- */
.work { padding: clamp(72px, 11vw, 150px) var(--pad) clamp(64px, 9vw, 130px); }

/* Phone and touch: a rich card per project. */
.worklist { display: grid; gap: 44px 28px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; text-decoration: none; }
.row__cover, .row__title, .row__sum { grid-column: 1 / -1; }
.row__cover, .card__cover, .case__cover, .next__cover, .plate__art, .preview { box-shadow: 0 0 0 1px var(--line); }
.row:hover { color: inherit; }
.row__cover { display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.row__title { font-size: clamp(2.5rem, 11vw, 3.4rem); font-weight: 650; font-stretch: 75%; line-height: 0.95; letter-spacing: -0.03em; }
.row__sum { font: 400 1.12rem/1.4 var(--text); margin-top: 6px; }
.row__tags, .row__year { color: var(--muted); font-size: 0.95rem; }
.row__tags, .row__year { margin-top: 8px; }
.preview { display: none; }
@media (min-width: 700px) { .worklist { grid-template-columns: 1fr 1fr; } }

/* Pointer and wide: a hoverable list, with one preview that follows the cursor. */
@media (hover: hover) and (min-width: 900px) {
  .worklist { display: block; border-bottom: 1px solid var(--line); }
  .row {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.5fr) 4ch;
    align-items: baseline; gap: 0 32px;
    padding: 20px 0 22px; border-top: 1px solid var(--line);
    transition: opacity 0.35s var(--ease);
  }
  .row__cover { display: none; }
  .row__title, .row__sum { grid-column: auto; }
  .row__title { font-size: clamp(3.2rem, 6.4vw, 6.4rem); transition: transform 0.5s var(--ease); }
  .row__sum { margin: 0; max-width: 30rem; }
  .row__tags { margin: 0; }
  .row__year { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
  .worklist:hover .row:not(:hover), .worklist:focus-within .row:not(:focus-visible) { opacity: 0.32; }
  .row:hover .row__title, .row:focus-visible .row__title { transform: translateX(18px); }

  .preview {
    display: block; position: fixed; top: 0; left: 0; z-index: 10;
    width: clamp(260px, 25vw, 400px); aspect-ratio: 4 / 3; margin: -12vw 0 0 28px;
    border-radius: 8px; overflow: hidden; pointer-events: none;
    opacity: 0; transition: opacity 0.3s var(--ease);
  }
  .preview.is-on { opacity: 1; }
  .preview__item { position: absolute; inset: 0; opacity: 0; transform: scale(1.12); transition: opacity 0.35s var(--ease), transform 0.7s var(--ease); }
  .preview__item.is-on { opacity: 1; transform: none; }
}

/* ---------- marquee ---------- */
.marquee { overflow: hidden; background: var(--accent); color: var(--on-accent); padding: clamp(14px, 2vw, 24px) 0; }
.marquee__track { display: flex; width: max-content; animation: marquee 36s linear infinite; }
.js .marquee:not(.is-in) .marquee__track { animation-play-state: paused; }
.marquee ul { display: flex; flex: none; }
.marquee li {
  display: flex; align-items: center; white-space: nowrap;
  font-size: clamp(1.7rem, 4.2vw, 3.4rem); font-weight: 600; font-stretch: 75%; letter-spacing: -0.02em; line-height: 1.1;
}
.marquee li::after {
  content: ""; width: 0.3em; height: 0.3em; margin: 0 0.7em;
  background: currentColor; transform: rotate(45deg);
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- all work: filterable grid ---------- */
.index { padding: clamp(72px, 10vw, 140px) var(--pad); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
html:not(.js) .filters { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer;
  font-size: 0.95rem; white-space: nowrap;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.chip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"] span { color: inherit; opacity: 0.7; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 14px; }
.card { display: block; text-decoration: none; }
.card:hover { color: inherit; }
.card__cover { display: block; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; }
.card__cover .cover { transition: transform 0.8s var(--ease); }
.card:hover .cover, .card:focus-visible .cover { transform: scale(1.05); }
.card__title { display: block; margin-top: 12px; font-size: clamp(1.35rem, 2.4vw, 2rem); font-weight: 650; font-stretch: 75%; letter-spacing: -0.02em; line-height: 1.05; }
.card__meta { display: block; margin-top: 3px; color: var(--muted); font-size: 0.9rem; }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 56px 32px; } }

/* ---------- about: an ink panel uncovered by a curtain ---------- */
.about, .dock { --focus: var(--on-dock); }
.about {
  position: relative; overflow: hidden;
  background: var(--dock); color: var(--on-dock);
  padding: clamp(72px, 11vw, 160px) var(--pad) clamp(64px, 9vw, 130px);
}
.about a:hover { color: inherit; text-decoration-thickness: 2px; }
.about__curtain { display: none; }
.about__statement {
  max-width: 14ch;
  font-size: clamp(3rem, 9.4vw, 9.5rem); font-weight: 700; font-stretch: 75%;
  line-height: 0.9; letter-spacing: -0.035em;
}
.about__cols { display: grid; gap: 28px; margin-top: clamp(36px, 6vw, 80px); }
.about__bio { display: grid; gap: 1.1em; max-width: 36rem; font: 400 1.22rem/1.5 var(--text); }
.about .now { color: var(--dock-muted); margin: 0; }
.about .now__dot { background: var(--on-dock); }
.about__block { margin-top: clamp(56px, 8vw, 110px); }
.about__block h3 { font-size: 1rem; font-weight: 500; color: var(--dock-muted); padding-bottom: 14px; }
.caps { display: grid; gap: 0 32px; }
.caps li { display: grid; gap: 6px; padding: 18px 0 22px; border-top: 1px solid var(--dock-line); }
.caps strong { font-size: 1.5rem; font-weight: 650; font-stretch: 75%; letter-spacing: -0.02em; line-height: 1.1; }
.caps span { color: var(--dock-muted); max-width: 30ch; }
.timeline li { display: grid; gap: 2px; padding: 16px 0 18px; border-top: 1px solid var(--dock-line); }
.timeline strong { font-weight: 550; font-size: 1.1rem; }
.timeline__years, .timeline__place { color: var(--dock-muted); }
.timeline__years { font-variant-numeric: tabular-nums; }
@media (min-width: 900px) {
  .about__cols { grid-template-columns: minmax(0, 1fr) auto; align-items: end; padding-left: 25%; }
  .about__block { display: grid; grid-template-columns: 25% minmax(0, 1fr); }
  .caps { grid-template-columns: 1fr 1fr; }
  .timeline li { grid-template-columns: 11rem minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; align-items: baseline; }
}
@media (min-width: 1200px) { .caps { grid-template-columns: repeat(4, 1fr); } }

/* ---------- contact ---------- */
.contact { display: grid; gap: 36px; padding: clamp(72px, 11vw, 160px) var(--pad) clamp(64px, 9vw, 120px); }
.contact h2 {
  max-width: 11ch;
  font-size: clamp(2.9rem, 7.6vw, 7.4rem); font-weight: 700; font-stretch: 75%;
  line-height: 0.9; letter-spacing: -0.035em;
}
.contact__lead p { max-width: 30rem; margin-top: 22px; font: 400 1.19rem/1.45 var(--text); }
.contact__lead .contact__direct { margin-top: 12px; font: inherit; color: var(--muted); }
.contact__panel { background: var(--raised); border-radius: 16px; padding: clamp(20px, 3.4vw, 44px); align-self: start; }
.form { display: grid; gap: 22px 20px; }
.field { display: grid; gap: 8px; align-content: start; }
.field label, .field legend { font-weight: 550; }
.field legend { margin-bottom: 10px; }
.field input[type="text"], .field input[type="email"], .field textarea {
  width: 100%; min-height: 52px; padding: 13px 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  font-size: 1.06rem; line-height: 1.4;
  transition: border-color 0.2s;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus-visible, .field textarea:focus-visible { outline-offset: 0; border-color: var(--accent); border-radius: 10px; }
.field [aria-invalid="true"] { border-color: var(--err); border-width: 2px; }
.field__err { color: var(--err); font-size: 0.95rem; font-weight: 500; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; font-weight: 400;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.choice:hover span { border-color: var(--ink); }
.choice input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.choice input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 3px; }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.form__hint { color: var(--muted); font-size: 0.95rem; }
.sent { display: grid; gap: 14px; outline: none; }
.sent h3 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 650; font-stretch: 75%; line-height: 1; letter-spacing: -0.03em; }
.sent p { font: 400 1.12rem/1.45 var(--text); max-width: 34rem; }
.sent__payload {
  padding: 16px 18px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line);
  font: 0.86rem/1.6 var(--code); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto;
}
.sent__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
@media (min-width: 700px) { .form { grid-template-columns: 1fr 1fr; } .field--wide { grid-column: 1 / -1; } }
@media (min-width: 1000px) { .contact { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr); gap: 64px; } }

/* ---------- footer: dither bands into a dock with a cut wordmark ---------- */
.dither i {
  display: block; height: 12px;
  background: radial-gradient(circle, var(--dock) var(--r), transparent calc(var(--r) + 0.6px)) 50% 0 / 12px 12px;
}
.dither i:nth-child(1) { --r: 1.4px; }
.dither i:nth-child(2) { --r: 2.9px; }
.dither i:nth-child(3) { --r: 4.6px; }
.dither i:nth-child(4) { --r: 6.6px; }
.dock { background: var(--dock); color: var(--on-dock); overflow: hidden; }
.dock__top { display: grid; gap: 22px; padding: clamp(40px, 6vw, 84px) var(--pad) clamp(36px, 5vw, 64px); }
.dock__line { font-size: clamp(1.4rem, 2.6vw, 2.2rem); font-weight: 600; font-stretch: 75%; letter-spacing: -0.02em; line-height: 1.15; max-width: 26ch; }
.dock a:hover { color: inherit; text-decoration-thickness: 2px; }
.dock__links { display: flex; flex-wrap: wrap; gap: 0 22px; }
.dock__links a { display: inline-flex; align-items: center; min-height: 44px; }
.dock__note { color: var(--dock-muted); font-size: 0.9rem; max-width: 46ch; }
.dock__mark { width: 100%; height: auto; fill: var(--on-dock); }
.dock__mark text { font-family: var(--display); font-size: 100px; font-weight: 800; font-stretch: 75%; }
@media (min-width: 900px) {
  .dock__top { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .dock__note { grid-column: 1 / -1; }
}

/* ---------- case study ---------- */
.case { padding: 104px var(--pad) 0; }
.case__back a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
.case__title {
  margin-top: 6px;
  font-size: clamp(3.6rem, 16.5vw, 15rem); font-weight: 700; font-stretch: 75%;
  line-height: 0.86; letter-spacing: -0.04em;
}
.case__sum { max-width: 30ch; margin-top: clamp(16px, 2.4vw, 30px); font: 400 clamp(1.3rem, 2.3vw, 1.9rem)/1.3 var(--text); }
.case__cover { aspect-ratio: 4 / 3; margin-top: clamp(28px, 4.5vw, 64px); border-radius: 10px; overflow: hidden; view-transition-name: cover; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin-top: clamp(24px, 3vw, 40px); }
.facts div { padding: 14px 0 18px; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 0.95rem; }
.facts dd { margin-top: 2px; font-weight: 500; }
.case__sec { margin-top: clamp(64px, 9vw, 140px); }
.case__sec h2 { font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 650; font-stretch: 75%; line-height: 0.95; letter-spacing: -0.03em; margin-bottom: 20px; }
.prose { display: grid; gap: 1em; max-width: 40rem; font: 400 clamp(1.22rem, 1.7vw, 1.45rem)/1.5 var(--text); }

/* Sticky process rail: the step list stays put while the steps scroll past. */
.rail__nav { display: none; }
.rail__steps { display: grid; gap: clamp(48px, 7vw, 96px); }
.step { scroll-margin-top: 96px; }
.step h3 { display: flex; align-items: center; gap: 12px; font-size: clamp(1.6rem, 2.6vw, 2.2rem); font-weight: 650; font-stretch: 75%; letter-spacing: -0.02em; line-height: 1.05; }
.step__n {
  display: grid; place-items: center; flex: none; width: 1.5em; height: 1.5em; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: 0.6em; font-stretch: 100%; font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.step p { max-width: 40rem; margin-top: 12px; font: 400 clamp(1.15rem, 1.5vw, 1.3rem)/1.5 var(--text); }
.plate { margin-top: 24px; }
.plate__art { width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: 8px; }
.plate figcaption { margin-top: 10px; color: var(--muted); font-size: 0.95rem; }

.results { display: grid; gap: 28px; margin-top: clamp(40px, 6vw, 80px); padding-bottom: clamp(64px, 9vw, 130px); }
.results li { display: grid; gap: 12px; align-content: start; padding-top: 18px; border-top: 1px solid var(--line); }
.results__label { color: var(--muted); max-width: 26ch; }
.flap {
  display: inline-flex; gap: 0.045em; justify-self: start;
  font-size: clamp(3.6rem, 8.6vw, 8rem); font-weight: 700; font-stretch: 75%; line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
/* Split-flap board: main.js cuts the value into cells and flips each one to its character. */
.flap__cell {
  position: relative; display: inline-block; min-width: 0.62em; padding: 0.07em 0.08em 0.03em; text-align: center;
  background: var(--ink); color: var(--paper); border-radius: 0.07em; overflow: hidden;
}
.flap__cell::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: var(--paper); opacity: 0.55; }
.flap__glyph { display: block; }
.flap__glyph.is-flip { animation: flip 0.13s linear; }
@keyframes flip { 0% { transform: rotateX(0); } 49% { transform: rotateX(-88deg); } 51% { transform: rotateX(88deg); } 100% { transform: rotateX(0); } }

.next {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; gap: 6px; padding: clamp(40px, 6vw, 80px) var(--pad) clamp(48px, 7vw, 96px);
  border-top: 1px solid var(--line); text-decoration: none;
  transition: color 0.35s var(--ease);
}
.next::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent); transform: translateY(101%); transition: transform 0.6s var(--ease); }
.next:hover, .next:focus-visible { color: var(--on-accent); }
.next:hover::before, .next:focus-visible::before { transform: none; }
.next__label { color: var(--muted); transition: color 0.35s var(--ease); }
.next:hover .next__label, .next:focus-visible .next__label { color: inherit; }
.next__title { font-size: clamp(3.4rem, 13vw, 11rem); font-weight: 700; font-stretch: 75%; line-height: 0.9; letter-spacing: -0.04em; }
.next__cover {
  display: block; width: min(64vw, 280px); aspect-ratio: 4 / 3; margin-top: 22px; border-radius: 8px; overflow: hidden;
  transform: rotate(-4deg); transition: transform 0.7s var(--ease);
}
.next:hover .next__cover, .next:focus-visible .next__cover { transform: rotate(3deg) scale(1.04); }

@media (min-width: 900px) {
  .case { padding-top: 128px; }
  .case__cover { aspect-ratio: 2 / 1; }
  .facts { grid-template-columns: 1.2fr 0.5fr 1.4fr 1.4fr; gap: 0 32px; }
  .case__sec { display: grid; grid-template-columns: 25% minmax(0, 1fr); }
  .case__sec h2 { margin: 0; }
  .case__sec--rail { display: block; }
  .rail { display: grid; grid-template-columns: 25% minmax(0, 1fr); }
  .case__sec--rail h2 { margin-bottom: 28px; }
  .rail__nav { display: grid; gap: 2px; position: sticky; top: 104px; align-self: start; padding-right: 24px; counter-reset: step; }
  .rail__nav a {
    display: flex; align-items: center; gap: 12px; min-height: 44px;
    color: var(--muted); text-decoration: none; transition: color 0.3s, transform 0.4s var(--ease);
  }
  .rail__nav a::before {
    counter-increment: step; content: counter(step);
    display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    border: 1.5px solid currentColor; font-size: 0.82rem; font-variant-numeric: tabular-nums;
  }
  .rail__nav a:hover, .rail__nav a.is-on { color: var(--ink); }
  .rail__nav a.is-on { transform: translateX(8px); }
  .rail__nav a.is-on::before { background: var(--ink); border-color: var(--ink); color: var(--paper); }
  .step__n { display: none; }
  .plate__art { aspect-ratio: 16 / 9; }
  .results { grid-template-columns: repeat(3, 1fr); gap: 32px; }
  .next { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .next__label { grid-column: 1 / -1; }
  .next__cover { width: clamp(240px, 22vw, 360px); margin: 0 4vw 0 0; }
}

/* ---------- not found, and the project.html fallback ---------- */
.lost { display: grid; gap: 20px; padding: 128px var(--pad) clamp(64px, 9vw, 120px); }
.lost__title { max-width: 12ch; font-size: clamp(3.2rem, 11vw, 9rem); font-weight: 700; font-stretch: 75%; line-height: 0.88; letter-spacing: -0.035em; }
.lost__text { max-width: 34rem; font: 400 1.19rem/1.45 var(--text); }
.lost__list { border-bottom: 1px solid var(--line); margin-block: 10px; }
.lost__list a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; min-height: 56px; padding: 12px 0;
  border-top: 1px solid var(--line); text-decoration: none;
  font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 650; font-stretch: 75%; letter-spacing: -0.02em;
}
.lost__list span { color: var(--muted); font-size: 0.95rem; font-weight: 400; font-stretch: 100%; letter-spacing: 0; }

/* ---------- motion ----------
   Everything animated is a transform or an opacity. The page reads the same with all of it off. */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: no-preference) {
  /* Opening scene, in CSS so it also plays without JavaScript:
     header drops in, headline lines rise out of their masks, then the text, then the cards are dealt. */
  .pill { animation: drop 0.8s var(--ease) 0.15s backwards; }
  .hero__title .line__in, .case__title .line__in { animation: rise 0.9s var(--ease) backwards; }
  .hero__title .line:nth-child(2) .line__in { animation-delay: 0.09s; }
  .hero__title .line:nth-child(3) .line__in { animation-delay: 0.18s; }
  .hero__title .line:nth-child(n + 4) .line__in { animation-delay: 0.27s; }
  .hero__meta, .hero__foot > *, .case__back, .case__sum { animation: settle 0.6s var(--ease) 0.28s backwards; }
  .hero__foot > :nth-child(2) { animation-delay: 0.36s; }
  .hero__foot > :nth-child(3) { animation-delay: 0.44s; }
  .fan__card { animation: deal 1s var(--ease) 0.4s backwards; }
  .fan__card:nth-child(2) { animation-delay: 0.5s; }
  .fan__card:nth-child(3) { animation-delay: 0.6s; }

  /* Headings marked data-lines are split into lines by main.js and revealed when they scroll in. */
  .lines-ready .line__in { transform: translateY(112%); }
  .lines-ready.is-in .line__in { transform: none; transition: transform 0.9s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }

  /* Curtain: a paper-coloured sheet lifts off the ink panel as it scrolls in. */
  @supports (animation-timeline: view()) {
    .about__curtain {
      display: block; position: absolute; top: 0; left: 0; right: 0; height: 100lvh; z-index: 1;
      background: var(--paper); transform-origin: top;
      animation: curtain linear both; animation-timeline: view(); animation-range: entry 0% entry 100%;
    }
  }

  ::view-transition-old(root) { animation: vt-out 0.3s var(--ease) both; }
  ::view-transition-new(root) { animation: vt-in 0.55s var(--ease) both; }
  ::view-transition-group(cover) { animation-duration: 0.6s; animation-timing-function: var(--ease); }
  ::view-transition-group(pill) { animation: none; }
  /* The grid filter runs its own in-page transition: only the cards move, the page stays put. */
  .vt-local::view-transition-old(root), .vt-local::view-transition-new(root) { animation: none; }

  /* Browsers without cross-page view transitions: main.js fades the page out before leaving. */
  .is-leaving main, .is-leaving .dock { opacity: 0; transform: translateY(-12px); transition: opacity 0.22s, transform 0.22s; }
}

@keyframes rise { from { transform: translateY(112%); } }
@keyframes settle { from { opacity: 0; transform: translateY(14px); } }
@keyframes drop { from { transform: translate(-50%, -180%); } }
@keyframes deal { from { transform: translate(0, 170%) rotate(0deg); } }
@keyframes curtain { to { transform: scaleY(0); } }
@keyframes vt-out { to { opacity: 0; transform: translateY(-18px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(26px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .marquee__track { width: auto; flex-wrap: wrap; }
  .marquee ul { flex-wrap: wrap; padding: 0 var(--pad); }
  .marquee ul[aria-hidden] { display: none; }
  .marquee li { white-space: normal; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

@media print {
  .pill, .fan, .marquee, .dither, .preview, .filters { display: none; }
}
