/* Inter Tight, self-hosted (variable 100–900). Latin + Latin Extended covers Lithuanian (ą č ę ė į š ų ū ž). */
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter-tight-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter-tight-latin-ext.woff2?v=2") format("woff2"); unicode-range: U+0100-017F; }

:root {
  /* one corner radius for every card, image and panel (matches the private-project dialog) */
  --radius: 28px;
  --radius-sm: 16px;
  --bg: #0a0a0a;
  --bg-2: #141414;
  --fg: #fafafa;
  --fg-soft: #dcdcdc;
  --muted: #9a9a9a;
  --line: rgba(255, 255, 255, 0.12);
  --pill: rgba(28, 28, 28, 0.72);
  --glass: rgba(40, 40, 40, 0.38);
  --glass-fg: #fafafa;
  --glass-hover: rgba(255, 255, 255, 0.1);
  --glass-active: rgba(255, 255, 255, 0.92);
  --glass-active-fg: #000;
  --glass-rim: rgba(255, 255, 255, 0.45);
  --glass-rim-2: rgba(255, 255, 255, 0.12);
  --glass-edge: rgba(255, 255, 255, 0.14);
  --glass-glow: rgba(255, 255, 255, 0.07);
  --gutter: clamp(16px, 2.6vw, 40px);
  --font: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* iOS 26 tab bar / glass controls (dark mode values; light pages override them, see build.mjs) */
  --tab-bg: rgba(44, 44, 46, 0.62);
  --tab-sel: rgba(18, 18, 18, 0.9);
  --tab-fg: #f5f5f5;
  --tab-accent: #0091ff;
  --tab-hover: rgba(255, 255, 255, 0.08);
  --tab-rim: inset 0 1px 0.5px rgba(255, 255, 255, 0.22), inset 0 0 0 0.5px rgba(255, 255, 255, 0.1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 4px; }

.caps { text-transform: uppercase; letter-spacing: 0.02em; }
.muted { color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 22px var(--gutter);
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar .brand { justify-self: start; }
.topbar .social { display: flex; gap: 28px; justify-self: end; }
.topbar .social a, .topbar .brand { transition: opacity 0.2s; }
.topbar .social a:hover, .topbar .brand:hover { opacity: 0.6; }
.topbar .clock { font-variant-numeric: tabular-nums; }
.page .topbar { background: linear-gradient(var(--bg) 40%, transparent); }

/* ---------- bottom tab bar ---------- */
/* iOS 26 Liquid Glass tab bar, values from Apple's iOS 26 UI kit (Tab Bar - iPhone):
   glass capsule (white 65% light / dark glass), 4px inset, 0 8px 40px 12% shadow; text-only tabs;
   the selected tab sits on a grey capsule in the system blue. */
.nav {
  position: fixed; left: 50%; bottom: 20px; z-index: 50; transform: translateX(-50%);
  display: flex; padding: 4px;
  border-radius: 296px; background: var(--tab-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.8); backdrop-filter: blur(14px) saturate(1.8);
  box-shadow: var(--tab-rim), 0 8px 40px rgba(0, 0, 0, 0.12);
  isolation: isolate;
}
.nav a {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-width: 76px; height: 46px; padding: 0 20px; border-radius: 100px;
  color: var(--tab-fg); font-family: var(--font); font-size: 15px; font-weight: 400;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
/* active tab keeps the site's own colours: white pill on dark pages, near-black pill on light ones */
.nav a[aria-current="page"] {
  background: var(--glass-active); color: var(--glass-active-fg);
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.9), 0 2px 10px rgba(0, 0, 0, 0.18);
}
.nav a:active { transform: scale(0.94); }
@media (hover: hover) { .nav a:not([aria-current]):hover { background: var(--tab-hover); } }

/* ---------- home hero ---------- */
.hero { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
.hero-name, .hero-tag {
  position: absolute; top: 50%; z-index: 5; margin: 0; transform: translateY(-50%);
  pointer-events: none;
}
.home { overflow: hidden; overscroll-behavior: none; }
.hero-name {
  left: var(--gutter);
  font-size: clamp(40px, 4.6vw, 80px); font-weight: 600; line-height: 1.04; letter-spacing: -0.035em;
  text-transform: uppercase;
}
.hero-name span { display: block; }
.hero-tag {
  right: var(--gutter); width: min(24vw, 360px);
  font-size: clamp(18px, 1.55vw, 26px); font-weight: 400; line-height: 1.2; letter-spacing: -0.02em;
}

/* Cedar-style deck: cards sit along the depth axis of a plane tilted 45deg;
   main.js positions each card and handles drift, wheel and touch. */
.stage {
  position: absolute; inset: 0; z-index: 1; overflow: hidden;
  perspective: 2650px; perspective-origin: 50% 50%;
  touch-action: none;
}
.plane {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  transform-style: preserve-3d;
  transform: scale(var(--deck-scale, 1)) translateY(calc(var(--cam, 0) * -24px)) rotateX(calc(-45deg + var(--cam, 0) * 5deg));
}
.deck-card {
  position: absolute; left: -200px; top: -250px; width: 400px; height: 500px;
  border-radius: var(--radius); overflow: hidden; background: var(--bg-2);
  will-change: transform, filter, opacity;
  backface-visibility: hidden;
}
/* phones: no per-frame blur, so don't reserve filter layers either */
.lite .deck-card { will-change: transform, opacity; }
.deck-card .shade { position: absolute; inset: 0; z-index: 1; background: #000; opacity: 0; pointer-events: none; }
.deck-card .label { z-index: 2; }
.deck-card img { width: 100%; height: 100%; object-fit: cover; }
/* covers: hidden until fully loaded (no half-painted progressive JPEGs), then a soft fade-in */
.js .deck-card img, .js .card img { opacity: 0; scale: 1.14; filter: blur(16px); transition: opacity 1s var(--ease), scale 1.6s var(--ease), transform 1.1s var(--ease), filter 1.3s var(--ease); }
.js .deck-card img.loaded, .js .card img.loaded { opacity: 1; scale: 1; filter: blur(0); }
/* deck: no grey slabs while covers load; the card itself appears with its cover */
.js .deck-card { background: transparent; transition: background-color 1.2s var(--ease); }
.js .deck-card:has(img.loaded) { background: var(--bg-2); }
/* covers set to "show whole cover": scaled down inside the card on the project's page colour */
.deck-card img.fit, .card img.fit { object-fit: contain; padding: 8%; }
/* zoomed: anchored to the top edge (nudged up past the image's own white top margin, ~1.3% of its height, times the zoom);
   the element runs past the card's bottom so its background fills the whole card */
.deck-card img.fit.zoom, .card img.fit.zoom {
  position: absolute; left: 0; top: -3.5%; width: 100%; height: 112%;
  padding: 0; object-position: 50% 0; transform-origin: 50% 0;
  transform: scale(var(--cover-zoom));
}
.card:hover img.fit.zoom { transform: scale(calc(var(--cover-zoom) * 1.04)); }
.deck-card .label {
  position: absolute; left: 16px; right: 16px; bottom: 14px;
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 15px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.02em;
  opacity: 0; transition: opacity 0.3s; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}
.deck-card:hover .label, .deck-card:focus-visible .label, .deck-card.picked .label { opacity: 1; }
.no-js .deck-card:not(:first-child) { display: none; }

/* letter-by-letter blur reveal */
.split .ch { display: inline-block; white-space: pre; opacity: 0; filter: blur(12px); transform: translateY(0.25em); animation: ch-in 0.9s var(--ease) forwards; }
.split .w { display: inline-block; white-space: nowrap; }
@keyframes ch-in { to { opacity: 1; filter: blur(0); transform: none; } }

.card {
  position: relative; display: block; overflow: hidden; border-radius: var(--radius);
  aspect-ratio: 1350 / 939; background: var(--bg-2);
}
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease), filter 0.5s; }
.card .label {
  position: absolute; left: 14px; right: 14px; bottom: 12px;
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.02em;
  opacity: 0; transform: translateY(6px); transition: opacity 0.3s, transform 0.3s var(--ease);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
.card:hover img { transform: scale(1.04); }
.card:hover .label, .card:focus-visible .label { opacity: 1; transform: none; }

/* ---------- inner pages ---------- */
.wrap { padding: 120px var(--gutter) 140px; }
.eyebrow { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); }
.display {
  margin: 0; font-weight: 600; text-transform: uppercase;
  /* 1.04, not tighter: Lithuanian accents (Ų Ž Č Ū) need room between lines */
  font-size: clamp(44px, 8.4vw, 150px); line-height: 1.04; letter-spacing: -0.045em;
}
.lead {
  margin: 0; font-size: clamp(22px, 2.6vw, 40px); line-height: 1.15; letter-spacing: -0.025em; font-weight: 400;
  max-width: 22em;
}

/* works list */
.works-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: clamp(32px, 5vw, 72px); }
.works-head .eyebrow { padding-bottom: 0.6em; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 3vw, 48px) clamp(12px, 1.4vw, 20px); }
.work { display: block; }
.work .card { aspect-ratio: 4 / 3; }
.work .meta {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: baseline;
  padding-top: 14px; font-size: 15px;
}
.work .meta .name { font-weight: 500; }
.work .meta .type { color: var(--muted); font-size: 13px; text-align: right; }

/* works: filter + display bar */
.works-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; margin-bottom: clamp(24px, 3vw, 40px); }
/* like iOS filter rows (App Store, Photos): separate Liquid Glass pills on a row that scrolls sideways when it
   doesn't fit; the edge that has more to scroll fades out (main.js sets fade-l / fade-r) */
.works-bar { flex-wrap: nowrap; align-items: center; }
.seg {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 2px 0;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  --fl: #000; --fr: #000;
  -webkit-mask-image: linear-gradient(90deg, var(--fl), #000 56px, #000 calc(100% - 56px), var(--fr));
  mask-image: linear-gradient(90deg, var(--fl), #000 56px, #000 calc(100% - 56px), var(--fr));
}
.seg.fade-l { --fl: transparent; }
.seg.fade-r { --fr: transparent; }
.seg::-webkit-scrollbar { display: none; }
.seg[aria-label="Display"] { flex: none; }
.seg-label { display: none; }
.seg button {
  flex: none; height: 38px; padding: 0 18px; border: 0; border-radius: 100px; color: var(--tab-fg);
  font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer;
  background: var(--tab-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.8); backdrop-filter: blur(14px) saturate(1.8);
  box-shadow: var(--tab-rim);
  transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}
@media (hover: hover) { .seg button:not([aria-pressed="true"]):hover { box-shadow: var(--tab-rim), inset 0 0 0 100px var(--tab-hover); } }
.seg button:active { transform: scale(0.95); }
.seg button[aria-pressed="true"] {
  background: var(--glass-active); color: var(--glass-active-fg);
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.9), 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* works: list rows, big names; the others fade while one is hovered */
.rows { margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 24px;
  padding: clamp(14px, 1.6vw, 22px) 0; border-top: 1px solid var(--line);
  transition: opacity 0.35s var(--ease);
}
.row-thumb { display: none; }
.row-name { font-size: clamp(30px, 5.2vw, 88px); font-weight: 600; line-height: 1.04; letter-spacing: -0.04em; text-transform: uppercase; transition: transform 0.45s var(--ease); }
.row-type { color: var(--muted); font-size: 14px; text-align: right; }
/* arrow in a round Liquid Glass button */
.row-arrow {
  display: grid; place-items: center; width: clamp(40px, 3.6vw, 56px); aspect-ratio: 1; border-radius: 50%;
  font-size: clamp(16px, 1.4vw, 22px); color: var(--tab-fg); background: var(--tab-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.8); backdrop-filter: blur(14px) saturate(1.8);
  box-shadow: var(--tab-rim), 0 8px 24px rgba(0, 0, 0, 0.14);
  opacity: 0; transform: translate(-8px, 8px) scale(0.9); transition: opacity 0.3s, transform 0.4s var(--ease);
}
@media (hover: hover) {
  .rows:hover .row { opacity: 0.28; }
  .rows .row:hover { opacity: 1; }
  .row:hover .row-name { transform: translateX(12px); }
  .row:hover .row-arrow { opacity: 1; transform: none; }
}
.row:focus-visible .row-arrow { opacity: 1; transform: none; }
.row-preview {
  position: fixed; left: 0; top: 0; z-index: 40; width: 340px;
  border-radius: var(--radius); overflow: hidden; pointer-events: none; background: var(--bg-2);
  opacity: 0; scale: 0.85; transition: opacity 0.3s var(--ease), scale 0.4s var(--ease);
}
.row-preview.on { opacity: 1; scale: 1; }
.row-preview img { display: block; width: 100%; height: auto; }

/* playable demo in a phone frame */
.demo {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(24px, 4vw, 64px);
  margin-bottom: clamp(40px, 5vw, 72px); padding: clamp(24px, 4vw, 56px); border-radius: var(--radius); background: var(--bg-2);
}
.demo-copy { display: grid; gap: 14px; align-content: center; }
.demo-title { margin: 0; font-size: clamp(40px, 5vw, 84px); font-weight: 600; line-height: 1; letter-spacing: -0.045em; text-transform: uppercase; }
.demo-copy p { margin: 0; font-size: clamp(17px, 1.4vw, 21px); line-height: 1.4; letter-spacing: -0.01em; color: var(--muted); max-width: 22em; }
/* the phone rises and settles in as the section scrolls into view */
.demo .phone { transform: translateY(70px) rotate(-3deg) scale(0.96); opacity: 0; transition: transform 1.3s var(--ease) 0.1s, opacity 0.9s var(--ease) 0.1s; }
.demo.in .phone { transform: none; opacity: 1; }
/* Apple iPhone 17 Pro bezel image on top of the screen (450x920, opening 402x874 at 24,23) */
.phone { position: relative; width: min(420px, 88vw); aspect-ratio: 450 / 920; filter: drop-shadow(0 40px 50px rgba(0, 0, 0, 0.3)); }
.bezel { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; pointer-events: none; user-select: none; }
/* screen: iPhone 17 Pro proportions; everything inside is sized in cqw (1cqw = 1% of the screen width) so it scales exactly */
.phone-screen {
  position: absolute; left: 5.333%; top: 2.5%; width: 89.333%; height: 95%;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 13.6% / 6.3%;
  background: #000; color: #fff; container-type: inline-size;
}
/* Before Play, the blurred poster runs behind the status bar and the hidden Safari bar. Once the demo is live
   the status bar is solid black (like Safari over a dark page: the game's top edge is always dark, whatever
   colour its sky is), and the Safari bar takes the demo's own bottom colour (--demo-bottom). */
.ios-view { position: relative; flex: 1; min-height: 0; background: var(--demo-bottom, #000); }
.demo-play { overflow: visible; }
/* flag on the game's balance pill, in game pixels (the game is laid out 359px wide = 100cqw) */
.demo-flag { position: absolute; left: calc(209cqw * 100 / 359 - 2.9cqw); top: calc(26cqw * 100 / 359 - 2.9cqw); z-index: 1; width: 5.8cqw; height: 5.8cqw; pointer-events: none; opacity: 0; transition: opacity 0.5s var(--ease); }
.no-flag-emoji .ios-view.live .demo-flag { opacity: 1; }
.ios-status {
  position: relative; z-index: 2; isolation: isolate;
  flex: none; display: flex; align-items: center; justify-content: space-between; height: 15.4cqw; padding: 1cqw 8.4cqw 0 10.4cqw;
  font-size: 4.3cqw; font-weight: 600; letter-spacing: -0.01em; font-family: -apple-system, "SF Pro Text", "Inter Tight", system-ui, sans-serif;
}
.ios-status::before { content: ""; position: absolute; inset: 0; z-index: -1; background: #000; opacity: 0; transition: opacity 0.5s var(--ease); }
.phone-screen:has(.ios-view.live) .ios-status::before { opacity: 1; }
.ios-icons { display: flex; align-items: center; gap: 1.6cqw; }
.ios-icons svg { display: block; height: 3cqw; width: auto; fill: currentColor; }
.ios-icons .i-batt { height: 3.2cqw; }
/* iOS 26 Safari compact bar: three Liquid Glass controls over the bottom of the page */
.safari {
  position: relative; flex: none; display: flex; align-items: center; gap: 2.4cqw; padding: 2cqw 4.4cqw 0;
  background: var(--demo-bottom, #000);
  font-family: -apple-system, "SF Pro Text", "Inter Tight", system-ui, sans-serif;
}
.sg {
  position: relative; display: flex; align-items: center; justify-content: center; height: 12.4cqw;
  border-radius: 999px; color: #fff;
  background: rgba(120, 120, 128, 0.28);
  -webkit-backdrop-filter: blur(10px) saturate(1.6); backdrop-filter: blur(10px) saturate(1.6);
  box-shadow: inset 0 0.25cqw 0.2cqw rgba(255, 255, 255, 0.28), inset 0 -0.2cqw 0.2cqw rgba(255, 255, 255, 0.08),
    inset 0 0 0 0.25cqw rgba(255, 255, 255, 0.1), 0 2cqw 5cqw rgba(0, 0, 0, 0.35);
}
.sg-round { flex: none; width: 12.4cqw; }
.sg-round svg { display: block; fill: currentColor; }
.s-back { height: 4.6cqw; width: auto; }
.s-more { width: 5cqw; height: auto; }
.sg-pill { flex: 1; justify-content: space-between; padding: 0 4.2cqw; font-size: 4.3cqw; font-weight: 500; letter-spacing: -0.01em; }
.s-page { width: 5cqw; opacity: 0.9; }
.s-reload { width: 4.2cqw; }
.home-bar { position: absolute; left: 32%; right: 32%; bottom: 2cqw; height: 1.3cqw; border-radius: 999px; background: #fff; }
.safari { padding-bottom: 8.6cqw; transition: opacity 0.6s var(--ease), background 0.6s var(--ease); }
/* before the demo starts, the Safari controls stay hidden and the blurred poster fills the whole screen;
   the bar fades in once the demo is live (only the home indicator shows meanwhile) */
.phone-screen:not(:has(.ios-view.live)) .safari { background: transparent; }
.phone-screen:not(:has(.ios-view.live)) :is(.safari .sg, .home-bar, .ios-time, .ios-icons) { opacity: 0; }
:is(.safari .sg, .home-bar, .ios-time, .ios-icons) { transition: opacity 0.6s var(--ease); }
.ios-view iframe {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; border: 0; transform-origin: 0 0;
  opacity: 0; transition: opacity 0.5s var(--ease);
}
.ios-view iframe.ready { opacity: 1; }
.demo-play.loading { cursor: progress; }
.demo-play.loading .demo-btn { color: transparent; scale: 1; }
.demo-play.loading .demo-btn::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* phones: the demo opens full screen at native size, with a Liquid Glass close button */
.demo-open, .demo-open body { overflow: hidden; }
.demo-open .nav, .demo-open .topbar { opacity: 0; pointer-events: none; }
.demo-full {
  position: fixed; inset: 0; z-index: 100; background: #000;
  opacity: 0; transform: scale(0.96); transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}
.demo-full.in { opacity: 1; transform: none; }
/* a slim iOS-style bar (Done + title) above the demo, so nothing covers the game's own corner buttons */
.demo-full-bar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  height: calc(env(safe-area-inset-top, 0px) + 52px); padding: env(safe-area-inset-top, 0px) 12px 0;
  color: #fff; font-size: 15px; font-weight: 500; background: #000;
}
.demo-full iframe {
  position: absolute; left: 0; top: calc(env(safe-area-inset-top, 0px) + 52px); width: 100%;
  height: calc(100% - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px));
  border: 0; opacity: 0; transition: opacity 0.5s var(--ease);
}
.demo-full.ready iframe { opacity: 1; }
.demo-full-spin {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite;
}
.demo-full.ready .demo-full-spin { display: none; }
.demo-full-close {
  position: absolute; left: 12px; bottom: 6px;
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 12px; border: 0; border-radius: 999px;
  color: #fff; font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  background: rgba(60, 60, 64, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(1.8); backdrop-filter: blur(14px) saturate(1.8);
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.3), inset 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.demo-full-close svg { width: 14px; height: 14px; }
.demo-play { position: absolute; inset: 0; padding: 0; border: 0; background: #000; cursor: pointer; }
/* Figma prototype: Figma draws its own iPhone and fits it inside this box, which is the demo phone's size */
/* Figma's phone takes ~74% of the embed (it keeps a margin and room for its cookie banner), so the box is 1/0.74
   larger than the demo phone: the phone inside then comes out the same size, uncropped for every visitor */
.demo-proto .phone { width: 566px; overflow: hidden; filter: none; }
.demo-proto .phone-screen { inset: 0; left: 0; top: 0; width: 100%; height: 100%; border-radius: 0; background: none; }
.demo-proto .ios-view { background: none; overflow: hidden; }
.demo-proto .ios-view iframe { transition: opacity 0.8s var(--ease); }
.demo-proto .demo-play { background: none; }
.demo-proto .demo-play img { object-fit: contain; transform: none; }
.demo-proto .demo-play:hover img { transform: none; }
/* poster covers the whole screen, from behind the status bar down under the Safari bar */
.demo-play img {
  position: absolute; left: 0; top: -15.4cqw; width: 100%; height: calc(100% + 15.4cqw + 26cqw);
  object-fit: cover; object-position: 50% 0; transform: scale(1.04); transition: transform 0.8s var(--ease);
}
.demo-proto .demo-play img { top: 0; height: 100%; }
/* app demo (Driveride): no status or Safari bar of ours, the app draws its own; white screen behind it */
.demo-app .ios-view { background: #fff; }
.demo-app .demo-play img { top: 0; height: 100%; }
.demo-play img.blur { filter: blur(14px) brightness(0.7); }
.demo-play:hover img { transform: scale(1.1); }
/* same liquid glass as the bottom nav (main.js adds the refraction in Chromium) */
.demo-btn {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; isolation: isolate;
  display: inline-flex; align-items: center; gap: 10px; padding: 15px 26px; border-radius: 999px;
  color: #fff; font-family: var(--font); font-size: 17px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap;
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(18px) saturate(1.8) brightness(1.1);
  backdrop-filter: blur(18px) saturate(1.8) brightness(1.1);
  box-shadow:
    inset 0 1px 0.5px rgba(255, 255, 255, 0.55),
    inset 0 -1px 0.5px rgba(255, 255, 255, 0.15),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 0 18px rgba(255, 255, 255, 0.08),
    0 10px 30px rgba(0, 0, 0, 0.3);
  transition: scale 0.4s var(--ease), background 0.3s;
}
.demo-btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 45%, rgba(255, 255, 255, 0.08) 100%);
}
.demo-play:hover .demo-btn { scale: 1.06; background: rgba(255, 255, 255, 0.2); }
.demo-play:active .demo-btn { scale: 0.97; }

/* about */
.about-hero { display: grid; gap: clamp(28px, 4vw, 56px); margin-bottom: clamp(80px, 12vw, 180px); }
.section { display: grid; grid-template-columns: minmax(140px, 1fr) 3fr; gap: 24px; padding: 28px 0; border-top: 1px solid var(--line); }
.section + .section { margin-top: clamp(48px, 7vw, 96px); }
.list { margin: 0; padding: 0; list-style: none; }
.list li { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.list li:first-child { padding-top: 0; }
/* the next section draws its own top line: no second line under the last item */
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list .t { font-size: clamp(20px, 2vw, 28px); letter-spacing: -0.02em; }
.list .d { color: var(--muted); }
.clients { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.clients li { padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; }
.big-link {
  display: inline-flex; align-items: center; gap: 0.3em;
  font-size: clamp(36px, 6.4vw, 110px); font-weight: 600; line-height: 1; letter-spacing: -0.045em; text-transform: uppercase;
  transition: opacity 0.2s;
}
.big-link:hover { opacity: 0.6; }
.big-link .arrow { font-weight: 400; transition: transform 0.3s var(--ease); }
.big-link:hover .arrow { transform: translate(0.08em, -0.08em); }

/* about: moving strip of covers, story */
.strip { overflow: hidden; margin: 0 calc(-1 * var(--gutter)) clamp(56px, 8vw, 120px); }
.strip-track { display: flex; gap: 12px; width: max-content; animation: strip 70s linear infinite; }
.strip img { width: auto; height: clamp(180px, 22vw, 340px); aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); background: var(--bg-2); }
.strip:hover .strip-track { animation-play-state: paused; }
@keyframes strip { to { transform: translateX(calc(-50% - 6px)); } }
.story { display: grid; gap: clamp(24px, 3vw, 48px); }
.story.has-portrait { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.story .portrait { width: 100%; height: auto; border-radius: var(--radius); }
.story .copy { margin: 0; }

/* project: details pinned on the left while the media scrolls past on the right */
.project { display: grid; grid-template-columns: minmax(240px, 1fr) 2.7fr; gap: clamp(24px, 3vw, 48px); align-items: start; }
.p-side { position: sticky; top: 96px; display: grid; gap: 18px; }
.p-side .eyebrow { display: flex; gap: 20px; }
.p-side .display { font-size: clamp(34px, 3.6vw, 68px); }
.p-sub { margin: 0; font-size: clamp(18px, 1.5vw, 22px); letter-spacing: -0.015em; color: var(--muted); line-height: 1.25; }
.p-side .facts { margin-top: 12px; }
.awards { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.award-mark { display: block; width: 92px; background: var(--fg); -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat; }
.awards img { width: 144px; height: auto; display: block; border-radius: var(--radius-sm); }
.p-main { min-width: 0; }
.copy { margin-bottom: clamp(40px, 5vw, 72px); }
.facts { margin: 0; display: grid; gap: 18px; align-content: start; }
.facts div { border-top: 1px solid var(--line); padding-top: 10px; }
.facts dt { font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-size: 17px; }
.facts a { border-bottom: 1px solid var(--line); transition: border-color 0.2s; }
.facts a:hover { border-color: var(--fg); }
.copy p { margin: 0 0 1.1em; font-size: clamp(18px, 1.5vw, 22px); line-height: 1.5; letter-spacing: -0.01em; color: var(--fg-soft); max-width: 40em; }
.copy p:first-child { font-size: clamp(22px, 2vw, 30px); line-height: 1.3; color: var(--fg); }
/* the whole stack of images/videos reads as one block with rounded outer corners */
/* clip-path rather than overflow+radius: Chrome leaves a hairline seam when clipping iframes that way */
.media { display: flex; flex-direction: column; clip-path: inset(0 round var(--radius)); }
/* text set on an image, scaled with it (container units); below the image on phones */
.media figure.has-note { container-type: inline-size; }
.note { position: absolute; left: var(--x); top: var(--y); width: var(--w); margin: 0; }
.note-center { left: calc(var(--x) - var(--w) / 2); text-align: center; } /* x is the centre for centred text */
.note h3 { margin: 0 0 0.4em; font-size: clamp(20px, 5cqw, 80px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.02; }
.note h3:only-child { margin: 0; font-size: clamp(13px, 1.3cqw, 20px); font-weight: 500; letter-spacing: -0.01em; }
.note p { margin: 0; font-size: clamp(13px, 1.75cqw, 26px); line-height: 1.45; letter-spacing: -0.005em; }
.note-dark h3 { color: #0b0b0c; } .note-dark p { color: #55575c; }
.note-light h3 { color: #fff; } .note-light p { color: rgba(255, 255, 255, 0.78); }
.js .note { opacity: 0; transform: translateY(10px); transition: opacity 0.9s var(--ease) 0.15s, transform 0.9s var(--ease) 0.15s; }
.js .media figure.loaded .note { opacity: 1; transform: none; }
/* phones: the text stays on the picture, like on desktop; only its size changes */
@media (max-width: 700px) {
  .note h3 { font-size: clamp(17px, 6.6cqw, 40px); } .note h3:only-child { font-size: clamp(12px, 3.6cqw, 18px); }
  .note p { font-size: clamp(10.5px, 3.1cqw, 15px); line-height: 1.35; }
}
@media (max-width: 560px) {
  .note { left: var(--xm, var(--x)); top: var(--ym, var(--y)); width: var(--wm, var(--w)); }
  .note-center { left: calc(var(--xm, var(--x)) - var(--wm, var(--w)) / 2); }
  .note-title-only p { display: none; }
}
/* desktop: project images run to the right edge */
@media (min-width: 561px) { .project .media { margin-right: calc(-1 * var(--gutter)); clip-path: inset(0 round var(--radius) 0 0 var(--radius)); } }
/* while loading, media shows the page colour so nothing flashes */
.media figure { position: relative; margin: 0; overflow: hidden; background: var(--bg-2); }
/* skeleton: a soft, blurred glow breathes until the image is ready; then the image comes into focus from a blur */
.media figure::after {
  content: ""; position: absolute; inset: -10%; pointer-events: none;
  background:
    radial-gradient(40% 50% at 30% 40%, color-mix(in srgb, var(--fg) 10%, transparent), transparent 70%),
    radial-gradient(45% 55% at 72% 62%, color-mix(in srgb, var(--fg) 7%, transparent), transparent 70%);
  filter: blur(30px); animation: skeleton 2.6s ease-in-out infinite alternate;
  transition: opacity 0.9s var(--ease);
}
/* only transform animates, so the fade-out on load (opacity) is never overridden by the animation */
@keyframes skeleton { from { transform: translate3d(-6%, 2%, 0) scale(0.92); } to { transform: translate3d(6%, -3%, 0) scale(1.12); } }
.media figure.loaded::after { opacity: 0; }
/* loaded: no backdrop behind the picture (cut-outs sit straight on the page) */
.media figure { transition: background-color 0.4s ease 1.5s; }
.media figure.loaded { background: transparent; }
/* the image comes into focus from a blur, at its final size (no zoom) */
.js .media img { opacity: 0; filter: blur(18px); transition: opacity 0.7s var(--ease), filter 1.1s var(--ease); }
.js .media figure.loaded img { opacity: 1; filter: blur(0); }
.media img { width: 100%; height: auto; }
.media .reveal { opacity: 1; transform: none; }
/* case study: quote, TL;DR, results, then numbered sections, each followed by its images and a caption */
.cs { display: grid; gap: clamp(56px, 7vw, 112px); margin-bottom: clamp(56px, 7vw, 112px); }
.cs-quote blockquote { margin: 0; }
.cs-quote figcaption { margin-top: 14px; font-size: 15px; letter-spacing: 0; color: var(--muted); }
.cs-quote cite { font-style: normal; }
.cs-quote { margin: 0; padding-left: clamp(16px, 2vw, 28px); border-left: 2px solid var(--fg); font-size: clamp(24px, 2.4vw, 38px); line-height: 1.2; letter-spacing: -0.02em; color: var(--fg); max-width: 22em; text-wrap: balance; }
.cs-block { display: grid; grid-template-columns: minmax(120px, 0.3fr) 1fr; gap: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.cs-block h2 { margin: 0; }
.cs-tldr { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: t; }
.cs-tldr li { counter-increment: t; display: grid; grid-template-columns: 2.2em 1fr; font-size: clamp(17px, 1.3vw, 20px); line-height: 1.4; color: var(--fg-soft); max-width: 40em; }
.cs-tldr li::before { content: counter(t, decimal-leading-zero); color: var(--muted); font-size: 0.8em; padding-top: 0.2em; font-variant-numeric: tabular-nums; }
.cs-results { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 28px 32px; }
.cs-results dt { font-size: clamp(30px, 2.8vw, 48px); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -0.035em; line-height: 1; color: var(--fg); }
.cs-results dd { margin: 8px 0 0; color: var(--muted); font-size: 15px; line-height: 1.35; }
.cs-section { display: grid; gap: clamp(20px, 2.4vw, 32px); }
.cs-text p { margin: 0 0 1em; font-size: clamp(18px, 1.5vw, 22px); line-height: 1.5; letter-spacing: -0.01em; color: var(--fg-soft); max-width: 40em; }
.cs-text p:last-child { margin-bottom: 0; }
.cs-h { margin: 0 0 18px; display: flex; gap: 14px; align-items: baseline; font-size: clamp(26px, 2.4vw, 40px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; color: var(--fg); text-wrap: balance; }
.cs-n { font-size: 13px; letter-spacing: 0.02em; color: var(--muted); font-variant-numeric: tabular-nums; transform: translateY(-0.4em); }
.cs-cap { margin: -8px 0 0; font-size: 14px; line-height: 1.4; color: var(--muted); max-width: 46em; }
.cs-cap b { font-weight: 500; color: var(--fg); }
.cs-rejected .media { opacity: 0.55; filter: grayscale(0.6); }
@media (max-width: 700px) { .cs-block { grid-template-columns: 1fr; gap: 14px; } }
.video { position: relative; width: 100%; overflow: hidden; }
/* 2% zoom so the video always covers its box: Vimeo's sizes are rounded, and any mismatch
   shows as a thin line of the player's own background along an edge */
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; transform: scale(1.02); }
/* cropped video: wider than its box and shifted left by the margin, so the white edge falls outside */
/* The iframe box keeps the video's exact ratio (resizing the box makes Vimeo letterbox the video
   inside it, showing the backdrop around it); a transform then enlarges it from the top-right
   corner, so the left margin falls outside and the box is filled exactly. */
.video-crop iframe { inset: 0 0 auto auto; height: calc(100% * (1 - var(--crop))); transform-origin: 100% 0; transform: scale(calc(1.005 / (1 - var(--crop)))); }
/* the player stays invisible (page colour shows) until the video actually plays */
.js .video iframe { opacity: 0; transition: opacity 0.6s var(--ease); }
.js .video.playing iframe { opacity: 1; }

.next {
  display: grid; grid-template-columns: 1fr minmax(200px, 34%); gap: 24px; align-items: end;
  margin-top: clamp(80px, 12vw, 180px); padding-top: 28px; border-top: 1px solid var(--line);
}
.next .display { font-size: clamp(40px, 7vw, 120px); transition: opacity 0.2s; }
.next:hover .display { opacity: 0.6; }
.next .card { aspect-ratio: 4 / 3; }

/* ---------- password gate ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gate {
  position: relative; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; padding: 96px var(--gutter);
}
.gate::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(960px, 150vw); aspect-ratio: 1;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none; animation: gate-glow 7s ease-in-out infinite alternate;
}
@keyframes gate-glow {
  from { transform: translate(-50%, -50%) scale(0.8); opacity: 0.6; }
  to { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}
.gate-inner { position: relative; width: min(100%, 640px); display: grid; justify-items: center; gap: 20px; text-align: center; }
.gate-logo {
  margin: 0; font-size: clamp(40px, 9vw, 104px); font-weight: 600; line-height: 0.95; letter-spacing: -0.045em;
  text-transform: uppercase;
}
.gate-sub { margin: 0; max-width: 26em; color: var(--muted); font-size: clamp(16px, 1.4vw, 19px); }
/* background for the glass to refract: a faint dot grid and slow drifting light */
.gate-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.gate-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.13) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(closest-side, #000, transparent);
  mask-image: radial-gradient(closest-side, #000, transparent);
}
.gate-bg i {
  position: absolute; width: 46vmax; aspect-ratio: 1; border-radius: 50%;
  filter: blur(60px); opacity: 0.55; animation: gate-drift 18s ease-in-out infinite alternate;
}
.gate-bg i:nth-child(1) { left: 8%; top: 18%; background: #2b3a67; }
.gate-bg i:nth-child(2) { right: 4%; top: 34%; background: #5a3a2c; animation-duration: 22s; animation-direction: alternate-reverse; }
.gate-bg i:nth-child(3) { left: 34%; bottom: -24%; background: #3b3b3b; animation-duration: 26s; }
@keyframes gate-drift { to { transform: translate(6vw, -5vh) scale(1.12); } }
/* iOS 26 Liquid Glass field: same glass capsule as the tab bar, a prominent (tinted) round glass button */
.gate-form {
  position: relative; isolation: isolate;
  display: flex; align-items: center; width: min(100%, 400px); margin-top: 12px; padding: 4px;
  border-radius: 296px; background: var(--tab-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.8); backdrop-filter: blur(14px) saturate(1.8);
  box-shadow: var(--tab-rim), 0 8px 40px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.25s;
}
.gate-form:focus-within { box-shadow: var(--tab-rim), inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 8px 40px rgba(0, 0, 0, 0.12); }
.gate-form input[type="password"] {
  flex: 1; min-width: 0; height: 48px; padding: 0 18px;
  background: none; border: 0; outline: 0; color: var(--fg); font: inherit; font-size: 16px; line-height: 48px;
  caret-color: var(--fg); -webkit-appearance: none; appearance: none;
}
/* typed password: Verdana's bullet is round and full-size; wider spacing gives even, airy dots.
   The fixed height and line-height above keep the pill from growing when the font switches. */
.gate-form input[type="password"]:not(:placeholder-shown) {
  font-family: Verdana, "DejaVu Sans", sans-serif; font-size: 17px; letter-spacing: 0.3em;
  -webkit-text-security: disc;
}
.gate-form input::placeholder { color: var(--muted); }
.gate-form button {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 999px;
  background: var(--glass-active); color: var(--glass-active-fg); font: inherit; font-size: 20px; cursor: pointer;
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.9), 0 2px 10px rgba(0, 0, 0, 0.18);
  transition: transform 0.3s var(--ease);
}
.gate-form button:hover { transform: scale(1.05); }
.gate-form button:active { transform: scale(0.94); }
.gate-error { margin: 0; color: #ff8a80; font-size: 14px; }
.gate-inner:has(.gate-error:not([hidden])) .gate-form { box-shadow: inset 0 1px 0.5px var(--glass-rim), inset 0 0 0 1px rgba(255, 138, 128, 0.7), 0 10px 36px rgba(0, 0, 0, 0.28); animation: gate-shake 0.45s; }
@keyframes gate-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.gate-ask { margin: 28px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.gate-ask a { white-space: nowrap; color: var(--fg); border-bottom: 1px solid var(--line); transition: border-color 0.2s; }
.gate-ask a:hover { border-color: var(--fg); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  /* like Cedar on mobile: name on one line, centred near the top, tagline right under it */
  .hero { --name-size: clamp(24px, 7.2vw, 44px); }
  .hero-name, .hero-tag { left: var(--gutter); right: var(--gutter); width: auto; transform: none; text-align: center; }
  .hero-name { top: 88px; font-size: var(--name-size); line-height: 1; }
  .hero-name > span { display: inline; }
  .hero-name > span + span { margin-left: 0.25em; }
  .hero-tag { top: calc(88px + var(--name-size) * 1.25); margin: 0 auto; max-width: 17em; font-size: clamp(16px, 4.4vw, 22px); line-height: 1.25; }
  .hero-name, .hero-tag { text-shadow: 0 2px 24px rgba(0, 0, 0, 0.7); }
  /* like Cedar: cards passing under the name and tagline blur and darken, so the text stays readable */
  .hero::before {
    content: ""; position: absolute; inset: 0 0 auto 0; z-index: 3; pointer-events: none;
    height: calc(88px + var(--name-size) * 1.25 + 130px);
    background: linear-gradient(rgba(10, 10, 10, 0.9), rgba(10, 10, 10, 0.55) 60%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    -webkit-mask-image: linear-gradient(#000 55%, transparent);
    mask-image: linear-gradient(#000 55%, transparent);
  }
  .grid { grid-template-columns: 1fr; }
  .project, .section, .next { grid-template-columns: 1fr; }
  .p-side { position: static; }
  .hero-name, .hero-tag { pointer-events: none; }
  .list li { grid-template-columns: 1fr; gap: 4px; }
  .story.has-portrait { grid-template-columns: 1fr; }
  .works-head { flex-direction: column; align-items: start; }
  /* phones: list rows get a small cover since there is no cursor preview */
  .row { grid-template-columns: 56px 1fr auto; gap: 14px; }
  .row-thumb { display: block; width: 56px; aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; background: var(--bg-2); }
  .row-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .row-thumb img.fit { padding: 0; object-fit: cover; }
  .row-thumb img.fit.zoom { position: static; height: 100%; transform: none; }
  .row-type { display: none; }
  .row-arrow { width: 36px; opacity: 1; transform: none; font-size: 15px; }
  /* phones: one compact filter capsule (scrolls sideways); the list with thumbnails is the phone view, so no List/Grid switch */
  /* phones: the filter row runs edge to edge, starting at the page margin; no List/Grid switch (list is the phone view) */
  .works-bar .seg[aria-label="Filter by category"] { flex: 1 1 100%; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter); }
  .works-bar .seg[aria-label="Display"] { display: none; }
  .seg button { height: 36px; padding: 0 16px; }
  .demo { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .demo .phone { width: min(420px, 100%); }   /* fit the section's own width, so it sits centred */
  .demo-proto .phone { width: min(566px, 100%); }
  .demo-copy p { margin-inline: auto; }
}
@media (max-width: 560px) {
  .topbar { grid-template-columns: 1fr auto; font-size: 12px; padding-top: 18px; }
  .topbar .clock { display: none; }
  .nav { bottom: 14px; }
  .nav a { min-width: 70px; }
  .wrap { padding-top: 96px; }
  .media { margin: 0 calc(-1 * var(--gutter)); clip-path: none; }
}
/* case-study motion: section images wipe up in sequence, drift slightly with scroll; TL;DR lines and section rules follow */
.cs .media { clip-path: none; gap: 0; }
.cs .media figure + figure { margin-top: 12px; }
.cs .media figure { clip-path: inset(0 round var(--radius)); }
@media (min-width: 561px) { .cs .media figure { clip-path: inset(0 round var(--radius) 0 0 var(--radius)); } }
.cs-section { position: relative; padding-top: 18px; }
.cs-section::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--line); transform: scaleX(0); transform-origin: left; transition: transform 1.4s var(--ease); }
.cs-section:has(.cs-text.in)::before { transform: none; }
.js .cs-tldr li { opacity: 0; transform: translateY(14px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: calc(0.15s + var(--i, 0) * 0.08s); }
.cs-block.in .cs-tldr li { opacity: 1; transform: none; }
.cs-quote { transition-duration: 1.4s; }
/* phones: case-study images and videos line up with the text (baked-in card margins are trimmed: tools/mobile-crops.mjs) */
@media (max-width: 560px) {
  .cs .media { margin: 0; }
  .cs .media figure { clip-path: inset(0 round var(--radius)); }
  /* video with a baked-in card: the player is enlarged so only the card shows, filling the box */
  .video.mcrop { padding-top: var(--mpad) !important; }
  /* the iframe keeps the video ratio at the box width (iOS ignores oversized iframe widths); a transform enlarges it */
  .video.mcrop iframe { inset: 0 auto auto 0; width: 100%; height: calc(100% * var(--mcw) / var(--mch)); transform-origin: 0 0; transform: translate(calc(-100% * var(--mcl) / var(--mcw)), calc(-100% * var(--mct) / var(--mcw))) scale(calc(1.005 / var(--mcw))); }
}
@media (prefers-reduced-motion: reduce) {
  .cs-tldr li { clip-path: none !important; transform: none !important; opacity: 1 !important; transition: none !important; }
  .cs-section::before { transform: none; transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .media figure::after, .js .deck-card::after, .js .card::after { animation: none; }
  .js .media img, .js .deck-card img, .js .card img { filter: none; scale: 1; transition: opacity 0.4s; }
  .js .note { transition: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .split .ch { animation: none; opacity: 1; filter: none; transform: none; }
  .gate::before, .gate-form, .strip-track, .gate-bg i { animation: none !important; }
  .row-preview { display: none; }
}

/* private projects: lock on the card, password dialog */
.lock {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  color: var(--fg); background: var(--tab-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.8); backdrop-filter: blur(14px) saturate(1.8);
  box-shadow: var(--tab-rim), 0 4px 18px rgba(0, 0, 0, 0.18);
  transition: opacity 0.4s var(--ease);
}
.lock svg { width: 17px; height: 17px; }
.locked-ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 35%, #262628 0%, #141415 70%);
  animation: lock-fade 1s var(--ease);
}
.locked-ph .lock { position: static; width: 84px; height: 84px; }
.locked-ph .lock svg { width: 32px; height: 32px; }
.deck-card .label { display: none; }
/* covers while loading: the same soft glow drifts across the card until the picture comes into focus */
.js .deck-card:not(:has(img.loaded)):not(:has(.locked-ph)), .js .card:not(:has(img.loaded)):not(:has(.locked-ph)) { background: var(--bg-2); }
.js .deck-card::after, .js .card::after {
  content: ""; position: absolute; inset: -15%; z-index: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(38% 46% at 32% 40%, color-mix(in srgb, var(--fg) 13%, transparent), transparent 70%), radial-gradient(42% 50% at 70% 64%, color-mix(in srgb, var(--fg) 9%, transparent), transparent 70%);
  filter: blur(26px); animation: skeleton 2.4s ease-in-out infinite alternate; transition: opacity 0.9s var(--ease);
}
.js .deck-card:not(:has(img.loaded)):not(:has(.locked-ph))::after, .js .card:not(:has(img.loaded)):not(:has(.locked-ph))::after { opacity: 1; }
.js .deck-card img, .js .card img { position: relative; z-index: 1; }
.blurred { filter: blur(0.24em); opacity: 0.5; user-select: none; }
/* redacted About text: blurred, with a lock; clicking asks for the password */
.redacted { color: inherit; text-decoration: none; cursor: pointer; }
.redacted .blurred { filter: blur(0.32em); opacity: 0.6; }
.redacted .lock-inline { width: 1.5em; height: 1.5em; min-width: 26px; min-height: 26px; margin-left: 0.2em; }
.redacted:hover .lock-inline { transform: translateY(-0.06em) scale(1.08); }
.redacted-li { display: inline-flex; align-items: center; gap: 8px; }
.redacted-li .blurred { display: inline-block; filter: blur(0.26em); opacity: 0.85; }
.redacted-li .lock-inline { width: 22px; height: 22px; min-width: 0; min-height: 0; margin: 0; transform: none; }
.redacted-li .lock-inline svg { width: 11px; height: 11px; }
.lock-inline { position: relative; top: auto; right: auto; display: inline-grid; vertical-align: middle; margin-left: 0.35em; width: 0.62em; height: 0.62em; min-width: 32px; min-height: 32px; transform: translateY(-0.06em); }
.lock-inline svg { width: 44%; height: 44%; }
.meta .lock-inline { width: 28px; height: 28px; min-width: 0; min-height: 0; }
.row-thumb:has(.locked-ph) { position: relative; }
.row-thumb .locked-ph .lock { width: 40px; height: 40px; }
.row-thumb .locked-ph .lock svg { width: 16px; height: 16px; }
.next .card .locked-ph .lock { width: 96px; height: 96px; }
.lock-dialog {
  width: min(calc(100% - 32px), 460px); padding: 40px 32px 32px; border: 0; border-radius: var(--radius);
  color: var(--fg); background: var(--bg-2); text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.lock-dialog[open] { display: flex; flex-direction: column; align-items: center; animation: lock-in 0.45s var(--ease); }
.lock-dialog::backdrop { background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: lock-fade 0.35s ease; }
.lock-dialog .gate-form { margin: 8px auto 14px; }
.lock-dialog.shake .gate-form { animation: gate-shake 0.45s; box-shadow: var(--tab-rim), inset 0 0 0 1px rgba(255, 138, 128, 0.7); }
.lock-big { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 18px; border-radius: 999px; background: var(--tab-bg); box-shadow: var(--tab-rim); }
.lock-big svg { width: 24px; height: 24px; }
.lock-title { margin: 0 0 8px; font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.lock-dialog .gate-ask { margin: 6px 0 0; font-size: 14px; }
.lock-dialog .gate-ask a { color: var(--fg); border-bottom: 1px solid currentColor; }
.lock-sub { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 34ch; }
.lock-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 26px; cursor: pointer; }
.lock-close:hover { color: var(--fg); }
.lock-dialog button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.lock-dialog .gate-form:has(input:focus-visible) { box-shadow: var(--tab-rim), inset 0 0 0 2px rgba(255, 255, 255, 0.7); }
.lock-dialog form[aria-busy="true"] button { opacity: 0.5; pointer-events: none; }
@keyframes lock-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes lock-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lock-dialog[open], .lock-dialog::backdrop { animation: none; } }

/* UX case-study structure: brief (challenge + goal), key decisions, stage labels */
.cs-brief { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 2vw, 24px); }
.cs-brief > div { padding: clamp(22px, 2.6vw, 36px); border-radius: var(--radius); background: var(--bg-2); }
.cs-brief h2 { margin: 0 0 12px; }
.cs-brief p { margin: 0; font-size: clamp(19px, 1.6vw, 24px); line-height: 1.35; letter-spacing: -0.015em; color: var(--fg); text-wrap: pretty; }
.cs-decisions { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: clamp(16px, 2vw, 24px); counter-reset: d; }
.cs-decisions li { counter-increment: d; display: grid; align-content: start; gap: 8px; }
.cs-decisions li::before { content: counter(d, decimal-leading-zero); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cs-decisions h3 { margin: 0; font-size: clamp(18px, 1.4vw, 22px); font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; color: var(--fg); }
.cs-decisions p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--fg-soft); }
.cs-stage { display: block; margin-bottom: 10px; }
.cs-section, .cs-brief, #decisions { scroll-margin-top: 96px; }
@media (max-width: 700px) { .cs-brief { grid-template-columns: 1fr; } }

/* smaller corners on phones */
@media (max-width: 700px) { :root { --radius: 16px; --radius-sm: 10px; } }
@media (max-width: 560px) { .cs-decisions { grid-template-columns: 1fr; gap: 22px; } }
/* phones: the thumbnail already shows the lock, so the one after the name in the Works list is hidden */
@media (max-width: 700px) { .row-name .lock-inline { display: none; } }

/* Project link: an arrow button next to the title. On phones it sits beside the tab bar (same height, same glass),
   hidden until the title area scrolls away; then the bar glides left and the arrow grows out from behind its edge. */
:root {
  /* gentle spring, a touch of overshoot (iOS-like) */
  --spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.2%, 1);
  --ios: cubic-bezier(0.32, 0.72, 0, 1);
}
.p-title { display: flex; align-items: center; gap: 16px; }
.p-title .display { min-width: 0; }
.p-visit {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  color: var(--tab-fg); background: var(--tab-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.8); backdrop-filter: blur(14px) saturate(1.8);
  box-shadow: var(--tab-rim), 0 8px 40px rgba(0, 0, 0, 0.12);
  transition: transform 0.4s var(--spring);
}
.p-visit svg { width: 20px; height: 20px; }
@media (hover: hover) { .p-visit:hover { transform: translate(2px, -2px); } }
@media (max-width: 700px) {
  /* the pair (bar + 8px + 54px arrow) stays centred: the bar moves 31px left, the arrow sits 8px after it */
  .p-visit {
    position: fixed; z-index: 49; bottom: 14px; left: calc(50% - 31px + var(--nav-w, 260px) / 2 + 8px); width: 54px; height: 54px;
    opacity: 0; pointer-events: none; filter: blur(6px);
    transform: translateX(-35px) scale(0.4);
    transition: transform 0.45s var(--ios), opacity 0.3s var(--ios), filter 0.3s var(--ios);
  }
  .p-visit svg { width: 22px; height: 22px; }
  .show-visit .p-visit {
    opacity: 1; pointer-events: auto; filter: none; transform: none;
    transition: transform 0.7s var(--spring), opacity 0.35s var(--ios) 0.05s, filter 0.45s var(--ios) 0.05s;
  }
  .nav { transition: transform 0.7s var(--spring); }
  .show-visit .nav { transform: translateX(calc(-50% - 31px)); }
}
@media (prefers-reduced-motion: reduce) {
  .p-visit, .show-visit .p-visit, .nav { transition: opacity 0.2s; }
}

/* Page changes: only the tab bar and the arrow animate (the rest of the page swaps instantly, as before).
   Leaving a page where the arrow shows for one without it: the arrow sinks back behind the bar, which glides
   back to the centre. Browsers without cross-document view transitions just swap pages. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
.nav { view-transition-name: tabbar; }
.show-visit .p-visit { view-transition-name: visit; }
::view-transition-group(tabbar) { animation-duration: 0.7s; animation-timing-function: var(--spring); }
::view-transition-old(tabbar), ::view-transition-new(tabbar) { animation-duration: 0.25s; }
::view-transition-group(visit) { animation-duration: 0.45s; animation-timing-function: var(--ios); }
::view-transition-old(visit):only-child { animation: visit-sink 0.45s var(--ios) both; }
@keyframes visit-sink { to { transform: translateX(-35px) scale(0.4); filter: blur(6px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* desktop: no link button next to the title (the sidebar has the link); it is a phone-only control */
@media (min-width: 701px) { .p-visit { display: none; } }
