/* Geist: the split-flap board draws its letters in it, on canvas */
@font-face {
  font-family: "Geist";
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/Geist-Variable.woff2") format("woff2");
}

/* Söhne (Klim Type Foundry), licensed webfonts */
@font-face {
  font-family: "Söhne";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/soehne-buch.woff2") format("woff2");
}

@font-face {
  font-family: "Söhne Breit";
  font-weight: 600;
  font-style: normal;
  font-display: block;   /* the headings wait a moment for it rather than flash up in a stand-in sans; each page preloads it */
  src: url("fonts/soehne-breit-halbfett.woff2") format("woff2");
}

@font-face {
  font-family: "Söhne Mono";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/soehne-mono-buch.woff2") format("woff2");
}

:root {
  --font-sans: "Söhne", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Söhne Breit", "Söhne", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Söhne Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Draft palette (Nov 2026), from Figma: Site Mockups > Palette - Working. More colours than the site will keep, so we can
     experiment. Point the role tokens below at these, e.g. --bg: var(--c-navy). */
  /* Darks and neutrals */
  --c-night: #040A13;
  --c-navy: #132534;
  --c-pine: #212C2D;
  --c-slate: #3C4F56;
  --c-graphite: #2F2F2F;
  --c-silver: #B8B9B9;
  --c-pewter: #8B8B93;
  --c-mist: #DAE4E3;
  /* Warms */
  --c-rust: #9F4933;
  --c-umber: #965200;
  --c-orange: #F18300;
  --c-apricot: #FFB078;
  /* Earths */
  --c-khaki: #A0855B;
  --c-sand: #C7B799;
  --c-sage: #A6AF98;
  --c-mocha: #92715F;
  /* Accents */
  --c-teal: #418A8B;
  --c-ochre: #DFC06C;
  /* Lights: page and panel colours for light mode */
  --c-paper: #F5F3ED;
  --c-linen: #F3EEE7;
  --c-frost: #E9F3F2;
  --c-foam: #F0F6F6;
  --c-cloud: #E9EDF2;

  /* Space: every padding, margin and gap uses a step. Lab-tuned parts (the split-flap board,
     the nav buttons) and offsets worked out from the halftone keep their own values. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 56px;
  --space-9: 96px;

  /* Corners */
  --radius-2xs: 3px;    /* split-flap windows */
  --radius-xs: 4px;     /* small hit areas */
  --radius-sm: 6px;     /* menu items, the board's plate */
  --radius-md: 8px;     /* reels, placeholders */
  --radius-lg: 10px;    /* menus, screenshots */
  --radius-xl: 12px;    /* cards */
  --radius-2xl: 16px;   /* Matte bodies */
  --radius-pill: 999px; /* tags, buttons */

  /* Motion. Duration steps up with the distance travelled; exits run one step shorter than entrances.
     The rules are in docs/design-system-research.md, section 6. The site's older transitions still use
     their own values; Matte (matte.css) is the first thing built on these. */
  --dur-0: 0ms;      /* focus rings, errors: anything a person is waiting on */
  --dur-1: 60ms;     /* a part going down under a finger */
  --dur-2: 110ms;    /* a part coming back up; hover colour */
  --dur-3: 160ms;    /* short travel */
  --dur-4: 220ms;    /* long travel; menus and popovers entering */
  --dur-5: 320ms;    /* dialogs, drawers and panels entering */
  --dur-6: 520ms;    /* page-level entrances */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);        /* entering or responding: the default */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);             /* leaving */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);     /* moving while staying on screen */
  --ease-detent: cubic-bezier(0.34, 1.3, 0.64, 1);   /* a physical part settling into its stop */

  /* Type sizes. Display sizes are named for their job; text sizes run large to small. */
  --text-name: clamp(48px, 8vw, 104px);
  --text-page-title: clamp(40px, 6vw, 72px);
  --text-section-title: clamp(36px, 4.7vw, 68px);
  --text-tagline: clamp(36px, 3.4vw, 64px);
  --text-heading: 20px;
  --text-lead: clamp(17px, 1.5vw, 21px);
  --text-lg: 18px;
  --text-base: 17px;
  --text-md: 16px;
  --text-sm: 15px;
  --text-xs: 14px;
  --text-2xs: 13px;

  /* Roles. --ground is the page colour and --pine-band the Pine section; light mode swaps both */
  --ground: var(--c-night);
  --pine-band: var(--c-pine);
  --bg: var(--ground);
  --halftone-reach: 84px;   /* how far the halftone reaches either side of a section edge; halftone.js sets it */
  --halftone-above: 72px;   /* section edge up to where the transition starts; halftone.js sets it */
  --halftone-below: 72px;   /* section edge down to where it finishes */
  --halftone-peak: 84px;    /* how high the dots realistically climb above a section edge; halftone.js sets it */
  --fg: var(--c-mist);
  /* neutrals mixed from Mist over Night, so they sit in the palette's cool cast.
     --muted keeps ≥4.5:1 on Night, Navy and Pine. */
  --muted: color-mix(in srgb, var(--c-mist) 66%, var(--c-night));
  --line: color-mix(in srgb, var(--c-mist) 16%, var(--c-night));
  --surface: color-mix(in srgb, var(--c-mist) 6%, var(--c-night));
  --hover: color-mix(in srgb, var(--c-mist) 12%, var(--c-night));
  --line-strong: color-mix(in srgb, var(--c-mist) 24%, var(--c-night));
  --max: 1200px;
  --nav-h: 80px;
  /* Nav buttons ("chips"). buttons.js sets these from the Button Lab's active version; these
     defaults match its Original. Colours: the split-flap tiles (Deep Blue dark, built-in light). */
  --chip-h: 36px; --chip-px: 16px; --chip-radius: 18px; --chip-bw: 1px; --chip-gap: 10px;
  --chip-fs: 14px; --chip-fw: 500; --chip-ls: 0em; --chip-tt: none; --chip-lift: 0px; --chip-angle: 180deg;
  --chip-top-d: #10202d; --chip-bottom-d: #0a161f; --chip-edge-d: #2c3b46; --chip-text-d: var(--c-mist);
  --chip-top-l: #fffdf7; --chip-bottom-l: #f0ebe0; --chip-edge-l: #cfcbc3; --chip-text-l: var(--c-night);
  --chip-grain: 0.14; --chip-grain-size: 83px; --chip-grain-blend: normal;
  --chip-shadow-d: none; --chip-shadow-l: none;
  --chip-hover: 1.18; --chip-press-y: 1px; --chip-press: 0.92; --chip-current: 0.82; --chip-speed: 150ms;
  --spark-glow: rgba(110, 170, 255, 0.8);
  --chip-top: var(--chip-top-d); --chip-bottom: var(--chip-bottom-d);
  --chip-edge: var(--chip-edge-d); --chip-text: var(--chip-text-d); --chip-shadow: var(--chip-shadow-d);
}

/* Light mode: a light page colour (--ground) replaces Night, and Pine's section turns to Slate
   with Mist text. Rust, Navy and Ochre keep their colours. The neutrals mix Night over Mist. */
:root[data-theme="light"],
[data-theme-scope="light"] {
  color-scheme: light;
  /* trying page colours: Paper, a warm off-white, now; Mist, then white, were earlier passes */
  --ground: var(--c-paper);
  --pine-band: var(--c-slate);   /* pale Pine-tinted Mist and Umber were earlier passes */
  --fg: var(--c-night);
  /* neutrals mix Night over whatever the page colour is */
  --muted: color-mix(in srgb, var(--c-night) 72%, var(--ground));
  --line: color-mix(in srgb, var(--c-night) 16%, var(--ground));
  --surface: color-mix(in srgb, var(--c-night) 5%, var(--ground));
  --hover: color-mix(in srgb, var(--c-night) 10%, var(--ground));
  --line-strong: color-mix(in srgb, var(--c-night) 26%, var(--ground));
  --chip-top: var(--chip-top-l); --chip-bottom: var(--chip-bottom-l);
  --chip-edge: var(--chip-edge-l); --chip-text: var(--chip-text-l); --chip-shadow: var(--chip-shadow-l);
}
:root { color-scheme: dark; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-padding-top: var(--nav-h); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* browser surfaces in the palette: keyboard focus in the section's own text colour (Night on
   the light bands), selection in Apricot */
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
::selection { background: var(--c-apricot); color: var(--c-night); }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--nav-h);
  padding: 0 max(var(--space-6), calc((100% - var(--max)) / 2 + var(--space-6)));
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Glass: a Night tint over a blur, so section colours glow through as they scroll under.
     Over the Night page it still reads as the page colour. */
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}

.nav__start { display: flex; align-items: center; }

.nav__links { display: flex; align-items: center; }

.nav__links > a,
.dropdown__toggle {
  color: var(--muted);
  font-size: var(--text-sm);
  transition: color 0.15s;
}

/* light/dark switch: an icon button at the end of the links */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.theme-toggle:hover { color: var(--fg); background: var(--hover); }
.theme-toggle svg { width: 18px; height: 18px; }
/* show the mode you'd switch to: a moon in light mode, a sun in dark */
.theme-toggle .icon-moon,
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.nav__links > a:hover,
.dropdown__toggle:hover,
.dropdown.is-open .dropdown__toggle { color: var(--fg); }

/* Dropdown */
.dropdown { position: relative; }

.dropdown__toggle {
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + var(--space-3));
  left: -16px;
  min-width: 240px;
  padding: var(--space-2);
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.dropdown.is-open .dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__menu a {
  display: block;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.dropdown__menu a:hover { background: var(--hover); color: var(--fg); }

/* Controls: the utility menu, at the far right beside the theme switch; its menu opens leftward */
.dropdown--controls .dropdown__menu { left: auto; right: 0; z-index: 1; }


/* Nav buttons ("chips"): every nav control is a pill shaded like a split-flap tile, with the
   same film grain. Every value comes from a --chip-* property (see :root and buttons.js). */
.nav__start, .nav__links { gap: var(--chip-gap); }
.nav .chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--chip-h);
  min-height: 0;
  /* extra bottom padding raises the centred label by half of it: the label lift */
  padding: 0 var(--chip-px) calc(var(--chip-lift) * 2);
  margin: 0;
  border: var(--chip-bw) solid var(--chip-edge);
  border-radius: var(--chip-radius);
  font-family: var(--chip-ff, inherit);
  font-size: var(--chip-fs);
  font-weight: var(--chip-fw);
  letter-spacing: var(--chip-ls);
  text-transform: var(--chip-tt);
  white-space: nowrap;
  color: var(--chip-text);
  background: linear-gradient(var(--chip-angle), var(--chip-top), var(--chip-bottom));
  box-shadow: var(--chip-shadow);
  cursor: pointer;
  isolation: isolate;
  transition: filter var(--chip-speed), transform var(--chip-speed);
}
/* the split-flap leaves' film grain (same recipe, baked to a tile) */
.nav .chip::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: url("images/grain.png") 0 0 / var(--chip-grain-size) var(--chip-grain-size);
  mix-blend-mode: var(--chip-grain-blend);
  opacity: var(--chip-grain);
  pointer-events: none;
  z-index: -1;
}
/* .is-hover, .is-press and .is-current let the Button Lab show each state at rest */
.nav .chip:hover, .nav .chip.is-hover { color: var(--chip-text); background-color: transparent; filter: brightness(var(--chip-hover)); }
.nav .chip:active, .nav .chip.is-press { transform: translateY(var(--chip-press-y)); filter: brightness(var(--chip-press)); }
.nav .chip[aria-current="page"],
.nav .chip.is-current,
.nav .dropdown.is-open .chip { filter: brightness(var(--chip-current)); }
/* the nav buttons that go to a page of this site carry a small lamp before their label, in Matte's copper: lit on
   the current page's button, dark on the rest. Buttons that leave the site, download or open a menu have none. */
.nav a.chip:not([target]):not([download])::before,
.nav .chip.chip.chip.is-current::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  margin-right: 2px;
  border-radius: 50%;
  background: #141415;
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.8), 0 1px 0 rgb(255 255 255 / 0.1);
  transition: background var(--chip-speed), box-shadow var(--chip-speed);
}
.nav a.chip:not([target]):not([download])[aria-current="page"]::before,
.nav .chip.chip.chip.is-current::before {
  background: var(--signal, #e08a3c);
  box-shadow: 0 0 2px 1px rgb(0 0 0 / 0.5), 0 0 7px 1px color-mix(in srgb, var(--signal, #e08a3c) 70%, transparent);
}
:root[data-theme="light"] .nav a.chip:not([target]):not([download])::before { background: #8f8f92; box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.45), 0 1px 0 rgb(255 255 255 / 0.6); }
:root[data-theme="light"] .nav a.chip:not([target]):not([download])[aria-current="page"]::before,
:root[data-theme="light"] .nav .chip.chip.chip.is-current::before { background: #e07a1f; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25), 0 0 5px color-mix(in srgb, #e07a1f 60%, transparent); }
.nav .theme-toggle.chip { width: var(--chip-h); padding: 0; }
.nav .chip svg { width: 17px; height: 17px; }
/* Lucide icons beside the labels, sized to the label and inheriting its colour */
.nav .chip .chip__icon { flex: none; width: calc(var(--chip-fs) + 1px); height: calc(var(--chip-fs) + 1px); }

/* the phone menu (nav.js) only exists at phone width */
.nav .nav__menu-toggle, .nav__menu { display: none; }
@media (prefers-reduced-motion: reduce) { .nav__menu, .nav__menu-bar { transition: none; } }

/* Shared */
.placeholder {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
}

/* Cover: the board and "Recent Work" stacked and centred, kept short so the first work
   section starts above the fold */
.cover {
  max-width: var(--max);
  margin: 0 auto;
  /* first screen = this cover plus the Rust halftone band, so the band ends right at the fold */
  min-height: calc(100svh - var(--nav-h) - var(--halftone-below));
  /* "Recent Work" sits just above the highest point the transition's dots climb to */
  padding: var(--space-7) var(--space-6) calc(var(--halftone-peak) + 12px);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  text-align: center;
}

.cover__work {
  font-family: var(--font-display);
  font-size: var(--text-section-title);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.cover__name {
  font-family: var(--font-display);
  font-size: var(--text-name);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

/* Tagline under the board: body type, a step quieter than the name */
.cover__tagline {
  max-width: 100ch;
  margin: var(--space-6) auto 0;
  font-size: var(--text-lead);
  line-height: 1.5;
  color: var(--muted);
  text-wrap: balance;
}
/* two balanced lines where the screen allows; the board's width follows the longer one */

/* Split-flap name: text stays for screen readers, modules are drawn over it */
/* the board takes the free space and centres in it; "Recent Work" sits at the bottom */
.cover__text { width: 100%; min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cover__name .sf-board { margin: 0 auto; }
.cover__text { position: relative; }
/* invisible button over the board's bottom-right window once it shows the restart icon */
.cover__replay { position: absolute; border-radius: var(--radius-xs); cursor: pointer; background: transparent; border: 0; padding: 0; }
.cover__replay:hover { background: rgba(255, 255, 255, 0.06); }
.cover__replay:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.cover__name.is-flap {
  font-size: 0;
  color: transparent;
}

.sf-board {
  display: flex;
  flex-direction: column;
  gap: var(--sf-gap, 6px);
  width: 100%;
  max-width: var(--sf-width, 560px);
}

/* Every row shares the longest line's columns, so modules match in size */
.sf-row {
  display: grid;
  /* split-flap.js sets --sf-col to a whole number of device pixels; the slack centres */
  grid-template-columns: repeat(var(--cols), var(--sf-col, minmax(0, 1fr)));
  justify-content: center;
  gap: var(--sf-gap, 6px);
}

/* One module: a canvas that spills past the tile so flaps can swing toward the viewer */
.sf {
  position: relative;
  aspect-ratio: 1 / var(--sf-ratio, 1.4);
  /* whole device pixels, from split-flap.js; with both set, aspect-ratio steps aside */
  width: var(--sf-col, auto);
  height: var(--sf-row, auto);
}

.sf canvas {
  position: absolute;
  top: calc(var(--sf-inset, 0) * 100%);
  left: calc((var(--sf-inset, 0) - (1 - 2 * var(--sf-inset, 0)) * var(--sf-overhang, 0.12)) * 100%);
  width: calc((1 - 2 * var(--sf-inset, 0)) * (1 + 2 * var(--sf-overhang, 0.12)) * 100%);
  height: calc((1 - 2 * var(--sf-inset, 0)) * 100%);
}

/* Framed: a plate with a recessed window per module. Leaves swing behind the plate, so the
   window clips them, and the shading sits above the canvas as shadow cast by the plate. */
.sf-board.is-framed {
  padding: var(--sf-frame-pad);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(100deg, rgba(255, 255, 255, var(--sf-frame-sheen)), transparent 60%),
    var(--sf-frame-color);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* on the light page the plate casts a soft warm-brown shadow, as on paper, and catches
   the light along its top edge */
:root[data-theme="light"] .sf-board.is-framed {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 2px rgba(70, 52, 28, 0.12), 0 14px 36px rgba(70, 52, 28, 0.16);
}

.is-framed .sf {
  overflow: hidden;
  border-radius: var(--radius-2xs);
  background: var(--sf-well-color);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, var(--sf-frame-lip)),
    0 -1px 0 rgba(0, 0, 0, 0.45);
}

.is-framed .sf::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 calc(var(--sf-cell) * 0.14 * var(--sf-frame-depth)) calc(var(--sf-cell) * 0.12 * var(--sf-frame-depth)) rgba(0, 0, 0, calc(0.95 * var(--sf-frame-depth))),
    inset 0 0 calc(var(--sf-cell) * 0.08 * var(--sf-frame-depth)) rgba(0, 0, 0, calc(0.8 * var(--sf-frame-depth)));
}

.button {
  display: inline-block;
  flex-shrink: 0;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--fg);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.button:hover { background: var(--fg); color: var(--bg); }

/* Projects */
.project {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space-9) var(--space-6);
  border-top: 1px solid var(--line);
}

/* Coloured work sections. Full-bleed fill behind the centred column, with a halftone band at
   the top: dots of the new colour (--band-to) grow until they touch, then holes of the colour
   above (--band-from) shrink until the new colour is solid. */
.project--band {
  position: relative;
  isolation: isolate;
  border-top: 0;
  max-width: none;   /* full width, so the hero image can grow */
}

/* doubled class so it outranks the narrow-screen .project padding. The bottom leaves room for
   the next section's halftone, which reaches up into this one. */
.project.project--band {
  padding-left: clamp(var(--space-6), 4.5vw, var(--space-9));
  padding-right: clamp(var(--space-6), 4.5vw, var(--space-9));
  padding-top: calc(var(--halftone-reach) + 72px);
  padding-bottom: max(96px, calc(var(--halftone-reach) + 40px));
  /* tall enough that a whole screen of solid colour fits between the two transitions: the band
     at each edge reaches --halftone-reach into the section, plus a little extra at either end */
  min-height: calc(100svh + 2 * var(--halftone-reach) + 48px);
  align-content: center;
}

.project--band::after {
  content: "";
  position: absolute;
  left: -100vmax;
  right: -100vmax;
  z-index: -2;   /* under the halftone canvas */
  pointer-events: none;
}

/* halftone.js draws the transition on a canvas centred on the edge with the section above,
   reaching --halftone-reach either side of it */
.project--band > .halftone {
  position: absolute;
  z-index: -1;
  display: block;
  pointer-events: none;
}

.project--band::after {
  top: 0;
  bottom: 0;
  background: var(--band-to);
}

.project--rust {
  --band-from: var(--ground);
  --band-to: var(--c-rust);
  /* Rust and Navy are dark in both modes, so they keep Mist text whatever the page does */
  --fg: var(--c-mist);
  --bg: var(--c-night);
  color: var(--fg);
  --muted: var(--c-mist);
  --line: color-mix(in srgb, var(--c-mist) 35%, transparent);
  --surface: color-mix(in srgb, var(--c-night) 12%, transparent);
}

.project--navy {
  --band-from: var(--c-rust);
  --band-to: var(--c-navy);
  --fg: var(--c-mist);
  --bg: var(--c-night);
  --muted: color-mix(in srgb, var(--c-mist) 66%, var(--c-night));
  color: var(--fg);
  --line: color-mix(in srgb, var(--c-mist) 25%, transparent);
  --surface: color-mix(in srgb, var(--c-mist) 6%, transparent);
}

/* Ochre is light, so this section flips to dark text */
.project--ochre {
  --band-from: var(--c-navy);
  --band-to: var(--c-ochre);
  --fg: var(--c-night);
  --bg: var(--c-ochre);
  --muted: var(--c-pine);
  --line: color-mix(in srgb, var(--c-night) 30%, transparent);
  --surface: color-mix(in srgb, var(--c-night) 8%, transparent);
  color: var(--fg);
}

/* Sage is light, so this section takes dark text like Ochre */
.project--sage {
  --band-from: var(--pine-band);
  --band-to: var(--c-sage);
  --fg: var(--c-night);
  --bg: var(--c-sage);
  --muted: var(--c-night);
  --line: color-mix(in srgb, var(--c-night) 35%, transparent);
  --surface: color-mix(in srgb, var(--c-night) 8%, transparent);
  color: var(--fg);
}

/* Pine: a deep green-grey between Ochre and Sage */
.project--pine {
  --band-from: var(--c-ochre);
  --band-to: var(--pine-band);
  --line: color-mix(in srgb, var(--c-mist) 25%, transparent);
  --surface: color-mix(in srgb, var(--c-mist) 6%, transparent);
}
/* in light mode "Recent Work" is set in Rust, like the board's letters above it and the band below */
:root[data-theme="light"] .cover__work { color: var(--c-rust); }

/* light mode's Slate is dark, so it keeps Mist text like Rust */
:root[data-theme="light"] .project--pine {
  --fg: var(--c-mist);
  --bg: var(--pine-band);
  color: var(--fg);
  --muted: var(--c-mist);
  --line: color-mix(in srgb, var(--c-mist) 35%, transparent);
  --surface: color-mix(in srgb, var(--c-night) 12%, transparent);
}

/* Project layout: tagline, pills and description in a narrow column on the left; the hero
   image takes the rest of the width */
.project--band {
  display: grid;
  grid-template-columns: minmax(340px, 5fr) minmax(0, 9fr);
  gap: clamp(var(--space-7), 4.5vw, var(--space-9));
  align-items: center;
}

.project__tagline {
  font-family: var(--font-display);
  font-size: var(--text-tagline);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.project__desc {
  max-width: 56ch;
  margin-top: var(--space-5);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-6);
  list-style: none;
}

.project__tags li {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: 1.2;
}

.project__hero {
  aspect-ratio: 4 / 3;
  width: 100%;
}

/* the hero with its call to action tucked under the image's right corner */
.project__media {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-5);
  min-width: 0;
}

.button--apricot {
  padding: var(--space-3) var(--space-5);
  border-color: var(--c-apricot);
  background: var(--c-apricot);
  color: var(--c-night);
  font-size: var(--text-sm);
  font-weight: 600;
}
.button--apricot:hover {
  --apricot-lit: color-mix(in srgb, var(--c-apricot) 70%, white);
  background: var(--apricot-lit);
  border-color: var(--apricot-lit);
  color: var(--c-night);
}

/* a product screenshot: shown whole, at its own shape, lifted off the section colour */
.project__hero--shot { aspect-ratio: auto; }
.project__hero--shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 24px 64px rgba(0, 0, 0, 0.3);
}
.project__hero--shot figcaption {
  margin-top: var(--space-4);
  max-width: 64ch;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

/* Embedded reel: breaks out of the content column to fill the viewport,
   capped so the whole 16:9 frame still fits on screen below the nav */
main { overflow-x: clip; }

.reel {
  --reel-w: min(100vw - 48px, (100svh - var(--nav-h) - 32px) * 16 / 9);
  width: var(--reel-w);
  margin-left: calc(50% - var(--reel-w) / 2);
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--c-night);
}

.reel iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Play overlay: covers the whole reel; the visible pill sits bottom-left
   so it doesn't cover the title card */
.reel__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: clamp(var(--space-4), 3vw, var(--space-7));
  border: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.45), transparent 40%);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.25s, visibility 0.25s;
}

.reel.is-playing .reel__play {
  opacity: 0;
  visibility: hidden;
}

.reel__pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-3) var(--space-4);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--c-night) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--c-mist) 25%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: var(--text-md);
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.reel__pill svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.reel__dur { color: var(--muted); font-family: var(--font-mono); font-weight: 400; font-variant-numeric: tabular-nums; }

.reel__play:hover .reel__pill,
.reel__play:focus-visible .reel__pill {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.reel__play:hover .reel__dur,
.reel__play:focus-visible .reel__dur { color: inherit; opacity: 0.6; }

.reel__play:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }

/* Tinkering */
.nav__links > a[aria-current="page"] { color: var(--fg); }

.tinkering {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space-7) var(--space-6) var(--space-9);
}

.tinkering__head { margin-bottom: var(--space-7); }

.tinkering__title {
  font-family: var(--font-display);
  font-size: var(--text-page-title);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.tinkering__intro {
  margin-top: var(--space-5);
  max-width: 46ch;
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: 1.6;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: var(--space-5);
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s;
}

a.card:hover,
a.card:focus-visible {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.card__thumb {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--c-night);
  overflow: hidden;
}

.card__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

a.card:hover .card__thumb img { transform: scale(1.03); }

.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
}

.card__title { font-family: var(--font-display); font-size: var(--text-heading); font-weight: 600; }
.card__desc { color: var(--muted); font-size: var(--text-sm); line-height: 1.5; }
.card__meta { margin-top: var(--space-1); font-family: var(--font-mono); color: var(--muted); font-size: var(--text-2xs); }

.card--soon {
  min-height: 300px;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  background: none;
  color: var(--muted);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
}

@media (max-width: 800px) {
  :root { --nav-h: 64px; }
  .nav { padding: 0 var(--space-4); }
  .reel { --reel-w: calc(100vw - 32px); }
  .dropdown__menu { left: auto; right: -16px; }
  .cover {
    gap: var(--space-6);
    /* phones sit closer: 95% of the time the dots stay under ~3/4 of the peak (measured at
       390px wide), so only a rare surge drifts up behind "Recent Work" */
    padding: var(--space-6) var(--space-4) calc(var(--halftone-peak) * 0.75 + 8px);
  }
  .project { padding: var(--space-8) var(--space-4); }
  .tinkering { padding: var(--space-6) var(--space-4) var(--space-9); }
  .project--band { grid-template-columns: 1fr; gap: var(--space-7); }
  /* stacked, the content is already about a screen tall: holding the band at a full screen
     plus the transitions only leaves a stretch of empty colour above the headline. The top
     clears where the transition usually finishes rather than its furthest possible swell, so
     the odd stray dot drifts behind the headline, as it does behind "Recent Work". */
  .project.project--band {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    padding-top: calc(var(--halftone-below) + 96px);
    min-height: 0;
  }
}

/* Phones: one row. The first button (Work) on the left; Menu, Controls and the theme switch on the
   right. The other links live in the Menu panel (built by nav.js) that drops down under the bar. */
@media (max-width: 600px) {
  :root { --nav-h: 60px; }
  .nav {
    height: var(--nav-h);
    padding: 0 max(var(--space-4), env(safe-area-inset-right)) 0 max(var(--space-4), env(safe-area-inset-left));
  }
  .nav__start { gap: min(var(--chip-gap), 6px); }
  .nav__links { gap: min(var(--chip-gap), 6px); }
  .nav__start > a.chip:not(:first-child), .nav__links > a.chip { display: none; }
  .nav .nav__menu-toggle { display: inline-flex; margin-left: auto; }
  .nav__menu {
    position: absolute;
    top: calc(100% + var(--space-2));
    left: var(--space-4);
    right: var(--space-4);
    display: grid;
    gap: var(--space-1);
    padding: var(--space-2);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.16s ease-out, transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
  }
  .nav__menu[hidden] { display: none; }
  .nav__menu.is-open { opacity: 1; transform: none; }
  /* menu rows: the chips, stretched full width and a finger's height */
  .nav .nav__menu .chip { width: 100%; height: 48px; justify-content: flex-start; gap: 10px; padding: 0 var(--space-4); font-size: 16px; }
  .nav .nav__menu .chip .chip__icon { width: 18px; height: 18px; }
  /* the three bars turn into a cross while the menu is open */
  .nav__menu-bar { transform-box: fill-box; transform-origin: center; transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.15s; }
  .nav.is-menu-open .nav__menu-bar--1 { transform: translateY(5px) rotate(45deg); }
  .nav.is-menu-open .nav__menu-bar--2 { opacity: 0; }
  .nav.is-menu-open .nav__menu-bar--3 { transform: translateY(-5px) rotate(-45deg); }
  .nav.is-menu-open .nav__menu-toggle { filter: brightness(var(--chip-current)); }
  .nav .chip { padding: 0 min(var(--chip-px), 12px) calc(var(--chip-lift) * 2); font-size: min(var(--chip-fs), 13px); }
  .nav .theme-toggle.chip { padding: 0; }
  /* Controls shrinks to its icon, so the second row fits */
  .dropdown--controls .chip__label { display: none; }
  .dropdown--controls .chip { width: var(--chip-h); padding: 0; }
  /* the board: a thin plate and tight windows, so the width goes to the letters. The board
     sets its own spacing inline as custom properties, so override the properties themselves */
  .cover__name .sf-board.is-framed { padding: 5px; border-radius: 0; }
  /* and it runs edge to edge, out through the cover's 16px gutters */
  .cover__name .sf-board { width: calc(100% + 32px); max-width: none; margin: 0 -16px; }
  .cover__name .sf-board, .cover__name .sf-row { gap: 3px; }
  /* "Recent Work" steps down so it labels the work instead of competing with the name */
  .cover__work { font-size: var(--text-heading); }
  .cover__tagline { margin-top: var(--space-5); font-size: var(--text-md); }
}

/* a phone screenshot: kept to a screen's height and centred in the media column,
   with the corners a phone's display has */
.project__hero--phone { width: auto; }
/* the media column shrinks to the phone's width and centres, so the button still tucks
   under the image's right corner */
.project__media:has(.project__hero--phone) { justify-self: center; }
.project__hero--phone img {
  width: auto;
  height: min(80svh, 800px);
  aspect-ratio: 480 / 1044;
  border-radius: clamp(28px, 4.2svh, 44px);
}
@media (max-width: 800px) {
  .project__hero--phone img { height: auto; width: min(72vw, 380px); border-radius: 32px; }
}

/* Flipped project: the image on the left and the text on the right. Stacked, the text still leads. */
@media (min-width: 801px) {
  .project--flip { grid-template-columns: minmax(0, 9fr) minmax(340px, 5fr); }
  .project--flip .project__media { order: -1; }
}

/* A phone, rendered in 3D: the screenshot sits under glass in a black bezel, on a titanium body
   built from stacked slabs so its edge shows as it turns. It sways slowly from side to side,
   like a product shot, with a glare sliding across the glass and a shadow on the floor. */
.project__hero--device { aspect-ratio: auto; width: auto; }
.project__media:has(.project__hero--device) { justify-self: center; }
.phone {
  --pw: min(34svh, 330px);                 /* body width */
  --pb: calc(var(--pw) * 0.045);           /* bezel */
  --pr: calc(var(--pw) * 0.18);            /* corner radius */
  --pd: calc(var(--pw) * 0.115);           /* thickness */
  --sway: 16s;
  position: relative;
  width: var(--pw);
  padding-bottom: var(--space-6);
  perspective: 1800px;
}
.phone__body {
  position: relative;
  width: var(--pw);
  /* the screenshot's own shape (480 × 1044) plus the bezel */
  height: calc((var(--pw) - 2 * var(--pb)) * 2.175 + 2 * var(--pb));
  transform-style: preserve-3d;
  transform: rotateX(6deg) rotateY(-16deg);
}
.phone__layer {
  position: absolute;
  inset: 0;
  border-radius: var(--pr);
  background: linear-gradient(90deg, #2f3134, #8e9196 14%, #55585c 40%, #a3a6ab 78%, #3a3c40);
  transform: translateZ(calc((var(--i) / 11 - 0.5) * var(--pd)));
}
.phone__front,
.phone__back {
  position: absolute;
  inset: 0;
  border-radius: var(--pr);
  backface-visibility: hidden;
}
.phone__front {
  padding: var(--pb);
  overflow: hidden;
  background: #070708;
  box-shadow: inset 0 0 0 1.5px #74777c, inset 0 0 0 3px #0c0c0d;
  transform: translateZ(calc(var(--pd) / 2 + 0.5px));
}
.phone__back {
  background: linear-gradient(160deg, #4a4d51, #2c2e31 60%, #393b3f);
  box-shadow: inset 0 0 0 1.5px #74777c;
  transform: rotateY(180deg) translateZ(calc(var(--pd) / 2 + 0.5px));
}
.phone__camera {
  position: absolute;
  top: calc(var(--pw) * 0.06);
  right: calc(var(--pw) * 0.06);
  width: calc(var(--pw) * 0.4);
  aspect-ratio: 1;
  border-radius: calc(var(--pw) * 0.1);
  background: #222427;
  box-shadow: inset 0 0 0 1px #5d6064;
}
.phone__screen {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--pr) - var(--pb));
}
.phone__island {
  position: absolute;
  top: calc(var(--pb) + var(--pw) * 0.03);
  left: 50%;
  width: calc(var(--pw) * 0.3);
  height: calc(var(--pw) * 0.085);
  border-radius: var(--radius-pill);
  background: #000;
  transform: translateX(-50%);
}
.phone__glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, 0.13) 47%, rgba(255, 255, 255, 0.04) 53%, transparent 62%) 70% 0 / 300% 100%;
  pointer-events: none;
}
.phone__shadow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: var(--space-5);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.5), transparent);
  filter: blur(6px);
}
@media (prefers-reduced-motion: no-preference) {
  .phone__body { animation: phone-sway var(--sway) ease-in-out infinite alternate; }
  .phone__glare { animation: phone-glare var(--sway) ease-in-out infinite alternate; }
  .phone__shadow { animation: phone-shadow var(--sway) ease-in-out infinite alternate; }
}
@keyframes phone-sway {
  from { transform: rotateX(6deg) rotateY(-28deg) rotateZ(-1deg); }
  to   { transform: rotateX(6deg) rotateY(28deg) rotateZ(1deg); }
}
@keyframes phone-glare {
  from { background-position: 90% 0; }
  to   { background-position: 10% 0; }
}
@keyframes phone-shadow {
  from { transform: translateX(-6%) scaleX(0.92); }
  50%  { transform: translateX(0) scaleX(1); }
  to   { transform: translateX(6%) scaleX(0.92); }
}
@media (max-width: 800px) {
  .phone { --pw: min(60vw, 280px); }
}

/* Static spark (spark.js): the button flinches when it discharges */
@keyframes button-zap {
  0%   { filter: brightness(1.6); box-shadow: 0 0 0 1px rgba(150, 195, 255, 0.9), 0 0 14px rgba(110, 170, 255, 0.7); }
  100% { filter: none; box-shadow: 0 0 0 0 transparent; }
}
.button.is-zapped { animation: button-zap 0.28s ease-out; }
@keyframes chip-zap {
  0%   { filter: brightness(1.5) drop-shadow(0 0 6px var(--spark-glow)); }
  100% { filter: none; }
}
.nav .chip.is-zapped { animation: chip-zap 0.28s ease-out; }
