/* Kalp Shah — portfolio.
   Dark and quiet, so the game art does the talking. Every game brings its own colours
   and typeface: build.mjs sets --bg, --surface, --ink, --muted, --accent, --on-accent,
   --game-font and --game-scale on each home-page slide and on each project page. */

@font-face { font-family: "MLCD"; src: url("../public/mlcd.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #07080a;
  --surface: #0f1115;
  --ink: #f3f1ec;
  --muted: #9a9da6;
  --accent: #f3f1ec;
  --on-accent: #07080a;
  --game-font: "Archivo";
  --game-scale: 1;
  --display: "Archivo", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --pad: clamp(16px, 4vw, 40px);
  --gap: clamp(80px, 12vw, 160px);
  --r: 18px;
}
body, .slide, .next a { --line: color-mix(in srgb, var(--ink) 14%, var(--bg)); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.65 var(--body); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2 { font-family: var(--display); font-stretch: 112%; font-weight: 800; line-height: 1; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
h3 { font: 650 1.12rem/1.25 var(--body); letter-spacing: -0.01em; }
code { font: 0.86em var(--mono); background: color-mix(in srgb, var(--ink) 10%, transparent); padding: 0.12em 0.4em; border-radius: 5px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }
.i { width: 1em; height: 1em; flex: none; }

.wrap { width: min(1180px, 100%); margin-inline: auto; padding-inline: var(--pad); }
.wrap--wide { width: min(1280px, 100%); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 30; }
.skip:focus { left: 8px; }
.label { font: 500 0.74rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.label a { color: var(--ink); }
.prose { max-width: 62ch; color: color-mix(in srgb, var(--ink) 84%, var(--bg)); }
.prose + .prose { margin-top: 1em; }
.prose--lead { font-size: 1.15rem; line-height: 1.6; color: var(--ink); }
.big { font-size: clamp(2.6rem, 8vw, 6rem); text-transform: uppercase; letter-spacing: -0.03em; }

/* Buttons ------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; gap: 9px; padding: 12px 20px; border: 1px solid color-mix(in srgb, var(--ink) 34%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--bg) 55%, transparent); color: var(--ink); font: 600 0.92rem/1.2 var(--body); text-decoration: none; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: border-color 0.2s, background 0.2s, color 0.2s; }
.btn:hover { border-color: var(--ink); }
.btn .i { transition: transform 0.2s; }
.btn:hover .i { transform: translateX(3px); }
.btn small { font: 500 0.68rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.65; }
.btn--solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--solid:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 86%, white); }
.btn--big { padding: 15px 26px; font-size: 1rem; }
.btn--small { padding: 8px 16px; font-size: 0.85rem; }

/* Top bar ------------------------------------------------------------ */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid color-mix(in srgb, var(--ink) 9%, transparent); }
.home .top { position: fixed; inset: 0 0 auto; }
.top__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.top__name { font: 800 1.05rem var(--display); font-stretch: 115%; letter-spacing: 0.02em; text-transform: uppercase; text-decoration: none; }
.top__nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 30px); font-size: 0.9rem; }
.top__nav > a:not(.btn) { text-decoration: none; color: color-mix(in srgb, var(--ink) 72%, transparent); }
.top__nav > a:not(.btn):hover { color: var(--ink); }

/* Home hero: the headline beside a cloud of points that morphs between the games' characters (js/hero.js) */
.hero { display: grid; align-items: center; min-height: min(100svh, 940px); padding-block: 110px clamp(40px, 6vw, 72px); overflow: hidden; }
.hero__in { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 42vw, 560px); gap: clamp(24px, 6vw, 88px); align-items: center; }
.hero__stage { position: relative; aspect-ratio: 1; }
.hero__stage::before { content: ""; position: absolute; inset: 8%; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--glow, #f3f1ec) 20%, transparent), transparent); transition: background 1.2s; }
.hero__canvas { position: absolute; inset: -8%; width: 116%; height: 116%; cursor: pointer; touch-action: pan-y; }
/* Tapping or dragging on the cloud must not select it or flash the browser's tap highlight. */
.hero__stage, .hero__stage * { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.hero__canvas:focus { outline: none; }
.hero__stage ::selection { background: transparent; }
.hero__pick { display: flex; justify-content: center; gap: 4px; margin-top: 8px; }
.hero__pick button { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.hero__pick button::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 30%, var(--bg)); transition: background 0.3s, scale 0.3s; }
.hero__pick button:hover::before { background: var(--ink); }
.hero__pick button[aria-pressed="true"]::before { background: var(--dot); scale: 1.5; }
.hero__stage { margin-bottom: 44px; }
.hero__now { position: absolute; z-index: 1; left: 0; right: 0; bottom: -44px; text-align: center; font: 500 0.72rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hero__now a { color: var(--ink); text-decoration-color: var(--glow, currentColor); text-decoration-thickness: 2px; }
.hero__who { display: flex; align-items: center; gap: 14px; }
.hero__who img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--ink); }
.hero__who span { font: 500 0.74rem/1.5 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: color-mix(in srgb, var(--ink) 75%, transparent); }
.hero__who b { display: block; font: 700 1rem var(--body); letter-spacing: 0; text-transform: none; color: var(--ink); }
.hero__h { margin-top: 22px; max-width: 11em; font-size: clamp(2.3rem, 4.6vw, 4.2rem); font-weight: 850; line-height: 0.94; letter-spacing: -0.035em; text-transform: uppercase; }
.hero__p { margin-top: 26px; max-width: 56ch; font-size: clamp(1.02rem, 1.5vw, 1.2rem); color: color-mix(in srgb, var(--ink) 80%, transparent); }
.hero__cta, .phead__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.numbers > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 8px; padding: clamp(20px, 3vw, 34px) clamp(14px, 2vw, 28px); border-left: 1px solid var(--line); }
.numbers > div:first-child { border-left: 0; padding-left: 0; }
.numbers dd { font: 800 clamp(1.9rem, 4.4vw, 3.4rem)/1 var(--display); font-stretch: 112%; letter-spacing: -0.03em; }
.numbers dt { font-size: 0.86rem; line-height: 1.4; color: var(--muted); max-width: 22ch; }

/* Sections ----------------------------------------------------------- */
.section { margin-top: var(--gap); }
.section__head { display: grid; gap: 14px; margin-bottom: clamp(28px, 4vw, 52px); }
.section--split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(20px, 5vw, 64px); align-items: start; }
.section--split .section__head { margin-bottom: 0; position: sticky; top: 96px; }
.section--note { margin-top: calc(var(--gap) * 0.55); padding-top: calc(var(--gap) * 0.4); border-top: 1px solid var(--line); }
.section--note h2 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }

/* Home: the games as a grid of cards, two across ---------------------- */
.games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2.4vw, 32px); }
.slide { position: relative; display: flex; flex-direction: column; container-type: inline-size; border-radius: calc(var(--r) + 6px); background: var(--bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent); box-shadow: 0 40px 90px -70px color-mix(in srgb, var(--accent) 55%, transparent); }
.slide__art { display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: calc(var(--r) + 5px) calc(var(--r) + 5px) 0 0; background: var(--surface); }
.slide__art img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1); }
.slide:hover .slide__art img { transform: scale(1.035); }
.slide__info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 22px; padding: clamp(20px, 2.6vw, 34px); border-top: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 9%, var(--bg)), var(--bg) 55%); border-radius: 0 0 calc(var(--r) + 5px) calc(var(--r) + 5px); }
.slide__title { margin-top: 10px; font: 400 calc(clamp(2rem, 3.4vw, 3.1rem) * var(--game-scale)) / 0.98 var(--game-font), var(--display); letter-spacing: 0; }
.slide__title a { color: var(--accent); text-decoration: none; }
.slide--light .slide__title a { color: var(--ink); }
.slide__pitch { margin-top: 12px; max-width: 54ch; font-size: 1rem; line-height: 1.5; color: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.slide__side { display: grid; gap: 8px; justify-items: start; }
.fact { display: flex; align-items: baseline; gap: 10px; font: 650 1rem/1.35 var(--body); max-width: 40ch; }
.fact::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); translate: 0 -1px; }
.slide__role { font: 500 0.74rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.slide__side .btn { margin-top: 8px; }
/* The sixth card: not a game, a way to the rest of the code. One dot per game, as in the favicon. */
.slide--more { --accent: var(--ink); border-style: dashed; border-color: color-mix(in srgb, var(--ink) 22%, transparent); box-shadow: none; }
.slide--more .slide__art { display: grid; place-items: center; background: radial-gradient(color-mix(in srgb, var(--ink) 12%, transparent) 1px, transparent 1.5px) 0 0 / 18px 18px, var(--surface); }
.slide--more .slide__info { background: none; }
.more__dots { display: flex; gap: clamp(10px, 3cqw, 18px); }
.more__dots i { width: clamp(14px, 5cqw, 28px); aspect-ratio: 1; border-radius: 50%; background: var(--dot); box-shadow: 0 0 24px -2px var(--dot); transition: translate 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }
.slide--more:hover .more__dots i { translate: 0 -8px; }
.slide--more:hover .more__dots i:nth-child(2) { transition-delay: 0.04s; } .slide--more:hover .more__dots i:nth-child(3) { transition-delay: 0.08s; }
.slide--more:hover .more__dots i:nth-child(4) { transition-delay: 0.12s; } .slide--more:hover .more__dots i:nth-child(5) { transition-delay: 0.16s; }
/* Two games lend a character to their slide. js/site.js sets --p from -1 to 1 as the slide crosses the screen. */
.slide__art--wide { position: relative; }
.slide__blur { position: absolute; inset: -12%; background: center / cover; filter: blur(22px) brightness(0.55); }
.slide__art img.is-wide { position: relative; object-fit: contain; }
.slide__art img.is-contained { object-fit: contain; padding: 2.5% 0; background: radial-gradient(closest-side, #ffffff, #dedee6); }
/* One scroll-reactive element per game, sitting on the line between the art and the text.
   --q runs from 0 (slide entering the screen) to 1 (leaving); --art is the art's height in px. Both set by js/site.js. */
.slide { --ar: 0.5625; }
.slide__prop { --q: 0.5; --size: clamp(46px, 14cqw, 92px); position: absolute; z-index: 2; top: 0; right: 15%; margin-top: calc(100% * var(--ar) - var(--size) * 0.6); pointer-events: none; will-change: transform; }
.slide__prop img { display: block; width: 100%; }
.slide__prop i, .slide__prop b { display: block; font-style: normal; }

/* Roll 'Em Out: the ball rolls along the line */
.slide__prop--roll { width: var(--size); filter: drop-shadow(0 18px 22px rgb(0 0 0 / 0.55)); transform: translateX(calc((var(--q) - 0.5) * 30cqw)) rotate(calc((var(--q) - 0.5) * 600deg)); }

/* Boom Corp.: floor tiles are cleared one by one; the live one stays covered and gets marked */
.slide__prop--tiles { --size: clamp(20px, 6.4cqw, 38px); display: flex; gap: clamp(3px, 0.9cqw, 6px); right: 5%; margin-top: calc(100% * var(--ar) - var(--size) * 0.5); }
.slide__prop--tiles i { --open: clamp(0, (var(--q) - 0.2 - var(--k) * 0.055) * 14, 1); position: relative; display: grid; place-items: center; width: var(--size); height: var(--size); border-radius: 18%; background: #020710; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); font: 700 calc(var(--size) * 0.46) "Orbitron", var(--mono); }
.slide__prop--tiles i::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; background: linear-gradient(145deg, #c9d4dc, #7d8b97); border: 1px solid #e7eef2; opacity: calc(1 - var(--open)); transform: translateY(calc(var(--open) * -70%)) rotate(calc(var(--open) * 14deg)) scale(calc(1 - var(--open) * 0.3)); }
.slide__prop--tiles i.is-live { --mark: clamp(0, (var(--q) - 0.66) * 12, 1); border-color: transparent; }
.slide__prop--tiles i.is-live::after { opacity: 1; transform: none; box-shadow: 0 0 0 calc(var(--mark) * 2px) var(--accent), 0 0 calc(var(--mark) * 22px) var(--accent); }
.slide__prop--tiles i.is-live::before { content: "×"; position: relative; z-index: 1; color: #020710; opacity: var(--mark); }

/* The Gravity Flip: the robot hangs from the ceiling, then gravity flips and it lands on the floor */
.slide__prop--flip { --size: clamp(44px, 13cqw, 88px); --s: clamp(0, (var(--q) - 0.3) * 3.2, 1); width: var(--size); right: 12%; margin-top: calc(100% * var(--ar) - var(--size) * 1.46); filter: drop-shadow(0 14px 18px rgb(0 0 0 / 0.6)); transform: translateY(calc((var(--s) - 1) * (var(--art, 300px) - var(--size) * 1.46))) rotate(calc((1 - var(--s)) * 180deg)); }

/* AuraRPG: a magic circle turns */
.slide__prop--circle { --size: clamp(54px, 16cqw, 104px); right: 6%; width: var(--size); height: var(--size); margin-top: calc(100% * var(--ar) - var(--size) * 0.5); border-radius: 50%; border: 2px solid var(--accent); background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 30%, transparent), transparent 72%); box-shadow: 0 0 34px -4px var(--accent), inset 0 0 18px -6px var(--accent); transform: rotate(calc(var(--q) * 300deg)); }
.slide__prop--circle i { position: absolute; inset: 15%; border: 1.5px solid var(--accent); }
.slide__prop--circle i:nth-child(2) { rotate: 45deg; }
.slide__prop--circle i:nth-child(3) { inset: 7%; border-radius: 50%; border-style: dashed; rotate: calc(var(--q) * -520deg); }

/* SnakeWall: a dot snake crawls to its food and grows by one */
.slide__prop--snake { --size: clamp(9px, 2.6cqw, 16px); --ate: clamp(0, (var(--q) - 0.58) * 30, 1); display: flex; flex-direction: row-reverse; gap: calc(var(--size) * 0.22); right: auto; left: 34%; margin-top: calc(100% * var(--ar) - var(--size) * 0.5); transform: translateX(calc(var(--q) * 30cqw)); }
.slide__prop--snake i { width: var(--size); height: var(--size); border-radius: 50%; background: #141218; box-shadow: 0 0 0 2px #eeeef2; }
.slide__prop--snake i:last-of-type { opacity: var(--ate); }
.slide__prop--snake b { position: absolute; top: 0; left: 100%; width: var(--size); height: var(--size); margin-left: calc(18cqw - var(--q) * 30cqw); border-radius: 50%; background: #c8201b; box-shadow: 0 0 0 2px #eeeef2; opacity: calc(1 - var(--ate)); }

/* Home: toolbox ------------------------------------------------------ */
/* A graph that grows sideways: each list item is a node followed by its children.
   js/site.js draws the wires and handles the game filter. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tree { position: relative; container-type: inline-size; }
.tree ul { display: grid; gap: 12px; }
.tree .tree__roots { gap: 44px; }
.tree li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: start; column-gap: clamp(24px, 50cqw - 380px, 260px); } /* the widest branch is about 740px of nodes; the two gaps share whatever width is left, so the graph spans its container */
.node { position: relative; z-index: 1; white-space: nowrap; display: inline-flex; align-items: center; gap: 12px; padding: 9px 14px; border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--bg)); border-radius: 10px; background: var(--surface); font-size: 0.95rem; font-weight: 500; transition: opacity 0.25s, border-color 0.25s, box-shadow 0.25s; }
.node--root { padding: 13px 18px; border-color: var(--ink); font: 800 1.05rem var(--display); font-stretch: 112%; letter-spacing: 0.02em; text-transform: uppercase; }
.node__in { display: flex; gap: 4px; flex: none; }
.node__in i, .tree__key i { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.tree__wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.tree__wires path { fill: none; stroke: color-mix(in srgb, var(--ink) 30%, var(--bg)); stroke-width: 1.5; transition: opacity 0.25s, stroke 0.25s; }
.tree__key { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(28px, 4vw, 44px); }
.tree__key button { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font: 500 0.78rem var(--mono); cursor: pointer; transition: border-color 0.2s, color 0.2s; }
.tree__key button:hover, .tree__key button[aria-pressed="true"] { border-color: var(--dot); color: var(--ink); }
/* A game is picked: its nodes and wires light up in its colour, the rest fall back. */
.tree[data-game] .node:not(.is-on) { opacity: 0.28; }
.tree[data-game] .node.is-on { border-color: var(--hl); box-shadow: 0 0 0 1px var(--hl), 0 0 28px -8px var(--hl); }
.tree[data-game] .tree__wires path { opacity: 0.25; }
.tree[data-game] .tree__wires path.is-on { opacity: 1; stroke: var(--hl); }

/* Home: about -------------------------------------------------------- */
.about { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(28px, 7vw, 110px); align-items: center; }
.about__card { display: grid; gap: 18px; justify-items: start; max-width: 36rem; }
.about__pic { width: clamp(200px, 28vw, 340px); aspect-ratio: 1; object-fit: cover; border-radius: 28px; border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--bg)); box-shadow: 0 40px 90px -50px rgb(243 241 236 / 0.35); }
.about__card h2 { font: 650 clamp(1.4rem, 2.4vw, 1.9rem)/1.25 var(--body); letter-spacing: -0.015em; }
.about__card .btn { margin-top: 6px; }
/* Path: one row per entry, date, what, detail */
.path li { display: grid; grid-template-columns: 11em minmax(0, 5fr) minmax(0, 6fr); gap: 4px clamp(16px, 3vw, 40px); align-items: baseline; padding: 18px 0; border-top: 1px solid var(--line); }
.path li:last-child { border-bottom: 1px solid var(--line); }
.path h3 a { text-decoration-thickness: 1px; }
.path li > p:last-child { font-size: 0.93rem; color: var(--muted); }

/* Project header ----------------------------------------------------- */
.phead { padding-top: clamp(36px, 6vw, 72px); }
.phead__title { margin-top: 16px; font: 400 calc(clamp(3rem, 10.5vw, 8rem) * var(--game-scale)) / 0.95 var(--game-font), var(--display); letter-spacing: 0; color: var(--accent); overflow-wrap: anywhere; }
.proj--light .phead__title { color: var(--ink); }
.phead__pitch { margin-top: 20px; max-width: 46ch; font: 500 clamp(1.12rem, 2.1vw, 1.5rem)/1.42 var(--body); letter-spacing: -0.01em; text-wrap: pretty; }
.phead__img { width: 100%; margin-top: clamp(30px, 5vw, 56px); aspect-ratio: 16 / 8; object-fit: cover; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent); background: var(--surface); box-shadow: 0 60px 140px -70px color-mix(in srgb, var(--accent) 70%, transparent); }
.phead--phone { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(24px, 6vw, 80px); align-items: center; }
.phone { width: clamp(200px, 24vw, 270px); padding: 8px; border-radius: 36px; background: #1d2027; border: 1px solid #3a3f4b; box-shadow: 0 50px 90px -40px rgb(20 18 24 / 0.6); rotate: 3deg; }
.phone video { width: 100%; border-radius: 28px; background: #000; }

.facts { display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; gap: 18px 28px; margin-block: clamp(36px, 5vw, 56px) 0; padding-bottom: 24px; }
.facts dt { font: 500 0.7rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin-top: 5px; font-size: 0.95rem; font-weight: 600; max-width: 26ch; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.stats > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 8px; padding: clamp(18px, 2.6vw, 30px) clamp(12px, 2vw, 24px); border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; padding-left: 0; }
.stats dd { font: 400 calc(clamp(1.7rem, 3.8vw, 2.9rem) * var(--game-scale)) / 1 var(--game-font), var(--display); color: var(--accent); }
.proj--light .stats dd { color: var(--ink); }
.stats dt { font-size: 0.86rem; line-height: 1.4; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tags li { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font: 400 0.75rem var(--mono); color: var(--muted); }

/* Systems ------------------------------------------------------------ */
.systems { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(20px, 3.4vw, 48px); }
.systems--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.system { padding: 26px 0 30px; border-top: 1px solid var(--line); }
.system__n { font: 500 0.74rem var(--mono); letter-spacing: 0.1em; color: var(--accent); }
.proj--light .system__n { color: var(--muted); }
.system h3 { margin-top: 10px; font-size: 1.2rem; }
.system h3 + p { margin-top: 8px; font-size: 0.96rem; line-height: 1.62; color: color-mix(in srgb, var(--ink) 78%, var(--bg)); }
.codebase { padding-top: 16px; border-top: 1px solid var(--line); font: 400 0.8rem var(--mono); color: var(--muted); }

/* Flow --------------------------------------------------------------- */
.flow { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); counter-reset: step; }
.flow li { position: relative; padding: 26px 22px 0 0; border-top: 2px solid var(--accent); counter-increment: step; }
.flow li::before { content: counter(step); position: absolute; top: -15px; left: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 600 0.8rem var(--mono); }
.flow p { margin-top: 6px; font-size: 0.9rem; line-height: 1.5; color: var(--muted); }

/* Devlog ------------------------------------------------------------- */
.devlog li { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.devlog li:last-child { border-bottom: 1px solid var(--line); }
.devlog time { font: 500 0.8rem/1.9 var(--mono); color: var(--accent); }
.proj--light .devlog time { color: var(--ink); }

/* Problem / approach / result --------------------------------------- */
.psr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3.4vw, 48px); }
.psr li { padding-top: 22px; border-top: 1px solid var(--line); }
.psr li:last-child { border-top: 2px solid var(--accent); }
.psr .label { margin-bottom: 12px; }

/* Gallery ------------------------------------------------------------ */
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.shots--tall { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.shot { display: block; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: zoom-in; transition: border-color 0.2s; }
.shot:hover { border-color: var(--accent); }
.shot img { width: 100%; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.shot:hover img { transform: scale(1.04); }
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 56px 16px; border: 0; background: rgb(5 6 8 / 0.95); color: #f3f1ec; }
.lightbox[open] { display: grid; place-items: center; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; border-radius: 8px; }
.lightbox__cap { font-size: 0.88rem; color: #9a9da6; text-align: center; }
.lightbox__btn { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #3a3d46; border-radius: 50%; background: #0f1115; color: #f3f1ec; font-size: 1rem; cursor: pointer; }
.lightbox__btn:hover { border-color: #f3f1ec; }
.lightbox__close { top: 12px; right: 12px; }
.lightbox__prev { left: 12px; top: 50%; margin-top: -22px; transform: scaleX(-1); }
.lightbox__next { right: 12px; top: 50%; margin-top: -22px; }

/* Quotes ------------------------------------------------------------- */
.quotes { columns: 3 280px; column-gap: clamp(20px, 3.4vw, 48px); }
.quote { break-inside: avoid; margin-bottom: 30px; padding-left: 20px; border-left: 2px solid var(--accent); }
.quote blockquote { font-size: 1.08rem; line-height: 1.5; }
.quote figcaption { margin-top: 12px; font-size: 0.84rem; color: var(--muted); }
.quote figcaption b { color: var(--ink); font-weight: 600; margin-right: 4px; }

/* Next project ------------------------------------------------------- */
.next { margin-top: var(--gap); }
.next a { display: grid; gap: 10px; padding: clamp(26px, 5vw, 56px); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: calc(var(--r) + 6px); background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 12%, var(--bg)), var(--bg) 60%); color: var(--ink); text-decoration: none; transition: border-color 0.2s; }
.next a:hover { border-color: var(--accent); }
.next__title { font: 400 calc(clamp(2.2rem, 7vw, 4.8rem) * var(--game-scale)) / 1 var(--game-font), var(--display); color: var(--accent); }
.next__kind { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.95rem; }

/* Footer ------------------------------------------------------------- */
.foot { margin-top: var(--gap); padding-block: clamp(56px, 9vw, 120px) 36px; border-top: 1px solid var(--line); }
.foot__h { margin-top: 14px; max-width: 18ch; font-size: clamp(1.7rem, 3.4vw, 2.5rem); text-transform: uppercase; }
.foot__mail { display: inline-block; margin-top: 26px; font: 800 clamp(1.5rem, 6vw, 4.4rem)/1.05 var(--display); font-stretch: 108%; letter-spacing: -0.03em; text-decoration-thickness: 2px; text-decoration-color: var(--accent); overflow-wrap: anywhere; }
.foot__links { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 32px; }
.foot__links a { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: var(--muted); }
.foot__links a:hover { color: var(--ink); }
.foot__copy { margin-top: 44px; font: 400 0.76rem var(--mono); color: var(--muted); }

/* Playable demos ----------------------------------------------------- */
.toy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(24px, 6vw, 72px); align-items: center; padding: clamp(20px, 4vw, 52px); border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent); border-radius: calc(var(--r) + 6px); background: var(--surface); }
.toy__side { display: grid; gap: 14px; justify-items: start; }
.toy__side > p:not(.label) { max-width: 44ch; color: var(--muted); }
.toy__stats { display: flex; gap: 28px; }
.toy__stats div { display: flex; flex-direction: column-reverse; }
.toy__stats dd { font: 400 calc(1.9rem * var(--game-scale)) / 1.1 var(--game-font), var(--display); color: var(--accent); font-variant-numeric: tabular-nums; }
.proj--light .toy__stats dd { color: var(--ink); }
.toy__stats dt { font: 500 0.7rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.toy__side .toy__msg { min-height: 1.6em; font-weight: 600; color: var(--ink); }
.toy__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mines { display: grid; grid-template-columns: repeat(8, clamp(30px, 4.6vw, 48px)); gap: 5px; }
.tile { aspect-ratio: 1; padding: 0; border: 1px solid color-mix(in srgb, var(--ink) 30%, var(--bg)); border-radius: 7px; background: color-mix(in srgb, var(--ink) 12%, var(--surface)); color: var(--ink); font: 400 1.05rem var(--game-font), var(--mono); cursor: pointer; }
.tile:hover { border-color: var(--accent); }
.tile.is-open { background: var(--bg); border-color: var(--line); cursor: default; }
.tile.is-mark { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-color: var(--accent); }
.tile.is-mark::before { content: "×"; color: var(--accent); }
.tile.is-mine { background: color-mix(in srgb, #ff5a4d 30%, var(--bg)); border-color: #ff5a4d; }
.tile.is-mine::before { content: "●"; color: #ff5a4d; }
.snake { display: grid; gap: 16px; justify-items: center; }
.snake canvas { width: min(323px, 74vw); height: auto; border: 1px solid color-mix(in srgb, var(--ink) 30%, var(--bg)); border-radius: 14px; background: #f4f2f7; }
.snake__pad { display: grid; grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(2, 50px); gap: 6px; }
.snake__pad .btn { justify-content: center; padding: 0; border-radius: 12px; }
.snake__pad [data-dir="0,-1"] { grid-area: 1 / 2; }
.snake__pad [data-dir="-1,0"] { grid-area: 2 / 1; }
.snake__pad [data-dir="0,1"] { grid-area: 2 / 2; }
.snake__pad [data-dir="1,0"] { grid-area: 2 / 3; }

/* Small screens ------------------------------------------------------ */
@media (max-width: 900px) {
  /* Not enough width for a sideways graph: stack it as an indented outline. */
  .tree li { grid-template-columns: minmax(0, 1fr); }
  .tree li > ul { margin-top: 12px; padding-left: 34px; }
  .node { white-space: normal; }
  .tree .tree__roots { gap: 30px; }
}
@media (max-width: 1000px) {
  .systems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { grid-auto-flow: row; }
  .flow li { padding: 0 0 26px 30px; border-top: 0; border-left: 2px solid var(--accent); }
  .flow li:last-child { padding-bottom: 0; }
  .flow li::before { top: -2px; left: -15px; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; }
}
@media (max-width: 760px) {
  body { font-size: 1rem; }
  .hero { min-height: 0; padding-top: 88px; }
  .hero__in { grid-template-columns: minmax(0, 1fr); }
  .hero__stage { order: -1; width: min(300px, 74vw); margin-inline: auto; }
  .numbers dt { font-size: 0.78rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stats > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .games, .about, .section--split, .toy, .phead--phone { grid-template-columns: minmax(0, 1fr); }
  .section--split .section__head { position: static; }
  .systems, .systems--2, .psr { grid-template-columns: minmax(0, 1fr); }
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shots--tall { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phead__img { aspect-ratio: 16 / 10; }
  .phone { justify-self: center; rotate: 0deg; }
  .toy__board { justify-self: center; }
  .top__nav > a:not(.btn):nth-child(2) { display: none; }
  .devlog li, .path li { grid-template-columns: 1fr; gap: 2px; }
  .about__pic { width: min(220px, 60vw); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
