/* ---------- Tokens ---------- */
/* One family in two cuts: DM Sans for everything you read, DM Mono for small facts (type, year, role).
   Six sizes, one accent, an 8px spacing scale. Nothing else. */
:root {
  --paper: #F5F4F0;
  --ink: #141414;
  --muted: #6B6862;
  --rule: #E2DFD8;
  --accent: #7A2620;          /* leather red, used sparingly */
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;
  --hand: var(--sans);         /* older pages still name these; they now read as plain type */
  --dot: var(--sans);

  /* the six sizes */
  --fs-display: clamp(72px, 13vw, 196px);
  --fs-h1: clamp(44px, 6vw, 88px);
  --fs-h2: clamp(28px, 3vw, 36px);
  --fs-lead: clamp(19px, 1.6vw, 22px);
  --fs-body: 17px;
  --fs-small: 14px;
  --fs-mono: 13px;

  /* spacing, in steps of 8 */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px; --s7: 96px; --s8: 128px;
  --pad: clamp(16px, 3vw, 40px);
  --bar: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: var(--bar); background: var(--paper); }
body {
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-weight: 500; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { max-width: 100%; }
main { position: relative; z-index: 2; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.mono { font-family: var(--mono); font-size: var(--fs-mono); letter-spacing: 0; line-height: 1.5; }
.muted { color: var(--muted); }
.hand { font: inherit; color: inherit; letter-spacing: inherit; }
.link { border-bottom: 1px solid currentColor; }
.link:hover { color: var(--accent); }

/* ---------- Page transitions: a short fade between pages ---------- */
html.page-in body { animation: fade-in .5s var(--ease) backwards; }
html.intro-done body, html.intro-done main { animation: none; }
html.page-out body { opacity: 0; transition: opacity .3s var(--ease); }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Backdrop: a faint, still dot grid ---------- */
.glow { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.glow::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(20, 20, 20, .14) 1px, transparent 1.4px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000 40%, transparent 100%);
          mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000 40%, transparent 100%);
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease) var(--d, 0s), transform .6s var(--ease) var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Header ---------- */
/* Clear at the top of a page; once you scroll it becomes a solid paper bar with a hairline, so it
   always reads. On the homepage the name only docks into the corner once the big one has scrolled away. */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: var(--bar);
  display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
  padding: 0 var(--pad); font-size: 15px;
  border-bottom: 1px solid transparent;
  transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
.topbar.scrolled, html.menu-open .topbar { background: var(--paper); border-bottom-color: var(--rule); }
.mark { font-weight: 500; font-size: 17px; letter-spacing: 0; transition: opacity .3s var(--ease); }
body.home .mark { opacity: 0; pointer-events: none; }
body.home .topbar.docked .mark, html.menu-open body.home .mark { opacity: 1; pointer-events: auto; }
.nav { display: flex; gap: var(--s3); margin-left: auto; }
.nav a { color: var(--muted); transition: color .2s; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }
.menu-btn { display: none; padding: var(--s1) 0; font-size: 15px; }

/* the phone menu: a full screen list */
.menu {
  position: fixed; inset: 0; z-index: 49; background: var(--paper);
  padding: calc(var(--bar) + var(--s5)) var(--pad) var(--s5);
  display: none; flex-direction: column; gap: var(--s2);
}
html.menu-open { overflow: hidden; }
html.menu-open .menu { display: flex; }
.menu a { font-size: var(--fs-h1); font-weight: 500; letter-spacing: 0; line-height: 1.05; }

@media (max-width: 767px) {
  .nav { display: none; }
  .menu-btn { display: block; }
}

/* ---------- Homepage: the name ---------- */
.hero { position: relative; height: 100svh; min-height: 560px; }
.hero-copy {
  position: absolute; inset: 0; padding: 0 var(--pad);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.hero-name { position: relative; display: inline-block; }
.hero-title { font-size: var(--fs-display); font-weight: 500; line-height: .85; letter-spacing: 0; }
.hero-sub { font-size: var(--fs-lead); margin-top: var(--s3); max-width: 32ch; }
.hero-cred { font-size: var(--fs-small); color: var(--muted); margin-top: var(--s1); }

/* ---------- Homepage: sections ---------- */
.section { padding: var(--s8) var(--pad) 0; }
.section-title {
  font-size: var(--fs-h1); letter-spacing: 0; line-height: 1;
  padding-top: var(--s2); border-top: 1px solid var(--rule); margin-bottom: var(--s6);
}

/* Highlights: two equal columns, every project the same weight */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6) var(--s4); }
.tile { display: block; }
.tile-media { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 4px; background: var(--rule); }
.tile-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
a.tile:hover .tile-media img { transform: scale(1.02); }
.tile h3 { font-size: var(--fs-h2); letter-spacing: 0; line-height: 1.15; margin-top: var(--s2); }
.tile-line { margin-top: var(--s1); max-width: 52ch; }
.tile-meta { margin-top: var(--s1); color: var(--muted); }
a.tile:hover h3 { color: var(--accent); }

/* All work: one plain list */
.rows { border-bottom: 1px solid var(--rule); }
.row {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr) minmax(0, 1fr) 56px; gap: var(--s3); align-items: baseline;
  padding: var(--s2) 0; border-top: 1px solid var(--rule);
}
.row-head { color: var(--muted); }
.row .name { font-size: var(--fs-lead); letter-spacing: 0; line-height: 1.3; }
.row .role, .row .type, .row .year { color: var(--muted); }
a.row:hover .name { color: var(--accent); }
.pill { font-family: var(--mono); font-size: var(--fs-mono); border: 1px solid currentColor; border-radius: 2px; padding: 0 6px; vertical-align: middle; margin-left: 6px; color: var(--muted); }

/* About */
.chain { font-size: var(--fs-h2); letter-spacing: 0; line-height: 1.3; max-width: 30ch; }
.chain .arrow { color: var(--muted); }
/* the photo is plain and editorial, cut like the stills inside the projects: same corners, a 4:5 frame */
.about-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s6); align-items: start; }
.about-photo { margin: 0; }
.about-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px; }
.about-cols { display: grid; grid-template-columns: 1fr; gap: var(--s3); max-width: 60ch; margin-top: var(--s5); }
.facts { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); margin-top: var(--s5); }
.facts dt { color: var(--muted); }

/* Contact */
.contact { padding-bottom: var(--s4); }
.contact-title { font-size: var(--fs-h1); letter-spacing: 0; line-height: 1; margin-bottom: var(--s6); }
.links { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.links a { display: flex; flex-direction: column; gap: 4px; padding-top: var(--s2); border-top: 1px solid var(--ink); font-size: var(--fs-lead); }
.links a:hover { color: var(--accent); }
.foot { margin-top: var(--s8); color: var(--muted); font-size: var(--fs-small); }

@media (max-width: 767px) {
  .section { padding-top: var(--s7); }
  .section-title { margin-bottom: var(--s5); }
  .tiles { grid-template-columns: 1fr; gap: var(--s5); }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row .role, .row .type { display: none; }
  .about-grid, .about-cols, .links { grid-template-columns: 1fr; }
  .about-grid { gap: var(--s4); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.page-in body { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .tile-media img { transition: none; }
  a.tile:hover .tile-media img { transform: none; }
}

/* ---------- The opening: a fall through the stills, landing on the name ---------- */
/* a pale limbo in the page's own tone (the 3D scene draws into the canvas), so the landing is a dissolve */
.opening { display: none; }
html.intro-on { overflow: hidden; }
html.intro-on body, html.intro-on main { animation: none; }   /* the opening is the entrance */
html.intro-on .opening { display: block; position: fixed; inset: 0; z-index: 180; overflow: hidden; transition: opacity .8s var(--ease); }
html.intro-on .topbar { opacity: 0; }
/* the page's dots stay hidden during the fall: they fly in from behind (drawn by the opening) and the real grid takes over once they've landed */
html.intro-on .glow::before { opacity: 0; }
/* the page waits at the bottom of the fall, small and out of focus; the opening sharpens it as it lands */
html.intro-on .hero-copy { filter: blur(var(--fall-blur, 26px)); transform: scale(var(--fall-scale, .62)); opacity: var(--fall-op, .22); will-change: filter, transform; }
.opening-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.opening-hud { position: absolute; inset: 0; pointer-events: none; color: color-mix(in srgb, var(--ink) 70%, transparent); }
.opening-hud > span { position: absolute; transition: opacity .6s var(--ease); }
.opening:not(.go) .opening-hud > span { opacity: 0; }
.ih-top { left: var(--pad); top: 18px; }
.ih-skip { right: var(--pad); top: 18px; color: var(--muted); }
.ih-file { left: var(--pad); bottom: 18px; }
.ih-count { right: var(--pad); bottom: 18px; font-variant-numeric: tabular-nums; }
/* the landing: the last prints are gone, the name is in focus, and the rest of the page arrives */
html.intro-landing .opening-hud { opacity: 0; transition: opacity .6s var(--ease); }
html.intro-on.intro-landing .topbar { opacity: 1; transition: opacity .9s .5s var(--ease); }
@media (prefers-reduced-motion: reduce) { html.intro-on .opening { display: none; } html.intro-on { overflow: auto; } html.intro-on .hero-copy { filter: none; transform: none; opacity: 1; } html.intro-on .topbar { opacity: 1; } }
