:root {
  /* v2 "Signal" theme. The -rgb triplets are for rgba(). */
  --bg: #0b0c0d;
  --s1: #141516;
  --s3: #1b1d20;
  --ln: #26282a;
  --ln2: #3a3c3f;
  --mu: #8d8b86;
  --tx: #e8e6e1;
  --ac: #ff6a3d;
  --fx2: #3dd5ff;
  --bg-rgb: 11, 12, 13;
  --tx-rgb: 232, 230, 225;
  --ac-rgb: 255, 106, 61;
  --display: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --gutter: 40px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--tx); font: 400 16px/1.5 var(--display); overflow-wrap: break-word; }
a { color: var(--tx); text-decoration: none; }
a:hover { color: var(--ac); }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 4px; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: var(--mono); font-size: 12px; }
.pad { padding: 120px var(--gutter) 60px; }
.label { display: flex; justify-content: space-between; gap: 16px; color: var(--mu); font-weight: 400; margin-bottom: 28px; }

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 12px; top: 12px; z-index: 200; background: var(--bg); padding: 8px 12px; }

/* Nav, cursor reticle, frame bar */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 40;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px;
  padding: 20px var(--gutter);
  font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  mix-blend-mode: difference;
}
.nav nav { display: flex; flex-wrap: wrap; gap: 28px; }
.nav a, .nav a:hover { color: #fff; }
.nav a:hover { opacity: .55; }
[data-mag] { display: inline-block; }
#trail { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 99; pointer-events: none; }

.reticle {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none;
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border: 1px solid #fff; mix-blend-mode: difference;
  transform: translate(-99px, -99px);
}
.reticle::before, .reticle::after { content: ""; position: absolute; background: #fff; opacity: .5; }
.reticle::before { left: 50%; top: -8px; bottom: -8px; width: 1px; }
.reticle::after { top: 50%; left: -8px; right: -8px; height: 1px; }
.reticle span { position: absolute; left: 46px; top: 30px; font-size: 10px; color: #fff; white-space: nowrap; }
@media (hover: none), (pointer: coarse) { .reticle { display: none; } }

.hud {
  position: fixed; inset: auto 0 0; height: 28px; z-index: 30;
  display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter);
  background: rgba(var(--bg-rgb), .8); border-top: 1px solid var(--ln);
  font-size: 10px; color: var(--mu);
}
#frame { width: 64px; color: var(--tx); }
.track { position: relative; flex: 1; height: 100%; background: repeating-linear-gradient(90deg, var(--ln2) 0 1px, transparent 1px 2%) bottom / 100% 8px no-repeat; }
#playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: var(--ac); }
#playhead::before { content: ""; position: absolute; top: 0; left: -4px; width: 9px; height: 9px; background: var(--ac); }

/* Hero */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 620px; overflow: hidden; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; }
.scan { position: absolute; left: 0; right: 0; top: -2%; height: 2px; background: linear-gradient(90deg, transparent, rgba(var(--ac-rgb), .53), transparent); animation: scan 5s linear infinite; pointer-events: none; }
.hero-foot { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 76px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; }
.kicker { color: var(--ac); letter-spacing: .1em; margin-bottom: 16px; }
/* Idle: a slight colour-fringe shimmer. script.js adds .glitching and .flicker for short bursts.
   `enter` stays first in both lists, or adding .glitching would replay the entrance. */
h1 {
  --idle: enter .4s ease-out, shimmer 2.8s ease-in-out infinite alternate;
  width: fit-content; font-family: "Chakra Petch", var(--display); font-weight: 700; font-size: clamp(56px, min(13vw, 21vh), 200px); line-height: .86; letter-spacing: -.01em;
  animation: var(--idle);
}
h1.glitching { animation: var(--idle), glitch .24s steps(1); }
h1 .letter.flicker { animation: flicker .18s steps(1); }
/* Idle: faint scanlines drifting down the hero */
.hero::after { content: ""; position: absolute; inset: -4px 0 0; background: repeating-linear-gradient(rgba(var(--tx-rgb), .04) 0 1px, transparent 1px 4px); animation: drift 1s linear infinite; pointer-events: none; }
h1 .letter { display: inline-block; will-change: transform, filter; }
.subtitle { margin-top: 20px; letter-spacing: .1em; max-width: 60ch; }
.hint { color: var(--mu); text-align: right; line-height: 1.8; margin-left: auto; }

/* Reel and marquee */
.reel { position: relative; aspect-ratio: 16 / 9; background: var(--s1); border: 1px solid var(--ln); }
.reel iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.reel-link { margin-top: 12px; }
.marquee { overflow: hidden; border-block: 1px solid var(--ln); padding: 18px 0; white-space: nowrap; font: 500 clamp(28px, 5vw, 64px) var(--display); letter-spacing: -.02em; }
.marquee-run { display: inline-flex; animation: marquee 30s linear infinite; }
.marquee-run span { padding-right: 32px; word-spacing: .25em; }
.marquee b { color: var(--ac); font-weight: 500; }

/* Coverflow */
.work {
  position: relative; height: 100vh; height: 100svh; min-height: 680px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 70%, var(--s3), var(--bg) 70%);
  user-select: none; touch-action: pan-y; overscroll-behavior-x: contain; cursor: grab;
}
.work > .label { position: absolute; top: 80px; left: var(--gutter); right: var(--gutter); z-index: 30; }
.floor { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--ac-rgb), .33), transparent); transform: translateY(120px); }
.stage { position: absolute; inset: 0; perspective: 1400px; }
.card, .bucket { position: absolute; left: 50%; top: 50%; width: min(58vw, 760px); aspect-ratio: 16 / 10; margin-top: -18vh; }
.bucket { transform: translate(-50%, 0); z-index: 25; pointer-events: none; }
.bucket canvas { display: block; width: 100%; height: 100%; }
/* Off-centre cards are unrendered placeholders: blurred and dim. The one landing in the centre
   renders as it arrives (--render-delay overlaps the end of the slide); a leaving card drops fast. */
.card {
  --slide: .24s cubic-bezier(.2, .8, .2, 1); --render-delay: .16s; --render: .32s ease-out;
  background: var(--s1); outline: 1px solid var(--ln); cursor: pointer; filter: blur(14px) brightness(.45);
  transition: transform var(--slide), opacity var(--slide), visibility var(--slide), filter .1s;
}
.card.on {
  outline-color: var(--ac); filter: blur(0) brightness(1);
  transition: transform var(--slide), opacity var(--slide), visibility var(--slide), filter var(--render) var(--render-delay);
}
.dragging .card { transition: none; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Anaglyph copies sit behind the main image, so the split shows as red and cyan fringes. */
.card .split { opacity: 0; mix-blend-mode: screen; }
.card .red { transform: translateX(-7px); filter: sepia(1) saturate(8) hue-rotate(-50deg); }
.card .cyan { transform: translateX(7px); filter: sepia(1) saturate(8) hue-rotate(150deg); }
.card.on:hover .split { opacity: .8; }
.card .wire { position: absolute; inset: 0; overflow: hidden; background: var(--bg); opacity: .85; pointer-events: none; transition: opacity .1s; }
.card.on .wire { opacity: 0; transition: opacity var(--render) var(--render-delay); }
.wire img { filter: grayscale(1) contrast(5) brightness(.55); opacity: .7; }
.wire::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(var(--ac-rgb), .4) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--ac-rgb), .4) 1px, transparent 1px); background-size: 32px 32px; }
.arrow { position: absolute; top: 46%; z-index: 30; width: 56px; height: 56px; border: 1px solid var(--ln2); background: rgba(var(--bg-rgb), .8); font-size: 20px; }
.arrow:hover, .button:hover, .passes button:hover { background: var(--ac); color: var(--bg); }
.prev { left: 24px; }
.next { right: 24px; }
.work-foot { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 44px; z-index: 30; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 24px; }
.num { color: var(--ac); margin-bottom: 8px; }
.sel-name { font-size: clamp(32px, 5vw, 72px); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.caption { margin-top: 8px; color: var(--mu); }
.ticks { display: flex; gap: 4px; }
.ticks button { width: 14px; height: 24px; border: 0; background: linear-gradient(var(--ln2), var(--ln2)) center / 100% 6px no-repeat; transition: width .3s; }
.ticks button[aria-current="true"] { width: 36px; background-image: linear-gradient(var(--ac), var(--ac)); }
.button { justify-self: end; white-space: nowrap; font-weight: 500; letter-spacing: .06em; border: 1px solid var(--ln2); padding: 12px 18px; }
.noscript { position: absolute; top: 45%; width: 100%; text-align: center; }

/* Credits */
.credits li { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) auto; gap: 8px 32px; align-items: center; padding: 24px 0; border-top: 1px solid var(--ln); }
.credits h3 { font-size: clamp(22px, 2.6vw, 36px); font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.credits p { color: var(--mu); }
.still { border: 1px dashed var(--ln2); background: var(--s1); color: var(--mu); padding: 12px 16px; font-size: 10px; }

/* About */
.about { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; padding-bottom: 120px; }
.about > div { max-width: 820px; }
.bio { font-size: clamp(28px, 3.6vw, 52px); line-height: 1.1; letter-spacing: -.03em; font-weight: 500; margin-bottom: 32px; }
.socials { display: flex; flex-wrap: wrap; gap: 24px; font-weight: 500; letter-spacing: .06em; }

/* Comp tree */
.tree { padding-top: 80px; padding-bottom: 120px; }
.tree svg { display: block; width: 100%; height: auto; overflow: visible; margin-top: 12px; }
.tree path { fill: none; stroke: var(--ln); stroke-width: 1.5; }
.tree path[data-ed] { stroke: var(--ac); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .tree [data-nd] { opacity: 0; }
.tree rect { fill: var(--s1); stroke: var(--ln2); }
.tree rect.tab { fill: var(--ac); stroke: none; }
.tree text { font: 500 13px var(--mono); fill: var(--tx); }
.tree text.sub { font-weight: 400; font-size: 10px; fill: var(--mu); }

/* Scroll-driven breakdown */
.breakdown { position: relative; height: 600vh; }
.pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: grid; grid-template-columns: minmax(180px, 300px) minmax(0, 1fr); gap: 40px; padding: 80px var(--gutter) 56px; align-items: center; align-content: center; }
.pin .label { margin-bottom: 20px; }
.pin h2 { font-size: clamp(26px, 3vw, 44px); font-weight: 500; line-height: 1; letter-spacing: -.03em; margin-bottom: 28px; }
.steps li { display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--ln); font-weight: 500; font-size: 15px; letter-spacing: .04em; opacity: .35; transition: .3s; }
.steps li span { color: var(--ac); font-size: 11px; }
.steps li.on { opacity: 1; color: var(--ac); padding-left: 10px; }
.bar { margin-top: 20px; height: 2px; background: var(--ln); }
#bar { height: 100%; width: 0; background: var(--ac); }
.viewer { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 100%; overflow: hidden; background: var(--s1); border: 1px solid var(--ln); }
.viewer img, .viewer .grid, .viewer .grain, .viewer .markers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.viewer img { object-fit: cover; transition: filter .8s; }
.grid { background-image: linear-gradient(rgba(var(--ac-rgb), .47) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--ac-rgb), .47) 1px, transparent 1px); background-size: 36px 36px; opacity: 0; transition: opacity .8s; }
.markers i { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 1px solid var(--ac); opacity: 0; transition: opacity .5s; background: linear-gradient(var(--ac), var(--ac)) center / 100% 1px no-repeat, linear-gradient(var(--ac), var(--ac)) center / 1px 100% no-repeat; }
.markers i:nth-child(2) { transition-delay: .08s; }
.markers i:nth-child(3) { transition-delay: .16s; }
.markers i:nth-child(4) { transition-delay: .24s; }
.markers i:nth-child(5) { transition-delay: .32s; }
.markers i:nth-child(6) { transition-delay: .4s; }
.grain { background: radial-gradient(transparent 55%, rgba(var(--bg-rgb), .67)); opacity: 0; transition: opacity .8s; }
[data-stage="0"] img, [data-stage="1"] img { filter: grayscale(.6) contrast(.7) brightness(.55); }
[data-stage="2"] img { filter: grayscale(1) contrast(5) brightness(.45); }
[data-stage="3"] img { filter: grayscale(1) contrast(2.2) brightness(.8) invert(1); }
[data-stage="4"] img { filter: grayscale(.3) contrast(1.3) brightness(.8) sepia(.4); }
[data-stage="5"] img { filter: none; }
[data-stage="1"] .grid { opacity: .35; }
[data-stage="2"] .grid { opacity: .9; }
[data-stage="1"] .markers i { opacity: 1; }
[data-stage="5"] .grain { opacity: 1; }
.tag { position: absolute; background: rgba(var(--bg-rgb), .73); padding: 4px 8px; font-size: 11px; font-weight: 500; }
.tag.top { top: 12px; left: 12px; }
.tag.bottom { bottom: 12px; right: 12px; }
.tag.stats { bottom: 12px; left: 12px; padding: 6px 10px; line-height: 1.7; }
.stats span { color: var(--mu); }
.stats b { font-weight: 500; }

/* Compare slider */
.compare { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--s1); border: 1px solid var(--ln); --pos: 50%; }
.compare:focus-within { outline: 2px solid var(--ac); outline-offset: 4px; }
.compare img, .compare .pass, .compare .grid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .pass { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
[data-pass="DEPTH"] img { filter: grayscale(1) contrast(2.2) brightness(.8) invert(1); }
[data-pass="NORMALS"] img { filter: hue-rotate(200deg) saturate(3) contrast(1.4); }
[data-pass="WIRE"] img { filter: grayscale(1) contrast(4) brightness(1.4); }
[data-pass="AO"] img { filter: grayscale(1) brightness(1.5) contrast(.7); }
[data-pass="WIRE"] .grid { opacity: .9; }
.divider { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--ac); }
.divider::after { content: ""; position: absolute; top: 50%; left: -8px; width: 18px; height: 18px; margin-top: -9px; background: var(--ac); }
.compare input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; touch-action: pan-y; }
.passes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.passes button { padding: 12px 18px; background: var(--s1); border: 1px solid var(--ln); font: inherit; }
.passes button[aria-pressed="true"] { background: var(--ac); color: var(--bg); }

/* Contact */
.contact { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding: 32px var(--gutter) 72px; border-top: 1px solid var(--ln); margin-top: 60px; }
.contact a { font-size: 14px; font-weight: 500; }
.contact .copy { color: var(--mu); }

/* Scroll reveals (only hidden when JavaScript is running) */
.js .rv { opacity: 0; transform: translateY(30px); transition: opacity .7s, transform .7s; }
.js .rv.in { opacity: 1; transform: none; }

/* `translate`, not `transform`, so the entrance and the glitch do not override each other. */
@keyframes enter { from { opacity: 0; translate: 0 16px; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes scan { from { top: -2%; } to { top: 102%; } }
@keyframes glitch {
  0% { text-shadow: -.035em 0 var(--ac), .035em 0 var(--fx2); transform: translateX(.02em); }
  35% { text-shadow: .035em 0 var(--ac), -.035em 0 var(--fx2); transform: translateX(-.02em); }
  70% { text-shadow: -.018em 0 var(--ac), .018em 0 var(--fx2); transform: none; }
}
@keyframes shimmer {
  from { text-shadow: -.5px 0 color-mix(in srgb, var(--ac) 55%, transparent), .5px 0 color-mix(in srgb, var(--fx2) 55%, transparent); }
  to { text-shadow: -1.5px 0 color-mix(in srgb, var(--ac) 55%, transparent), 1.5px 0 color-mix(in srgb, var(--fx2) 55%, transparent); }
}
@keyframes flicker {
  0%, 50% { color: rgba(var(--tx-rgb), .4); }
  25%, 75% { color: var(--tx); }
}
@keyframes drift { to { translate: 0 4px; } }

/* Short desktop screens: shrink hero, card and title so the carousel controls stay on screen. */
@media (min-width: 801px) and (max-height: 760px) {
  .hero { min-height: 520px; }
  .work { min-height: 520px; }
  .card, .bucket { width: min(58vw, calc((68vh - 170px) * 1.6)); }
  .work-foot { bottom: 36px; }
  .sel-name { font-size: clamp(28px, 7vh, 52px); }
}

@media (max-width: 800px) {
  :root { --gutter: 20px; }
  .nav { padding-block: 14px; font-size: 11px; }
  .nav nav { gap: 14px; }
  .pad { padding-block: 80px 40px; }
  .card, .bucket { width: 76vw; margin-top: -22vh; }
  .arrow { width: 44px; height: 44px; top: 58%; }
  .prev { left: 20px; }
  .next { right: 20px; }
  .work-foot { grid-template-columns: 1fr; justify-items: start; gap: 12px; }
  .button { justify-self: start; }
  .credits li { grid-template-columns: 1fr; justify-items: start; }
  .about { grid-template-columns: 1fr; padding-bottom: 80px; }
  .tree { padding-top: 40px; padding-bottom: 80px; }
  .tree svg { max-width: 420px; margin-inline: auto; }
  .pin { grid-template-columns: 1fr; gap: 20px; padding-block: 70px 44px; }
  .pin h2 { margin-bottom: 12px; }
  .pin .label { margin-bottom: 8px; }
  .steps li { padding: 4px 0; font-size: 13px; }
  .bar { margin-top: 10px; }
}

@media (max-width: 800px) and (max-height: 700px) {
  .work { min-height: 560px; }
  .arrow { top: auto; bottom: 232px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .rv { opacity: 1; transform: none; }
  .js .tree [data-nd] { opacity: 1; }
  .tree path[data-ed] { stroke-dashoffset: 0; }
  .hero::after { display: none; }
}
