/* Mobile-first. The desktop layout is one @media block near the bottom, mirrored by DESKTOP in app.js: change both together. */

@font-face {
  font-family: "InterVariable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/InterVariable.woff2") format("woff2");
}
@font-face {
  font-family: "XanhMono";
  font-style: normal;
  font-display: swap;
  src: url("assets/fonts/XanhMono-Regular.woff2") format("woff2");
}

:root {
  --c-bg: #000;
  --c-fg: #fff;
  --c-mute: #8a8a8a;
  --c-accent: #8a6bff;
  --c-select: #410dff;
  --font-sans: "InterVariable", "Inter", sans-serif;
  --font-mono: "XanhMono", monospace;
  --pad: 12px;
  --row-h: 32px;
  --w-sans: 340;
  --fs-ui: 12px;
  --fs-meta: 13px;

  --t-h1: var(--w-sans) 29px / 1.1 var(--font-sans);
  --t-h2: var(--w-sans) 26px / 1.18 var(--font-sans);
  --t-h3: var(--w-sans) 20px / 1.15 var(--font-sans);
  --t-body: var(--w-sans) 14px / 1.35 var(--font-sans);
  --t-body-strong: calc(var(--w-sans) + 60) 14px / 1.35 var(--font-sans);
  --t-label: var(--w-sans) 14px var(--font-sans);
  --t-nav: 18px var(--font-mono);
  --t-button: 500 15px / 1 var(--font-sans);
  --ls-display: -0.01em;
  --inset: 6px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

html, body { margin: 0; height: 100%; background: var(--c-bg); color: var(--c-fg); }
body {
  overflow: hidden;
  font-family: var(--font-sans);
  font-weight: var(--w-sans);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--c-accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
img, video { display: block; }
p, h1, h2, h3, ul { margin: 0; padding: 0; }
ul { list-style: none; }
::selection { background: var(--c-select); color: #fff; }
:focus-visible { outline: 1px solid var(--c-accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- shell (mobile) ---------- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  height: var(--app-h, 100svh);
  padding: calc(var(--pad) + env(safe-area-inset-top, 0px)) var(--pad) calc(var(--pad) + env(safe-area-inset-bottom, 0px));
}
.rail { display: contents; }
.stage { position: relative; flex: 1; min-height: 0; order: 1; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
  font: var(--t-nav);
}
.topbar a { display: flex; align-items: center; min-height: 44px; }
.topnav { display: flex; gap: 20px; }
body[data-route="about"] #nav-about,
body.is-index[data-route="home"] #nav-index { text-decoration: underline; text-underline-offset: 6px; }

.list-wrap, .hint, .rail-about { display: none; }

.rail-info {
  order: 2;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--c-fg);
  padding-top: var(--pad);
}
body[data-route="project"] .stage,
body[data-route="home"]:not(.is-index) .stage { margin-bottom: 45px; }
body.is-index[data-route="home"] .rail-info.is-tray { display: none; }
.rail-info.is-tray { position: absolute; left: var(--pad); right: var(--pad); bottom: 0; z-index: 6; gap: 0; padding: 0 0 env(safe-area-inset-bottom, 0px); background: #000; }
.info-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; text-align: left; }
.info-head .info-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-client { color: var(--c-mute); font-weight: var(--w-sans); }
.info-client::before { content: "\00a0\00b7\00a0"; }
.info-tog { flex: none; font: var(--t-label); color: var(--c-mute); }
.info-tog::after { content: " +"; }
.rail-info:not(.is-closed) .info-tog::after { content: " \2212"; }
.info-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.45s var(--ease), opacity 0.35s ease; }
.info-inner { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.rail-info.is-closed .info-body { grid-template-rows: 0fr; opacity: 0; }
.rail-info.is-closed .info-inner { padding-bottom: 0; }
.info-title { font: var(--t-body-strong); }
.info-desc { font: var(--t-body); color: var(--c-fg); }
.info-roles { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--fs-meta); color: var(--c-mute); }

.chip { display: inline-flex; align-items: center; padding: 3px 10px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 999px; font-size: var(--fs-meta); line-height: 1.3; color: var(--c-mute); transition: color 0.12s ease, border-color 0.12s ease; }
.chip:hover, .chip.is-on { color: var(--c-fg); border-color: rgba(255, 255, 255, 0.7); }
@media (hover: none) { .chip { padding: 8px 12px; } }
.list-filter { flex: none; display: flex; padding: 0 0 12px; }
.list-filter.is-empty { display: none; }

/* ---------- views ---------- */
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }

.home-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  --feed-h: 100%;
}
body.is-index .home-feed { scroll-snap-type: none; }
.card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  height: var(--feed-h);
  overflow: hidden;
  scroll-snap-align: center;
  transition: height 0.35s ease;
}
body.is-index .home-feed { border-top: 1px solid rgba(255, 255, 255, 0.1); }
body.is-index .card { height: 44px; gap: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.card-media {
  container-type: inline-size;
  max-height: calc(var(--feed-h) - 48px);
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}
body.is-index .card-media { max-height: 0; opacity: 0; }
.card-media > * { display: block; width: 100%; max-height: min(100cqw, var(--feed-h) - 48px); object-fit: contain; } /* a square safe zone, so portrait cards are no taller than wide ones are wide */
.card-row { display: flex; justify-content: space-between; gap: 12px; font: var(--t-label); letter-spacing: 0.01em; }
.card-row span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row span:last-child { flex: none; white-space: nowrap; }
body:not(.is-index) .card-row { display: none; }
body.is-index #feed-pager { display: none; }

.vwrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px 0; min-height: 0; }
.vwrap .video-shell { max-width: min(100%, 880px); }
.vwrap video { width: 100%; height: auto; max-height: calc(100svh - 220px); }
/* Mobile: centred between the video and the info rail, like the phone captions (100cqh is the page less the 16px padding, 100% the video). */
.vwrap figcaption { position: absolute; left: 0; right: 0; top: calc(100% + (100cqh - 100%) / 4 + 8px); text-align: center; text-wrap: balance; font: var(--t-body); opacity: 0.85; transform: translateY(-50%); }
.vstack { position: absolute; inset: 0; overflow-y: auto; scroll-snap-type: y mandatory; }
.vstack .vwrap { height: 100%; margin: 0; scroll-snap-align: start; container-type: size; }

.sp { position: absolute; inset: 0; overflow-y: auto; scroll-snap-type: y mandatory; }
.sp-page { height: 100%; scroll-snap-align: start; display: flex; align-items: center; justify-content: center; padding: 12px 20px; }
.sp-page img { width: 100%; height: 100%; object-fit: contain; }
.sp-page:not(.is-sharp) img { filter: blur(6px); }
.sp-page.is-sharp img { filter: none; transition: filter 0.4s ease; }

.rail-about { font: var(--t-h2); letter-spacing: var(--ls-display); min-height: 0; overflow-y: auto; }
.rail-about a:not(.mail) { text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
.about-photo { display: block; width: 25%; height: auto; margin-top: 24px; }
.mail { display: inline-block; vertical-align: -0.35em; padding: 12px; margin: -12px -8px -12px -8px; }
.mail svg { width: 0.85em; height: 0.85em; }
body[data-route="about"] .rail-about { display: block; flex: 1; padding-top: 32px; }
body[data-route="about"] .stage { display: none; }

/* ---------- case study (Lapse) ---------- */
.cs { position: absolute; inset: 0; z-index: 1; overflow-y: auto; scroll-snap-type: y mandatory; }
.cs-sec {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.pager { position: absolute; right: 0; top: 24px; bottom: 44px; display: flex; flex-direction: column; justify-content: space-between; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
.pager.is-live { opacity: 1; }
.pager i { flex: none; width: 2px; height: 2px; border-radius: 50%; background: #555; transition: background 0.25s ease; }
.pager i.on { background: var(--c-fg); }

.phone-wrap { position: relative; }
.phone-frame { position: relative; height: min(52svh, 500px); aspect-ratio: 1350 / 2760; }
.phone-frame-screen, .phone-frame-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.phone-frame-overlay { z-index: 2; pointer-events: none; }
.phone-frame-screen {
  z-index: 1;
  background: #000;
  -webkit-mask: url("assets/misc/iphone17pro-screen-mask.png") center / 100% 100% no-repeat;
          mask: url("assets/misc/iphone17pro-screen-mask.png") center / 100% 100% no-repeat;
}
.phone-frame-screen .video-shell { width: 100%; height: 100%; }
.phone-frame-screen video { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.phone-frame.screen-rec video { position: absolute; inset: 0; margin: auto; width: 89.333%; height: 95%; }
.phone-frame-screen .video-play { left: 4%; bottom: 3%; }
.phone-frame-screen .video-mute { right: 4%; bottom: 3%; }

.s1 { --d: 84px; }
.stk {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--d);
  height: var(--d);
  background: #ff6300;
  color: #000;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  transform: rotate(var(--r, 0deg));
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) calc(0.45s + var(--n, 0) * 0.14s), opacity 0.3s ease calc(0.45s + var(--n, 0) * 0.14s);
}
.s1:not(.is-active) .stk { opacity: 0; transform: translateY(-0.6em) rotate(var(--r, 0deg)) scale(0.3); transition: opacity 0.4s ease, transform 0.5s var(--ease); }
.sticker { top: -12px; right: -22px; width: 68px; height: 68px; padding: 10px; }
.stat-stk { padding: 8px; text-align: center; }
.stat-num { font: 600 24px/1 var(--font-sans); letter-spacing: -0.02em; }
.stat-label { font-size: 10px; font-weight: 500; line-height: 1.1; margin-top: 3px; }
.stat-stk--1 { left: calc(var(--d) * -0.62); top: 16%; --r: -8deg; }
.stat-stk--2 { right: calc(var(--d) * -0.72); top: 50%; --r: 7deg; }
.stat-stk--3 { left: calc(var(--d) * -0.3); bottom: 18%; --r: 5deg; }
.stat-stk--4 { right: calc(var(--d) * -0.4); bottom: calc(var(--d) * -0.3); --r: -6deg; }
.sticker img { width: 100%; height: 100%; object-fit: contain; filter: brightness(0); }

.s3 .phone-frame { height: min(60svh, 560px); }
.statement { font: var(--t-h1); letter-spacing: var(--ls-display); text-align: center; padding: 0 20px; }

.ba-stage { position: relative; flex: 1 1 0; min-height: 0; width: 100%; max-width: 900px; margin-top: 16px; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.ba-frame { position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.ba-frame.on { opacity: 1; }
.ba-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.6s ease-in-out; }
.ba-frame img.is-on { opacity: 1; }
.ba-stage.is-orig .ba-frame img { opacity: 0; transition-duration: 0.15s; }
.ba-stage.is-orig .ba-frame img.before { opacity: 1; }
.ba-controls { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 12px; }
.ba-tabs { display: flex; gap: 8px; }
.ba-tabs button { width: 44px; height: 44px; padding: 0; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.28); opacity: 0.55; transition: opacity 0.2s ease, border-color 0.2s ease; }
.ba-tabs button:hover { opacity: 0.85; }
.ba-tabs button[aria-pressed="true"] { opacity: 1; border-color: var(--c-fg); }
.ba-tabs img { width: 100%; height: 100%; object-fit: cover; }
.ba-hint { font: var(--fs-ui) var(--font-mono); color: var(--c-mute); margin-bottom: 8px; }
.ba-hint .st-after, .ba-hint .st-before { color: var(--c-fg); }
.s4:not(.is-orig) .st-before, .s4.is-orig .st-after { display: none; }

.statement .w, .ig-cap .w, .fx-intro .w, .fx-end .w { display: inline-block; opacity: 0; transform: translateY(0.4em); filter: blur(2px); transition: opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease; }
.cap-role.is-on .w, .cs-sec.is-active .ig-cap .w, .fx-tour.is-start .fx-intro .w, .fx-tour.is-end .fx-end .w { opacity: 1; transform: none; filter: none; transition: opacity 0.7s ease, transform 0.7s var(--ease), filter 0.7s ease; transition-delay: calc(var(--l, 0) * 110ms); }
.s4 { display: block; height: 200%; padding: 0; scroll-snap-align: none; }
.pg { position: absolute; left: 0; right: 0; top: 0; height: 50%; scroll-snap-align: start; pointer-events: none; }
.pg--b { top: 50%; }
.s4-pin { position: sticky; top: 0; height: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 20px; }
.s4-ui { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; transition: opacity 0.6s ease; }
.s4.is-capped .s4-ui { opacity: 0.28; }
.s4-cap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; transition: opacity 0.5s ease, transform 0.5s var(--ease); }
.s4:not(.is-capped) .s4-cap { opacity: 0; transform: translateY(-0.6em); }

.wall--bg { z-index: 0; opacity: 0.28; pointer-events: none; transition: opacity 0.6s ease; }
.wall--bg.is-off { opacity: 0; }
.wall--main { z-index: 0; opacity: 0; pointer-events: none; transition: opacity 0.6s ease; }
.wall--main.is-dim { opacity: 0.28; }
.wall--main.is-full { opacity: 1; }
.cap-layer { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; pointer-events: none; }
.cap { grid-area: 1 / 1; max-width: 900px; margin: 0; opacity: 0; transform: translateY(-0.6em); transition: opacity 0.5s ease, transform 0.5s var(--ease); }
.cap.is-on { opacity: 1; transform: none; }
.s1 .phone-wrap { transition: opacity 0.5s ease, transform 0.5s var(--ease); }
.s1:not(.is-active) .phone-wrap { opacity: 0; transform: translateY(-0.6em); }
.s-cap-text { max-width: 900px; padding: 0 20px; text-align: center; text-shadow: 0 1px 14px rgba(0, 0, 0, 0.85); }
.wall { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(6, 1fr); }
.wall-cell { position: relative; overflow: hidden; background: #111; border: 0.5px solid rgba(255, 255, 255, 0.2); }
.wall-cell::before { content: ""; position: absolute; inset: -8%; background: var(--thumb) center / cover no-repeat; filter: blur(6px); }
.wall-cell.is-ready::before { display: none; }
.wall-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; visibility: hidden; filter: blur(8px); transition: filter 0.5s ease; animation: wall-fade 16s ease-in-out infinite; }
.wall-cell img.is-loaded { visibility: visible; filter: none; }
.wall-cell img:first-child { z-index: 1; animation-delay: calc(var(--d) * -1.7s); }
.wall-cell img:last-child { opacity: 1; animation: none; }
@keyframes wall-fade { 0%, 40% { opacity: 1; } 50%, 90% { opacity: 0; } 100% { opacity: 1; } }

.video-shell { position: relative; width: fit-content; margin-inline: auto; --video-ctrl-size: 44px; --video-ctrl-icon-size: 16px; }
.video-shell button { position: absolute; bottom: 0; width: var(--video-ctrl-size); height: var(--video-ctrl-size); color: #fff; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 1px 3px rgb(0 0 0 / 0.5)); transition: opacity 150ms ease; }
.video-play { left: 0; }
.video-mute { right: 0; }
.video-shell button svg { width: var(--video-ctrl-icon-size); height: var(--video-ctrl-icon-size); display: block; }
.video-shell.is-playing .video-play { opacity: 0; }
.video-shell.is-playing .video-play:focus-visible { opacity: 1; }
@media (hover: hover) { .video-shell.is-playing:hover .video-play { opacity: 1; } }
@media (hover: none) {
  .video-shell .video-play, .video-shell .video-mute { opacity: 0; pointer-events: none; }
  .video-shell.controls-visible .video-play, .video-shell.controls-visible .video-mute { opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
  .wall-cell img:first-child { opacity: 1; }
}

/* ---------- case study (Forexy) ---------- */
.fx-logo { position: relative; z-index: 1; width: 96px; height: 96px; border-radius: 22px; }
.fx-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; isolation: isolate; }
.fx-bg i { position: absolute; border-radius: 50%; --c: 77, 77, 255; --a: 0.5; width: 58vmax; height: 58vmax; background: radial-gradient(circle closest-side, rgba(var(--c), calc(var(--a) * 1)) 0%, rgba(var(--c), calc(var(--a) * 0.8)) 16%, rgba(var(--c), calc(var(--a) * 0.54)) 36%, rgba(var(--c), calc(var(--a) * 0.28)) 56%, rgba(var(--c), calc(var(--a) * 0.1)) 76%, rgba(var(--c), calc(var(--a) * 0.02)) 90%, rgba(var(--c), 0) 100%); }
.fx-bg i:nth-child(1) { left: -14%; top: -40%; animation: fx-d1 34s ease-in-out -8s infinite alternate; }
.fx-bg i:nth-child(2) { --c: 152, 152, 255; --a: 0.36; width: 120vmax; height: 120vmax; right: -20%; bottom: -40%; animation: fx-p2 40s ease-in-out -12s infinite alternate; }
.fx-bg i:nth-child(3) { --c: 55, 55, 190; --a: 0.42; width: 54vmax; height: 54vmax; left: 26%; top: 22%; animation: fx-d3 28s ease-in-out -4s infinite alternate; }
.fx-bg i:nth-child(4) { --c: 152, 152, 255; --a: 0.36; width: 100vmax; height: 100vmax; left: 50%; top: 50%; margin: -50vmax 0 0 -50vmax; animation: fx-p4 52s ease-in-out -20s infinite alternate, fx-pl 22s ease-in-out -6s infinite alternate; }
.fx-bg::before { content: ""; position: absolute; inset: -128px; background: url(assets/projects/forexy/grain.png) 0 0 / 128px 128px; mix-blend-mode: overlay; opacity: 0.06; animation: fx-noise 1s step-end infinite; }
@keyframes fx-d1 { from { transform: translate3d(-5%, 3%, 0) scale(1); } to { transform: translate3d(9%, -6%, 0) scale(1.14); } }
@keyframes fx-p2 { 0% { transform: translate3d(0, 0, 0) scale(1); } 30% { transform: translate3d(-45%, -60%, 0) scale(1.08); } 60% { transform: translate3d(-85%, -20%, 0) scale(0.95); } 100% { transform: translate3d(-60%, 25%, 0) scale(1.12); } }
@keyframes fx-d3 { from { transform: translate3d(-7%, -5%, 0) scale(0.92); } to { transform: translate3d(7%, 6%, 0) scale(1.12); } }
@keyframes fx-p4 { 0% { transform: translate3d(0, 0, 0) scale(0.9); } 30% { transform: translate3d(-55%, -45%, 0) scale(1.1); } 60% { transform: translate3d(45%, -55%, 0) scale(1); } 100% { transform: translate3d(30%, 50%, 0) scale(1.15); } }
@keyframes fx-pl { from { opacity: 0.3; } to { opacity: 0.95; } }
@keyframes fx-noise { 0.00% { transform: translate3d(-42px, -107px, 0); } 4.17% { transform: translate3d(-107px, -72px, 0); } 8.33% { transform: translate3d(-122px, -55px, 0); } 12.50% { transform: translate3d(-121px, -46px, 0); } 16.67% { transform: translate3d(-60px, 0px, 0); } 20.83% { transform: translate3d(-3px, -94px, 0); } 25.00% { transform: translate3d(-109px, -17px, 0); } 29.17% { transform: translate3d(-37px, -59px, 0); } 33.33% { transform: translate3d(-59px, -10px, 0); } 37.50% { transform: translate3d(-111px, -104px, 0); } 41.67% { transform: translate3d(-113px, -8px, 0); } 45.83% { transform: translate3d(-84px, -127px, 0); } 50.00% { transform: translate3d(-29px, -94px, 0); } 54.17% { transform: translate3d(-5px, -39px, 0); } 58.33% { transform: translate3d(-22px, -31px, 0); } 62.50% { transform: translate3d(-5px, -116px, 0); } 66.67% { transform: translate3d(-41px, -87px, 0); } 70.83% { transform: translate3d(-102px, -124px, 0); } 75.00% { transform: translate3d(-38px, -47px, 0); } 79.17% { transform: translate3d(-9px, -120px, 0); } 83.33% { transform: translate3d(-60px, -19px, 0); } 87.50% { transform: translate3d(-50px, -53px, 0); } 91.67% { transform: translate3d(-18px, -31px, 0); } 95.83% { transform: translate3d(-121px, -99px, 0); } }
.cs-sec.fx-tour { display: grid; grid-template: 100% / 100%; height: calc(var(--n) * 100%); padding: 0; scroll-snap-align: none; --wp: #0e0c13; }
.fx-tour[data-theme="l"] { --wp: #e8e6f0; }
.fx-steps, .fx-stage { grid-area: 1 / 1; }
.fx-steps { height: 100%; }
.fx-stage { --ph-half: calc(var(--ph) * 0.2445); --fx-lilac: #9898ff; --fx-ink: #44231f; position: sticky; top: 0; align-self: start; height: calc(100% / var(--n)); z-index: 1; display: flex; align-items: center; justify-content: center; --ph: min(62svh, 540px); padding-bottom: 96px; }
.fx-step { height: calc(100% / var(--n)); scroll-snap-align: start; }
.fx-phone { height: var(--ph); cursor: pointer; }
.fx-shots { position: absolute; inset: 0; margin: auto; width: 89.333%; height: 95%; background: var(--wp); }
.fx-phone .phone-frame-screen { -webkit-mask-image: url("assets/misc/iphone18pro-glacier-silhouette.png"); mask-image: url("assets/misc/iphone18pro-glacier-silhouette.png"); }
.fx-shot { position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s ease; }
.fx-shot.on { opacity: 1; }
.fx-shot img { width: 100%; height: 100%; }
.fx-caps { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.fx-cap { position: absolute; inset: 0; color: #fff; opacity: 0; transition: opacity 0.3s ease; }
.fx-cap.on { opacity: 1; }
.fx-cap h3 { position: absolute; left: 14px; top: 58%; max-width: 230px; margin: 0; padding: 12px 16px; background: var(--fx-lilac); color: var(--fx-ink); border-radius: 20px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6); font: var(--t-h3); letter-spacing: var(--ls-display); transform: rotate(-4deg); }
.fx-cap:nth-child(even) h3 { left: auto; right: 14px; top: 54%; transform: rotate(3deg); }
/* Mobile caption under a phone: centred between the phone and the info rail. Both stages leave 96px at the bottom, so the phone ends at 50% - 48px + ph/2. */
.fx-cap p, .ig-cap { position: absolute; left: 36px; right: 36px; top: calc(75% - 24px + var(--ph) / 4); margin: 0; text-align: center; text-wrap: balance; font: var(--t-body); opacity: 0.85; transform: translateY(-50%); }
.fx-loop img { position: absolute; inset: 0; opacity: 0; }
.fx-loop.on img { animation: fx-k3 6.6s linear infinite; }
.fx-loop--7.on img { animation-name: fx-k7; animation-duration: 15.4s; }
.fx-loop.on img:nth-child(2) { animation-delay: 2.2s; }
.fx-loop.on img:nth-child(3) { animation-delay: 4.4s; }
.fx-loop.on img:nth-child(4) { animation-delay: 6.6s; }
.fx-loop.on img:nth-child(5) { animation-delay: 8.8s; }
.fx-loop.on img:nth-child(6) { animation-delay: 11s; }
.fx-loop.on img:nth-child(7) { animation-delay: 13.2s; }
@keyframes fx-k3 { 0% { opacity: 0; z-index: 2; } 4% { opacity: 1; z-index: 2; } 4.01% { z-index: 1; } 37.3% { opacity: 1; } 37.31%, 100% { opacity: 0; z-index: 1; } }
@keyframes fx-k7 { 0% { opacity: 0; z-index: 2; } 1.7% { opacity: 1; z-index: 2; } 1.71% { z-index: 1; } 16% { opacity: 1; } 16.01%, 100% { opacity: 0; z-index: 1; } }
.fx-cap.on .fx-acc { animation: fx-as 15.4s infinite; }
@keyframes fx-as { 0.0%, 12.8% { background: var(--fx-lilac); color: #16131d; } 15.8%, 27.1% { background: #4d4dff; color: #f8f7fc; } 30.1%, 41.4% { background: #ffb000; color: #000; } 44.4%, 55.6% { background: #ffc66b; color: #141008; } 58.6%, 69.9% { background: #7dff9b; color: #020602; } 72.9%, 84.2% { background: #9ee8e0; color: #03141a; } 87.2%, 98.5% { background: #ff5a4a; color: #0a0000; } 100% { background: var(--fx-lilac); color: #16131d; } }
@media (prefers-reduced-motion: reduce) { .fx-loop img:first-child { opacity: 1; } }
.fx-phone, .fx-caps { transition: opacity 0.5s ease, filter 0.5s ease; }
.fx-tour.is-start .fx-phone, .fx-tour.is-end .fx-phone { opacity: 0.15; filter: blur(4px); }
.fx-intro p, .fx-end p { width: 100%; max-width: 900px; margin: 0; font: var(--t-h1); letter-spacing: var(--ls-display); text-align: center; }
.fx-intro, .fx-end { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1em; padding: 0 20px; opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity 0.5s ease, transform 0.5s var(--ease), visibility 0s 0.5s; }
.fx-tour.is-start .fx-intro, .fx-tour.is-end .fx-end { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.cta { display: flex; align-items: center; gap: 10px; margin-top: 1em; padding: 14px 28px; border-radius: 999px; background: var(--cta-bg); color: var(--cta-fg); font: var(--t-button); white-space: nowrap; transition: background 0.15s ease; }
.cta img { width: 1.5em; height: 1.5em; margin: -0.25em 0; border-radius: 22%; display: block; }
.cta:hover { background: var(--cta-fg); color: var(--cta-bg); }
.fx-more { --cta-bg: var(--fx-lilac); --cta-fg: var(--fx-ink); }
.lp-more { --cta-bg: #ff6300; --cta-fg: #000; }
.lp-more img { filter: brightness(0); }
.lp-more:hover img { filter: brightness(0) invert(1); }
.cap-end { display: flex; flex-direction: column; align-items: center; }
.cap-end p { margin: 0; }
.cap-end.is-on .cta { pointer-events: auto; }

/* ---------- case study (Air Max Day) ---------- */
.ig-sec { --ph: min(62svh, 540px); padding-bottom: 96px; }
.ig-phone { height: var(--ph); }
.ig-swipe { --sw-bg: #fff; --sw-ink: #000; position: absolute; z-index: 2; top: 22%; display: flex; gap: 6px; right: calc(100% - 72px); padding: 10px 16px; border-radius: 20px; background: var(--sw-bg); color: var(--sw-ink); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6); font: var(--t-h3); letter-spacing: var(--ls-display); white-space: nowrap; pointer-events: none; transform: translateY(-50%) rotate(-4deg); transition: opacity 0.4s ease; }
.ig-swipe i { font-style: normal; }
.ig-sec:not(.is-active) .ig-swipe, .ig-sec.is-swiped .ig-swipe { opacity: 0; }
.ig-phone .phone-frame-screen { -webkit-mask-image: url("assets/misc/iphone18pro-glacier-silhouette.png"); mask-image: url("assets/misc/iphone18pro-glacier-silhouette.png"); }
.ig-screen { position: absolute; inset: 0; margin: auto; width: 89.333%; height: 95%; overflow: hidden; container-type: inline-size; background: #000; }
.ig-status { height: 9cqw; }
.ig-head { display: flex; align-items: center; gap: 2.5cqw; height: 13cqw; padding: 0 3cqw; font: var(--t-body-strong); }
.ig-av { flex: none; width: max(20px, 8cqw); aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); }
.ig-handle { flex: 1; min-width: 0; }
.ig-more { flex: none; width: max(18px, 6cqw); }
.ig-media { position: relative; width: 100%; aspect-ratio: 1; }
.ig-carousel { display: flex; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; cursor: grab; }
.ig-carousel::-webkit-scrollbar { display: none; }
.ig-carousel.is-drag { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.ig-carousel .video-shell { flex: 0 0 100%; width: 100%; height: 100%; margin: 0; scroll-snap-align: start; scroll-snap-stop: always; --video-ctrl-size: 36px; }
.ig-carousel video { width: 100%; height: 100%; object-fit: cover; }
.ig-badge { position: absolute; top: 2.5cqw; right: 2.5cqw; z-index: 1; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); font: var(--fs-ui) / 1.2 var(--font-mono); pointer-events: none; }
.ig-act { position: relative; display: flex; align-items: center; justify-content: space-between; height: 13cqw; padding: 0 3cqw; }
.ig-act svg { display: block; width: max(16px, 6.4cqw); }
.ig-acts { display: flex; gap: max(8px, 3cqw); }
.ig-dots { position: absolute; left: 50%; top: 50%; display: flex; gap: 4px; transform: translate(-50%, -50%); }
.ig-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); }
.ig-dots i.on { background: var(--c-fg); }
.ig-bars { display: grid; gap: 2cqw; padding: 1cqw 3cqw; }
.ig-bars i { height: max(5px, 1.8cqw); border-radius: 999px; background: rgba(255, 255, 255, 0.14); }
.ig-bars i:nth-child(1) { width: 30%; }
.ig-bars i:nth-child(2) { width: 92%; }
.ig-bars i:nth-child(3) { width: 58%; }
/* Outline of the next post in the feed, filling the screen below */
.ig-next { margin-top: 4cqw; }
.ig-next .ig-head i { width: 30%; height: max(5px, 1.8cqw); border-radius: 999px; background: rgba(255, 255, 255, 0.14); }
.ig-next .ig-av { border-color: rgba(255, 255, 255, 0.14); }
.ig-ghost { aspect-ratio: 1; background: rgba(255, 255, 255, 0.06); }

/* ---------- desktop: persistent left rail | media stage ---------- */
@media (min-width: 1024px) and (min-height: 520px) {
  :root {
    --t-h1: var(--w-sans) clamp(32px, 3.6vw, 52px) / 1.1 var(--font-sans);
    --t-h2: var(--w-sans) 28px / 1.18 var(--font-sans);
    --t-h3: var(--w-sans) 24px / 1.15 var(--font-sans);
    --t-body: var(--w-sans) 16px / 1.4 var(--font-sans);
    --t-body-strong: calc(var(--w-sans) + 60) 16px / 1.4 var(--font-sans);
    --t-nav: 20px var(--font-mono);
  }
  .app {
    display: grid;

    grid-template-columns: minmax(320px, 7fr) minmax(0, 17fr);
    column-gap: var(--pad);
    padding: var(--pad);
  }
  .rail { display: flex; flex-direction: column; position: relative; min-height: 0; overflow: hidden; }
  .topbar { margin-bottom: 12px; }
  .list-filter { height: 36px; align-items: center; padding: 0 var(--inset); }
  .list-filter.is-empty { display: flex; visibility: hidden; }
  .topbar a { min-height: 0; padding: 6px var(--inset); }

  .list-wrap { display: block; flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  body[data-route="about"] .list-wrap { display: none; }
  .list { position: relative; display: flex; flex-direction: column; border-top: 1px solid rgba(255, 255, 255, 0.1); }
  .list a {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    height: var(--row-h); padding: 0 var(--inset);
    font: var(--t-label); letter-spacing: 0.01em; color: var(--c-mute);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    transition: color 0.12s ease;
  }
  .list a.is-cursor, .list a:hover, .list:not(.has-cursor) a { color: var(--c-fg); }
  .list a span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 20px; }
  .list a span:last-child { flex: none; white-space: nowrap; }

  .rail-about { padding: 0 var(--inset) 56px; flex: 1; }
  body[data-route="about"] .rail-about { padding-top: 0; }
  body[data-route="about"] .stage { display: block; }

  body[data-route="project"] .stage, body[data-route="home"]:not(.is-index) .stage { margin-bottom: 0; }
  .rail-info.is-tray { position: static; z-index: auto; background: none; padding: 0 var(--inset) 60px; }
  .rail-info.is-tray .info-inner { gap: 12px; padding-bottom: 0; }
  .info-head { cursor: default; }
  .info-tog, .info-client { display: none; }
  .rail-info {
    flex: 0 0 auto;
    max-height: min(340px, 35svh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--pad) var(--inset) 60px;
    gap: 12px;
  }

  .hint {
    display: flex; justify-content: space-between;
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 10px var(--inset);
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(14px);
            backdrop-filter: blur(14px);
    font: var(--fs-ui) var(--font-mono);
    color: var(--c-mute);
  }

  #feed-pager,   .home-feed {
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), var(--cell, 1fr));
    grid-auto-rows: var(--cell, auto);
    justify-content: center;
    align-content: start;
    gap: 16px;
    scroll-snap-type: none;
  }
  body.is-index .home-feed { display: none; }
  .card { height: auto; justify-content: flex-start; transition: opacity 0.2s ease; }
  .card-media { max-height: none; }
  .card { position: relative; }
  .card-media { position: absolute; inset: 0; scale: var(--s, 1); }
  .card-media > * { position: absolute; inset: 0; height: 100%; max-height: none; aspect-ratio: auto; object-fit: contain; background: none; }
  .card-row { display: none; }
  .home-feed.has-cursor .card:not(.is-cursor) { opacity: 0.35; }

  .vwrap { padding: 0; }
  .vwrap video { max-height: 78svh; }
  .vwrap figcaption { top: 100%; padding-top: 10px; transform: none; }

  .phone-frame { height: min(78svh, 720px); }
  .s1 { --d: 150px; }
  .stat-num { font-size: 42px; }
  .stat-label { font-size: var(--fs-meta); }
  .sticker { width: 104px; height: 104px; padding: 13px; top: -22px; right: -34px; }

  .statement { max-width: 900px; padding: 0 24px; }
  .s3 .phone-frame { height: min(82svh, 760px); }
  .ba-stage { margin-top: 0; }
  .s4-pin { padding: 12px 0; }
  .s4-ui { justify-content: center; gap: 16px; }
  .wall { grid-template-columns: repeat(8, 1fr); }
  .fx-stage { --ph: min(78svh, 720px); padding-bottom: 0; }
  .ig-sec { --ph: min(78svh, 720px); padding-bottom: 0; }
  .ig-swipe { top: 34%; right: calc(100% - 40px); }
  .ig-cap { top: 50%; left: auto; right: calc(50% + var(--ph) * 0.2445 + 48px); width: 240px; max-width: calc(50% - var(--ph) * 0.2445 - 72px); text-align: left; transform: translateY(-50%); }
  .ig-sec:nth-child(even) .ig-cap { right: auto; left: calc(50% + var(--ph) * 0.2445 + 48px); }

  .fx-cap { --ov: 36px; inset: auto; top: 50%; right: calc(50% + var(--ph-half) - var(--ov)); width: max-content; max-width: calc(50% - var(--ph-half) + var(--ov)); display: flex; flex-direction: column; align-items: flex-start; transform: translateY(calc(-50% + 10px)); transition: opacity 0.3s ease, transform 0.4s var(--ease); }
  .fx-cap:nth-child(even) { right: auto; left: calc(50% + var(--ph-half) - var(--ov)); }
  .fx-cap.on { transform: translateY(-50%); }
  .fx-cap h3, .fx-cap:nth-child(even) h3 { position: static; max-width: none; margin: 0 0 32px; padding: 12px 16px; display: inline-block; transform: rotate(-3deg); text-wrap: balance; }
  .fx-cap:nth-child(even) h3 { transform: rotate(3deg); }
  .fx-cap p { position: static; transform: none; width: 0; min-width: calc(100% - var(--ov) - 24px); text-align: left; text-wrap: balance; }
  .fx-cap:nth-child(even) p { width: auto; min-width: 0; max-width: 240px; margin-left: calc(var(--ov) + 24px); }
  .fx-cap:nth-child(6) p { max-width: 200px; }
}

@media (min-width: 1024px) and (max-width: 1279px) and (min-height: 520px) {
  .s1 { --d: 120px; }
  .stat-num { font-size: 32px; }
  .sticker { width: 84px; height: 84px; padding: 12px; right: -26px; }
}

@media (min-width: 1024px) and (max-width: 1099px) and (min-height: 520px) {
  .fx-cap { --ov: 72px; }
}
/* Lapse cover on Home: the lapse.com card, hue shifting while the hand holds its color */
.lapse-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1200 / 1331;
  width: auto;
  height: 100cqw;
  margin: 0 auto;
  background: url(assets/projects/lapse/cover-wordmark.webp) 0 0 / 100% 100% no-repeat, #a0f;
  animation: hue-shift 10.5s linear infinite;
}
.lapse-card > i { position: absolute; inset: 0; background: 0 0 / cover no-repeat; }
.lapse-card .hand { background-image: url(assets/projects/lapse/cover-hand.webp); --k: -1; animation: inherit; }
.lapse-card .shadow { background-image: url(assets/projects/lapse/cover-shadow.webp); mix-blend-mode: multiply; }
.lapse-card .flash { background-image: url(assets/projects/lapse/cover-flash.webp); mix-blend-mode: screen; }
.lapse-card .grain { background-image: url(assets/projects/lapse/cover-grain.webp); mix-blend-mode: hard-light; opacity: 0.8; }
@keyframes hue-shift {
  0%, 4.76% { filter: hue-rotate(0deg); }
  33.3% { filter: hue-rotate(calc(25deg * var(--k, 1))); }
  61.9% { filter: hue-rotate(calc(-60deg * var(--k, 1))); }
  100% { filter: hue-rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) { .lapse-card, .lapse-card .hand { animation: none; } }

.info-tog, .info-title, .info-desc, .card-row, .rail-about, .statement, .fx-cap h3, .fx-cap p, .ig-cap, .ig-swipe, .fx-intro p, .fx-end p, .ig-handle, .ig-badge, .list a, .vwrap figcaption { font-variant-numeric: tabular-nums; }
