/* ===========================================================================
   site.css — the single stylesheet for the whole site.

   World: a flight-data ledger. Ships light (white paper, near-black ink) with
   the dark original kept as the base tokens. Schibsted Grotesk
   carrying the display voice, JetBrains Mono reserved strictly for data —
   values, indices, counters, measurements. One blue accent. Hairline rules do
   the structural work; there are no cards, no shadows and no gradients.
   Renders lead, the interface recedes.
   =========================================================================== */

/* --- 1. Fonts ------------------------------------------------------------
   Self-hosted variable fonts. Two files each (latin + latin-ext); the latin
   subsets that load first total ~97 KB. No third-party request.
   Both are SIL Open Font License — see assets/fonts/LICENSE-*.txt.
   ------------------------------------------------------------------------- */

/* Schibsted Grotesk — an editorial grotesk drawn in Oslo. Variable weight
   400–900; the display voice is carried by weight rather than width. */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin.woff2") format("woff2");
  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: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Tektur — the wordmark only. A contemporary sci-fi grotesk with real
   lowercase, variable weight 400–900 and width 75–100%. 19 KB, latin only. */
@font-face {
  font-family: "Tektur";
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url("../fonts/tektur-latin.woff2") format("woff2");
}

/* --- 2. Tokens ----------------------------------------------------------- */

:root {
  /* The ground is tinted cold, not neutral: blue lives in the surface and
     the hairlines, so the accent reads as part of the world rather than a
     sticker on top of it. */
  --bg:          #0a0b0f;
  --bg-elev:     #12141a;
  --bg-sunk:     #07080b;

  --line:        rgba(140, 170, 255, 0.12);
  --line-soft:   rgba(140, 170, 255, 0.07);
  --line-strong: rgba(140, 170, 255, 0.32);

  --text:        #f6f7fa;
  --text-mid:    #d3d7de;   /* 12.6:1 on --bg — body copy */
  --text-dim:    #9aa1af;   /* 7.3:1 on --bg — labels, captions */

  --accent:      #5aa0ff;   /* 7.1:1 on --bg — passes as body text, not just large */
  --accent-soft: rgba(90, 160, 255, 0.14);
  --accent-line: rgba(90, 160, 255, 0.45);
  --accent-ink:  #07080b;   /* text on an accent-filled surface */
  --accent-hover: #7ab4ff;

  /* Surfaces that were once hard-coded. Every one has a light counterpart below. */
  --glass:       rgba(10, 11, 15, 0.9);    /* sticky top bar */
  --scrim-a:     rgba(7, 8, 11, 0.55);     /* embed poster gradient, top */
  --scrim-b:     rgba(7, 8, 11, 0.88);     /* embed poster gradient, bottom */
  --scrim-btn:   rgba(10, 11, 15, 0.55);   /* button ground on a poster */
  --overlay:     rgba(5, 6, 9, 0.97);      /* lightbox */
  --overlay-soft: rgba(5, 6, 9, 0.8);      /* palette */
  --ink-halo:    rgba(7, 8, 11, 0.55);     /* dark halo behind the compare handle */
  --tag-bg:      rgba(10, 11, 15, 0.7);    /* compare tags, handle ring */
  --scrollbar:   #262a34;

  /* Code and the wordmark toy: hues that hold on this ground. */
  --code-string: #7dffb0;
  --code-number: #5ee0ff;
  --tone-2: #5ee0ff;
  --tone-3: #9d8bff;
  --tone-4: #ff7ad1;
  --tone-5: #7dffb0;

  --display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;

  /* Schibsted Grotesk has no width axis; this stays at 100% and is kept as a
     hook so a future face with a wdth axis can be set expanded in one place. */
  --width-display: 100%;
  --weight-display: 700;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --brand: "Tektur", "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;

  --page-w: 1200px;
  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  /* Calibrated against measured output, not assumed — re-measured for
     Schibsted Grotesk (see README, Typography). */
  --measure: 52ch;

  --rhythm: clamp(3rem, 6vw, 5.5rem);

  /* Exponential ease-out — fast departure, long settle. */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 3. Reset ------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Always keep room for the scrollbar: a short page, or one that is still
     being built, must not be 10-17px wider than a long one, or the centred
     layout jumps sideways on every navigation. */
  scrollbar-gutter: stable;
  /* Browser chrome themed from the palette rather than left at defaults. */
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) var(--bg-sunk);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.006em;
  caret-color: var(--accent);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg-sunk); }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border: 3px solid var(--bg-sunk);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

img, video, iframe { display: block; max-width: 100%; }
img, video { height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

p { margin: 0 0 1.15em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

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

ul { margin: 0; padding: 0; list-style: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 1px;
}

/* --- 4. Type ------------------------------------------------------------- */

.t-display {
  font-size: clamp(2.9rem, 8.2vw, 6rem);
  font-weight: var(--weight-display);
  font-stretch: var(--width-display);
  letter-spacing: -0.04em;
  line-height: 0.92;
}

.t-h1 {
  font-size: clamp(2.4rem, 5.6vw, 4.5rem);
  font-weight: var(--weight-display);
  font-stretch: var(--width-display);
  letter-spacing: -0.038em;
  line-height: 0.98;
}

.t-h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  font-weight: var(--weight-display);
  font-stretch: var(--width-display);
  letter-spacing: -0.032em;
}

.t-h3 {
  font-size: clamp(1.2rem, 1.7vw, 1.5rem);
  letter-spacing: -0.022em;
}

.t-lead {
  font-size: clamp(1.0625rem, 1.5vw, 1.3125rem);
  line-height: 1.5;
  letter-spacing: -0.016em;
  color: var(--text-mid);
}

.t-body { color: var(--text-mid); }

/* UI labels — the display face, not mono. Mono is reserved for data. */
.t-label {
  font-family: var(--display);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Data — values, indices, counters, measurements. Mono earns its place here. */
.t-data {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.measure { max-width: var(--measure); }

/* Prose links inside written copy. */
.about__body a, .breakdown__body a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.2s var(--ease);
}
.about__body a:hover, .breakdown__body a:hover { text-decoration-color: var(--accent); }

/* Unfilled data, made impossible to miss. */
.todo {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px dashed var(--accent-line);
  padding: 0.1em 0.5em;
  border-radius: 2px;
  line-height: 1.45;
}

/* --- 5. Skip link -------------------------------------------------------- */

.skip {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease-out);
}
.skip:focus { transform: translateY(0); }

/* --- 6. Shell ------------------------------------------------------------ */

.main {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section { padding-block: var(--rhythm); }
.section + .section { border-top: 1px solid var(--line); }

/* A section heading that sits beside its content rather than above it. */
.aside-grid {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 4.5rem);
  align-items: start;
}

@media (max-width: 860px) {
  /* minmax(0, 1fr), not 1fr: a bare 1fr is minmax(auto, 1fr), and a <pre>
     inside the column would push its min-content width past the viewport. */
  .aside-grid { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}

/* --- 7. Top header -------------------------------------------------------
   One row: wordmark, section links, contact links. Sticky, glass ground,
   hairline below. Wraps to two rows on narrow screens; contact links move
   to the footer there.
   ------------------------------------------------------------------------- */

.top {
  position: relative;
  z-index: 110;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.top__inner {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: 64px;
}

.top__brand {
  font-family: var(--brand);
  font-size: 1.25rem;
  font-weight: 700;
  font-stretch: 92%;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.top__nav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-left: clamp(0.5rem, 3vw, 2.5rem);
}

.top__nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-mid);
  transition: color 0.2s var(--ease);
}
.top__nav a:hover { color: var(--text); }
.top__nav a[aria-current="page"] { color: var(--text); }
.top__nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
}

/* The project index: every category, every project, as columns under the
   top row. Not sticky — it is the top of the page, not chrome. */
.cats {
  border-top: 1px solid var(--line);
  background: var(--bg-sunk);
}
.cats__inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));   /* six categories fit one row on a laptop */
  gap: 1.25rem clamp(1rem, 2vw, 2rem);
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 1.1rem var(--gutter) 1.35rem;
}
.cats__name {
  display: inline-block;
  padding-bottom: 0.45rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
  transition: color 0.2s var(--ease);
}
.cats__name:hover { color: var(--accent); }
.cats__name[aria-current="page"] { color: var(--accent); border-color: var(--accent-line); }
.cats__list li a {
  display: block;
  padding: 0.3rem 0;
  font-size: 0.9375rem;
  color: var(--text-mid);
  transition: color 0.2s var(--ease);
}
.cats__list li a:hover { color: var(--text); }
/* Only a very long group (7+) splits into two columns on desktop; the rest
   stay one column each, so every category reads as its own list. */
@media (min-width: 721px) {
  .cats__group--wide { grid-column: span 2; }
  .cats__group--wide .cats__list { columns: 2; column-gap: clamp(1rem, 2vw, 2rem); }
  .cats__group--wide .cats__list li { break-inside: avoid; }
}
.cats__list li a[aria-current="page"] { color: var(--accent); font-weight: 500; }

.top__links {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}
.top__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-mid);
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.top__links a:hover { color: var(--accent); }
.top__links:empty { display: none; }

.top__nav { flex-wrap: wrap; row-gap: 0; }

@media (max-width: 1000px) {
  .top__inner { flex-wrap: wrap; row-gap: 0; padding-block: 0.4rem 0.2rem; }
  .top__brand { min-height: 44px; display: inline-flex; align-items: center; }
  .top__nav { order: 3; width: 100%; margin-left: 0; gap: 0 1.25rem; }
  .top__links { margin-left: auto; }
}
@media (max-width: 720px) {
  .top__links { display: none; }   /* the footer carries them on phones */
  /* Every category and project stays on screen, but side by side in a strip
     you swipe, not stacked: stacked, the index took ~600px and pushed every
     page's title below the fold. The fade at the right edge says "more". */
  .cats__inner {
    display: flex;
    gap: 1.75rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gutter);
    padding: 0.85rem var(--gutter) 0.6rem;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2.75rem), transparent);
            mask-image: linear-gradient(90deg, #000 calc(100% - 2.75rem), transparent);
  }
  .cats__inner::-webkit-scrollbar { display: none; }
  .cats__inner::after { content: ""; flex: 0 0 1.5rem; }   /* room to scroll the last column clear of the fade */
  .cats__group { flex: 0 0 auto; max-width: 15rem; scroll-snap-align: start; }
  /* A long group flows into two columns: the strip scrolls sideways, so width is cheap and height is not. */
  .cats__group--long { max-width: none; }
  .cats__group--long .cats__list { columns: 2; column-gap: 1.75rem; }
  .cats__group--long .cats__list li { break-inside: avoid; }
  .cats__name { margin-bottom: 0.1rem; }
  .cats__list li a { min-height: 44px; display: flex; align-items: center; white-space: nowrap; }
}

/* --- 9. Home: hero -------------------------------------------------------
   The one authored motion moment on the site. Lines clip upward in sequence
   and the meta rule draws across beneath them. Default state is fully
   visible; the animation only runs when site.js opts in.
   ------------------------------------------------------------------------- */

.hero {
  padding-block: clamp(3rem, 8vh, 5.5rem) var(--rhythm);
}

/* The headline states the job, so it does not need display size: it sits
   between .t-h1 and .t-h2 and lets the intro paragraph carry the voice. */
.hero__title { font-size: clamp(2.1rem, 4.4vw, 3.4rem); letter-spacing: -0.03em; line-height: 1.02; }

.hero__line { display: block; overflow: hidden; }
.hero__line > span { display: block; }

.hero__accent { color: var(--accent); }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.25rem;
  margin-top: clamp(1.75rem, 3vw, 2.25rem);
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.hero__intro {
  margin-top: clamp(1.5rem, 3vw, 2rem);
  max-width: 52ch;
}

/* Below this the three labels wrap into a ragged two-line block. Stack them
   instead, so the break reads as a decision rather than an accident. */
@media (max-width: 620px) {
  .hero__meta { flex-direction: column; gap: 0.55rem; }
}

@media (prefers-reduced-motion: no-preference) {
  body[data-anim="on"] .hero__line > span {
    animation: line-rise 1.05s var(--ease-out) backwards;
  }
  body[data-anim="on"] .hero__line:nth-child(1) > span { animation-delay: 0.05s; }
  body[data-anim="on"] .hero__line:nth-child(2) > span { animation-delay: 0.14s; }
  body[data-anim="on"] .hero__line:nth-child(3) > span { animation-delay: 0.23s; }

  body[data-anim="on"] .hero__meta {
    animation: rule-draw 1.1s var(--ease-out) 0.42s backwards;
  }
  body[data-anim="on"] .hero__intro {
    animation: soft-rise 1s var(--ease-out) 0.5s backwards;
  }
}

@keyframes line-rise {
  from { transform: translateY(105%); }
  to   { transform: translateY(0); }
}

@keyframes rule-draw {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

@keyframes soft-rise {
  from { opacity: 0; transform: translateY(12px); filter: blur(3px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* --- 10. Home: about ----------------------------------------------------- */

.about__body { max-width: var(--measure); }
.about__body p { color: var(--text-mid); }
.about__body p + p { margin-top: 1.15em; }

/* --- 11. Home: project ledger --------------------------------------------
   Each project is a full-width band: a document rule carrying index and year,
   then the render at full column width, then title and datasheet. The render
   leads; the interface is hairlines and mono values.
   ------------------------------------------------------------------------- */

.work__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--line-strong);
}

.entry {
  display: block;
  padding-block: clamp(1.75rem, 3.5vw, 2.75rem);
  border-bottom: 1px solid var(--line);
}

/* Document rule: index on the left, year on the right, hairline between. */
.entry__rule {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.15rem;
  margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
}

.entry__rule::after {
  content: "";
  grid-column: 1;
  grid-row: 1;
  height: 1px;
  background: var(--line);
  transition: background 0.4s var(--ease);
}

.entry:hover .entry__rule::after { background: var(--accent-line); }

.entry__year {
  grid-column: 2;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.entry__media {
  position: relative;
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  aspect-ratio: 16 / 9;
}

.entry__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.005);
  transition: transform 0.85s var(--ease-out);
}

.entry:hover .entry__media img,
.entry:focus-visible .entry__media img { transform: scale(1.035); }

/* The render wipes in the first time it enters view — the same clip gesture
   as the hero rule, so the page carries one motion idea rather than several.
   The visible state is the default: the wipe is an animation played over it,
   never a style the render has to be rescued from. If the observer never
   fires, or JavaScript never runs, the image is simply there. */
@media (prefers-reduced-motion: no-preference) {
  .entry__media[data-wipe="in"] {
    animation: media-wipe 1.05s var(--ease-out) backwards;
  }
}

@keyframes media-wipe {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0 0); }
}

.entry__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
  gap: clamp(1.5rem, 4vw, 4rem);
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  align-items: start;
}

@media (max-width: 900px) {
  .entry__body { grid-template-columns: 1fr; gap: 1.75rem; }
}

.entry__title {
  font-size: clamp(2rem, 4.4vw, 3.5rem);
  font-weight: var(--weight-display);
  font-stretch: var(--width-display);
  letter-spacing: -0.038em;
  line-height: 1;
  transition: color 0.25s var(--ease);
}

.entry:hover .entry__title { color: var(--accent); }

.entry__tagline { margin-top: 0.9rem; max-width: 30ch; }
.entry__summary { margin-top: 1.15rem; max-width: 53ch; font-size: 0.9375rem; }

/* Datasheet rail — the signature motif, at list scale. */
.entry__specs { margin: 0; }

.entry__spec {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line-soft);
}
.entry__spec:first-child { border-top: 1px solid var(--line); }

/* Label in the display face, value in mono — the contrast between the two
   is what makes the rail read as a datasheet rather than as code. */
.entry__spec dt {
  font-family: var(--display);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.entry__spec dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-mid);
}

.entry__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 0.4rem;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.entry:hover .entry__cta { color: var(--accent); border-color: var(--accent); }
.entry__arrow { transition: transform 0.35s var(--ease-out); }
.entry:hover .entry__arrow { transform: translateX(5px); }

/* --- 12. Project page: hero ---------------------------------------------- */

.phero { padding-block: clamp(2rem, 5vh, 3.5rem) 0; }

.phero__back {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
}
.phero__back:hover { color: var(--accent); }
.phero__back span { transition: transform 0.3s var(--ease-out); }
.phero__back:hover span { transform: translateX(-4px); }

.phero__rule {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}
.phero__rule::after {
  content: "";
  grid-column: 1;
  grid-row: 1;
  height: 1px;
  background: var(--line);
}

.phero__year { grid-column: 2; color: var(--text-dim); }

.phero__tagline { margin-top: 1.35rem; max-width: 50ch; }

.phero__media {
  position: relative;
  margin-top: clamp(2.25rem, 5vw, 3.5rem);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.phero__media > img,
.phero__media > video { width: 100%; height: 100%; object-fit: cover; }

/* --- 13. Project page: datasheet ----------------------------------------- */

.datasheet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  border-top: 1px solid var(--line-strong);
}

.datasheet__row {
  padding: 1.5rem 1.75rem 1.6rem 0;
  border-bottom: 1px solid var(--line);
}

.datasheet__row dt { margin-bottom: 0.6rem; }

.datasheet__row dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.7;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.datasheet__row--wide { grid-column: 1 / -1; }

.datasheet__list li {
  position: relative;
  padding-left: 1.2rem;
  color: var(--text-mid);
}
.datasheet__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.chip {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: -0.005em;
  color: var(--text-mid);
  border: 1px solid var(--line);
  padding: 0.28rem 0.65rem;
  border-radius: 2px;
}

/* --- 14. Project page: breakdown ----------------------------------------- */

.breakdown__block + .breakdown__block { margin-top: clamp(2.75rem, 6vw, 4.5rem); }
.breakdown__body { max-width: var(--measure); min-width: 0; }
/* Code may run wider than prose; it scrolls inside its own box. */
.breakdown__body .code { max-width: min(100%, 78ch); }
.breakdown__body p { color: var(--text-mid); }

/* --- 15. Lazy embeds ----------------------------------------------------- */

.embed {
  position: relative;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.embed__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
/* Not-ready state is a plain element, not a disabled button, so the note
   inside stays reachable by assistive tech. */
.embed__poster--inert { cursor: default; }

.embed__poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transition: opacity 0.45s var(--ease), transform 0.85s var(--ease-out);
}

.embed__poster:not(.embed__poster--inert):hover img { opacity: 0.7; transform: scale(1.025); }

.embed__scrim {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.15rem;
  text-align: center;
  padding: 2rem;
  /* Weighted so the button and note stay legible over a bright render,
     not just over the dark placeholder. */
  background: linear-gradient(180deg, var(--scrim-a), var(--scrim-b));
}

.embed__button {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.75rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  background: var(--scrim-btn);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.embed__poster:not(.embed__poster--inert):hover .embed__button { background: var(--accent); color: var(--accent-ink); }

.embed__note {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.65;
  color: var(--text-mid);
  max-width: 44ch;
}

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

.embed__play {
  width: 0; height: 0;
  border-left: 11px solid currentColor;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  flex: none;
}

/* --- 16. Gallery --------------------------------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr));
  gap: clamp(0.85rem, 2vw, 1.5rem);
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

.gallery__item { display: block; padding: 0; text-align: left; width: 100%; }   /* padding: a photo is a <button>; without this it keeps the browser's own and sits narrower than a clip */

.gallery__frame {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  aspect-ratio: 16 / 10;
  transition: border-color 0.3s var(--ease);
}

.gallery__item:hover .gallery__frame { border-color: var(--line-strong); }

.gallery__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.85s var(--ease-out);
}

.gallery__item:hover .gallery__frame img { transform: scale(1.045); }
.gallery__frame video { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery__item--clip { margin: 0; }

/* Screenshots of graphs, settings panels and code, and portrait photos, are shown whole, not cropped to 16:10. */
.gallery__frame--contain { background: var(--bg-elev); }
.gallery__frame--contain img,
.gallery__frame--contain video { object-fit: contain; }

.gallery__caption {
  display: block;
  margin-top: 0.8rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text-dim);
}

/* --- 17. Lightbox -------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.35rem;
  padding: clamp(3.5rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem);
  background: var(--overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.lightbox[data-open="true"] { opacity: 1; visibility: visible; }

.lightbox img {
  max-width: min(100%, 1500px);
  max-height: 76vh;
  object-fit: contain;
  border: 1px solid var(--line);
}

.lightbox__caption {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text-dim);
  text-align: center;
  max-width: 62ch;
  margin: 0;
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
}
.lightbox__close:hover, .lightbox__nav:hover { color: var(--accent); }

.lightbox__close {
  top: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.6rem;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 1.5rem;
  padding: 1rem;
}
.lightbox__nav--prev { left: clamp(0.25rem, 2vw, 1.5rem); }
.lightbox__nav--next { right: clamp(0.25rem, 2vw, 1.5rem); }

body[data-lock="true"] { overflow: hidden; }

/* --- 18. Pager ----------------------------------------------------------- */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: var(--rhythm);
}

.pager__link {
  background: var(--bg);
  padding: clamp(1.75rem, 4vw, 2.75rem) clamp(1.15rem, 3vw, 2rem);
  transition: background 0.3s var(--ease);
}
.pager__link:hover { background: var(--bg-elev); }
.pager__link:hover .pager__title { color: var(--accent); }
.pager__link--next { text-align: right; }
.pager__title {
  display: block;
  margin-top: 0.7rem;
  transition: color 0.25s var(--ease);
}
.pager__empty { background: var(--bg-sunk); }

@media (max-width: 640px) {
  .pager { grid-template-columns: 1fr; }
  .pager__link--next { text-align: left; }
}

/* --- 19. Footer ---------------------------------------------------------- */

.footer {
  padding: clamp(2.75rem, 6vw, 4.5rem) var(--gutter);
  border-top: 1px solid var(--line);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem 2.5rem;
  align-items: baseline;
  justify-content: space-between;
  max-width: var(--page-w);
  margin: 0 auto;
}

.footer__links { display: flex; flex-wrap: wrap; gap: 1.65rem; }

.footer__links a {
  font-size: 0.8125rem;
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
}
.footer__links a:hover { color: var(--accent); }

/* --- 20. Motion preferences ---------------------------------------------- */

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

/* --- 21. Utilities ------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- 22. Music player ----------------------------------------------------
   A slim bar under the header, in the same sticky block: artwork and title,
   the transport, the seek bar with its times. Progress and time are data,
   so they are mono. The bar only exists when a music source is configured.
   ------------------------------------------------------------------------- */

/* A second row of the sticky header. */
.dock { border-top: 1px solid var(--line); }
.dock__inner {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0.5rem var(--gutter);
}


.player {
  display: grid;
  grid-template-columns: minmax(0, 18rem) auto minmax(0, 1fr) auto;
  grid-template-areas: "track controls bar credit";
  align-items: center;
  gap: 0.5rem clamp(1rem, 3vw, 2.5rem);
}

.player__head { grid-area: track; display: none; }   /* "Now playing" is implied in a dock */
.player__index { color: var(--text-dim); }

.player__track {
  grid-area: track;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.player__track > div { min-width: 0; flex: 1; }

.player__art {
  flex: none;
  width: 40px;
  height: 40px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.player__art[hidden] { display: none; }

.player__title {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player__artist {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player__controls { grid-area: controls; display: flex; align-items: center; gap: 0.15rem; }

/* Seek bar and times share the wide middle column. */
.player__bar {
  grid-area: bar;
  position: relative;
  display: block;
  width: 100%;
  height: 28px;
  cursor: pointer;
  touch-action: none;
}
.player__bar::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: var(--line-strong);
  transform: translateY(-50%);
}
.player__fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 2px;
  width: 100%;
  background: var(--accent);
  transform: translateY(-50%) scaleX(var(--p, 0));
  transform-origin: left center;
  transition: transform 0.12s linear;
}
.player__knob {
  position: absolute;
  left: var(--progress, 0%);
  top: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%) scale(0);
  transition: transform 0.2s var(--ease-out);
}
.player__bar:hover .player__knob,
.player__bar:focus-visible .player__knob,
.player[data-state="playing"] .player__knob { transform: translateY(-50%) scale(1); }

.player__row {
  grid-area: bar;
  display: contents;
}
.player__row .player__controls { grid-area: controls; }
.player__time {
  grid-area: credit;
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
}

.player__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-mid);
  border-radius: 2px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.player__btn:hover { color: var(--text); background: var(--bg-elev); }
.player__btn svg { width: 14px; height: 14px; display: block; fill: currentColor; }

.player__btn--main {
  width: 40px;
  height: 40px;
  color: var(--accent-ink);
  background: var(--accent);
}
.player__btn--main:hover { color: var(--accent-ink); background: var(--accent-hover); }
.player__btn--main svg { width: 15px; height: 15px; }

.player__btn--main .icon-pause { display: none; }
.player[data-state="playing"] .player__btn--main .icon-play { display: none; }
.player[data-state="playing"] .player__btn--main .icon-pause { display: block; }

.player[data-state="loading"] .player__btn--main {
  animation: player-breathe 1.1s var(--ease) infinite;
  cursor: progress;
}
@keyframes player-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.player__credit {
  display: none;   /* the SoundCloud credit lives in the title tooltip on the dock */
}

.player__empty {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text-dim);
}

/* The hidden top-bar play control from the sidebar layout is gone. */
.topbar__play { display: none; }

@media (max-width: 720px) {
  .player {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "track controls"
      "bar   bar";
    gap: 0.35rem 0.75rem;
  }
  .player__time { display: none; }
  .player__bar { height: 22px; }
}

/* --- 23. Touch targets --------------------------------------------------
   Anything tappable is at least 44px tall where fingers are the input.
   Padding does the work so the visible design is unchanged.
   ------------------------------------------------------------------------- */

@media (max-width: 960px), (pointer: coarse) {
  .footer__links a { display: inline-block; padding: 0.6rem 0; }

  .phero__back { padding: 0.75rem 0; margin-bottom: 1.25rem; }

  .player__btn { width: 44px; height: 44px; }
  .player__btn--main { width: 48px; height: 48px; }
  .player__controls { gap: 0; }

  .lightbox__close { min-height: 44px; min-width: 44px; }
  .lightbox__nav { min-width: 48px; min-height: 48px; }
}

/* --- 24. Category groups -------------------------------------------------
   The index is organised by category. In the sidebar each group carries its
   own heading; on the home page a group heading sits above its entries.
   Index numbers run continuously across groups.
   ------------------------------------------------------------------------- */

/* Anchored groups land below the sticky header. */
.work__group, #about, #contact { scroll-margin-top: 24px; }

.work__group + .work__group { margin-top: clamp(2.25rem, 5vw, 3.5rem); }

.work__group-name {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-top: clamp(1.75rem, 4vw, 2.75rem);
  padding-bottom: 0.25rem;
}
.work__group-name::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
  align-self: center;
}

/* --- 25. Wordmark ---------------------------------------------------------
   The name is a small toy: click a letter and it pops and changes colour;
   neighbours ripple. Tones are hue-rotations of the accent so the play stays
   inside the palette. Letters are presentational — the accessible name is a
   visually-hidden copy of the text.
   ------------------------------------------------------------------------- */

.mark { display: inline-block; white-space: nowrap; }

.mark__letter {
  display: inline-block;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.35s var(--ease);
  transform-origin: 50% 70%;
}

.mark__letter[data-tone="1"] { color: var(--accent); }
.mark__letter[data-tone="2"] { color: var(--tone-2); }
.mark__letter[data-tone="3"] { color: var(--tone-3); }
.mark__letter[data-tone="4"] { color: var(--tone-4); }
.mark__letter[data-tone="5"] { color: var(--tone-5); }

.mark__letter.is-pop { animation: mark-pop 0.55s var(--ease-out); }

@keyframes mark-pop {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-0.16em) scale(1.22); }
  100% { transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .mark__letter.is-pop { animation: none; }
}

/* --- 26. Metrics ------------------------------------------------------------
   Performance and scale figures in the datasheet. Pure data: mono, tabular.
   ------------------------------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem 2rem;
  margin: 0;
}
.metrics__item dt {
  font-family: var(--display);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}
.metrics__item dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* --- 27. Code blocks --------------------------------------------------------
   Shader and script snippets inside a breakdown. Mono is earned here.
   ------------------------------------------------------------------------- */

.code {
  margin: 1.5rem 0;
  border: 1px solid var(--line);
  background: var(--bg-sunk);
  max-width: 100%;
}
.code__bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
}
.code__file { color: var(--text-dim); }
.code__pre {
  margin: 0;
  padding: 1rem 1.1rem 1.15rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--text-mid);
  tab-size: 2;
  scrollbar-width: thin;
}
.code__pre code { font: inherit; }
.code__caption {
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}
.c-cm { color: var(--text-dim); font-style: italic; }
.c-st { color: var(--code-string); }
.c-nu { color: var(--code-number); }
.c-kw { color: var(--accent); }

/* --- 28. Before / after ----------------------------------------------------
   A range input drives --split; the "before" layer is clipped to it.
   ------------------------------------------------------------------------- */

.compare__list { display: grid; gap: clamp(1.5rem, 4vw, 3rem); margin-top: clamp(1.75rem, 4vw, 2.75rem); }

.compare { margin: 0; --split: 50%; }

.compare__stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  user-select: none;
  -webkit-user-select: none;
}
.compare__stage img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.compare__before {
  position: absolute; inset: 0;
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
}
.compare__handle {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--split);
  width: 1px;
  background: var(--text);
  transform: translateX(-0.5px);
  pointer-events: none;
}
.compare__handle span {
  position: absolute;
  top: 50%; left: 50%;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--text);
  background: var(--tag-bg);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.compare__handle span::before,
.compare__handle span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 6px; height: 6px;
  border-top: 1px solid var(--text);
  border-left: 1px solid var(--text);
}
.compare__handle span::before { left: 9px;  transform: translateY(-50%) rotate(-45deg); }
.compare__handle span::after  { right: 9px; transform: translateY(-50%) rotate(135deg); }

.compare__tag {
  position: absolute;
  top: 0.9rem;
  padding: 0.3rem 0.6rem;
  background: var(--tag-bg);
  color: var(--text);
  pointer-events: none;
}
.compare__tag--before { left: 0.9rem; }
.compare__tag--after  { right: 0.9rem; }

/* The range sits over the whole stage, invisible but fully operable. */
.compare__range {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: none;
}
.compare__range:focus-visible + * { outline: none; }
.compare__stage:has(.compare__range:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }

/* --- 29. 3D viewer -----------------------------------------------------------*/

.embed--model { background: var(--bg-elev); }
.embed[data-loading="true"] .embed__button { animation: player-breathe 1.1s var(--ease) infinite; }
model-viewer.embed__frame { --poster-color: transparent; background: var(--bg-elev); }

/* --- 30. Command palette -------------------------------------------------- */

.palette {
  position: fixed; inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(4rem, 14vh, 9rem) 1rem 1rem;
  background: var(--overlay-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.palette[hidden] { display: none; }
.palette__panel {
  width: min(100%, 34rem);
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  overflow: hidden;
}
.palette__input {
  display: block;
  width: 100%;
  padding: 1rem 1.15rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem;
  outline: none;
}
.palette__input::placeholder { color: var(--text-dim); }
.palette__list { max-height: min(50vh, 22rem); overflow-y: auto; }
.palette__list li a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  color: var(--text-mid);
}
.palette__list li[aria-selected="true"] a { background: var(--bg-elev); color: var(--text); }
.palette__meta { font-size: 0.75rem; color: var(--text-dim); }
.palette__empty { padding: 1rem 1.15rem; color: var(--text-dim); }
.palette__foot {
  display: flex; gap: 1.25rem;
  padding: 0.6rem 1.15rem;
  border-top: 1px solid var(--line);
}
@media (max-width: 960px) {
  .palette__foot { display: none; }
}

/* --- 31. Draft mode, notices, contact ---------------------------------------*/

/* A value the owner has not filled in yet, as a visitor sees it. */
.unset { color: var(--text-dim); }

/* A runtime problem, phrased for the visitor. Distinct from .todo (authoring). */
.notice {
  display: inline-block;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-mid);
  border-left: 1px solid var(--accent-line);
  padding-left: 0.6rem;
}

/* Footer meta is a sentence, not a label: no caps. */
.footer__meta {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* Closing contact block on the home page. */
.contact__line { max-width: 22ch; }
.contact__avail { margin-top: 1.25rem; max-width: 40ch; }
.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}
.contact__links a {
  display: inline-block;
  padding: 0.35rem 0;
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.contact__links a:hover { color: var(--accent); border-color: var(--accent); }

/* Compare handle: a 2px line with a dark halo survives bright renders. */
.compare__handle { width: 2px; transform: translateX(-1px); box-shadow: 0 0 0 1px var(--ink-halo); }

/* --- 32. Hero simulation ----------------------------------------------------
   Cuboi's Escape, the playable project. Canvas on the sunken ground with a
   hairline frame; readout in the datasheet voice. Nothing about it is
   decoration: the numbers are real.
   ------------------------------------------------------------------------- */

.hero__play { margin-top: 1.4rem; font-size: 0.9375rem; }
.hero__play a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 0.1rem;
}
.hero__play a:hover { border-bottom-color: var(--accent); }

/* Standalone text links get a larger invisible hit area (24px+), so they are
   easy to tap without looking any bigger. */
.hero__play a, .phero__back { position: relative; }
.hero__play a::after, .phero__back::after { content: ""; position: absolute; inset: -0.55rem -0.35rem; }

.sim { margin: 0; }

/* On its project page the game is the hero: the canvas and its controls in a
   fixed-width column, the how-to and the shop beside them when there is room. */
.phero__media--game,
.phero__media--demo { aspect-ratio: auto; background: none; border: 0; overflow: visible; }
.sim--page { max-width: 36rem; }
@media (min-width: 900px) {
  .sim--page {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 34rem) minmax(16rem, 1fr);
    column-gap: clamp(2rem, 4vw, 4rem);
    align-items: start;
  }
  .sim--page > * { grid-column: 1; }
  .sim--page .sim__hint { max-width: none; }
  .sim--page .shop { grid-column: 2; grid-row: 1 / span 4; margin-top: 0; padding-top: 0; border-top: 0; }
}

.sim__canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
}
.sim__canvas:active { cursor: grabbing; }

.sim__readout {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}
.sim__readout > span { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.sim__wallet .t-data { display: inline-flex; align-items: center; gap: 0.35rem; }
.sim__readout .t-data { color: var(--text); white-space: nowrap; }

.sim__hint {
  margin-top: 0.9rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 44ch;
}

.sim[data-motion="off"] .sim__hint::after { content: " (Motion is off in your system settings.)"; }

@media (prefers-reduced-motion: no-preference) {
  body[data-anim="on"] .sim { animation: soft-rise 1.1s var(--ease-out) 0.55s backwards; }
}

@media (max-width: 480px) {
  .sim__readout { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- Music page ------------------------------------------------------------
   A grid of songs: SoundCloud's visual player on top (artwork, waveform, play),
   the title and a line of detail under it. One song sits at a comfortable
   width rather than stretching across the page.
   ------------------------------------------------------------------------- */

.music__lead { margin-top: 1rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; }
.music__count { color: var(--text-dim); font-size: 0.8em; }
.music__about { margin-top: 0.85rem; max-width: var(--measure); color: var(--text-mid); }
.songs-section { padding-top: clamp(1.5rem, 3vw, 2.5rem); }

.songs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3rem);
}
.song { display: grid; gap: 1rem; align-content: start; scroll-margin-top: 24px; }
.song:target .song__player { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.song__player {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  overflow: hidden;
  width: 100%;                  /* definite, so min-height can't widen it through the ratio */
  aspect-ratio: 6 / 1;          /* a slim banner: half the old 3:1 height */
  min-height: 120px;
  transition: border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.song__player iframe { display: block; width: 100%; height: 100%; border: 0; }
.song__title { font-size: clamp(1.35rem, 2.2vw, 1.75rem); font-weight: var(--weight-display); letter-spacing: -0.02em; line-height: 1.1; }
.song__meta { margin-top: 0.4rem; color: var(--text-dim); }
.song__note { margin-top: 0.5rem; color: var(--text-mid); max-width: 44ch; }
.song__link {
  justify-self: start;
  margin-top: 0.2rem;
  padding-block: 0.6rem 0.15rem;
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
}
.song__link:hover { border-bottom-color: var(--accent); }
.embed__open { display: inline-block; margin-top: 0.9rem; }
.phero__links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-top: 0.85rem; }
.datasheet__link { display: inline-block; margin-right: 1.25rem; padding-top: 0; }
.song__body { display: grid; gap: 0.1rem; }

/* --- Comedy page -----------------------------------------------------------
   Videos two across on wide screens. A YouTube video uses the site's own
   poster-then-player embed, with the thumbnail shown near full strength; a
   Short gets a tall 9:16 frame; any other link is a card that opens it.
   ------------------------------------------------------------------------- */

.clips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr));
  gap: clamp(2rem, 4vw, 3rem) clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}
.clip { display: grid; gap: 1rem; align-content: start; scroll-margin-top: 24px; }
.clip .embed { margin-top: 0; }
.clip .embed__poster img { opacity: 0.94; }
.clip .embed__poster:hover img { opacity: 1; }
.clip .embed__scrim { background: linear-gradient(180deg, transparent 45%, var(--scrim-b)); justify-content: flex-end; padding-bottom: 1.25rem; }
.clip:target .embed, .clip:target .clip__card { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.embed--short { aspect-ratio: 9 / 16; max-width: 22rem; }
.embed--short img { object-position: center; }
.embed--short img.is-cropped { transform: scale(1.34); }   /* past the letterbox bars baked into the landscape thumbnail */

.clip__card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 16 / 9;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}
.clip__card:hover { border-color: var(--line-strong); background: var(--bg-sunk); }
.clip__card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.clip__platform { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: var(--weight-display); letter-spacing: -0.03em; line-height: 1; }
.clip__open { font-size: 0.9375rem; color: var(--accent); }

/* --- Music: visualizer switch ------------------------------------------------ */
.viz { margin-top: clamp(1.25rem, 3vw, 1.75rem); display: grid; gap: 0.9rem; }
.viz__toggle { justify-self: start; }
.viz__stage { aspect-ratio: 16 / 9; max-height: 70vh; width: 100%; border: 1px solid var(--line); background: #000; }
.viz__stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.viz__note { font-size: 0.875rem; color: var(--text-dim); max-width: 62ch; }

/* --- More videos (project pages) ------------------------------------------ */
.videos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: clamp(1rem, 2.5vw, 1.75rem); margin-top: clamp(1.5rem, 3.5vw, 2.25rem); }
.videos__item { margin: 0; }
.videos__title { margin-top: 0.7rem; font-size: 0.9375rem; color: var(--text-mid); }
.videos__chapters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.videos__chapter { font: inherit; font-size: 0.875rem; color: var(--text); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.8rem; cursor: pointer; transition: border-color 0.2s, color 0.2s; }
.videos__chapter:hover, .videos__chapter:focus-visible { border-color: var(--accent); color: var(--accent); }
.videos__at { font-variant-numeric: tabular-nums; color: var(--accent); }

/* --- ArtStation tiles (home) ----------------------------------------------
   Square covers, four to six across, each a link out to ArtStation.
   ------------------------------------------------------------------------- */

.as-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr));
  gap: clamp(0.85rem, 2vw, 1.25rem);
  margin-top: clamp(1.5rem, 3.5vw, 2.25rem);
}
.as-tile { display: grid; gap: 0.55rem; color: var(--text-mid); }
.as-tile__frame { display: block; overflow: hidden; aspect-ratio: 1; background: var(--bg-elev); border: 1px solid var(--line); transition: border-color 0.3s var(--ease); }
.as-tile__frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.85s var(--ease-out); }
.as-tile:hover .as-tile__frame { border-color: var(--line-strong); }
.as-tile:hover .as-tile__frame img { transform: scale(1.045); }
.as-tile__title { font-size: 0.875rem; line-height: 1.4; transition: color 0.2s var(--ease); }
.as-tile:hover .as-tile__title { color: var(--text); }
.as-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 720px) { .as-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- Bio page --------------------------------------------------------------
   Name, role, and the text. The side column carries the gravity switch.
   ------------------------------------------------------------------------- */

.bio__role { margin-top: 1rem; max-width: 40ch; }

/* Name and role on the left, the portrait on the right, bottoms aligned. */
.phero.bio { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: clamp(1.25rem, 4vw, 3rem); }
.bio__portrait { margin: 0; width: clamp(8rem, 18vw, 13.5rem); display: grid; gap: 0.35rem; }
.bio__portrait img { width: 100%; height: auto; aspect-ratio: 574 / 799; object-fit: cover; border: 1px solid var(--line); background: var(--bg-elev); }
.bio__portrait figcaption { font-size: 0.8125rem; }
.bio__portrait .song__link { padding-top: 0.35rem; }

/* Wide screens: the name sits level with the top of the portrait and the
   About text rises up beside it (the portrait hangs into the next section). */
@media (min-width: 75rem) {
  .phero.bio { align-items: start; }
  .bio__portrait { margin-bottom: -40rem; }
}

.bio__side { display: grid; align-content: start; gap: 1.1rem; position: relative; z-index: 60; }

.bio__gravity {
  display: inline-flex; align-items: center; gap: 0.55rem;
  justify-self: start;
  min-height: 40px;
  padding: 0.45rem 0.9rem 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit; font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out), background-color 0.15s var(--ease-out);
}
.bio__gravity:hover { border-color: var(--line-strong); }
.bio__gravity:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bio__gravity svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s var(--ease-out); }
.bio__gravity[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.bio__gravity[aria-pressed="true"] svg { transform: rotate(180deg); }
.bio__hint { font-size: 0.8125rem; line-height: 1.5; color: var(--text-dim); max-width: 24ch; }
.bio__hint kbd { font-family: var(--mono); font-size: 0.6875rem; padding: 0.05rem 0.3rem; border: 1px solid var(--line); border-radius: 2px; }

/* While the words are out, the real text stays in the document (readable by
   assistive tech, findable) but invisible; the copies fly in a fixed layer. */
[data-gravity].is-lifted { opacity: 0; }
.gravity { position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden; }
.gravity__word {
  position: absolute; left: 0; top: 0;
  white-space: nowrap;
  transform-origin: 50% 50%;
  pointer-events: auto;
  cursor: grab;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  will-change: transform;
}
.gravity__word.is-held { cursor: grabbing; }

@media (max-width: 720px) {
  .phero.bio { grid-template-columns: minmax(0, 1fr) 6.5rem; align-items: start; }
  .bio__portrait figcaption { font-size: 0.75rem; line-height: 1.3; }
  .bio__side { grid-template-columns: auto 1fr; align-items: center; }
  .bio__side .t-label { grid-column: 1 / -1; }
  .bio__hint { max-width: none; }
}

/* --- Configurator --------------------------------------------------------
   Car-configurator layout: the stage is the product, the panel is the spec.
   Side by side from 1000px, stacked below it. The options are real radios
   styled as pills and swatches; the checked one carries the accent.
   ------------------------------------------------------------------------- */

.cfg {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem clamp(1.5rem, 3vw, 2.75rem);
  margin-top: clamp(1.5rem, 3.5vw, 2.25rem);
}
@media (min-width: 1000px) {
  .cfg { grid-template-columns: minmax(0, 1.7fr) minmax(17rem, 1fr); align-items: start; }
}

.cfg__stage {
  position: relative;
  aspect-ratio: 16 / 11;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  overflow: hidden;
}
.cfg__canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.cfg__canvas:active { cursor: grabbing; }

.cfg__open {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  padding: 0; border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.cfg__open img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.5; transition: opacity 0.4s var(--ease-out), transform 0.8s var(--ease-out); }
.cfg__open:hover img { opacity: 0.65; transform: scale(1.02); }
.cfg__open:hover .embed__button { background: var(--accent); color: var(--accent-ink); }
.cfg__open:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.cfg__open[disabled] { cursor: progress; }
.cfg__openlabel {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  padding: 1.5rem; text-align: center;
  background: linear-gradient(180deg, var(--scrim-a), var(--scrim-b));
}
.cfg__loading {
  position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.75rem; color: var(--text-mid);
}

.cfg__tools { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.8rem; }
.cfg__seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-elev); }
.cfg__tool {
  min-height: 32px;
  padding: 0.25rem 0.8rem;
  border: 0; border-radius: 999px;
  background: none;
  color: var(--text-mid);
  font: inherit; font-size: 0.8125rem;
  cursor: pointer;
  transition: color 0.15s var(--ease-out), background-color 0.15s var(--ease-out);
}
.cfg__tool:hover { color: var(--text); }
.cfg__tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cfg__tool[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.cfg__foot .cfg__tool { border: 1px solid var(--line); border-radius: 3px; }

.cfg__panel { display: grid; gap: 1.35rem; min-width: 0; }
.cfg__opt { border: 0; padding: 0; margin: 0; min-width: 0; }
.cfg__opt legend { display: flex; align-items: baseline; gap: 0.6rem; padding: 0; margin-bottom: 0.6rem; }
.cfg__val { font-size: 0.875rem; color: var(--text); }
.cfg__choices { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.cfg__choice { position: relative; display: inline-flex; }
.cfg__choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cfg__choice .cfg__name {
  display: inline-flex; align-items: center;
  min-height: 36px;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.875rem;
  color: var(--text-mid);
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.cfg__choice:hover .cfg__name { border-color: var(--line-strong); color: var(--text); }
.cfg__choice input:checked + .cfg__name,
.cfg__choice input:checked + .cfg__sw + .cfg__name { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--text); }
.cfg__choice input:focus-visible ~ .cfg__name { outline: 2px solid var(--accent); outline-offset: 2px; }

/* colour choices: a swatch, the name kept for screen readers and tooltips */
.cfg__choice--swatch .cfg__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; border: 0; min-height: 0; }
.cfg__sw {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: box-shadow 0.15s var(--ease-out);
}
.cfg__choice--swatch:hover .cfg__sw { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 0 0 2px var(--line-strong); }
.cfg__choice--swatch input:checked + .cfg__sw { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.cfg__choice--swatch input:focus-visible + .cfg__sw { outline: 2px solid var(--accent); outline-offset: 4px; }

.cfg__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.cfg__status { font-size: 0.8125rem; color: var(--text-dim); word-break: break-all; }
.cfg__note { font-size: 0.8125rem; line-height: 1.55; color: var(--text-dim); }

/* touch: every control at least 44px */
@media (max-width: 720px) {
  .cfg__tool, .cfg__choice .cfg__name { min-height: 44px; }
  .cfg__sw { width: 44px; height: 44px; }
  .cfg__tools { gap: 0.5rem; }
}

@media print { .cfg__view, .cfg__foot { display: none !important; } }

/* --- Turntable -----------------------------------------------------------
   A ring of photographs played back by dragging. The stage keeps a square-ish
   frame so the object does not jump between views; the slider is the same
   control for keyboards and for anyone who would rather not drag.
   ------------------------------------------------------------------------- */

.spin { margin: 0; max-width: 46rem; }

.spin__stage {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  aspect-ratio: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.spin.is-turning .spin__stage { cursor: grabbing; }

.spin__frame {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

.spin__grab {
  position: absolute;
  left: 50%; bottom: 0.9rem;
  transform: translateX(-50%);
  padding: 0.3rem 0.7rem;
  background: var(--scrim-btn);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mid);
  pointer-events: none;
  transition: opacity 0.2s var(--ease-out);
}
.spin.is-turning .spin__grab { opacity: 0; }

.spin__load {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 8rem;
}
.spin__bar {
  display: block;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}
.spin__bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }

.spin__range {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  accent-color: var(--accent);
  cursor: ew-resize;
}
.spin__range:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.spin__note {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 52ch;
}

/* Controls under the canvas: reset, jump, orbit. */
.sim__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.sim__orbit { display: inline-flex; gap: 0.25rem; margin-left: auto; }
.sim__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out), color 0.15s var(--ease-out), opacity 0.15s var(--ease-out);
}
.sim__btn:hover { border-color: var(--line-strong); }
.sim__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sim__btn:disabled { color: var(--text-dim); cursor: default; opacity: 0.55; }
.sim__btn kbd {
  font-family: var(--mono);
  font-size: 0.6875rem;
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text-dim);
}
.sim__btn--icon { min-width: 36px; padding: 0.3rem 0.5rem; font-size: 1rem; justify-content: center; }
.sim__canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The cube shop: coins from the game buy colours and finishes. Built by
   cubois-escape.js into [data-sim-shop]; hidden until the script runs. */
.shop {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}
.shop__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.shop__wallet { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text); }
.shop__wallet b { font-weight: 500; }
.shop__coin {
  display: inline-block;
  width: 0.75em; height: 0.75em;
  border-radius: 50%;
  background: #e9a820;
  box-shadow: inset 0 0 0 1.5px #a8720a;
  vertical-align: -0.05em;
}
.shop__group { display: grid; gap: 0.45rem; }
.shop__row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.shop__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.3rem 0.6rem 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text-mid);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.shop__item:hover { border-color: var(--line-strong); color: var(--text); }
.shop__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shop__item[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--text); }
.shop__item[data-state="locked"] { color: var(--text-dim); cursor: not-allowed; }
.shop__item[data-state="locked"] .shop__swatch { opacity: 0.45; }
.shop__swatch {
  flex: none;
  width: 1rem; height: 1rem;
  border-radius: 2px;
  background: var(--sw, var(--bg-elev));
  border: 1px solid rgba(0, 0, 0, 0.18);
}
.shop__swatch--matte { background: var(--text-dim); }
.shop__swatch--gloss { background: radial-gradient(circle at 30% 28%, #fff 0, #fff 18%, var(--text-dim) 20%, var(--text-mid) 100%); }
.shop__swatch--wire  { background: transparent; border: 1.5px solid var(--text-mid); box-shadow: inset 0.28rem 0 0 -0.2rem var(--text-mid), inset 0 0.28rem 0 -0.2rem var(--text-mid); }
.shop__swatch--trail { background: linear-gradient(90deg, transparent, var(--accent)); border-color: transparent; }
.shop__swatch--metal { background: linear-gradient(135deg, #f2f3f6 0%, #8b909c 45%, #d7dae1 60%, #5f6470 100%); }
.shop__swatch--neon { background: transparent; border: 1.5px solid var(--accent); box-shadow: 0 0 6px var(--accent), inset 0 0 4px var(--accent); }
.shop__swatch--rainbow { background: conic-gradient(#f24d4d, #f99926, #f2d933, #40cc73, #408cfa, #a659f2, #f24d4d); border-color: transparent; }
.shop__swatch--sparkle { background: radial-gradient(circle at 30% 30%, #fff 0 12%, transparent 13%), radial-gradient(circle at 70% 65%, #e9a820 0 14%, transparent 15%), radial-gradient(circle at 45% 75%, #fff 0 8%, transparent 9%), var(--bg-elev); }
.shop__swatch--hat { background: linear-gradient(to bottom right, transparent 49%, #e63a52 50%) left/50% 100% no-repeat, linear-gradient(to bottom left, transparent 49%, #e63a52 50%) right/50% 100% no-repeat; border-color: transparent; }
.shop__swatch--boots { background: linear-gradient(180deg, transparent 0 40%, var(--text-mid) 40% 55%, transparent 55% 70%, var(--text-mid) 70% 85%, transparent 85%); border-color: transparent; }
.shop__swatch--sling2 { background: linear-gradient(90deg, var(--accent) 0 40%, transparent 40% 60%, var(--accent) 60%); border-color: transparent; }
.shop__swatch--ring { background: transparent; border: 2.5px solid var(--sw, transparent); border-radius: 50%; }
.shop__swatch--glyph {
  width: auto; min-width: 1rem; padding: 0 0.15rem;
  background: var(--bg-elev);
  font-family: var(--mono); font-size: 0.6875rem; line-height: 1rem; text-align: center;
  color: var(--text);
}
.shop__cost {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}
.shop__cost:empty { display: none; }
.shop__item[data-state="locked"] .shop__cost,
.shop__item[data-state="owned"] .shop__cost { color: var(--text-dim); }
.shop__item.is-shake { animation: shop-shake 0.3s var(--ease-out); }
@keyframes shop-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) { .shop__item.is-shake { animation: none; } }

/* --- 33. Light theme ---------------------------------------------------------
   Set data-theme="light" on <html>. Same system, inverted ground: white paper,
   near-black ink, hairlines in cool grey, the accent deepened so it still
   passes as text on white. Remove the attribute for the dark original.
   ------------------------------------------------------------------------- */

:root[data-theme="light"] {
  color-scheme: light;

  --bg:          #ffffff;
  --bg-elev:     #f1f3f7;
  --bg-sunk:     #f7f8fa;

  --line:        rgba(20, 30, 60, 0.13);
  --line-soft:   rgba(20, 30, 60, 0.07);
  --line-strong: rgba(20, 30, 60, 0.32);

  --text:        #0b0c10;
  --text-mid:    #262a33;   /* 14:1 on white */
  --text-dim:    #5d6474;   /* 6.0:1 on white */

  --accent:      #1c66e0;   /* 5.2:1 on white — text-safe */
  --accent-soft: rgba(28, 102, 224, 0.10);
  --accent-line: rgba(28, 102, 224, 0.45);
  --accent-ink:  #ffffff;
  --accent-hover: #1554bf;

  --glass:       rgba(255, 255, 255, 0.88);
  --scrim-a:     rgba(255, 255, 255, 0.35);
  --scrim-b:     rgba(255, 255, 255, 0.82);
  --scrim-btn:   rgba(255, 255, 255, 0.7);
  --overlay:     rgba(247, 248, 250, 0.97);
  --overlay-soft: rgba(247, 248, 250, 0.85);
  --ink-halo:    rgba(255, 255, 255, 0.7);
  --tag-bg:      rgba(255, 255, 255, 0.78);
  --scrollbar:   #c7ccd6;

  --code-string: #0f7a3a;
  --code-number: #0b6f8a;
  --tone-2: #0b8fb0;
  --tone-3: #6a46d6;
  --tone-4: #c92d86;
  --tone-5: #178f57;
}

/* The wordmark's default letter colour and the sim frame follow the ink. */
:root[data-theme="light"] .sim__canvas { background: #fbfbfd; }
:root[data-theme="light"] .code { background: var(--bg-elev); }
:root[data-theme="light"] .skip { color: #ffffff; }

/* --- 34. Disco -------------------------------------------------------------
   The dark set, with the lights on. The accent is not a colour but a hue that
   travels round the wheel (a registered custom property, so it animates);
   everything drawn in the accent — links, the current nav item, chips,
   the game's sling — goes with it. Behind the page: three coloured
   spotlights sweeping, and a scatter of mirror-ball glints drifting past.
   The wordmark letters take turns. Under reduced motion it is a still
   disco: the colours stay, nothing moves.
   ------------------------------------------------------------------------- */

@property --disco-h {
  syntax: "<number>";
  inherits: true;
  initial-value: 300;
}

:root[data-theme="disco"] {
  color-scheme: dark;
  --bg:          #0b0714;
  --bg-elev:     #140d22;
  --bg-sunk:     #07040d;
  --line:        rgba(230, 200, 255, 0.14);
  --line-soft:   rgba(230, 200, 255, 0.07);
  --line-strong: rgba(230, 200, 255, 0.34);
  --text:        #fbf7ff;
  --text-mid:    #d9cfe8;
  --text-dim:    #a99cbd;
  --accent:      hsl(var(--disco-h) 100% 66%);
  --accent-soft: hsl(var(--disco-h) 100% 66% / 0.14);
  --accent-line: hsl(var(--disco-h) 100% 66% / 0.5);
  --accent-ink:  #0b0714;
  --accent-hover: hsl(var(--disco-h) 100% 76%);
  --glass:       rgba(11, 7, 20, 0.88);
  --scrim-a:     rgba(11, 7, 20, 0.5);
  --scrim-b:     rgba(11, 7, 20, 0.88);
  --scrim-btn:   rgba(11, 7, 20, 0.6);
  --overlay:     rgba(7, 4, 13, 0.96);
  --overlay-soft: rgba(7, 4, 13, 0.8);
  --ink-halo:    rgba(11, 7, 20, 0.55);
  --tag-bg:      rgba(11, 7, 20, 0.7);
  --scrollbar:   #3a2856;
  --code-string: #7dffb0;
  --code-number: #5ee0ff;
  --tone-2: #5ee0ff;
  --tone-3: #b58bff;
  --tone-4: #ff7ad1;
  --tone-5: #ffe45e;
  /* Each step restyles the whole page (every element inherits the accent), so
     it moves in 84 steps over 7 s — 12 a second, which still reads as a
     continuous drift — instead of on every frame. */
  animation: disco-hue 7s steps(84) infinite;
}
@keyframes disco-hue { to { --disco-h: 660; } }

:root[data-theme="disco"] body { isolation: isolate; }

/* The spotlights and the glints are painted once and then only moved:
   transform animations run on the compositor, so the page is not repainted
   on every frame the way an animated background-position would be. */

/* the spotlights: a layer larger than the screen, sweeping slowly */
:root[data-theme="disco"] body::before {
  content: "";
  position: fixed;
  left: -30vmax; top: -30vmax;
  width: calc(100vw + 60vmax); height: calc(100vh + 60vmax);
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(closest-side, rgba(255, 60, 200, 0.22), transparent) 18% 22% / 60vmax 60vmax no-repeat,
    radial-gradient(closest-side, rgba(60, 200, 255, 0.2), transparent) 82% 38% / 55vmax 55vmax no-repeat,
    radial-gradient(closest-side, rgba(255, 220, 60, 0.16), transparent) 46% 84% / 50vmax 50vmax no-repeat;
  will-change: transform;
  animation: disco-spots 16s ease-in-out infinite alternate;
}
@keyframes disco-spots {
  0%   { transform: translate(0, 0) rotate(0deg); }
  33%  { transform: translate(-8vmax, 6vmax) rotate(8deg); }
  66%  { transform: translate(6vmax, -5vmax) rotate(-6deg); }
  100% { transform: translate(-4vmax, -7vmax) rotate(4deg); }
}

/* the mirror-ball glints: one tile, repeated, sliding by exactly one tile so
   the loop is seamless */
:root[data-theme="disco"] body::after {
  content: "";
  position: fixed;
  left: -240px; top: -240px;
  width: calc(100vw + 480px); height: calc(100vh + 480px);
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20px 30px,  rgba(255, 255, 255, 0.9) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 150px 90px, rgba(255, 180, 240, 0.8) 0 1px,   transparent 2px),
    radial-gradient(circle at 90px 190px, rgba(160, 230, 255, 0.8) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 210px 160px, rgba(255, 255, 255, 0.7) 0 1px,  transparent 2px);
  background-size: 240px 240px;
  opacity: 0.7;
  will-change: transform;
  animation: disco-glints 20s linear infinite;
}
@keyframes disco-glints {
  from { transform: translate(0, 0); }
  to   { transform: translate(240px, 240px); }
}

/* the wordmark takes turns */
:root[data-theme="disco"] .mark__letter { animation: disco-letter 1.6s linear infinite; }
:root[data-theme="disco"] .mark__letter.is-pop { animation: mark-pop 0.55s var(--ease-out), disco-letter 1.6s linear infinite; }
@keyframes disco-letter {
  0%   { color: #ff4fd8; }
  25%  { color: #ffe45e; }
  50%  { color: #5ee0ff; }
  75%  { color: #7dffb0; }
  100% { color: #ff4fd8; }
}
:root[data-theme="disco"] .mark__letter:nth-child(1) { animation-delay: -0.18s; }
:root[data-theme="disco"] .mark__letter:nth-child(2) { animation-delay: -0.36s; }
:root[data-theme="disco"] .mark__letter:nth-child(3) { animation-delay: -0.54s; }
:root[data-theme="disco"] .mark__letter:nth-child(4) { animation-delay: -0.72s; }
:root[data-theme="disco"] .mark__letter:nth-child(5) { animation-delay: -0.90s; }
:root[data-theme="disco"] .mark__letter:nth-child(6) { animation-delay: -1.08s; }
:root[data-theme="disco"] .mark__letter:nth-child(7) { animation-delay: -1.26s; }
:root[data-theme="disco"] .mark__letter:nth-child(8) { animation-delay: -1.44s; }
:root[data-theme="disco"] .mark__letter:nth-child(9) { animation-delay: -1.62s; }
:root[data-theme="disco"] .mark__letter:nth-child(10) { animation-delay: -1.80s; }
:root[data-theme="disco"] .mark__letter:nth-child(11) { animation-delay: -1.98s; }
:root[data-theme="disco"] .mark__letter:nth-child(12) { animation-delay: -2.16s; }

:root[data-theme="disco"] .sim__canvas,
:root[data-theme="disco"] .code { background: var(--bg-sunk); }
:root[data-theme="disco"] .skip { color: var(--accent-ink); }

/* The placeholder art is drawn for a light page. On a dark one it is inverted
   (hue kept, so the blue labels stay blue) rather than left glaring. Real
   photographs are not SVGs, so they are never touched; the one SVG that is
   real art is excluded by name. */
:root[data-theme="dark"] main img[src$=".svg"]:not([src*="cubois-escape/thumb"]),
:root[data-theme="disco"] main img[src$=".svg"]:not([src*="cubois-escape/thumb"]) {
  filter: invert(0.92) hue-rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  :root[data-theme="disco"],
  :root[data-theme="disco"] body::before,
  :root[data-theme="disco"] body::after,
  :root[data-theme="disco"] .mark__letter { animation: none; }
}

/* --- 35. The theme switch ----------------------------------------------------
   Three radio-like buttons in the top bar: Light, Dark, Disco. The choice
   lives in localStorage["swl-theme"]; light is the default.
   ------------------------------------------------------------------------- */

.theme {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-left: 0.9rem;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
}
.theme__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s var(--ease-out), background-color 0.15s var(--ease-out);
}
.theme__btn:hover { color: var(--text); }
.theme__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme__btn[aria-checked="true"] { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.theme__btn[data-theme-set="disco"][aria-checked="true"] { color: var(--accent); }
.theme__btn svg { width: 14px; height: 14px; display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 720px) {
  .theme { margin-left: auto; }
  .theme__btn { width: 34px; height: 30px; }
}

/* --- Rendering what is on screen --------------------------------------------
   Long pages have a lot below the fold: every entry on the home page, a
   project's gallery and pager. content-visibility lets the browser skip
   laying out and painting those until they come near the screen;
   contain-intrinsic-size gives each a stand-in height so the scrollbar does
   not jump, and `auto` makes it remember the real height once seen.
   ------------------------------------------------------------------------- */

.entry,
.gallery,
.pager,
.footer {
  content-visibility: auto;
  /* An entry is a 16:9 image the width of the column plus its text, so the
     stand-in follows the same sum; the estimate only has to be close. */
  --col: calc(min(100vw, var(--page-w)) - 2 * var(--gutter));
  contain-intrinsic-size: auto calc(var(--col) * 0.5625 + var(--entry-text, 430px));   /* padding is added on top */
}
/* two columns of 16:10 frames plus a caption line each; one column on narrow screens */
.gallery { contain-intrinsic-size: auto calc(var(--gal-rows, 3) * (var(--col) * 0.3125 + 58px)); }
@media (max-width: 800px) { .gallery { contain-intrinsic-size: auto calc(var(--gal-n, 6) * (var(--col) * 0.625 + 58px)); } }
.pager, .footer { contain-intrinsic-size: auto 170px; }
@media (max-width: 720px) { .entry { --entry-text: 640px; } }
@media print {
  .entry, .gallery, .pager, .footer { content-visibility: visible; }
}

/* --- Page to page ------------------------------------------------------------
   No cross-page fade: the browser's view transition made the header and text
   slide sideways and snap back on every Home / Bio / Contact click. Pages cut.
   ------------------------------------------------------------------------- */

/* --- 36. Print ---------------------------------------------------------------
   A project page printed is a one-page fact sheet: no navigation, no player,
   no game, hairlines instead of fills, and every link's destination spelled
   out so a printed page is still usable.
   ------------------------------------------------------------------------- */

@media print {
  :root, :root[data-theme] {
    --bg: #fff; --bg-elev: #fff; --bg-sunk: #fff;
    --text: #000; --text-mid: #222; --text-dim: #444;
    --line: #bbb; --line-soft: #ddd; --line-strong: #888;
    --accent: #0033aa; --accent-line: #0033aa; --accent-soft: transparent;
  }
  .top, .dock, .cats, .theme, .skip, .palette, .pager, .sim, .spin__range,
  .embed__poster, .work__more, .hero__play, [data-draft-only] { display: none !important; }
  body { background: #fff; }
  .main, .section, .hero { padding-block: 0.6cm; }
  .t-display, .hero__title { font-size: 24pt; }
  .t-h1 { font-size: 20pt; }
  .t-h2 { font-size: 13pt; }
  body, .t-lead { font-size: 10.5pt; line-height: 1.45; }
  a { text-decoration: underline; }
  .breakdown a[href^="http"]::after,
  .datasheet a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; word-break: break-all; }
  .phero__media, .gallery figure, .spin__stage { break-inside: avoid; border: 1px solid #bbb; }
  .section { break-inside: auto; }
  h1, h2, h3 { break-after: avoid; }
  img { max-height: 9cm; object-fit: contain; }
  .footer { border-top: 1px solid #bbb; font-size: 8.5pt; }
}

/* --- Track switch: the two sides of the portfolio ----------------------- */
.track { border-top: 1px solid var(--line); }
.track__inner {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
  max-width: var(--page-w); margin: 0 auto; padding: 0.7rem var(--gutter);
}
.track__btn {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 2.75rem; padding: 0.5rem 1rem;
  border: 1px solid var(--accent-line); border-radius: 999px;
  color: var(--accent); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  position: relative; z-index: 1;
  transition: background-color .15s, color .3s;
}
.track__btn:hover { background: var(--accent-soft); }
.track__btn[aria-current="true"] { color: var(--accent-ink); border-color: var(--accent); }
.track__btn[aria-current="true"]:hover { background: none; }
/* The filled pill that slides under the chosen side. */
.track__pill {
  position: absolute; z-index: 0;
  top: 0.7rem; bottom: 0.7rem; left: var(--gutter);
  width: calc((100% - 2 * var(--gutter) - 0.6rem) / 2);
  border-radius: 999px; background: var(--accent);
  transform: translateX(calc(var(--i, 0) * (100% + 0.6rem)));
  transition: transform .22s cubic-bezier(.65, 0, .35, 1);
}
/* Leaving: the page under the header dims and drops slightly. Arriving: it rises in. */
body.track-out .main, body.track-out .footer { opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
body.track-in .main { animation: track-in .4s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes track-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .track__pill, body.track-in .main { transition: none; animation: none; } }
@media (max-width: 560px) { .track__btn { font-size: 0.8rem; padding: 0.4rem 0.6rem; } }
/* The games side is magenta: its button, and the pill when it sits there. */
:root { --games: #c8178f; --games-soft: rgba(200, 23, 143, 0.10); --games-line: rgba(200, 23, 143, 0.45); }
:root[data-theme="dark"], :root[data-theme="disco"] { --games: #ff5cc8; --games-soft: rgba(255, 92, 200, 0.14); --games-line: rgba(255, 92, 200, 0.45); }
.track__btn--creative { color: var(--games); border-color: var(--games-line); }
.track__btn--creative:hover { background: var(--games-soft); }
.track__btn--creative[aria-current="true"] { border-color: var(--games); }
.track__inner[data-side="creative"] .track__pill { background: var(--games); }
.track__pill { transition: transform .22s cubic-bezier(.65, 0, .35, 1), background-color .22s; }
/* Hero copy written for one side only */
body[data-track="creative"] [data-track-only]:not([data-track-only="creative"]),
body[data-track="engineering"] [data-track-only]:not([data-track-only="engineering"]) { display: none; }

/* Contact page: the contact block on its own, with room to breathe. */
.contact-page { min-height: 60vh; padding-top: clamp(3rem, 8vw, 6rem); }

/* --- Cuboi's Escape: start-up card (built by cubois-escape.js) ----------- */
.sim__stage { position: relative; }
.cs-splash {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  background: #f8f6f2; border: 1px solid var(--line);
  cursor: pointer;
  transition: opacity .4s ease, transform .4s ease;
}
.cs-splash:not(.is-play) * { animation-play-state: paused !important; }
.cs-splash.is-out { opacity: 0; transform: scale(1.03); pointer-events: none; }
.cs-splash svg { width: 100%; height: 100%; display: block; }
.cs-splash__box {
  fill: none; stroke: #1b1b1b; stroke-width: 13; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 520; stroke-dashoffset: 520;
  animation: cs-draw .6s cubic-bezier(.6, 0, .3, 1) .1s forwards;
}
.cs-splash__cube { transform: translateY(-260px); animation: cs-drop .75s cubic-bezier(.5, 0, .75, 0) .55s forwards; }
.cs-splash__squash { transform-box: fill-box; transform-origin: 50% 100%; animation: cs-squash .5s ease-out 1.2s both; }
.cs-splash__face { opacity: 0; animation: cs-fade .25s ease 1.45s forwards; }
.cs-splash__title {
  font: 800 92px/1 "Schibsted Grotesk", system-ui, sans-serif; fill: #1b1b1b; letter-spacing: -1px;
  opacity: 0; transform: translateX(40px); animation: cs-slide .6s cubic-bezier(.2, .7, .2, 1) .9s forwards;
}
.cs-splash__sub { font: 700 34px/1 "Schibsted Grotesk", system-ui, sans-serif; fill: #1b1b1b; letter-spacing: 22px; }
.cs-splash__sub tspan { opacity: 0; animation: cs-fade .3s ease forwards; animation-delay: calc(1.25s + var(--d) * 70ms); }
.cs-splash__dots circle { fill: #f26c3d; opacity: 0; animation: cs-fade .2s ease 1.6s forwards, cs-pulse .9s ease-in-out 1.8s infinite; }
.cs-splash__dots circle:nth-child(2) { animation-delay: 1.65s, 1.95s; }
.cs-splash__dots circle:nth-child(3) { animation-delay: 1.7s, 2.1s; fill: #d9c4b4; }
@keyframes cs-draw { to { stroke-dashoffset: 0; } }
@keyframes cs-drop {
  0%   { transform: translateY(-260px); }
  60%  { transform: translateY(0); animation-timing-function: cubic-bezier(.2, .6, .4, 1); }
  78%  { transform: translateY(-34px); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
  100% { transform: translateY(0); }
}
@keyframes cs-squash { 0% { transform: scale(1.18, .8); } 45% { transform: scale(.94, 1.06); } 100% { transform: none; } }
@keyframes cs-slide { to { opacity: 1; transform: none; } }
@keyframes cs-fade { to { opacity: 1; } }
@keyframes cs-pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.cs-splash__dots circle { transform-box: fill-box; }

/* --- Cuboi's Escape: 16:9 game screen with an in-game HUD ---------------- */
.sim--page { display: block !important; max-width: 64rem !important; }
.sim__screen {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-sunk);
}
.sim__screen .sim__canvas { width: 100%; height: 100%; aspect-ratio: auto; border: 0; }
.sim__screen .cs-splash { border: 0; }
/* readout: a strip across the top */
.sim__screen .sim__readout {
  position: absolute; top: 0.6rem; left: 0.6rem; right: 0.6rem; z-index: 1;
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; border: 0;
  pointer-events: none;
}
.sim__screen .sim__readout > .sim__wallet { margin-left: auto; }
.sim__screen .sim__readout > span {
  padding: 0.25rem 0.6rem; border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line); font-size: 0.8rem; white-space: nowrap;
}
/* buttons: a row along the bottom */
.sim__screen .sim__controls {
  position: absolute; left: 0.6rem; right: 0.6rem; bottom: 0.6rem; z-index: 1;
  margin: 0; pointer-events: none;
}
.sim__screen .sim__controls > * { pointer-events: auto; }
.sim__screen .sim__btn { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(6px); }
.sim__btn--mute svg { display: block; }
.sim__btn--mute .sim__snd-off, .sim__btn--mute[aria-pressed="true"] .sim__snd-on { display: none; }
.sim__btn--mute[aria-pressed="true"] .sim__snd-off { display: inline; }
.sim__btn--shop { font-weight: 600; color: var(--accent); border-color: var(--accent-line); }
.sim.is-shop .sim__btn--shop { background: var(--accent); color: var(--accent-ink); }
/* shop: a panel that slides in from the right, inside the screen */
.sim__screen .shop {
  position: absolute; top: 0; right: 0; bottom: 3.3rem; z-index: 2;   /* stops above the button row, so Shop still closes it */
  width: min(22rem, 70%); margin: 0; padding: 0.9rem; border: 0;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px);
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(105%); transition: transform .25s cubic-bezier(.2, .7, .2, 1);
}
.sim.is-shop .sim__screen .shop { transform: none; }
@media (max-width: 620px) {
  .sim__screen { aspect-ratio: 4 / 3; }
  .sim__screen .sim__readout > span { font-size: 0.7rem; padding: 0.15rem 0.45rem; }
  .sim__screen .sim__btn kbd { display: none; }
  .sim__screen .shop { width: 100%; }
}

/* Gallery split into labelled groups (items with `group`). */
.gallery__group { margin-top: clamp(1.75rem, 4vw, 2.75rem); }
.gallery__group-name { padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.gallery--sub { margin-top: 1rem; content-visibility: visible; grid-template-columns: repeat(auto-fill, minmax(min(100%, 23rem), 1fr)); }  /* auto-fill: a lone image stays one column wide */
