:root {
  --bg: #fafaf9;
  --bg-2: #efece6;
  --bg-3: #e8e4dc;
  --fg: #14110d;
  --fg-2: #5d574e;
  --fg-3: #8a8478;
  --rule: #e2dfd8;
  --accent: oklch(0.68 0.14 62);
  --img-col: 22%;
  --img-aspect: 4/3;
  --img-radius: 3px;
  --row-gap: 28px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 96px 36px 96px;
}

/* ---------- Hero ---------- */
.hero { padding-bottom: 64px; }
.hero .wave {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; color: var(--fg-2);
  margin-bottom: 22px; letter-spacing: 0.01em;
}
.wave-emoji {
  display: inline-block;
  transform-origin: 70% 80%;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
.wave-emoji.waving {
  animation: wave-hand 1.6s ease-in-out 0s 1;
}
.wave-emoji.intro {
  animation: wave-hand 1.6s ease-in-out 1.2s 1;
}

/* ---------- Page entrance ---------- */
@keyframes fade-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-only {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fade-rise-deep {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-slide-right {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
:root { --fade-scale: 1.2; }
.fade-in {
  opacity: 0;
  animation: fade-rise calc(0.95s * var(--fade-scale)) cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: calc(var(--fade-delay, 0ms) * var(--fade-scale));
  will-change: opacity, transform;
}
.fade-in.no-rise { animation-name: fade-only; }
.fade-in.slide-right { animation-name: fade-slide-right; }
.fade-in.deep {
  animation-name: fade-rise-deep;
  animation-duration: calc(1.05s * var(--fade-scale));
}
@media (prefers-reduced-motion: reduce) {
  .fade-in { opacity: 1; transform: none; animation: none; }
}
@keyframes wave-hand {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(14deg); }
  30%  { transform: rotate(-7deg); }
  45%  { transform: rotate(14deg); }
  60%  { transform: rotate(-4deg); }
  75%  { transform: rotate(9deg); }
  100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .wave-emoji.intro { animation: none; }
}
.hero h1 {
  font-size: 46px; line-height: 1.12; font-weight: 500;
  letter-spacing: -0.02em; max-width: 40ch; margin-bottom: 24px;
  text-wrap: balance;
}
.hero .sub {
  color: var(--fg-2); max-width: 58ch;
  font-size: 16px; line-height: 1.6; margin-bottom: 24px;
}
.hero .links {
  display: flex; gap: 14px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--fg-3); align-items: center; flex-wrap: wrap;
}
.hero .links a, .hero .links button {
  font-family: inherit; font-size: inherit;
  color: var(--fg-2); border-bottom: 1px solid var(--rule);
  letter-spacing: 0.01em;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  padding: 4px 0;
  min-height: 32px;
  display: inline-flex; align-items: center;
}
.hero .links a:hover, .hero .links button:hover { color: var(--fg); border-bottom-color: var(--fg); }
.hero .links .dot { color: var(--fg-3); }

.site-foot {
  margin-top: 32px;
  padding: 24px 0 40px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--fg-3);
  letter-spacing: 0.01em;
}
.site-foot .foot-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: inherit; font-size: inherit; color: var(--fg-2);
  border-bottom: 1px solid var(--rule);
  transition: color 0.15s, border-color 0.15s;
}
.site-foot .foot-link:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* ---------- Filter bar ---------- */
.filter-bar {
  position: sticky; top: 0;
  background: rgba(250, 250, 249, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 10;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  margin-top: -1px;
}
.filter-bar .inner {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.chip {
  font-size: 12px; padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--fg-2);
  transition: all 0.15s;
  background: transparent;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  min-height: 32px;
}
.chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
@media (hover: hover) {
  .chip:hover:not(.on) { border-color: var(--fg-2); color: var(--fg); }
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: sticky; top: 0;
  background: rgba(250, 250, 249, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 10;
  margin: 32px -24px 0;
  padding: 0 24px;
}
/* The bottom rule is a pseudo-element so its left/right insets can animate
   between the Featured Projects content edge and the wider gallery edge. */
.tabbar::after {
  content: '';
  position: absolute;
  left: 24px; right: 24px; bottom: 0;
  height: 1px;
  background: var(--rule);
  transition: left 0.35s cubic-bezier(.65,.05,.36,1), right 0.35s cubic-bezier(.65,.05,.36,1);
  pointer-events: none;
}
.tabbar[data-active-panel="gallery"]::after { left: 0; right: 0; }
.tabbar-row {
  display: flex; gap: 32px; align-items: flex-end; position: relative;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  padding-top: 14px;
}
.tab {
  background: none; border: 0; padding: 10px 0 14px; cursor: pointer;
  font-family: inherit; font-size: inherit;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em;
  display: inline-flex; gap: 8px; align-items: baseline;
  transition: color 0.2s;
}
.tab .tab-count { font-size: 10px; color: var(--fg-3); opacity: 0.7; }
@media (hover: hover) { .tab:hover { color: var(--fg-2); } }
.tab.on { color: var(--fg); }
.tab.on .tab-count { color: var(--accent); opacity: 1; }
.tab-underline {
  position: absolute; bottom: -1px; left: 0; height: 2px;
  background: var(--fg);
  transition: left 0.35s cubic-bezier(.65,.05,.36,1), width 0.35s cubic-bezier(.65,.05,.36,1);
  pointer-events: none;
}

/* ---------- Tab panels ---------- */
/* Both panels share a single grid cell so cross-tab animations can run
   simultaneously without one taking the layout space of the other. */
.panel-stack { display: grid; }
.panel-stack > .panel { grid-area: 1 / 1; min-width: 0; }
.panel { padding-top: 0; }
.panel[hidden] { display: none; }
/* Enter is slightly delayed after exit starts, so the outgoing has a
   head-start out of the frame before the incoming arrives. */
.panel.panel-enter-from-right { animation: panel-enter-from-right 0.34s cubic-bezier(.2,.8,.2,1) 0.1s both; }
.panel.panel-enter-from-left  { animation: panel-enter-from-left  0.34s cubic-bezier(.2,.8,.2,1) 0.1s both; }
.panel.panel-exit-to-left     { animation: panel-exit-to-left     0.26s cubic-bezier(.4,0,.6,1) both; }
.panel.panel-exit-to-right    { animation: panel-exit-to-right    0.26s cubic-bezier(.4,0,.6,1) both; }
@keyframes panel-enter-from-right {
  from { opacity: 0; transform: translateX(72px); }
  to   { opacity: 1; transform: none; }
}
@keyframes panel-enter-from-left {
  from { opacity: 0; transform: translateX(-72px); }
  to   { opacity: 1; transform: none; }
}
@keyframes panel-exit-to-left {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateX(-72px); }
}
@keyframes panel-exit-to-right {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateX(72px); }
}
@media (prefers-reduced-motion: reduce) {
  .panel.panel-enter-from-right,
  .panel.panel-enter-from-left,
  .panel.panel-exit-to-left,
  .panel.panel-exit-to-right { animation: none; }
  .tabbar::after,
  .tab-underline { transition: none; }
}

/* ---------- Project rows ---------- */
.projects { padding-top: 0; }
.row {
  display: grid;
  grid-template-columns: var(--img-col) 1fr;
  gap: var(--row-gap);
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
  align-items: center;
  cursor: pointer;
  transition: opacity 0.25s, padding-left 0.35s cubic-bezier(.2,.8,.2,1);
  text-decoration: none;
  color: inherit;
}
.row.dim { opacity: 0.22; }
.rimg {
  aspect-ratio: var(--img-aspect);
  background: var(--bg-2);
  border-radius: var(--img-radius);
  position: relative; overflow: hidden;
  transition: transform 0.35s ease;
}
.rimg::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, rgba(20,17,13,0.04) 14px 15px);
}
.video-frame {
  position: relative;
  margin: 28px 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-2);
  line-height: 0;
}
.video-frame video {
  display: block;
  width: 100%;
  height: auto;
}
.video-replay {
  position: absolute;
  bottom: 12px; right: 12px;
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 0;
  background: rgba(20,17,13,0.55);
  color: #fafaf9;
  font-size: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s, transform 0.15s;
}
.video-replay:hover { background: rgba(20,17,13,0.85); transform: scale(1.05); }
.video-frame.ended .video-replay { display: flex; }

.rimg.has-img::before { display: none; }
.rimg img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
}
.rimg .ph {
  position: absolute; bottom: 10px; left: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; color: var(--fg-3);
  letter-spacing: 0.04em; line-height: 1.3;
  max-width: calc(100% - 24px);
}
.rbody { display: flex; flex-direction: column; gap: 8px; min-width: 0; user-select: text; -webkit-user-drag: none; }
.rbody .top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.rbody .kicker, .rbody .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg-3);
}
.rbody .kicker { text-transform: uppercase; letter-spacing: 0.08em; }
.rbody .meta { white-space: nowrap; }
.rbody h3 {
  font-size: 22px; line-height: 1.2; font-weight: 500;
  letter-spacing: -0.005em; text-wrap: balance;
}
.rbody h3 .title-wrap { color: var(--fg); }
.rbody .desc {
  font-size: 14px; color: var(--fg-2);
  line-height: 1.55; max-width: 60ch;
}
.rbody .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.rbody .tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; padding: 3px 8px;
  background: var(--bg-2);
  border-radius: 3px;
  color: var(--fg-2);
  letter-spacing: 0.02em;
}

@media (hover: hover) and (min-width: 768px) {
  .row:hover { padding-left: 8px; }
  .row:hover .rimg { transform: scale(1.005); }
}

/* ---------- Modal ---------- */
.scrim {
  position: fixed; inset: 0;
  background: rgba(20, 17, 13, 0.32);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.modal-wrap { position: relative; max-width: 560px; width: 100%; }
.modal {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 32px;
  box-shadow: 0 20px 60px -20px rgba(20,17,13,0.25);
  transform: translateY(8px);
  transition: transform 0.25s;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
}
.scrim.open .modal { transform: translateY(0); }
.modal h2 { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 6px; }
.modal .lede { color: var(--fg-2); font-size: 14px; line-height: 1.6; margin-bottom: 18px; }
.modal .tabs {
  display: inline-flex; gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border-radius: 8px;
  margin-bottom: 18px;
}
.modal .tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.02em;
  padding: 7px 14px;
  border-radius: 5px;
  border: 0; background: transparent; color: var(--fg-2);
  cursor: pointer;
}
.modal .tab.on { background: var(--bg); color: var(--fg); box-shadow: 0 1px 2px rgba(20,17,13,0.06); }
.modal .panels {
  position: relative;
  overflow: hidden;
  transition: height 0.28s cubic-bezier(.4,.0,.2,1);
}
.modal .tab-panel {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease;
  position: absolute; top: 0; left: 0; right: 0;
}
.modal .tab-panel.on {
  opacity: 1;
  visibility: visible;
  position: relative;
}
.modal .tab-panel p + p { margin-top: 14px; }
.modal h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 18px 0 8px; font-weight: 500;
}
.modal p { font-size: 14px; color: var(--fg-2); line-height: 1.6; margin-bottom: 8px; }
.modal code, .modal .codeblock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; background: var(--bg-2);
  border-radius: 3px; color: var(--fg);
}
.modal code { padding: 2px 6px; word-break: break-all; }
.modal .codeblock {
  display: block; padding: 12px 14px; line-height: 1.55;
  white-space: pre; overflow-x: auto;
}
.modal .snippet { position: relative; margin-bottom: 4px; }
.modal .snippet .codeblock { padding-right: 44px; }
.modal .snippet code { display: block; padding: 12px 44px 12px 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-all; }
.modal .copy-btn {
  position: absolute; top: 6px; right: 6px;
  width: 30px; height: 30px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.modal .copy-btn svg { width: 14px; height: 14px; }
.modal .copy-btn .icon-check { display: none; }
.modal .copy-btn.copied .icon-copy { display: none; }
.modal .copy-btn.copied .icon-check { display: block; color: var(--accent); }
.modal .close {
  position: absolute; top: 14px; right: 16px;
  font-size: 22px; color: var(--fg-3);
  padding: 6px; line-height: 1;
  min-width: 40px; min-height: 40px;
}
.modal .close:hover { color: var(--fg); }
.modal .try {
  margin-top: 14px;
  font-size: 13px;
  color: var(--fg-3);
  font-style: italic;
}

/* ---------- Project detail page ---------- */
.topbar {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 36px 0;
}
.back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--fg-2);
}
.back .arr { transition: transform 0.2s; }
.back:hover { color: var(--fg); }
.back:hover .arr { transform: translateX(-3px); }

article {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 36px 120px;
}
article .col { max-width: 760px; margin: 0 auto; }

article h1.title {
  font-size: 54px; line-height: 1.08; font-weight: 500;
  letter-spacing: -0.025em; text-wrap: balance;
  margin-bottom: 28px;
}
article .employer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; color: var(--fg-2);
  margin-bottom: 28px; letter-spacing: 0.01em;
}
article .employer .yr { color: var(--fg-3); margin-left: 10px; }
article .lede {
  font-size: 21px; line-height: 1.5;
  color: var(--fg-2); max-width: 38ch;
  text-wrap: pretty; font-weight: 300;
  margin-bottom: 48px;
}

.hero-img {
  aspect-ratio: 16/9;
  background: var(--bg-2);
  position: relative; overflow: hidden;
  border-radius: 4px;
  margin: 0 0 28px;
  border: 1px solid var(--rule);
}
.hero-img::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, transparent 0 18px, rgba(20,17,13,0.04) 18px 19px);
}
.hero-img .ph {
  position: absolute; bottom: 14px; left: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--fg-3);
  letter-spacing: 0.04em;
}
.caption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg-3);
  margin-bottom: 48px; letter-spacing: 0.01em;
}

article .col h2 {
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--fg-3);
  margin: 48px 0 16px;
}
article .col h3 {
  font-size: 26px; font-weight: 500;
  letter-spacing: -0.015em; line-height: 1.25;
  margin: 56px 0 18px; text-wrap: balance;
}
/* When h3 follows the kicker (h2), tighten the gap so they read as a pair. */
article .col h2 + h3 { margin-top: 4px; }
article .col p {
  margin-bottom: 18px;
  color: var(--fg);
  max-width: 62ch;
  font-size: 16px; line-height: 1.65;
}
article .col ul, article .col ol {
  max-width: 62ch;
  margin: 0 0 18px 22px;
}
article .col li { margin-bottom: 8px; color: var(--fg); line-height: 1.6; }
article .col blockquote {
  margin: 36px auto;
  padding: 0 24px;
  max-width: 56ch;
  text-align: center;
  border: 0;
}
article .col blockquote p {
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.4;
  font-style: italic;
  color: var(--fg);
  margin: 0 auto 14px;
  letter-spacing: -0.005em;
  text-wrap: balance;
  max-width: none;
}
article .col blockquote p:last-of-type { margin-bottom: 0; }
article .col blockquote cite, article .col blockquote footer {
  display: block;
  font-style: normal;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 14px;
}
@media (max-width: 767px) {
  article .col blockquote p { font-size: 17px; }
}

/* Body images. Default: matches prose width (~62ch). */
article .col img {
  display: block;
  width: 100%;
  max-width: 62ch;
  height: auto;
  border-radius: var(--img-radius);
  margin: 32px 0;
}
article .col figure {
  margin: 32px 0;
  max-width: 62ch;
}
article .col figure img { margin: 0; max-width: 100%; }
article .col figure figcaption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 10px;
}
/* Wide: breaks out of the 760px text column to the full article width. */
article .col figure.wide {
  position: relative;
  width: min(972px, 100vw - 48px);
  max-width: none;
  left: 50%;
  transform: translateX(-50%);
}
article .col figure.wide img { width: 100%; max-width: none; }
/* Two-up: side-by-side images. */
article .col figure.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
article .col figure.two-up img { margin: 0; width: 100%; }
@media (max-width: 767px) {
  article .col figure.two-up { grid-template-columns: 1fr; }
}

/* Split: image on one side, prose block on the other. Breaks out of the
   text column to use the article width. */
article .col .split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
  margin: 56px 0 48px;
  max-width: 1080px;
  margin-left: calc(380px - 540px); /* nudge left so it visually centers in article */
}
/* Simpler: just let it center via the column's own centering. */
article .col .split {
  margin-left: 0; margin-right: 0;
  max-width: none;
}
article .col .split.reverse { direction: rtl; }
article .col .split.reverse > * { direction: ltr; }
article .col .split img {
  width: 100%; max-width: none; margin: 0;
  aspect-ratio: 4/5;
  object-fit: cover;
}
article .col .split.lopsided { grid-template-columns: 1.1fr 1.9fr; }
article .col .split figure.low-res {
  display: flex;
  justify-content: center;
  margin: 0;
}
article .col .split figure.low-res img {
  width: 100%; max-width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  image-rendering: auto;
}
@media (max-width: 767px) {
  article .col .split.lopsided { grid-template-columns: 1fr; }
}
article .col .split .video-frame {
  margin: 0;
  width: 100%;
}
article .col .split .video-frame video {
  width: 100%; height: auto;
}
article .col .split .split-text { max-width: 460px; }
article .col .split .split-text h2 { margin-top: 0; }
article .col .split .split-text p { max-width: none; }
@media (max-width: 767px) {
  article .col .split {
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 32px 0;
  }
  article .col .split.reverse { direction: ltr; }
  article .col .split img { aspect-ratio: 16/9; }
}

article .col a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.highlights {
  background: var(--bg-2);
  border-radius: 4px;
  padding: 20px 24px;
  margin: 24px 0 36px;
}
.highlights .hlbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.highlights ul { margin: 0; padding-left: 18px; }
.highlights li { margin-bottom: 8px; font-size: 15px; line-height: 1.55; color: var(--fg); }

.next-row {
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 12px;
}
.next-row .nx-group {
  display: flex; flex-direction: column; gap: 8px;
}
.next-row .nx {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.next-row a.next-link {
  font-size: 22px; font-weight: 500;
  letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--fg);
}
.next-row a.next-link .arr { transition: transform 0.2s; color: var(--fg-3); }
.next-row a.next-link:hover .arr { transform: translateX(4px); color: var(--accent); }
.next-row a.back { font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  main { padding: 72px 28px 72px; }
  .hero h1 { font-size: 38px; }
  article { padding: 48px 28px 96px; }
  article h1.title { font-size: 44px; }
}

/* ---------- Shared clip-detail visual building blocks ---------- */
.clip-detail-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--rule);
}
.clip-detail-media {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.clip-detail-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.clip-detail-top {
  display: flex; gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.clip-detail-top .num { color: var(--fg); font-weight: 500; }
.clip-detail-ttl {
  font-size: 24px; font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.22;
  text-wrap: balance;
}
.clip-detail-prose {
  font-size: 14.5px; color: var(--fg-2);
  line-height: 1.65; max-width: 56ch;
}
.clip-detail-specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px dashed var(--rule);
}
@media (max-width: 760px) {
  .clip-detail-specs { border-top: 0; padding-top: 0; margin-top: 0; }
}
.clip-spec { display: flex; flex-direction: column; gap: 3px; }
.clip-spec .k {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.clip-spec .v { font-size: 13px; color: var(--fg); }
/* ---------- Interaction Gallery (single-column card stack) ---------- */
.cards-panel { padding-top: 0; }
.card-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg);
}
.card-row:first-child { padding-top: 16px; }
.card-row {
  display: grid;
  width: calc(100% + 48px);
  min-width: 0;
  grid-template-columns: minmax(280px, 46%) 1fr;
  gap: 40px;
  align-items: start;
  padding: 36px 24px 40px;
  margin: 0 -24px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  transition: background-color 160ms ease;
}
@media (hover: hover) {
  .card-row:hover { background-color: rgba(20,17,13,0.025); }
}
/* Wide variant: media full-width on top; body below splits into prose + specs */
.card-row.wide {
  grid-template-columns: 1fr;
  gap: 28px;
  padding: 36px 24px 40px;
}
.card-row.wide .card-row-stage { max-width: none; max-height: none; }
.card-row.wide .clip-detail-body {
  display: grid;
  grid-template-columns: 1fr 240px;
  grid-template-areas:
    "stamp ."
    "title specs"
    "prose specs";
  column-gap: 36px;
  row-gap: 14px;
  align-items: start;
}
.card-row.wide .clip-detail-body > .clip-detail-top { grid-area: stamp; }
.card-row.wide .clip-detail-body > .clip-detail-ttl { grid-area: title; }
.card-row.wide .clip-detail-body > .clip-detail-prose { grid-area: prose; max-width: 64ch; }
.card-row.wide .clip-detail-body > .clip-detail-specs {
  grid-area: specs;
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
  grid-template-columns: 1fr;
  gap: 18px;
  align-self: start;
}
/* Below desktop-roomy width: the +24px outward extension would clip near or
   past the viewport edge. Switch to full viewport bleed for the bg/blur, with
   the content padded back inside via calc. The rule line stays at content edge. */
@media (max-width: 1023px) {
  .card-row, .card-row.wide {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: calc(50vw - 50%);
    padding-right: calc(50vw - 50%);
  }
  .tabbar {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: calc(50vw - 50%);
    padding-right: calc(50vw - 50%);
  }
  .tabbar::after, .tabbar[data-active-panel="gallery"]::after {
    left: calc(50vw - 50%);
    right: calc(50vw - 50%);
  }
}
@media (max-width: 760px) {
  /* Mobile layout: drop the 2-col grid and tighten vertical padding. Bleed
     comes from the (max-width: 1023px) rule above. */
  .card-row { grid-template-columns: 1fr; gap: 22px; padding-top: 28px; padding-bottom: 32px; }
  .card-row.wide { padding-top: 28px; padding-bottom: 32px; }
  /* Drop the wide layout's grid-areas split on mobile: stack the body items
     normally so scrollytelling reads like every other clip. */
  .card-row.wide .clip-detail-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    grid-template-areas: none;
    grid-template-columns: 1fr;
  }
  /* Match specificity of the desktop wide-specs rule above to actually win. */
  .card-row.wide .clip-detail-body > .clip-detail-specs {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}
/* Touch / no-hover devices: an interactive play/pause button on each video
   stage. Desktop hides it and relies on hover-play instead. */
.clip-play {
  position: absolute;
  bottom: 10px; right: 10px;
  width: 36px; height: 36px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background-color: rgba(20, 17, 13, 0.62);
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: 18px 18px;
  /* Play triangle, optically nudged ~1px right since the visual center sits
     left of the bounding-box center. Stroke + paint-order rounds the corners. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white' stroke='white' stroke-width='2.2' stroke-linejoin='round' paint-order='stroke fill'><path d='M9 6.5v11l9-5.5z'/></svg>");
  cursor: pointer;
  display: none;
  z-index: 2;
  transition: background-color 0.15s ease;
}
.clip-play[data-state="playing"] {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><rect x='6.5' y='5' width='4' height='14' rx='1.5'/><rect x='13.5' y='5' width='4' height='14' rx='1.5'/></svg>");
}
.clip-play:active { background-color: rgba(20, 17, 13, 0.85); }
/* Progress ring around the play button. JS animates ring-progress's
   stroke-dashoffset and toggles data-loop-parity each loop so the colors
   swap places, avoiding a snap on restart. */
.clip-play-ring {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0;
  transform: rotate(-90deg);
  transition: opacity 0.18s ease;
}
.clip-play[data-state="playing"] .clip-play-ring { opacity: 1; }
.clip-play-ring circle {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.clip-play-ring .ring-base { stroke: rgba(255, 255, 255, 0.9); }
.clip-play-ring .ring-progress { stroke: rgba(20, 17, 13, 0.85); }
.clip-play[data-loop-parity="odd"] .ring-base { stroke: rgba(20, 17, 13, 0.85); }
.clip-play[data-loop-parity="odd"] .ring-progress { stroke: rgba(255, 255, 255, 0.9); }
@media (hover: none), (max-width: 1023px) {
  .clip-play { display: block; }
}
.card-row-stage {
  position: relative;
  width: 100%;
  /* Cap the height of side-by-side stages so portrait clips don't tower over
     landscape ones. The video's object-position controls which slice shows. */
  max-height: 360px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  align-self: start;
}
.clip-spec-link {
  color: var(--fg);
  transition: color 0.15s;
}
.clip-spec-link:hover { color: var(--accent); }
.clip-spec-link .arr { display: inline-block; transition: transform 0.18s ease; }
.clip-spec-link:hover .arr { transform: translateX(3px); }

@media (max-width: 767px) {
  main { padding: 56px 20px 64px; }
  .hero { padding-bottom: 40px; }
  .hero .wave { margin-bottom: 16px; }
  .hero h1 { font-size: 32px; max-width: none; margin-bottom: 18px; }
  .hero .sub { font-size: 15px; margin-bottom: 18px; }
  .hero .links { gap: 10px; row-gap: 8px; }

  .filter-bar { padding: 14px 0; margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
  .filter-bar .inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .filter-bar .inner::-webkit-scrollbar { display: none; }
  .chip { padding: 10px 14px; min-height: 38px; font-size: 12px; }

  .row {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 22px 0;
  }
  .rimg { aspect-ratio: 16/9; }
  .rbody h3 { font-size: 20px; }

  /* Project detail */
  .topbar { padding: 24px 20px 0; }
  article { padding: 36px 20px 80px; }
  article h1.title { font-size: 34px; }
  article .lede { font-size: 18px; max-width: none; margin-bottom: 36px; }
  article .col p { font-size: 15px; }
  .hero-img { margin-bottom: 20px; }
  .caption { margin-bottom: 32px; }
  article .col h2 { margin-top: 40px; }
  article .col h3 { font-size: 22px; }

  .next-row { margin-top: 64px; }
  .next-row a.next-link { font-size: 18px; }

  /* Modal */
  .scrim { padding: 12px; }
  .modal { padding: 24px 20px; }
  .modal h2 { font-size: 20px; }
}
