@font-face {
  font-family: "Archivo";
  src: url("../assets/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("../assets/fonts/figtree-var.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("../assets/fonts/figtree-var-ext.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Dark is the default (also without JavaScript); [data-theme="light"] swaps the tokens.
   The research band is the one block that differs from the page in both themes. */
:root {
  color-scheme: dark;
  --paper: #11142a;
  --ink: #e4e7ef;
  --ink-soft: #a4aac4;
  --staff: #363c60;
  --low: #8ea2ff;
  --low-note: #4766ff; /* Kandinsky's deep blue for the low cells; --low is the lighter link blue */
  --mid: #4fc48c;
  --high: #f2b705;
  --cell: #1b1f3d;
  --cell-now: #2a2f55;

  --band: #1b1f3d;
  --band-ink: #e4e7ef;
  --band-line: #4a5280;
  --band-soft: #a4aac4;

  /* chips sit on video, so they stay light in both themes */
  --chip: #e9ecf1;
  --chip-ink: #1b2040;
  --media: #07080f;

  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --text: "Figtree", "Helvetica Neue", Arial, sans-serif;

  /* perfect fourth, base 18px */
  --s-1: 0.844rem;
  --s0: 1.125rem;
  --s1: 1.5rem;
  --s2: 2rem;
  --s3: 2.666rem;
  --s4: 3.553rem;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --measure: 36em;
  --section-gap: clamp(4rem, 9vw, 7.5rem); /* one gap between all sections */
}

:root[data-theme="light"] {
  color-scheme: light;
  --paper: #e9ecf1;
  --ink: #1b2040;
  --ink-soft: #4a5070;
  --staff: #b9c0ce;
  --low: #2440b8;
  --low-note: #2440b8;
  --mid: #2e8b57;
  --high: #f2b705;
  --cell: #dfe3ea;
  --cell-now: #d3d8e2;

  --band: #1b2040;
  --band-ink: #e9ecf1;
  --band-line: #5a6290;
  --band-soft: #b9c0e0;
}

/* Fallback when the browser has no View Transitions: colours fade for a moment */
:root.theme-fading *,
:root.theme-fading *::before,
:root.theme-fading *::after {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease,
    fill 0.25s ease, stroke 0.25s ease !important;
}
/* With View Transitions the new theme opens as a circle from the toggle (js/theme.js) */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 1; }

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--s0);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; } /* grid and flex rules must not bring hidden things back */

a { color: var(--low); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--low);
  outline-offset: 3px;
}
.video-play:focus-visible,
.clip-controls button:focus-visible { outline-color: var(--high); }

h1, h2, h3, h4 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: 0;
  transform: translateY(-120%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip:focus { transform: none; }

/* Top bar */
.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 80rem;
  margin-inline: auto;
  padding: 0.75rem var(--gutter);
  font-family: var(--sans);
  font-size: var(--s-1);
}
.top a {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  /* the underline draws in from the left */
  background: linear-gradient(currentColor, currentColor) left calc(50% + 0.75em) / 0 1px no-repeat;
  transition: background-size 0.2s ease;
}
.top a:hover { background-size: 100% 1px; }
.top-name { font-weight: 700; }
.top nav { display: flex; gap: 0 1.25rem; flex-wrap: wrap; margin-left: auto; }
@media (prefers-reduced-motion: reduce) { .top a { transition: none; } }

/* Theme toggle: a sun whose rays retract while a shadow bites it into a moon */
.theme-toggle {
  flex: none;
  align-self: center;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
@media (hover: hover) { .theme-toggle:hover { background: var(--cell); } }
.theme-toggle:active svg { transform: scale(0.9); }
.theme-toggle svg { display: block; overflow: visible; transition: transform 0.15s ease; }
.theme-core { fill: currentColor; transform-origin: 12px 12px; }
.theme-rays { transform-origin: 12px 12px; }
.theme-rays line {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  transform-origin: 12px 12px;
}

/* moon (dark): the rays fold away first, then the core swells and the bite slides in */
.theme-core { transform: scale(1.6); transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s; }
.theme-bite { transform: translate(0, 0); transition: transform 0.4s cubic-bezier(0.34, 1.3, 0.64, 1) 0.12s; }
.theme-rays { transform: rotate(-45deg); transition: transform 0.3s ease-in; }
.theme-rays line { transform: scale(0); opacity: 0; transition: transform 0.25s ease-in, opacity 0.2s ease-in; }

/* sun (light): the bite slides off, the core settles, the rays open one after another */
[data-theme="light"] .theme-core { transform: scale(1); transition-delay: 0s; }
[data-theme="light"] .theme-bite { transform: translate(9px, -9px); transition: transform 0.3s ease-in; }
[data-theme="light"] .theme-rays { transform: rotate(0deg); transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.12s; }
[data-theme="light"] .theme-rays line {
  transform: scale(1);
  opacity: 1;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease-out;
  transition-delay: calc(0.15s + var(--i) * 0.02s);
}
.theme-rays line:nth-child(1) { --i: 0; }
.theme-rays line:nth-child(2) { --i: 1; }
.theme-rays line:nth-child(3) { --i: 2; }
.theme-rays line:nth-child(4) { --i: 3; }
.theme-rays line:nth-child(5) { --i: 4; }
.theme-rays line:nth-child(6) { --i: 5; }
.theme-rays line:nth-child(7) { --i: 6; }
.theme-rays line:nth-child(8) { --i: 7; }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle svg,
  .theme-core,
  .theme-bite,
  .theme-rays,
  .theme-rays line { transition: none !important; }
}

main, .contact {
  padding-inline: var(--gutter);
  max-width: 80rem;
  margin-inline: auto;
}

/* Hero */
.hero {
  padding-top: clamp(1.5rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.hero-intro { padding-top: 0.5rem; }

.hero h1 {
  font-size: clamp(3.2rem, 8.4vw, 8.5rem);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.02em;
  line-height: 0.92;
}

.hero-role {
  font-family: var(--sans);
  font-size: var(--s1);
  font-weight: 700;
  font-stretch: 100%;
  line-height: 1.25;
  max-width: 22em;
  margin: 1.5rem 0 0;
}
.hero-lede {
  font-size: var(--s1);
  line-height: 1.45;
  max-width: 30em;
  margin: 0.5rem 0 0;
  color: var(--ink-soft);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 1.25rem 0 0;
}
.hero-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* The hero enters once on load, about 1.1 s, then stands (taste-skill motion.md):
   the name rises line by line out of its masks, the lede and links fade up 12px,
   the instrument settles from .98. Transform and opacity only, no overshoot. */
.h1-line { display: block; overflow: hidden; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.h1-line > span { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .h1-line > span { animation: rise-line 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .h1-line + .h1-line > span { animation-delay: 0.08s; }
  .hero-role,
  .hero-lede,
  .hero-links { animation: fade-up 0.52s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .hero-role { animation-delay: 0.36s; }
  .hero-lede { animation-delay: 0.42s; }
  .hero-links { animation-delay: 0.48s; }
  .instrument { animation: settle 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
}
@keyframes rise-line { from { transform: translateY(110%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes settle { from { transform: scale(0.98); } to { transform: none; } }

/* Instrument */
.instrument { margin: 0; }

.seq {
  --steps: 16;
  display: grid;
  grid-template-columns: 2.4rem repeat(var(--steps), minmax(0, 1fr));
  gap: 3px;
  touch-action: manipulation;
}

.seq-note {
  font-family: var(--sans);
  font-size: var(--s-1);
  font-stretch: 75%;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  align-self: center;
}

.seq-cell {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  aspect-ratio: 1;
  min-height: 0;
  background: var(--cell);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.seq-cell.reg-low { --c: var(--low-note); }
.seq-cell.reg-mid { --c: var(--mid); }
.seq-cell.reg-high { --c: var(--high); }

/* beat lines: a heavier gap before every fourth step */
.seq-cell.beat-start { box-shadow: -3px 0 0 var(--staff); }

.seq-cell:hover { background: var(--staff); }
.seq-cell[aria-pressed="true"] { background: var(--c); }

/* playhead: the column being heard */
.seq-cell.now:not([aria-pressed="true"]) { background: var(--cell-now); }

/* a note sounding: the cell pops and throws a glow in its own colour */
.seq-cell.hit { animation: seq-pop 0.28s ease-out; z-index: 1; }
.seq-cell.hit::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 5px;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--c), 0 0 26px 8px var(--c);
  animation: seq-glow 0.6s ease-out forwards;
}
@keyframes seq-pop {
  from { transform: scale(1.22); }
  to { transform: scale(1); }
}
@keyframes seq-glow {
  from { opacity: 0.85; transform: scale(1); }
  to { opacity: 0; transform: scale(1.6); }
}
@media (prefers-reduced-motion: reduce) {
  .seq-cell.hit { animation: none; }
  .seq-cell.hit::after { animation: seq-glow-still 0.5s ease-out forwards; }
  @keyframes seq-glow-still {
    from { opacity: 0.7; }
    to { opacity: 0; }
  }
}

.instrument figcaption {
  font-size: var(--s-1);
  line-height: 1.55;
  color: var(--ink-soft);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.25rem;
  margin-top: 1.25rem;
  padding-left: calc(2.4rem + 3px); /* the button sits on the first column of cells */
}
.instrument figcaption p { margin: 0; max-width: 34em; }


/* Play / stop: one round button, the icon says what a press will do */
.play {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.play svg { display: block; fill: currentColor; }
.play .stop-icon { display: none; }
.play[aria-pressed="true"] { background: var(--high); color: #1b2040; }
.play[aria-pressed="true"] .play-icon { display: none; }
.play[aria-pressed="true"] .stop-icon { display: inline; }
/* Buttons: step up 1px on hover (fine pointer), sink 1px and scale .985 on press */
.play, .video-play, .game-play, .clip-controls button, .game-bar button {
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.15s ease, box-shadow 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .play:hover, .video-play:hover, .game-play:hover, .clip-controls button:hover, .game-bar button:hover { transform: translateY(-1px); }
}
.play:active, .video-play:active, .game-play:active, .clip-controls button:active, .game-bar button:active {
  transform: translateY(1px) scale(0.985);
  transition-duration: 0.09s;
}
@media (prefers-reduced-motion: reduce) {
  .play, .video-play, .game-play, .clip-controls button, .game-bar button { transition: background-color 0.15s ease; }
  .play:hover, .video-play:hover, .game-play:hover, .clip-controls button:hover, .game-bar button:hover,
  .play:active, .video-play:active, .game-play:active, .clip-controls button:active, .game-bar button:active { transform: none; }
}

/* Section headings */
/* h2 for every section, h3 for every project */
.work > h2,
.more > h2,
.contact > h2,
.research h2 {
  font-size: clamp(var(--s3), 5vw, var(--s4));
  font-stretch: 115%;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.work > h2,
.more > h2,
.contact > h2 { margin: 0 0 2rem; }

.work { padding-top: var(--section-gap); }

/* Projects
   split: title, then media | text side by side (media and text of similar height)
   wide:  title, then media across the page, then intro | notes                     */
.project {
  display: grid;
  column-gap: clamp(1.5rem, 4vw, 3.5rem);
  row-gap: 1.75rem;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
  border-top: 1px solid var(--staff);
}
.project > h3, .project > .project-head { grid-area: title; }
.project-media { grid-area: media; display: grid; gap: 1rem; align-content: start; }
.project-text { grid-area: text; }
.project-media img { border-radius: 4px; }

.project--split {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-areas: "title title" "media text";
}
.project--split .project-lede { margin-top: 0; }

.project--wide {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "title" "media" "text";
}
.project--wide .project-text {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: clamp(1.5rem, 4vw, 3.5rem);
}
.project--wide .project-lede { margin-top: 0; }

.project h3,
.small-project h3 {
  font-size: clamp(var(--s2), 3.2vw, var(--s3));
  font-stretch: 112%;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.project-lede {
  font-size: var(--s1);
  line-height: 1.4;
  margin: 1rem 0 1.5rem;
  max-width: var(--measure);
}

.facts {
  margin: 0 0 1.75rem;
  display: grid;
  gap: 0.35rem;
  font-family: var(--sans);
  font-size: var(--s-1);
}
.facts div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; }
.facts dt { font-stretch: 75%; color: var(--ink-soft); }
.facts dd { margin: 0; }

.project h4 {
  font-size: var(--s0);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.decisions {
  margin: 0 0 1.75rem;
  padding-left: 1.1rem;
  max-width: var(--measure);
}
.decisions li { margin-bottom: 0.7rem; }
.decisions li::marker { color: var(--staff); }

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  margin: 0;
}
.link-strong {
  font-family: var(--sans);
  font-weight: 700;
  font-size: var(--s0);
}
/* Strong links rest on a faint hairline; on hover an ink line draws in from the left */
.link-strong,
.contact-links a {
  text-decoration: none;
  background:
    linear-gradient(currentColor, currentColor) left calc(50% + 0.72em) / 0 2px no-repeat,
    linear-gradient(color-mix(in srgb, currentColor 40%, transparent), color-mix(in srgb, currentColor 40%, transparent)) left calc(50% + 0.72em) / 100% 1px no-repeat;
  transition: background-size 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.link-strong:hover,
.link-strong:focus-visible,
.contact-links a:hover,
.contact-links a:focus-visible { background-size: 100% 2px, 100% 1px; }
@media (prefers-reduced-motion: reduce) { .link-strong, .contact-links a { transition: none; } }
.link-hint { font-size: var(--s-1); color: var(--ink-soft); }

.media-pair {
  display: grid;
  grid-template-columns: 1.17fr 2.09fr;
  gap: 1rem;
  align-items: start;
}
.media-pair figure { margin: 0; }
.media-pair figcaption {
  font-family: var(--sans);
  font-size: var(--s-1);
  color: var(--ink-soft);
  margin-top: 0.4rem;
}

.phones {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  max-width: 40rem;
}
.phones img { border-radius: 14px; }
.phones img:nth-child(2) { margin-top: 3rem; }

/* Click-to-load video */
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--media);
  border-radius: 4px;
  overflow: hidden;
}
.video img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; transition: transform 0.4s ease; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .video:hover img { transform: scale(1.025); }
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  font-family: var(--sans);
  font-size: var(--s-1);
  font-weight: 700;
  color: var(--chip-ink);
  background: var(--chip);
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.1rem 0.6rem 2.2rem;
  cursor: pointer;
}
.video-play::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  translate: 0 -50%;
  border-left: 0.6rem solid currentColor;
  border-block: 0.38rem solid transparent;
}
.video-play:hover { background: var(--high); }

/* Play here: the main action on a playable project, over its media */
.phones { position: relative; }
.game-play {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 1;
  font-family: var(--sans);
  font-size: var(--s0);
  font-weight: 800;
  color: #1b2040;
  background: var(--high);
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.2rem 0.6rem 2.3rem;
  min-height: 44px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgb(0 0 0 / 0.35);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.game-play::before {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 50%;
  translate: 0 -50%;
  border-left: 0.65rem solid currentColor;
  border-block: 0.4rem solid transparent;
}
.game-play:hover { box-shadow: 0 6px 24px rgb(242 183 5 / 0.45); }
.game-play:active { transform: translateY(1px); }
.game-play:focus-visible { outline-color: var(--ink); }
.phones .game-play { left: 1rem; bottom: 1rem; }

.game-frame {
  position: relative;
  display: grid;
  gap: 0.6rem;
  justify-items: start;
}
.game-frame iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: var(--media);
}
.game-frame--square iframe { aspect-ratio: 1 / 1; }
.game-frame--phone { justify-items: center; max-width: 40rem; } /* the phone sits where the two screenshots were */
.game-frame--phone iframe {
  width: min(100%, 24rem);
  aspect-ratio: 9 / 19;
  max-height: 85vh;
  border-radius: 28px;
  box-shadow: 0 0 0 10px var(--cell), 0 0 0 11px var(--staff);
  margin: 11px;
}
.game-frame:fullscreen { background: #000; place-items: center; align-content: center; }
.game-frame:fullscreen iframe { width: 100vw; height: calc(100vh - 4rem); aspect-ratio: auto; max-height: none; border-radius: 0; box-shadow: none; margin: 0; }
.game-frame:fullscreen .game-bar { justify-self: center; }
.game-bar { display: flex; gap: 0.5rem; }
.game-bar button {
  font-family: var(--sans);
  font-size: var(--s-1);
  font-weight: 700;
  color: var(--chip-ink);
  background: var(--chip);
  border: 0;
  border-radius: 999px;
  padding: 0 1rem;
  min-height: 44px;
  cursor: pointer;
}
.game-bar button:hover { background: var(--high); }
.game-bar button:active { transform: translateY(1px); }

/* Research */
.project:last-child { padding-bottom: 0; }
/* the band splits the section gap: half outside, half inside, so content-to-content stays one gap */
.research {
  margin-top: calc(var(--section-gap) / 2);
  padding: calc(var(--section-gap) / 2) var(--gutter);
  margin-inline: calc(var(--gutter) * -1);
  background: var(--band);
  color: var(--band-ink);
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.research a { color: var(--high); }
.research-sub {
  font-size: var(--s1);
  line-height: 1.4;
  margin: 1rem 0 2rem;
  max-width: 30em;
}
.research-text > p:not(.research-sub) { max-width: var(--measure); }

/* The thesis' claim as a statement: it lights up word by word as it crosses the screen
   (taste-skill word-highlight; tokens mapped to the research band) */
.research-text > p.research-statement {
  --ink: var(--band-ink);
  --bg: var(--band);
  --accent: var(--high);
  --font-display: var(--sans);
  --display-weight: 600;
  --display-tracking: -0.01em;
  --t-h2: clamp(1.45rem, 2.4vw, 2.05rem);
  max-width: 30em;
  margin: 0 0 2rem;
}
.concepts { padding-left: 1.1rem; max-width: var(--measure); }
.concepts li { margin-bottom: 0.7rem; }
.concepts strong { font-family: var(--sans); font-weight: 700; }

.cube { margin: 0; position: sticky; top: 2rem; }
.cube svg { width: 100%; height: auto; overflow: visible; }
.cube-edges path { fill: none; stroke: var(--band-line); stroke-width: 1; }
.cube-axes path { fill: none; stroke: var(--band-ink); stroke-width: 2; }
.cube-diagonal { stroke: var(--high); stroke-width: 3; stroke-dasharray: 2 7; stroke-linecap: round; }
.cube-origin { fill: var(--band-ink); }
.cube-peak { fill: var(--high); }
.cube-label { fill: var(--band-ink); font-family: var(--sans); font-size: 13px; }
.cube figcaption {
  font-family: var(--sans);
  font-size: var(--s-1);
  color: var(--band-soft);
  margin-top: 0.75rem;
}

/* Interactive cube (js/cube.js) */
.cube-svg { display: block; width: 100%; height: auto; overflow: visible; cursor: grab; touch-action: pan-y; user-select: none; }
.cube.is-turning .cube-svg { cursor: grabbing; }
.cube-svg:focus-visible { outline: 3px solid var(--high); outline-offset: 4px; border-radius: 6px; }
.cube-svg .cube-edges line { stroke: var(--band-line); stroke-width: 1; }
.cube-svg .cube-axes line { stroke: var(--band-ink); stroke-width: 2; stroke-linecap: round; }
.cube-route { stroke-width: 2; stroke-linecap: round; opacity: 0.45; }
.cube-route--photo { stroke: var(--low); }
.cube-route--audio { stroke: var(--high); stroke-dasharray: 2 7; stroke-width: 3; }
.cube-run { stroke-width: 4; stroke-linecap: round; }
.cube-run--photo { stroke: var(--low); }
.cube-run--audio { stroke: var(--high); }
.cube-corners circle { fill: var(--band); stroke: var(--band-soft); stroke-width: 1.5; transition: fill 0.2s ease; }
.cube-corners circle.is-on { fill: var(--band-ink); }
.cube-dot { fill: var(--high); }
.cube-halo { fill: var(--high); opacity: 0; transform-box: fill-box; transform-origin: center; }
.cube.is-arrived .cube-halo { animation: cube-arrive 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes cube-arrive { from { opacity: 0.55; transform: scale(0.6); } to { opacity: 0; transform: scale(2.4); } }
.cube-tag { fill: var(--band-ink); font-family: var(--sans); font-size: 12px; font-weight: 700; }
.cube-svg .cube-label { font-size: 13px; }

.cube-ui { font-family: var(--sans); font-size: var(--s-1); }
.cube-meter { display: grid; gap: 0.4rem; margin: 0.75rem 0 1.25rem; }
.cube-meter div { display: grid; grid-template-columns: 6.5rem 1fr; align-items: center; gap: 0.75rem; color: var(--band-soft); }
.cube-meter i { display: block; height: 6px; border-radius: 3px; background: var(--band-line); overflow: hidden; position: relative; }
.cube-meter i::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--high);
  transform-origin: left; transform: scaleX(var(--v, 0));
}
.cube-ask { margin: 0 0 0.5rem; color: var(--band-soft); }
.cube-routes, .cube-corner-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.cube-routes button, .cube-corner-list button {
  font: inherit; font-weight: 700; color: var(--band-ink); background: transparent;
  border: 1px solid var(--band-line); border-radius: 999px; padding: 0 0.9rem; min-height: 40px; cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cube-routes button { min-height: 44px; font-size: var(--s0); }
.cube-routes button[data-route="photo"][aria-pressed="true"] { background: var(--low); border-color: var(--low); color: #11142a; }
.cube-routes button[data-route="audio"][aria-pressed="true"],
.cube-corner-list button[aria-pressed="true"] { background: var(--high); border-color: var(--high); color: #1b2040; }
@media (hover: hover) and (pointer: fine) {
  .cube-routes button:hover, .cube-corner-list button:hover { border-color: var(--band-ink); transform: translateY(-1px); }
}
.cube-routes button:active, .cube-corner-list button:active { transform: translateY(1px) scale(0.985); }
.cube-routes button:focus-visible, .cube-corner-list button:focus-visible { outline-color: var(--high); }
.cube-note { min-height: 4.6em; margin: 0 0 1rem; color: var(--band-ink); font-family: var(--text); font-size: var(--s0); line-height: 1.5; }
.cube-corner-list button { font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .cube.is-arrived .cube-halo { animation: none; }
  .cube-routes button, .cube-corner-list button { transition: none; }
}
@media (max-width: 600px) { .cube-corner-list button { min-height: 44px; } }

/* Also */
.more { padding-top: var(--section-gap); }
.more-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
}
.small-project h3 { margin: 1.25rem 0 0.5rem; }
.small-project:not(:has(.video)) h3 { margin-top: 0; }
.small-project p { max-width: var(--measure); margin: 0 0 1rem; }

/* Contact */
.contact {
  padding-top: var(--section-gap);
  padding-bottom: 4rem;
}
.contact > p { font-size: var(--s1); line-height: 1.4; max-width: 28em; margin: 0 0 1.5rem; }
.contact-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  font-family: var(--sans);
  font-size: var(--s1);
  font-weight: 700;
}

.tools {
  margin: 3rem 0 0;
  display: grid;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: var(--s-1);
  max-width: 44rem;
}
.tools div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; }
.tools dt { font-stretch: 75%; color: var(--ink-soft); }
.tools dd { margin: 0; }

/* Narrow screens */
@media (max-width: 860px) {
  .hero,
  .research,
  .more-grid { grid-template-columns: minmax(0, 1fr); }
  .project--split,
  .project--wide { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "media" "text"; }
  .project--wide .project-text { grid-template-columns: minmax(0, 1fr); }
  .cube { position: static; }
  .cube { max-width: 26rem; }
  .instrument { margin-top: 2.5rem; }
  .top nav { gap: 0.9rem; }
}

@media (max-width: 600px) {
  .seq { --steps: 8; grid-template-columns: 2rem repeat(var(--steps), minmax(0, 1fr)); }
  .instrument figcaption { padding-left: calc(2rem + 3px); }
  .facts div { grid-template-columns: 5.5rem 1fr; }
  .tools div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .contact-links { font-size: var(--s0); gap: 0 1.5rem; }
  .contact-links a,
  .links .link-strong { display: inline-flex; align-items: center; min-height: 44px; }
  .clip-toggle, .clip-sound, .video-play { min-height: 44px; }
  .top { flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; }
  .top nav { order: 3; width: 100%; margin-left: 0; }
  .theme-toggle { margin-left: auto; }
}

/* Looping gameplay clip */
.clip { margin: 0; }
.clip-frame { position: relative; border-radius: 4px; overflow: hidden; background: var(--media); }
.clip video { display: block; width: 100%; height: auto; }
.clip-controls {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  gap: 0.5rem;
}
.clip-toggle,
.clip-sound {
  font-family: var(--sans);
  font-size: var(--s-1);
  font-weight: 700;
  color: var(--chip-ink);
  background: var(--chip);
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  opacity: 0.85;
}
.clip-toggle:hover,
.clip-toggle:focus-visible,
.clip-sound:hover,
.clip-sound:focus-visible { opacity: 1; }
.clip-sound[aria-pressed="true"] { background: var(--high); opacity: 1; }
.clip figcaption {
  font-family: var(--sans);
  font-size: var(--s-1);
  color: var(--ink-soft);
  margin-top: 0.5rem;
  max-width: 40em;
}

@media (max-width: 600px) {
  /* leave the bottom edge of the clip to Play here */
  .clip-controls { top: 0.75rem; bottom: auto; }
}

@media (max-height: 899px) { .cube { position: static; } } /* the interactive cube is taller than a short screen */

/* ---------- Built on the thesis ---------- */
/* the research band now sits right after the hero; the band splits the gap (half outside, half inside) */
.built { position: relative; padding-top: calc(var(--section-gap) / 2); }
.built-lede { font-size: var(--s1); line-height: 1.4; max-width: 34em; margin: -1rem 0 2rem; color: var(--ink-soft); }

.project-head h3 { margin: 0; }
.tests { margin: 0.6rem 0 0; max-width: 46em; font-size: var(--s0); line-height: 1.5; color: var(--ink-soft); transition: color 0.4s ease; }
.tests span { font-family: var(--sans); font-weight: 700; color: var(--high); }
.has-thread .tests { color: color-mix(in srgb, var(--ink-soft) 70%, var(--paper)); }
.has-thread .tests span { color: var(--ink-soft); transition: color 0.4s ease; }
.has-thread .is-reached .tests { color: var(--ink); }
.has-thread .is-reached .tests span { color: var(--high); }

/* The thread: the cube's yellow dotted diagonal, carried down the margin to the games (js/thread.js) */
.thread { display: none; }
.has-thread .thread {
  display: block;
  position: absolute;
  top: 0;
  left: calc(-1 * clamp(14px, 2.6vw, 44px));
  width: 2px;
  pointer-events: none;
}
.thread-track, .thread-line { position: absolute; inset: 0; border-radius: 1px; }
.thread-track { background: var(--staff); opacity: 0.5; }
.thread-line {
  background: repeating-linear-gradient(to bottom, var(--high) 0 4px, transparent 4px 10px);
  transform-origin: top;
  transform: scaleY(0);
}
.thread-node {
  position: absolute;
  left: 1px;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid var(--staff);
  background: var(--paper);
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.thread-node--start { top: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; }
.thread-node.is-on { background: var(--high); border-color: var(--high); transform: scale(1.15); }
@media (prefers-reduced-motion: reduce) {
  .tests, .tests span, .thread-node { transition: none; }
}

/* the five ideas, folded */
.ideas { margin: 0 0 1.5rem; max-width: var(--measure); }
.ideas summary {
  font-family: var(--sans); font-weight: 700; cursor: pointer; color: var(--high);
  min-height: 44px; display: flex; align-items: center; gap: 0.5rem; list-style: none;
}
.ideas summary::-webkit-details-marker { display: none; }
.ideas summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; border: 1px solid currentColor; border-radius: 50%; font-weight: 400; }
.ideas[open] summary::before { content: "2"; }
.ideas .concepts { margin-top: 0.5rem; }
@media (max-width: 600px) { .has-thread .thread { left: -10px; } .thread-node { width: 12px; height: 12px; margin: -6px 0 0 -6px; } }

/* the research band says first what it is */
.research-kicker {
  font-family: var(--sans);
  font-weight: 700;
  font-size: var(--s0);
  color: var(--high);
  margin: 0 0 0.6rem;
}

/* the link from the instrument to the game it borrows its rule from */
.instrument-link { color: var(--high); font-family: var(--sans); font-weight: 700; text-decoration-color: color-mix(in srgb, var(--high) 45%, transparent); }
.instrument-link:hover { text-decoration-color: var(--high); }
:root[data-theme="light"] .instrument-link { color: #8a6a00; text-decoration-color: color-mix(in srgb, #8a6a00 45%, transparent); }
