/* E3 — meiyuchi.com
   Hairlines, white space, big type. No rounded cards, shadows or gradients. */

:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --muted: #6b6b66;
  --line: #e2e2de;
  --placeholder: #f1f1ef;
  --row-hl: #f4f3f0;
  --accent: #c4553d;
  /* --accent is 4.45:1 on white — just under AA for small text.
     Small accent text (mono labels, the −30% metric) uses this
     visually identical, slightly deeper value (4.74:1). */
  --accent-text: #be5139;
  --font-sans: "Inter Tight", sans-serif;
  --font-serif: "Instrument Serif", serif;
  --font-mono: "IBM Plex Mono", monospace;
  --pad: 32px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 600px) {
  :root {
    --pad: 16px;
  }
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px; /* anchors land below the sticky header */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

a:hover {
  color: #555555;
}

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.muted {
  color: var(--muted);
}

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

.mono.accent,
.accent-text {
  color: var(--accent-text);
}

.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

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

.skip-link {
  position: absolute;
  left: var(--pad);
  top: -100px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--bg);
}

.skip-link:focus {
  top: 12px;
  color: var(--bg);
}

/* ---------- Motion primitives ---------- */

@keyframes rise {
  from {
    transform: translateY(110%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes mq {
  to {
    transform: translateX(-50%);
  }
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

@keyframes nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}

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

@keyframes draw {
  from {
    stroke-dashoffset: 900;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* A line that rises out of its own box. clip-path (not overflow) so
   wide glyphs and negative tracking are never cut at the sides. */
.mask {
  display: block;
  clip-path: inset(-0.5em -0.5em 0 -0.5em);
}

.mask > span {
  display: inline-block;
}

.load-rise {
  animation: rise 0.8s var(--d, 0s) var(--ease) both;
}

/* Scroll-triggered: hidden only when JS is running, so no-JS shows everything. */
.js .reveal {
  opacity: 0;
  transform: translateY(48px);
  transition:
    opacity 0.9s var(--ease),
    transform 0.9s var(--ease);
  transition-delay: var(--d, 0s);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

.js .reveal-line > span {
  transform: translateY(110%);
  opacity: 0;
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
}

.js .reveal-line.is-in > span {
  transform: none;
  opacity: 1;
}

.nudge {
  display: inline-block;
  animation: nudge 1.6s ease-in-out infinite;
}

/* ---------- Splash (homepage, once per visit) ---------- */

.splash {
  display: none;
}

.is-splash,
.is-splash body {
  overflow: hidden;
}

/* Hold the hero's entrance until the splash lifts. */
.is-splash .load-rise {
  animation-play-state: paused;
}

.is-splash .splash,
.splash.is-done {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px var(--pad);
  background: var(--bg);
}

.splash.is-done {
  transform: translateY(-100%);
  transition: transform 0.9s var(--ease);
}

.splash-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.splash-count {
  margin-top: 8px;
  font-size: clamp(120px, 22vw, 320px);
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.splash-pct {
  margin-left: 0.15em;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  vertical-align: top;
}

.splash-bar {
  height: 1px;
  margin-top: 32px;
  background: var(--line);
}

.splash-bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 20px var(--pad);
  align-items: start;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

/* Nav: the one sans element in the header, so it reads as navigation, not a label. */
.site-header .nav {
  grid-column: 3 / span 2;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  line-height: 1.2;
}

.nav-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  vertical-align: 0.35em;
}

.site-header .nav a:hover {
  color: var(--accent-text);
}

.site-header .nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.menu-toggle {
  display: none;
  justify-self: end;
  color: var(--accent-text);
}

.menu-toggle:hover {
  color: var(--ink);
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  /* One slim sticky row on phones; the clock lives in the menu overlay. */
  .site-header .meta,
  .site-header .nav {
    display: none;
  }

  .menu-toggle {
    display: block;
    grid-row: 1;
    grid-column: 2;
  }
}

/* Full-screen menu overlay (native <dialog>: focus trap + Esc for free) */
.menu {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 20px var(--pad) 32px;
  border: 0;
  background: var(--bg);
  color: var(--ink);
}

.menu[open] {
  display: flex;
  flex-direction: column;
}

.menu::backdrop {
  background: var(--bg);
}

.menu-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.menu-close {
  color: var(--accent-text);
}

.menu-links {
  margin: auto 0;
  padding: 0;
  list-style: none;
  counter-reset: menu;
}

.menu-links li {
  border-top: 1px solid var(--line);
}

.menu-links li:last-child {
  border-bottom: 1px solid var(--line);
}

.menu-links a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  font-size: clamp(40px, 9vw, 112px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

.menu-links a .mono {
  letter-spacing: 0.02em;
}

/* ---------- Hero ---------- */

.hero {
  padding: 120px var(--pad) 0;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px;
}

.hero-intro {
  max-width: 440px;
  font-size: 22px;
  line-height: 1.3;
}

.hero-intro .serif {
  font-size: 26px;
  color: var(--accent-text);
}

.hero-facts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.availability {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-text);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.name {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.18em;
  margin-top: 48px;
  font-size: 15.4vw;
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.name .mask {
  padding-bottom: 0.04em;
}

.name .load-rise {
  animation-duration: 1s;
}

.hero-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.meaning {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meaning svg {
  flex: none;
}

.orbit {
  transform-origin: 20px 20px;
  animation: orbit 6s linear infinite;
}

/* Scroll cue: the Playground's pixel character points down at the work. */
.scroll-cue {
  display: inline-block;
  line-height: 0;
}

.p-k {
  fill: var(--ink);
}

.p-a {
  fill: var(--accent);
}

.p-s {
  fill: #e9c9a8;
}

.p-m {
  fill: var(--muted);
}

.p-w {
  fill: #ffffff;
}

.p-l {
  fill: var(--line);
}

.pixel-cue-arm,
.pixel-cue-arrow {
  animation: poke 2.4s steps(1, end) infinite;
}

.pixel-cue-arrow {
  animation-name: poke-arrow;
}

@keyframes poke {
  50% {
    transform: translateY(1px);
  }
}

@keyframes poke-arrow {
  50% {
    transform: translateY(2px);
  }
}

@media (max-width: 600px) {
  .hero {
    padding-top: 72px;
  }

  .hero-facts {
    align-items: flex-start;
    text-align: left;
  }

  .name {
    font-size: 22vw;
    line-height: 0.84;
  }

  .scroll-cue {
    flex: none;
  }

  .pixel-cue {
    width: 42px;
    height: 57px;
  }
}

/* ---------- Section heads ---------- */

.section {
  padding: 160px var(--pad) 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 600px) {
  .section {
    padding-top: 112px;
  }

  .section-head .hide-sm {
    display: none;
  }
}

/* ---------- Covers ---------- */
/* Every cover is the same system: flat placeholder panel, square corners,
   real product screens in a plain ink device frame. Titles live in captions. */

.cover {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7%;
  overflow: hidden;
  background: var(--placeholder);
  container-type: size;
}

.cover > * {
  transition: transform 1.2s var(--ease);
}

.device {
  flex: none;
  height: 76cqh;
  aspect-ratio: 720 / 1557;
  overflow: hidden;
  border: 1.5cqh solid var(--ink);
  border-radius: 7cqh;
  background: #ffffff;
}

.device img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.cover--pair .device:nth-of-type(2) {
  margin-top: 14cqh;
}

.cover--screen img {
  width: 84%;
  height: auto;
}

.cover--browser .browser {
  flex: none;
  width: 84%;
  border: 1px solid var(--line);
  background: #ffffff;
}

.cover--browser .browser::before {
  content: "";
  display: block;
  height: 4.5cqh;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle, var(--line) 0 30%, transparent 32%) 1.2cqh 50% / 3cqh 3cqh no-repeat,
    radial-gradient(circle, var(--line) 0 30%, transparent 32%) 4cqh 50% / 3cqh 3cqh no-repeat,
    radial-gradient(circle, var(--line) 0 30%, transparent 32%) 6.8cqh 50% / 3cqh 3cqh no-repeat;
}

.cover--browser img {
  width: 100%;
  height: auto;
}

a:hover .cover > *,
a:focus-visible .cover > * {
  transform: scale(1.035);
}

a:hover .cover--pair .device:nth-child(1) {
  transform: scale(1.035) translateY(-2cqh);
}

/* ---------- Selected work ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.case {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.case:hover {
  color: var(--ink);
}

.case-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.case-caption h3 {
  font: inherit;
}

/* Staggered slots: wide, narrow offset down, then mirrored. */
.case--a {
  grid-column: span 8;
}

.case--a .cover {
  aspect-ratio: 912 / 640;
}

.case--b {
  grid-column: span 4;
  margin-top: 240px;
}

.case--b .cover {
  aspect-ratio: 448 / 400;
}

.case--c {
  grid-column: 2 / span 6;
  margin-top: 40px;
}

.case--c .cover {
  aspect-ratio: 696 / 520;
}

.case--d {
  grid-column: 9 / span 4;
  margin-top: 160px;
}

.case--d .cover {
  aspect-ratio: 448 / 460;
}

@media (max-width: 900px) {
  .work-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 56px;
  }

  .work-grid .case {
    grid-column: 1;
    margin-top: 0;
  }

  .work-grid .case .cover {
    aspect-ratio: 4 / 3;
  }

  .work-grid .cover--row .device {
    height: 68cqh;
  }
}

@media (max-width: 600px) {
  .case-caption {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .case-caption h3 {
    flex-basis: 100%;
  }
}

/* ---------- Marquee ---------- */

.marquee {
  margin-top: 160px;
  padding: 20px 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 96px;
  line-height: 1;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: mq 30s linear infinite;
}

.marquee-track > p {
  padding-right: 0.3em;
}

.marquee .accent {
  font-style: normal;
}

@media (max-width: 600px) {
  .marquee {
    margin-top: 112px;
    font-size: 56px;
  }
}

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: center;
  margin-top: 48px;
}

.sketch {
  grid-column: span 5;
  width: 100%;
  height: 320px;
}

/* Pixel volleyball: the ball goes up and comes back to the hands in steps;
   the character hops on each touch. One rally = 1.8s. */
.pixel-ball {
  animation: rally 1.8s steps(1, end) infinite;
}

.pixel-hero {
  animation: set-hop 1.8s steps(1, end) infinite;
}

/* Scrolled down to the Playground: the ball falls out of this scene and into the game. */
.pixel-scene.is-dropped .pixel-ball {
  animation: drop-out 0.6s ease-in forwards;
}

@keyframes drop-out {
  to {
    transform: translateY(24px);
    opacity: 0;
  }
}

@keyframes rally {
  0%,
  100% {
    transform: translateY(0);
  }
  15% {
    transform: translateY(-3px);
  }
  30% {
    transform: translateY(-6px);
  }
  45% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-6px);
  }
  75% {
    transform: translateY(-3px);
  }
  90% {
    transform: translateY(-1px);
  }
}

@keyframes set-hop {
  0%,
  100% {
    transform: translateY(-1px);
  }
  10% {
    transform: translateY(0);
  }
}

.about-body {
  grid-column: 7 / span 6;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.about-lede {
  font-size: 46px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.facts {
  margin: 0;
}

.facts > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 16px;
}

.facts > div:last-child {
  border-bottom: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .sketch,
  .about-body {
    grid-column: 1;
  }

  .sketch {
    height: 240px;
  }

  .about-lede {
    font-size: clamp(30px, 7vw, 46px);
  }
}

@media (max-width: 600px) {
  .facts > div {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

/* ---------- Archive ---------- */

.archive {
  width: 100%;
  border-collapse: collapse;
}

.archive th,
.archive td {
  padding: 22px 16px 22px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.archive th {
  padding-top: 14px;
  padding-bottom: 14px;
  color: var(--muted);
}

.archive th:last-child,
.archive td:last-child {
  padding-right: 0;
  text-align: right;
}

.archive td:first-child {
  width: 40%;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
}

.archive td {
  font-size: 18px;
}

.archive td:nth-child(2) {
  color: var(--muted);
}

.archive a::after {
  /* stretch the link over the whole row */
  content: "";
  position: absolute;
  inset: 0;
}

.archive tr {
  position: relative;
  transition: background-color 0.3s var(--ease);
}

/* Highlight bleeds to the page edge: flat fills, not shadows. */
.archive tbody tr.is-highlight,
.archive tbody tr:hover,
.archive tbody tr:focus-within {
  background: var(--row-hl);
}

.archive tbody tr.is-highlight td:first-child,
.archive tbody tr:hover td:first-child,
.archive tbody tr:focus-within td:first-child {
  box-shadow: calc(-1 * var(--pad)) 0 0 var(--row-hl);
}

.archive tbody tr.is-highlight td:last-child,
.archive tbody tr:hover td:last-child,
.archive tbody tr:focus-within td:last-child {
  box-shadow: var(--pad) 0 0 var(--row-hl);
}

.archive tr.is-highlight .ext {
  color: var(--accent);
}

@media (max-width: 600px) {
  .archive td:first-child {
    width: auto;
    font-size: 22px;
  }

  .archive td {
    font-size: 15px;
  }

  .archive th:nth-child(2),
  .archive td:nth-child(2) {
    display: none;
  }
}

/* ---------- Playground game (homepage) ---------- */

.game {
  margin-top: 48px;
}


/* The scene is drawn in e3.js; this only sizes it. */
.game-stage {
  display: block;
  width: 100%;
  height: 190px;
  margin-top: 24px;
  border-bottom: 1px solid var(--ink);
  image-rendering: pixelated;
  touch-action: manipulation;
}

.game-bar {
  display: flex;
  align-items: center;
  gap: 16px 32px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.game-pad {
  display: flex;
  gap: 8px;
}

.game-btn {
  width: 56px;
  height: 44px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.game-btn.is-held {
  background: var(--ink);
  color: var(--bg);
}

.game-hint {
  flex: 1;
}

.game-skip {
  white-space: nowrap;
}

@media (max-width: 600px) {
  .game-stage {
    height: 130px;
  }

  .game-bar {
    flex-wrap: wrap;
  }

  .game-hint {
    order: 3;
    flex-basis: 100%;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 180px var(--pad) 24px;
}

.email {
  display: block;
  margin-top: 16px;
  text-align: left;
  font-size: 7.5vw;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  overflow-wrap: anywhere;
}

.email:hover {
  color: #555555;
}

.footer-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 80px;
}

.footer-row > :last-child {
  text-align: right;
}

@media (max-width: 600px) {
  .site-footer {
    padding-top: 120px;
  }

  .email {
    font-size: 7.8vw;
  }

  .footer-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 12px;
  }
}

/* ---------- Inner page hero (works, about) ---------- */

.page-hero {
  padding: 120px var(--pad) 0;
}

.page-title {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 24px;
  font-size: 15.4vw;
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.page-title .mask {
  padding-bottom: 0.04em;
}

.page-title .load-rise {
  animation-duration: 1s;
}

.page-count {
  margin-top: 0.6em;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.page-lede {
  max-width: 640px;
  margin-top: 48px;
  font-size: 22px;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .page-hero {
    padding-top: 72px;
  }

  .page-title {
    font-size: 26vw;
  }

  .page-lede {
    font-size: 19px;
  }

  /* Let the lede reflow as one paragraph; lines just fade in. */
  .page-lede .mask,
  .page-lede .mask > span {
    display: inline;
    clip-path: none;
  }
}

/* Long one-word titles (Playground) shrink so the count still fits. */
.page-title.page-title--long {
  font-size: 12vw;
}

/* ---------- About page ---------- */

.about-grid--bio {
  align-items: start;
}

.portrait {
  grid-column: span 5;
  margin: 0;
  background: var(--placeholder);
}

.portrait img {
  width: 100%;
  height: auto;
}

.prose p + p {
  margin-top: 16px;
}

.principles,
.toolkit {
  display: grid;
  gap: 0 16px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.principles {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toolkit {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.principles > li,
.toolkit > div {
  padding: 16px 0 24px;
  border-top: 1px solid var(--line);
}

.principles h3 {
  margin: 24px 0 8px;
  font-size: clamp(26px, 2.6vw, 36px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.principles p {
  color: var(--muted);
}

.toolkit h3 {
  margin-bottom: 16px;
}

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

.toolkit li + li {
  margin-top: 4px;
}

.facts--long {
  margin-top: 24px;
}

.facts--long > div {
  grid-template-columns: 25% minmax(0, 680px);
  padding: 20px 0;
}

.facts--long h3 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.facts--long p {
  color: var(--muted);
}

@media (max-width: 900px) {
  .portrait {
    grid-column: 1;
  }

  .principles {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolkit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .facts--long > div {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .toolkit {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Work index ---------- */

.work-index {
  margin: 0;
  padding: 0;
  list-style: none;
}

.work-row {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 16px;
  align-items: baseline;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.work-row:hover {
  color: var(--ink);
}

.work-row-title {
  font-size: clamp(32px, 4.4vw, 64px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  transition: transform 0.6s var(--ease);
}

.work-row-tags {
  color: var(--muted);
  font-size: 16px;
}

.work-row-role {
  text-align: right;
}

/* Cover preview floats in on hover/focus (pointer devices only). */
.work-row-thumb {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 46%;
  width: min(340px, 26vw);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -46%) scale(0.96);
  transition:
    opacity 0.5s var(--ease),
    transform 0.8s var(--ease);
}

.work-row-thumb .cover {
  aspect-ratio: 4 / 3;
}

@media (hover: hover) and (min-width: 901px) {
  .work-row:hover .work-row-thumb,
  .work-row:focus-visible .work-row-thumb {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  .work-row:hover .work-row-title {
    transform: translateX(12px);
  }
}

/* Touch / narrow: covers sit inline above each row. */
@media (hover: none), (max-width: 900px) {
  .work-row {
    grid-template-columns: 48px minmax(0, 1fr);
    row-gap: 8px;
    padding: 24px 0 32px;
  }

  .work-row-thumb {
    position: static;
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    margin-bottom: 12px;
    opacity: 1;
    transform: none;
  }

  .work-row-tags,
  .work-row-role {
    grid-column: 2;
    text-align: left;
  }
}

/* ---------- Case study ---------- */
/* Text sits in one 680px column starting a quarter in; figures run full width. */

.container {
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.case-hero {
  padding: 120px var(--pad) 0;
}

.case-title {
  margin-top: 24px;
  font-size: clamp(56px, 10.5vw, 168px);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.case-title .mask {
  padding-bottom: 0.04em;
}

.case-title .load-rise {
  animation-duration: 1s;
}

.case-intro {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  margin-top: 56px;
}

.case-sub {
  grid-column: span 6;
  font-size: 22px;
  line-height: 1.35;
}

.case-meta {
  grid-column: 8 / span 5;
  margin: 0;
}

.case-meta > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.case-meta > div:last-child {
  border-bottom: 1px solid var(--line);
}

.case-meta dt {
  color: var(--muted);
}

.case-meta dd {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  text-transform: none;
  letter-spacing: 0;
}

/* Summary: four short answers a reviewer can read in 20 seconds. */
.case-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 56px 0 0;
}

.case-summary > div {
  padding-top: 12px;
  border-top: 1px solid var(--ink);
}

.case-summary dt {
  color: var(--muted);
}

.case-summary dd {
  margin: 12px 0 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.case-cover {
  margin-top: 80px;
}

.case-cover .cover {
  aspect-ratio: 16 / 9;
}

/* Browser-framed media shrink-wraps so tall captures never overflow. */
.cover--browser .browser {
  width: auto;
  max-width: 84%;
}

.cover--browser .browser img,
.cover--browser .browser video {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 72cqh;
}

.case-section {
  padding-top: 120px;
}

/* A row of app screens on one placeholder panel. */
.cover--row {
  aspect-ratio: 16 / 9;
  gap: 3%;
}

.cover--row .device {
  height: 70cqh;
}

.cover--portrait {
  aspect-ratio: 4 / 5;
}

/* Live hero cover (Water, MuPa): phones rise in, then show the product —
   a recorded walkthrough (Water) or screens changing (MuPa); MuPa stamps press onto the panel. */
@keyframes device-in {
  from {
    transform: translateY(40cqh);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes stamp-in {
  from {
    opacity: 0;
    transform: rotate(var(--r)) scale(1.6);
  }
  to {
    opacity: 1;
    transform: rotate(var(--r)) scale(1);
  }
}

.cover--live .device {
  position: relative;
  z-index: 1;
  animation: device-in 1.1s 0.3s var(--ease) both;
}

.cover--live .device:nth-of-type(2) {
  animation-delay: 0.45s;
}

.device video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.device--cycle img {
  position: absolute;
  inset: 0;
}

html:not(.js) .device--cycle img + img {
  display: none;
}

.js .device--cycle img {
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}

.js .device--cycle img.is-on {
  opacity: 1;
}

.cover-stamp {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 13%;
  height: auto;
  transform: rotate(var(--r));
  animation: stamp-in 0.8s var(--d) var(--ease) both;
}

.cover-toggle {
  position: absolute;
  right: 16px;
  bottom: 12px;
  z-index: 2;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
}

.cover-toggle:hover {
  color: var(--ink);
}

/* Hand-drawn stamps sit on the panel, no frames. */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 48px;
  background: var(--placeholder);
}

.stamp-grid img {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
}

/* Numbered steps joined by hairlines. */
.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-left: 0;
  margin-right: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.flow li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--ink);
}

.flow strong {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.flow li > span:last-child {
  font-size: 16px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .flow {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .flow li {
    padding-bottom: 16px;
    border-top-color: var(--line);
  }

  .stamp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 24px;
  }
}

@media (max-width: 700px) {
  .cover--row {
    aspect-ratio: 4 / 3;
    gap: 2.5%;
  }

  .cover--row .device {
    height: 52cqh;
    border-width: 1cqh;
    border-radius: 5cqh;
  }
}

.case-section h2,
.callout h2 {
  margin: 0;
}

.case-section h2 em,
.callout h2 em {
  font-family: var(--font-serif);
  font-weight: 400;
}

.case-section h3 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.case-section h4 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
}

.case-section p {
  line-height: 1.55;
}

.case-section p + p,
.case-section p + ul,
.case-section ul + p {
  margin-top: 16px;
}

.case-section ul {
  margin: 0;
  padding-left: 1.1em;
}

.case-section li + li {
  margin-top: 4px;
}

.case-step {
  display: grid;
  grid-template-columns: 25% minmax(0, 1fr);
  align-items: baseline;
  padding-top: 16px;
  margin-bottom: 48px;
  border-top: 1px solid var(--line);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.step-num::before {
  content: "[ ";
}

.step-num::after {
  content: " ]";
}

.case-step h2 {
  max-width: 20ch;
  font-size: clamp(32px, 4vw, 56px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.case-block > div:not([class]),
.section-intro,
.case-section > .section-head,
.case-section > .eyebrow {
  max-width: 680px;
  margin-left: 25%;
}

.case-section > .section-head {
  display: block;
  border: 0;
}

.section-intro {
  font-size: 20px;
}

.case-section > * + * {
  margin-top: 40px;
}

.case-section > .case-step + * {
  margin-top: 0;
}

.case-block > * + * {
  margin-top: 32px;
}

.case-two,
.case-three {
  display: grid;
  gap: 40px 16px;
  align-items: start;
}

.case-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.case-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.case-figure {
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
}

/* Small reference images (sticky-note boards) — never wider than a column of text. */
.case-figure--small {
  max-width: 360px;
}

.case-figure img,
.case-figure video {
  width: 100%;
  height: auto;
}

.case-figure figcaption {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.stat {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stat .figure {
  font-size: clamp(48px, 6vw, 88px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.stat p {
  margin-top: 12px;
  font-size: 16px;
  color: var(--muted);
}

.insight-list {
  margin-top: 20px;
}

.insight {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.insight:last-child {
  border-bottom: 1px solid var(--line);
}

.insight p {
  font-size: 16px;
  color: var(--muted);
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 16px;
}

.fact {
  padding: 16px 0 20px;
  border-top: 1px solid var(--line);
}

.fact h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.fact ul {
  font-size: 16px;
}

/* Ease scores as plain bars: label, track, value. */
.score-chart {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.score-chart li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.score-bar {
  height: 10px;
  background: var(--line);
}

.score-bar span {
  display: block;
  height: 100%;
  background: var(--ink);
}

.flow-steps {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

.flow-steps p {
  margin-top: 8px;
  font-size: 16px;
}

.stat-grid {
  margin-top: 24px;
}

.callout {
  margin-top: 120px;
  padding: 48px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.callout h2 {
  margin-top: 16px;
  max-width: 16ch;
  font-size: clamp(40px, 6vw, 96px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

.callout h2 strong {
  font-weight: inherit;
}

.callout p:last-child {
  margin-top: 20px;
  color: var(--muted);
}

.eyebrow,
.text-link {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.eyebrow {
  color: var(--muted);
}

.arrow {
  display: inline-block;
}

.next-project {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 160px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.next-link {
  display: block;
}

.next-title {
  display: block;
  margin-top: 16px;
  font-size: clamp(48px, 9vw, 140px);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

@media (max-width: 1000px) {
  .case-intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .case-sub,
  .case-meta {
    grid-column: 1;
  }

  .case-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 32px;
  }

  .case-step {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 12px;
  }

  .case-block > div:not([class]),
  .section-intro,
  .case-section > .section-head,
  .case-section > .eyebrow {
    margin-left: 0;
  }

  .case-three,
  .fact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 700px) {
  .case-hero {
    padding-top: 72px;
  }

  .case-sub {
    font-size: 19px;
  }

  .case-meta > div {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .case-summary {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 24px;
  }

  .case-cover {
    margin-top: 48px;
  }

  .case-cover .cover {
    aspect-ratio: 1 / 1;
  }

  .case-section {
    padding-top: 88px;
  }

  .case-two,
  .case-three,
  .fact-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* ---------- Reduced motion: show the final state, no movement ---------- */

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .reveal,
  .js .reveal-line > span {
    opacity: 1;
    transform: none;
  }

  .marquee {
    white-space: normal;
    font-size: clamp(40px, 6vw, 96px);
    padding-left: var(--pad);
    padding-right: var(--pad);
  }

  .marquee-track {
    width: auto;
  }

  .marquee-track > [aria-hidden="true"] {
    display: none;
  }

  a:hover .cover > * {
    transform: none !important;
  }
  .cover-toggle {
    display: none;
  }
}
