/* ------------------------------------------------------------
   The two faces, served from this site rather than the Fontshare
   CDN. Both are under the ITF Free Font License, which allows it.
   Six files, 129KB in all, and nothing to ask a third party for
   before the first word can be drawn.

   swap, so the fallback shows immediately and is replaced when the
   real face arrives. Weight 600 appears once in this file and has no
   file of its own; it resolves to 700, as it did on the CDN.
   ------------------------------------------------------------ */

@font-face {
  font-family: "Melodrama";
  src: url("assets/fonts/melodrama-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Melodrama";
  src: url("assets/fonts/melodrama-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Melodrama";
  src: url("assets/fonts/melodrama-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Supreme";
  src: url("assets/fonts/supreme-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Supreme";
  src: url("assets/fonts/supreme-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Supreme";
  src: url("assets/fonts/supreme-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   Chika Zhang, portfolio

   Type: Instrument Serif for display moments (name, project
   titles, the contact line), Inter for everything that is read
   rather than looked at.
   ============================================================ */

:root {
  /* Melodrama carries the display moments; Supreme, a neutral grotesque,
     carries everything that is read rather than looked at.
     Both from Fontshare. Melodrama is a high-contrast display serif with
     a proper lowercase, so display moments run at 700 with tracking pulled
     slightly negative. */
  --font-display: "Melodrama", "Iowan Old Style", Georgia, serif;
  --font-sans: "Supreme", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Helvetica Neue", Arial, sans-serif;

  --bg:        #1a1a1a;
  --bg-raise:  #202020;
  --panel:     #262626;
  --panel-2:   #2e2e2e;

  --text:      #ededed;
  --text-2:    #a4a4a4;
  --text-3:    #6e6e6e;
  --text-4:    #525252;

  /* the royal blue from the portrait, rgb(20 80 245). The flat colour is
     too dark to read as text on this background, so the text steps are
     lightened from it and the fills keep the original hue. */
  --accent:        #1450f5;
  --accent-text:   #e6ecff;
  --accent-bright: #ffffff;
  --accent-line:   rgba(20, 80, 245, .62);
  --accent-fill:   rgba(20, 80, 245, .24);
  --accent-solid:  #2250d8;

  /* the role tag is the one that is about you rather than the game, so it
     inverts instead of taking a second hue. The palette stays grey, blue
     and white. */
  --invert-bg:     #ededed;
  --invert-ink:    #161616;

  /* warm, and used once: the tag that says she led the thing. Sitting
     opposite the blue keeps it from reading as a louder brief chip. */
  --lead-bg:       #d9a441;
  --lead-ink:      #1b1408;

  --line:      #343434;
  --line-soft: #2a2a2a;
  --line-hair: #242424;

  --maxw:      1180px;
  --gutter:    40px;
  --radius:    10px;
  --nav-h:     68px;

  --ease:      cubic-bezier(.4, 0, .2, 1);
  --ease-out:  cubic-bezier(.16, 1, .3, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Only the home page is built as boards. main.js adds this class there.
   "proximity" settles onto the nearest board when scrolling stops, but never
   traps you mid-section the way "mandatory" would. */
html.snap { scroll-snap-type: y proximity; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* film grain, so the flat dark does not read as dead space */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }

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

::selection { background: #41413c; color: #fff; }

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

/* ---------- layout primitives ---------- */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  /* .hero, .section and .footer are flex columns, so .wrap is a flex item;
     without this it refuses to shrink below its content and anything that
     scrolls inside it widens the page instead */
  min-width: 0;
}

/* each board fills a screen and carries a hairline at its top edge, so the
   four of them read as separate places rather than one long scroll */
.section {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: 76px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-margin-top: var(--nav-h);
  scroll-snap-align: start;
}

.section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(to right,
    transparent, var(--line-soft) 14%, var(--line-soft) 86%, transparent);
}

/* small tracked label, used all over */
.label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin: 0 0 44px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

/* the numeral stays a quiet marker so the title itself carries the weight */
.section-num {
  align-self: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
  letter-spacing: .14em;
}

/* a real heading rather than a tracked label: this is the title of a
   whole board, so it is set like one */
.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.1vw, 40px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
}

.section-note {
  margin: 0 0 0 auto;
  align-self: center;
  white-space: nowrap;
  text-align: right;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-3);
}

/* ---------- nav ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(26, 26, 26, 0.6);
  backdrop-filter: saturate(170%) blur(16px);
  -webkit-backdrop-filter: saturate(170%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: background .3s var(--ease), border-color .3s var(--ease);
}

.nav.is-scrolled {
  background: rgba(22, 22, 22, 0.86);
  border-bottom-color: var(--line-hair);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo {
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  transition: opacity .25s var(--ease);
}
.nav-logo:hover { opacity: .62; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 13.5px;
  color: var(--text-3);
}

.nav-links a {
  position: relative;
  padding: 4px 0;
  transition: color .25s var(--ease);
}

/* Three ways to read the same page, set off from the pages themselves
   by a hairline. The one you are on is lit and not a target. */
.nav-langs {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: 6px;
  padding-left: 26px;
  border-left: 1px solid var(--line);
  font-size: 12.5px;
}

.nav-langs a { color: var(--text-4); }
.nav-langs a:hover { color: var(--text-2); }
.nav-langs a::after { display: none; }

.nav-langs a[aria-current] {
  color: var(--text);
  cursor: default;
  pointer-events: none;
}

.nav-langs .lang-short { display: none; }

/* Once the bar is tight the three go down to one character each. Both
   labels are in the markup; the hidden one is display:none, so a screen
   reader still reads a single word. */
@media (max-width: 760px) {
  .nav-langs { gap: 11px; padding-left: 16px; margin-left: 2px; }
  .nav-langs .lang-full { display: none; }
  .nav-langs .lang-short { display: inline; }
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease-out);
}
.nav-links a:hover { color: var(--text-2); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-links a.is-active { color: var(--text); }
.nav-links a.is-active::after { transform: scaleX(1); background: var(--text-4); }

/* --- Projects dropdown --- */

.nav-item { position: relative; display: inline-flex; }

.nav-caret {
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 8px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: .55;
  transition: transform .3s var(--ease-out), opacity .2s var(--ease);
}
.nav-item.is-open .nav-caret { transform: translateY(1px) rotate(225deg); opacity: 1; }

.nav-menu {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  z-index: 10;
  min-width: 272px;
  padding: 8px;
  /* nearly opaque, because it has to stay readable over bright project imagery */
  background: rgba(34, 34, 34, 0.975);
  backdrop-filter: saturate(170%) blur(18px);
  -webkit-backdrop-filter: saturate(170%) blur(18px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 28px 64px -30px rgba(0, 0, 0, .95);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity .22s var(--ease),
              transform .3s var(--ease-out),
              visibility .22s var(--ease);
}

/* bridges the gap between the trigger and the panel so the pointer
   can travel across it without the menu closing */
.nav-menu::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -22px;
  height: 22px;
}

.nav-item.is-open .nav-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-menu-label {
  margin: 12px 12px 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-4);
}
.nav-menu-label:first-child { margin-top: 6px; }

.nav-links .nav-menu-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 12px;
  border-radius: 6px;
  transition: background .2s var(--ease);
}
.nav-links .nav-menu-item::after { display: none; }
.nav-links .nav-menu-item:hover { background: rgba(255, 255, 255, 0.055); }

.nav-menu-name {
  font-size: 14px;
  color: var(--text-2);
  transition: color .2s var(--ease);
}
.nav-menu-item:hover .nav-menu-name { color: var(--text); }

.nav-menu-year {
  flex: none;
  font-size: 11px;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}

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

/* ---------- board indicator (home page) ---------- */

.chapters {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.chapter-dot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  height: 14px;
  padding: 0;
  cursor: pointer;
  background: none;
  border: 0;
  font: inherit;
  color: var(--text-4);
}

.chapter-tick {
  display: block;
  width: 16px;
  height: 1px;
  background: var(--text-4);
  opacity: .5;
  transition: width .35s var(--ease-out), opacity .25s var(--ease),
              background-color .25s var(--ease);
}

.chapter-dot:hover .chapter-tick { opacity: 1; width: 24px; }

.chapter-dot.is-current .chapter-tick {
  width: 30px;
  opacity: 1;
  background: var(--text);
}

.chapter-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity .25s var(--ease), transform .3s var(--ease-out);
}

.chapters:hover .chapter-label,
.chapter-dot:focus-visible .chapter-label { opacity: 1; transform: none; }
.chapter-dot.is-current .chapter-label { color: var(--text-2); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: calc(100vh - var(--nav-h));
  min-height: min(840px, calc(100svh - var(--nav-h)));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 96px 0 108px;
  overflow: hidden;
  scroll-margin-top: var(--nav-h);
  scroll-snap-align: start;
}

/* soft wash so the top of the page has some light in it. It drifts slowly
   so the background is never completely still */
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 140%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(52% 48% at 18% 34%, rgba(255, 255, 255, .062), transparent 70%),
    radial-gradient(42% 42% at 86% 14%, rgba(255, 255, 255, .034), transparent 70%),
    radial-gradient(48% 40% at 62% 86%, rgba(255, 255, 255, .026), transparent 72%);
  animation: wash 34s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes wash {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  45%  { transform: translate3d(2.4%, -2%, 0) scale(1.08); }
  100% { transform: translate3d(-2%, 1.6%, 0) scale(1.04); }
}

/* the frosted layer: finer, denser grain than the page-wide one, sitting on
   top of the wash so the gradient reads as matte rather than as a smooth
   digital ramp */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  /* coarse grain: a low baseFrequency makes the speckle itself bigger, which
     is a different thing from scaling a fine noise up (that only blurs it) */
  opacity: .075;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.42' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: center;
}

/* the role line is sized from this column, so it keeps fitting on one line
   whatever the gap and the portrait end up being */
.hero-text { container-type: inline-size; }

.hero-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.2;
  letter-spacing: .01em;
  color: var(--text-2);
}

/* the role line is the headline, and it has to hold one line next to the
   portrait, hence the viewport-driven size rather than a fixed one */
.hero-role {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  /* sized from the width left over beside the portrait, not from taste.
     The vw version is the fallback where container units are unavailable. */
  font-size: clamp(26px, 4.4vw, 62px);
  font-size: min(9.6cqw, 72px);
  line-height: 1.08;
  letter-spacing: -0.018em;
  color: var(--text);
  white-space: nowrap;
}

.hero-place {
  margin: 24px 0 0;
  font-size: 14px;
  color: var(--text-2);
  letter-spacing: .01em;
}
.hero-place .pin { margin-right: 7px; font-size: 13px; }

.hero-pitch { margin-top: 30px; }

.hero-pitch-label {
  margin: 0;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
}

.hero-pitch-list {
  margin: 9px 0 0;
  font-size: clamp(14px, 1.4vw, 16.5px);
  line-height: 1.6;
  color: var(--text-2);
  white-space: nowrap;
}

/* ---- portrait ---- */

.hero-portrait {
  width: clamp(196px, 26vw, 330px);
  /* held off the right edge of the content column */
  margin-right: clamp(0px, 2.6vw, 44px);
}

/* a <button>, so the UA styling goes and the easter egg is reachable by
   keyboard as well as pointer */
.hero-portrait-tilt {
  display: block;
  width: 100%;
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 36px 70px -34px rgba(0, 0, 0, .95);
  transform: rotate(4deg);
  transition: transform .6s var(--ease-out);
}
.hero-portrait-tilt img { width: 100%; height: auto; }

.hero-portrait:hover .hero-portrait-tilt { transform: rotate(1.2deg) scale(1.03); }

/* ---- the speech bubble ---- */

.hero-bubble {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  margin: 0;
  max-width: 250px;
  width: max-content;
  padding: 13px 17px;
  background: #f7f4ec;
  color: #1c1c1c;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.005em;
  border-radius: 16px;
  box-shadow: 0 18px 34px -16px rgba(0, 0, 0, .7);
  pointer-events: none;

  /* translate and scale as separate properties so the entrance can animate
     the scale without fighting the offset */
  translate: -56% -62%;
  scale: .8;
  opacity: 0;
  visibility: hidden;
  transition: opacity .16s var(--ease), scale .22s var(--ease),
              visibility .16s var(--ease);
}

/* the tail */
.hero-bubble::after {
  content: "";
  position: absolute;
  right: 30px;
  bottom: -6px;
  width: 16px;
  height: 16px;
  background: inherit;
  border-radius: 0 0 4px 0;
  transform: rotate(45deg);
}

.hero-bubble.is-on {
  opacity: 1;
  visibility: visible;
  scale: 1;
  transition: opacity .14s var(--ease),
              scale .42s cubic-bezier(.22, 1.4, .36, 1),
              visibility .14s var(--ease);
}

@keyframes portraitFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 26px;
  margin-top: 38px;
  font-size: 13px;
}

.hero-links a {
  position: relative;
  color: var(--text-2);
  padding-bottom: 3px;
  transition: color .25s var(--ease);
}
.hero-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--text-4);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease-out);
}
.hero-links a:hover { color: var(--text); }
.hero-links a:hover::after { transform: scaleX(1); }

/* bottom rail of the hero */
.hero-foot {
  position: absolute;
  left: 0; right: 0; bottom: 40px;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
  transition: color .25s var(--ease);
}
.scroll-cue:hover { color: var(--text-2); }
.scroll-cue .cue-arrow {
  display: inline-block;
  animation: cue 2.4s var(--ease) infinite;
}

@keyframes cue {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50%      { transform: translateY(4px); opacity: 1; }
}

/* page headers on the inner pages: same family, smaller */
.page-head {
  padding: 92px 0 0;
  position: relative;
}

.page-head .hero-name { font-size: clamp(46px, 8vw, 96px); }

/* ---------- project module (list + preview) ---------- */

/* the list is deliberately the minor column. The image carries the module */
.module {
  display: grid;
  grid-template-columns: minmax(0, 0.62fr) minmax(0, 1.68fr);
  gap: 52px;
  align-items: start;
}

/* --- left: list --- */

.plist {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-hair);
}

/* a narrow column, so the name takes the full width and the year drops to a
   meta line beneath it rather than being squeezed in beside it */
.pitem {
  display: grid;
  grid-template-columns: 26px auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0 10px;
  position: relative;
  width: 100%;
  padding: 22px 10px 22px 12px;
  /* it is a <button>, so the UA styling has to go */
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-hair);
  border-radius: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .3s var(--ease), padding-left .3s var(--ease-out);
}

/* the indicator rail */
.pitem::before {
  content: "";
  position: absolute;
  left: 0; top: -1px; bottom: -1px;
  width: 2px;
  background: var(--text-2);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .35s var(--ease-out);
}

.pitem:hover,
.pitem.is-active {
  background: rgba(255, 255, 255, 0.028);
  padding-left: 20px;
}
.pitem:hover::before,
.pitem.is-active::before { transform: scaleY(1); }

/* on desktop the wrapper dissolves so index / name / year sit on the
   .pitem grid directly; on narrow screens it becomes a flex row */
.pitem-top { display: contents; }

.pitem-index {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  transition: color .3s var(--ease);
}
.pitem:hover .pitem-index,
.pitem.is-active .pitem-index { color: var(--text-3); }

.pitem-name {
  grid-column: 2 / 4;
  grid-row: 1;
  font-size: 18.5px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.018em;
  color: var(--text-2);
  transition: color .3s var(--ease);
}
.pitem:hover .pitem-name,
.pitem.is-active .pitem-name { color: var(--text); }

.pitem-year {
  grid-column: 2;
  grid-row: 2;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: .02em;
}

.pitem-sub {
  grid-column: 2 / 4;
  grid-row: 3;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-4);
  transition: color .3s var(--ease);
}
.pitem:hover .pitem-sub,
.pitem.is-active .pitem-sub { color: var(--text-3); }

/* thumbnail inside the list, only shown on narrow screens */
.pitem-thumb { display: none; }

/* optional tail link under a list, so the column does not just stop */
.plist-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-top: 26px;
  padding-left: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
  transition: color .25s var(--ease), gap .25s var(--ease-out);
}
.plist-more:hover { color: var(--text-2); gap: 14px; }

/* --- right: preview panel --- */

.ppreview {
  position: sticky;
  top: calc(var(--nav-h) + 40px);
}

.ppreview-frame {
  position: relative;
  display: block;
  /* 16:9, which is what everything on the site is cut for. A project whose
     media is some other shape declares it and main.js sets this from the
     data, rather than letting object-fit take its edges off. */
  aspect-ratio: var(--preview-ratio, 16 / 9);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px -32px rgba(0, 0, 0, .9),
              inset 0 1px 0 rgba(255, 255, 255, .035);
}

.ppreview-frame img,
.ppreview-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .3s var(--ease), transform .7s var(--ease-out);
}

.ppreview-frame.is-swapping img,
.ppreview-frame.is-swapping video { opacity: 0; transform: scale(1.025); }

/* the video sits over the still, which acts as its poster. It is invisible
   until it can play, so switching projects never shows an empty frame. */
.ppreview-frame video {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.ppreview-frame video.is-ready { opacity: 1; }
.ppreview-frame.is-swapping video.is-ready { opacity: 0; }

/* The still is the clip's fallback, not a beat in the transition. On a
   fast connection it was appearing for a frame or two and being covered
   again, which reads as a flicker, so it waits. It has no transition of
   its own here: when it is let up the clip is already fading over it, and
   two things fading in together would dip through the panel underneath. */
.ppreview-frame.is-waiting img { opacity: 0; transition: none; }

.ppreview-body {
  padding: 20px 2px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.ppreview-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.015em;
}

.ppreview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.ppreview-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px 6px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--accent-text);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
}

/* a studio's own mark, where it has one. Sized off the tag's own text so
   it tracks the type rather than a fixed pixel value */
.ppreview-tag-mark {
  height: 1.25em;
  width: auto;
  margin: 0 6px 0 -2px;
}

/* the date leads, so it is solid rather than tinted */
.ppreview-tag:first-child {
  color: var(--accent-bright);
  background: var(--accent-solid);
  border-color: transparent;
}

/* what you did, on its own line. A tag as well, but the one that is
   about you rather than about the game */
.ppreview-role {
  display: inline-flex;
  /* a grid item stretches by default; this keeps the pill at its text width */
  justify-self: start;
  margin: 10px 0 0;
  padding: 5px 12px 6px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--invert-ink);
  background: var(--invert-bg);
  border: 1px solid transparent;
  border-radius: 999px;
}
.ppreview-role:empty { display: none; }

.ppreview-desc {
  margin: 9px 0 0;
  max-width: 54ch;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-2);
}

.ppreview-cta {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 22px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  transition: color .25s var(--ease), gap .25s var(--ease-out);
}
.ppreview-cta { margin-top: 18px; }
.ppreview-cta:hover { color: var(--text); gap: 15px; }

/* ---------- detail pages ---------- */

.detail { padding: 48px 0 140px; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
  transition: color .25s var(--ease), gap .25s var(--ease-out);
}
.back:hover { color: var(--text-2); gap: 14px; }

.detail-head { margin: 48px 0 52px; }

.detail-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 6.8vw, 88px);
  line-height: 1.04;
  letter-spacing: -0.022em;
}

.detail-tagline {
  margin: 22px 0 0;
  font-size: clamp(17px, 2vw, 21px);
  color: var(--text-2);
  max-width: 46ch;
  letter-spacing: -0.012em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--line-soft);
}

.meta-item { min-width: 110px; }

/* forces the next item onto a new line, for a header that wants a field
   kept clear of whatever is behind it */
.meta-break { flex-basis: 100%; height: 0; }

.meta-label {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-4);
}

.meta-value {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  color: var(--text);
}

/* a studio's own lockup in place of its name. Tall enough that the wordmark
   is read rather than guessed, which the 13px version in the home panel's
   tag could not manage */
.meta-logo {
  display: block;
  height: 30px;
  width: auto;
  margin-top: -3px;
}

.hero-media {
  margin: 0 0 64px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 32px 80px -40px rgba(0, 0, 0, .9);
}
.hero-media img,
.hero-media video { display: block; width: 100%; height: auto; }

/* an embedded player has no intrinsic size of its own to give the box */
.hero-media iframe {
  display: block;
  width: 100%;
  aspect-ratio: var(--embed-ratio, 16 / 9);
  border: 0;
}

/* The key art behind the page header. It carries its own title, so it is
   covered to 47% of its width, which is where its printed title ends, so
   the heading on top of it is the only one you read. What shows is the
   right-hand side: the speech bubble and the creature. */
.detail-head-art {
  position: relative;
  margin: 48px calc(var(--gutter) * -1) 52px;
  padding: 56px var(--gutter) 44px;
  border-radius: var(--radius);
  overflow: hidden;
  background-image: var(--head-art);
  /* Fills the header, pinned right, the way it always did. What is fixed
     now is the slice: the file is cut to the bubble and the head, so the
     framing no longer drifts with the shape of the box. Its left edge
     fades out inside the file; the top and the foot are the container's
     own clipped edges. */
  background-size: auto 100%;
  background-position: right center;
  background-repeat: no-repeat;
}

.detail-head-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(26, 26, 26, .60) 40%, rgba(26, 26, 26, .10) 74%, rgba(26, 26, 26, 0) 100%),
    linear-gradient(0deg, var(--bg) 0%, rgba(26, 26, 26, .74) 24%, rgba(26, 26, 26, .28) 52%, rgba(26, 26, 26, 0) 80%);
}

.detail-head-art > * { position: relative; }

/* the rule reads as a divider on a plain page and as a scratch across a
   picture, so the header that has one does without it */
.detail-head-art .meta { border-top: 0; padding-top: 0; }

/* a subtitle rather than a sentence: no full stop, tracked out, and close
   enough to the title to belong to it */
.detail-subtitle {
  margin-top: 16px;
  font-size: clamp(19px, 2.4vw, 27px);
  font-weight: 400;
  letter-spacing: 0.07em;
  color: var(--text-2);
}

/* No picture on a phone. The header is taller than it is wide there and
   the text runs the full width, so the art can only sit underneath it as a
   smudge: it costs contrast and shows nothing. The header goes back to the
   plain one, rule included, and the file is never fetched. */
@media (max-width: 760px) {
  .detail-head-art {
    margin: 48px 0 52px;
    padding: 0;
    border-radius: 0;
    background-image: none;
  }
  .detail-head-art::before { content: none; }
  .detail-head-art .meta {
    border-top: 1px solid var(--line-soft);
    padding-top: 26px;
  }
}

.prose { max-width: 66ch; }

.prose h2 {
  margin: 64px 0 18px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
}
.prose h2:first-child { margin-top: 0; }

.prose p { margin: 0 0 20px; color: var(--text-2); line-height: 1.75; }

.prose p.lead {
  color: var(--text);
  font-size: clamp(19px, 2.2vw, 23px);
  line-height: 1.5;
  letter-spacing: -0.012em;
  margin-bottom: 26px;
}

.prose ul { margin: 0 0 20px; padding-left: 0; list-style: none; color: var(--text-2); }
.prose li {
  position: relative;
  margin-bottom: 11px;
  padding-left: 22px;
  line-height: 1.7;
}
.prose li::before {
  content: "";
  position: absolute;
  left: 2px; top: .72em;
  width: 9px; height: 1px;
  background: var(--text-4);
}

/* An entry is a record rather than an essay: what the project was, the
   seat and the months, then what was built. The Shengqu page is a list of
   them, in the wording the old site used. */
/* The old site ran the clip beside the entry rather than across the page,
   and the whole row scaled with the window: at 1280, 1600 and 1920 the
   proportions came out the same every time, 50.4% text, 10.1% gap, 39.5%
   clip. Those are the numbers below. The two columns leave the gap over
   and space-between hands it back, so the row holds its shape at any
   width this page allows. */
.entry {
  display: grid;
  grid-template-columns: 50.4% 39.5%;
  justify-content: space-between;
  align-items: start;
  margin-top: 72px;
}

.record > .entry:first-child { margin-top: 0; }

.entry-clip {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.entry-clip img,
.entry-clip video { display: block; width: 100%; height: auto; }

.entry-kind {
  margin: 0 0 9px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-4);
}

.prose .entry-name {
  margin: 0 0 9px;
  font-size: clamp(19px, 2.1vw, 22px);
  font-weight: 400;
  letter-spacing: -0.012em;
  text-transform: none;
  color: var(--text);
}

.entry-seat {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 22px;
  font-size: 13.5px;
  color: var(--text-3);
}

.entry-seat .when {
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}

/* Once the window is too narrow to sit two things side by side, the clip
   drops under its entry and takes the whole measure. The old site shrank
   it to 58.7% and centred it there, which is the one thing from that page
   not worth copying: a phone has less room, not more, so the clip wants
   all of it. */
@media (max-width: 860px) {
  .entry { grid-template-columns: 1fr; row-gap: 26px; margin-top: 56px; }
  .entry-clip { width: 100%; }
}

.prose strong { color: var(--text); font-weight: 500; }
.prose em { font-style: italic; }

.prose a:not(.btn) {
  color: var(--text);
  border-bottom: 1px solid var(--line);
  transition: border-color .25s var(--ease);
}
.prose a:not(.btn):hover { border-bottom-color: var(--text-3); }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 15px 32px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--invert-ink);
  background: var(--invert-bg);
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background .25s var(--ease), transform .25s var(--ease-out);
}
.btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

/* the way into a project belongs under the whole column, not tucked against
   the left edge of a 66ch paragraph */
.btn-row.is-centred {
  justify-content: center;
  margin-top: 44px;
}

/* ---------- gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  /* pieces of different heights sit on their own rather than stretching to
     the tallest in the row and showing panel underneath */
  align-items: start;
  gap: 22px;
  margin-top: 32px;
}

.gallery figure {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.gallery img,
.gallery video { display: block; width: 100%; height: auto; }

.gallery.is-wide { grid-template-columns: 1fr; gap: 28px; }

/* Pinterest-style: columns rather than rows, so every piece keeps its own
   height and nothing is padded out to match a neighbour. break-inside stops
   a figure being split down the middle of a column. */
.masonry {
  columns: 3;
  column-gap: 22px;
  margin-top: 32px;
}

.masonry figure {
  break-inside: avoid;
  margin: 0 0 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.masonry img,
.masonry video { display: block; width: 100%; height: auto; }

@media (max-width: 860px) { .masonry { columns: 2; } }
@media (max-width: 560px) { .masonry { columns: 1; } }

/* Every piece on the wall opens full size. main.js wraps the picture in
   this button, so without script the wall is still a wall, just not one
   that opens. */
.tile {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: zoom-in;
}

.tile > img,
.tile > video { display: block; width: 100%; height: auto; }

.masonry figure {
  transition: border-color .25s var(--ease), transform .35s var(--ease-out);
}

.masonry figure:hover { border-color: var(--line); transform: translateY(-2px); }

/* the ring goes on the figure: the button is inside an overflow:hidden
   box, which would clip an outline of its own */
.tile:focus-visible { outline: none; }
.masonry figure:has(.tile:focus-visible) {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-fill);
}

/* ---------- the piece, full size ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 64px 76px;
  background: rgba(12, 12, 12, .94);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .22s var(--ease);
}

.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox:focus { outline: none; }

.lightbox-stage {
  margin: 0;
  display: flex;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  transform: scale(.985);
  transition: transform .28s var(--ease-out);
}

.lightbox.is-open .lightbox-stage { transform: none; }

/* the picture is sized against the window rather than the flex box, so a
   tall one and a wide one both land inside it without the stage having to
   be measured first */
.lightbox-stage img,
.lightbox-stage video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(1180px, calc(100vw - 152px));
  max-height: calc(100svh - 168px);
}

.lightbox-ctl {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(26, 26, 26, .72);
  color: var(--text-2);
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease),
              background .2s var(--ease);
}

.lightbox-ctl:hover {
  color: var(--text);
  border-color: var(--text-3);
  background: var(--panel);
}

.lightbox-ctl:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.lightbox-close { top: 22px; right: 26px; }
.lightbox-prev { left: 22px; top: 50%; margin-top: -22px; }
.lightbox-next { right: 22px; top: 50%; margin-top: -22px; }

.lightbox-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100vw - 152px));
  font-size: 12.5px;
  color: var(--text-3);
}

.lightbox-foot p { margin: 0; }
.lightbox-foot .count {
  margin-left: auto;
  color: var(--text-4);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* the page behind does not scroll while this is open, and the gap the
   scrollbar leaves is paid back in main.js so nothing jumps sideways */
body.is-locked { overflow: hidden; }

@media (max-width: 640px) {
  .lightbox { padding: 68px 16px 82px; gap: 12px; }
  .lightbox-stage img,
  .lightbox-stage video {
    max-width: calc(100vw - 32px);
    max-height: calc(100svh - 190px);
  }
  .lightbox-foot { width: calc(100vw - 32px); }
  .lightbox-close { top: 14px; right: 14px; }
  .lightbox-prev { left: 50%; top: auto; bottom: 20px; margin: 0 0 0 -54px; }
  .lightbox-next { right: 50%; top: auto; bottom: 20px; margin: 0 -54px 0 0; }
}

/* two players side by side. They stack again once a column is too narrow
   for anyone to make out what is playing in it */
.media-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin: 0 0 64px;
}

.media-pair .hero-media { margin: 0; }
.media-label { margin: 0 0 12px; }

@media (max-width: 860px) {
  .media-pair { grid-template-columns: 1fr; gap: 34px; }
}

/* ---------- card grid (NYU prototypes) ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 26px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-hair);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raise);
  transition: border-color .3s var(--ease), transform .35s var(--ease-out),
              background .3s var(--ease), box-shadow .35s var(--ease);
}
.card:hover {
  border-color: #3d3d3d;
  background: var(--panel);
  transform: translateY(-3px);
  box-shadow: 0 20px 44px -28px rgba(0, 0, 0, .95);
}

.card-media {
  aspect-ratio: 63 / 50;
  background: var(--panel);
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .55s var(--ease-out);
}
.card:hover .card-media img { transform: scale(1.04); }

.card-body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* the studio prompt each game answered. A rounded rect rather than a pill
   because some of the prompts run to two lines */
.card-prompt {
  align-self: flex-start;
  margin: 0 0 10px;
  padding: 4px 9px 5px;
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent-solid);
  border-radius: 5px;
}
.card-prompt b { color: #fff; font-weight: 600; }

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.014em;
}

.card-desc {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}

/* What you did on it, split the way the home panel splits it: the part
   that is about you inverts, the part that is about the project keeps the
   outline. Most of the games on the Other Projects page were made with
   other people, so this carries as much as the pitch above it. */
.card-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.card-roles li {
  padding: 4px 10px 5px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--invert-ink);
  background: var(--invert-bg);
  border: 1px solid transparent;
  border-radius: 999px;
}

/* the one that leads. Not the blue the brief chip above it already uses */
.card-roles li.is-lead {
  color: var(--lead-ink);
  background: var(--lead-bg);
}

/* who else was on it, which is about the project rather than about you */
.card-roles li.is-credit {
  color: var(--accent-text);
  background: none;
  border-color: var(--accent-line);
}

.card-tag {
  display: inline-block;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-hair);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
  transition: color .25s var(--ease);
}
.card:hover .card-tag { color: var(--text-2); }

/* ---------- about page ---------- */

/* ---------- footer ---------- */

/* A rule and a line. It used to be a whole board on the home page, set
   aside for an address that the hero already carries four lines further
   up, so it snapped like a section and read like an announcement. */
.footer {
  margin-top: 88px;
  padding: 26px 0 32px;
  border-top: 1px solid var(--line-hair);
  font-size: 12px;
  color: var(--text-4);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  align-items: baseline;
  justify-content: space-between;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 26px; }
.footer-links a { transition: color .25s var(--ease); }
.footer-links a:hover { color: var(--text-2); }

/* ---------- reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .75s var(--ease-out), transform .75s var(--ease-out);
}
.reveal.is-in { opacity: 1; transform: none; }

/* hero sets its own entrance, no scroll needed */
.hero-text > * {
  opacity: 0;
  transform: translateY(14px);
  animation: rise .9s var(--ease-out) forwards;
}
.hero-text > *:nth-child(1) { animation-delay: .05s; }
.hero-text > *:nth-child(2) { animation-delay: .13s; }
.hero-text > *:nth-child(3) { animation-delay: .21s; }
.hero-text > *:nth-child(4) { animation-delay: .29s; }
.hero-text > *:nth-child(5) { animation-delay: .37s; }

/* fades in, then picks up the idle float, kept on separate properties so
   the two animations do not fight over transform */
.hero-portrait {
  opacity: 0;
  animation: fade .9s var(--ease-out) .24s forwards,
             portraitFloat 11s ease-in-out 1.4s infinite;
}

.hero-foot {
  opacity: 0;
  animation: rise 1s var(--ease-out) .5s forwards;
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

@keyframes fade {
  to { opacity: 1; }
}

/* ---------- responsive ---------- */

/* The frame holds one shape at every window size. Sizing its height from
   the viewport used to leave the ratio drifting with the window: 2.08 on a
   short laptop, 1.54 on a tall monitor, so object-fit cropped the same clip
   differently on every screen. The height still has to come from somewhere
   on the boards, where a module should stay within one screen: it comes from
   the column's width instead, and on a short window the whole preview column
   narrows so the picture and the text under it still arrive together. */
@media (min-width: 861px) {
  .ppreview { width: min(100%, calc(46svh * 1.778)); }
}

@media (max-width: 1040px) {
  :root { --gutter: 32px; }
  .module { grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.5fr); gap: 40px; }
  /* no room for it beside the content column */
  .chapters { display: none; }
}

@media (max-width: 860px) {
  :root { --gutter: 22px; --nav-h: 60px; }

  .section { padding: 80px 0; }

  .hero { min-height: auto; padding: 64px 0 48px; }
  .hero-foot { display: none; }

  .section-note { white-space: normal; max-width: 22ch; }

  .hero-inner { grid-template-columns: 1fr; gap: 30px; }
  .hero-portrait { order: -1; width: min(62vw, 300px); margin: 0 auto; }

  /* the portrait is centred here, so the bubble centres over it instead of
     hanging off the left, where it ran off the screen */
  .hero-bubble {
    left: 50%;
    max-width: min(70vw, 230px);
    translate: -50% -58%;
    font-size: 13.5px;
  }
  .hero-pitch-list { white-space: normal; }
  .hero-pitch { margin-top: 24px; }
  .page-head { padding: 64px 0 0; }

  /* narrow screens: the preview goes full-bleed and the list becomes a
     horizontal strip of thumbnails above it */
  /* the grid rule leaves align-items at start; as a flex column that sizes
     children to their content, which let the strip outgrow the page */
  .module {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .plist {
    order: 1;
    flex-direction: row;
    gap: 10px;

    /* a flex item will not shrink below its content without this, so the
       strip was widening the whole page instead of scrolling */
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    border-top: 0;
    scrollbar-width: none;

    /* runs to the screen edges, so a half-visible card reads as "there is
       more over there" rather than as something clipped by a box */
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 2px;
    scroll-padding: 0 var(--gutter);
  }
  .plist::-webkit-scrollbar { display: none; }

  /* main.js adds these while there is actually something to scroll to, so
     the fade never eats the first or last card at either end */
  .plist.has-right {
    mask-image: linear-gradient(to right, #000 calc(100% - 54px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 54px), transparent);
  }
  .plist.has-left {
    mask-image: linear-gradient(to left, #000 calc(100% - 54px), transparent);
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 54px), transparent);
  }
  .plist.has-left.has-right {
    mask-image: linear-gradient(to right, transparent, #000 54px,
                                #000 calc(100% - 54px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 54px,
                                        #000 calc(100% - 54px), transparent);
  }

  .pitem {
    display: block;
    flex: 0 0 112px;
    padding: 0;
    border-bottom: 0;
    border-radius: 6px;
    scroll-snap-align: start;
    opacity: .45;
    transition: opacity .3s var(--ease);
  }
  .pitem::before { display: none; }
  .pitem:hover, .pitem.is-active {
    background: none;
    padding-left: 0;
    opacity: 1;
  }

  .pitem-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--line-hair);
    border-radius: 6px;
    overflow: hidden;
    background: var(--panel);
    transition: border-color .3s var(--ease);
  }
  .pitem-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .pitem.is-active .pitem-thumb { border-color: var(--text-3); }

  .pitem-index, .pitem-name, .pitem-sub { display: none; }

  .pitem-year {
    display: block;
    margin-top: 7px;
    font-size: 10.5px;
    letter-spacing: .08em;
    color: var(--text-4);
  }
  .pitem.is-active .pitem-year { color: var(--text-2); }

  .plist-more { display: none; }

  /* preview returns, image edge to edge */
  .ppreview { order: 2; display: block; position: static; }

  .ppreview-frame {
    margin: 0 calc(var(--gutter) * -1);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .ppreview-body { padding: 18px 0 0; }
  .ppreview-title { font-size: 30px; }

  /* the dropdown spans the screen rather than hanging off the trigger */
  .nav-menu {
    position: fixed;
    top: var(--nav-h);
    left: var(--gutter);
    right: var(--gutter);
    min-width: 0;
    transform: translateY(-6px);
  }
  .nav-item.is-open .nav-menu { transform: translateY(0); }
  .nav-menu::before { display: none; }

  .gallery { grid-template-columns: 1fr; }
  .detail { padding: 32px 0 88px; }
  .detail-head { margin: 36px 0 40px; }
  .meta { gap: 20px 32px; margin-top: 32px; }
  .footer { padding: 72px 0 36px; }
  .footer-bottom { margin-top: 48px; }
}

@media (max-width: 520px) {
  .pitem { flex-basis: 96px; }
  .ppreview-title { font-size: 27px; }

  /* the bar now carries three languages as well, so it is tightened
     rather than left to wrap the name onto a second line */
  .nav-links { gap: 12px; font-size: 12.5px; }
  .nav-logo { font-size: 19px; }
  .nav-langs { gap: 8px; padding-left: 11px; margin-left: 0; font-size: 12px; }
  .cards { grid-template-columns: 1fr; }
  .hero-eyebrow::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html, html.snap { scroll-behavior: auto; scroll-snap-type: none; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-inner > *, .hero-foot { opacity: 1; transform: none; }
}
