/* Split-view portfolio: text + projects on the left, media on the right. Hard grid, no pills.
   Paged, not free-scrolling: both columns are tracks moved by ONE variable (--cur), so they can never drift apart. */
* { box-sizing: border-box; }

:root {
  --bg: #fbfaf7;
  --ink: #111;
  --bar-h: 96px;
  --pad: clamp(20px, 2.4vw, 44px);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Velvelyne", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --th: 100dvh; /* height of one text page */
  --mh: 100dvh; /* height of one media page */
  --ease: cubic-bezier(0.76, 0, 0.2, 1);
  --dur: 760ms;
}

html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; width: 100%; font-family: var(--sans); -webkit-font-smoothing: antialiased; }

/* ---------- top bar (icons left, About right, over the text pane) ---------- */
.bar {
  position: fixed; z-index: 20; top: 0; left: 0; width: 50%;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--pad); padding-top: max(var(--pad), env(safe-area-inset-top));
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.icons { display: flex; gap: clamp(12px, 1.5vw, 24px); }
.icons button {
  all: unset; cursor: pointer; width: 22px; height: 26px; position: relative;
  display: grid; place-items: start center;
}
.icons img { width: 20px; height: 20px; object-fit: contain; display: block; }
.icons button::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--ink); transform: scaleX(0); transition: transform 160ms ease;
}
.icons button[aria-current="true"]::after { transform: scaleX(1); }
.about {
  color: var(--ink); text-decoration: none; font-size: 14px; letter-spacing: 0.02em;
  text-transform: uppercase; line-height: 20px;
}
.about:hover { text-decoration: underline; text-underline-offset: 4px; }
.links { display: flex; gap: clamp(14px, 1.8vw, 28px); align-items: baseline; }
.gridBtn {
  all: unset; cursor: pointer; color: var(--ink); width: 22px; height: 26px; position: relative;
  display: grid; place-items: start center;
}
.gridBtn svg { display: block; }
.gridBtn::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); transform: scaleX(0); transition: transform 160ms ease; }
.icons .qIcon { color: var(--ink); width: 22px; height: 26px; display: grid; place-items: start center; position: relative; }
.icons .qIcon svg { display: block; }
.icons .qIcon::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); transform: scaleX(0); transition: transform 160ms ease; }
.icons .qIcon:hover::after { transform: scaleX(1); }

/* ---------- grid overview of all projects ---------- */
.grid {
  position: fixed; inset: 0; z-index: 15; background: var(--bg); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--bar-h) 0 0;
}
.grid[hidden] { display: none; }
.grid .cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 22vw, 340px), 1fr));
  gap: clamp(24px, 3vw, 44px) clamp(12px, 1.6vw, 24px); margin: 0 var(--pad) var(--pad);
}
.card {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column;
  background: var(--bg);
}
.card .thumb { aspect-ratio: 4 / 5; background: #e9e8e5; overflow: hidden; }
.card .thumb img, .card .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .t { padding: 12px 0 0; font-weight: 600; font-size: 15px; line-height: 1.15; letter-spacing: -0.01em; }
.card .s { padding: 0; font: 11px/1.3 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 6px; }
.card:hover .t { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- two panes, each a track moved by --cur ---------- */
.split { display: grid; grid-template-columns: 50% 50%; width: 100%; height: 100%; }
.pane { height: 100%; width: 100%; min-width: 0; overflow: hidden; position: relative; }
.track {
  will-change: transform;
  transition: transform var(--dur) var(--ease);
  transform: translate3d(0, calc(var(--cur, 0) * var(--step) * -1), 0);
}
.pane-text .track { --step: var(--th); }
.pane-media .track { --step: var(--mh); }
.split.no-anim .track { transition: none; }

/* ---------- left: one page per project (scrolls inside only if the text is longer than the page) ---------- */
.proj {
  height: var(--th); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  display: flex; flex-direction: column;
  padding: var(--bar-h) var(--pad) var(--pad);
}
.proj::-webkit-scrollbar { display: none; width: 0; height: 0; }
.proj h2 {
  margin: 0; font-weight: 600; font-size: clamp(34px, 4.7vw, 88px);
  line-height: 0.95; letter-spacing: -0.025em; text-wrap: balance; max-width: 11em;
}
.credit { margin-top: 14px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.credit a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.credit a:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.gap1 { flex: 1.3 1 40px; }
.gap2 { flex: 0.5 1 32px; }
.body { max-width: 34em; font-size: clamp(15px, 1.2vw, 19px); line-height: 1.38; font-weight: 500; }
.body p { margin: 0 0 0.9em; }
.body p:last-child { margin-bottom: 0; }
.meta {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: baseline;
}
.meta a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.meta a:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- right: one container per project, level with its text; scroll inside it for more media ---------- */
.pane-media { background: #e9e8e5; }
.cell { height: var(--mh); position: relative; overflow: hidden; }
.stack { height: 100%; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y mandatory; scrollbar-width: none; }
.stack { -ms-overflow-style: none; }
.stack::-webkit-scrollbar { display: none; width: 0; height: 0; }
.m { width: 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; position: relative; background: #e9e8e5; }
.m img, .m video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* video: sits centred on black with a margin around it */
.m.vid { background: #000; display: grid; place-items: center; padding: clamp(24px, 6vw, 96px); }
.m.vid video, .m.vid img { border-radius: clamp(20px, 3vw, 44px); width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.m .play {
  position: absolute; right: var(--pad); bottom: var(--pad); background: var(--ink); color: #fff;
  font: 12px/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; padding: 10px 12px;
}
/* dots belong to the image container and travel with it: black, active solid, the rest 50% */
.dots { position: absolute; z-index: 2; left: var(--pad); bottom: var(--pad); display: flex; flex-direction: column; gap: 10px; }
.dots button { all: unset; cursor: pointer; width: 10px; height: 10px; border-radius: 50%; background: #000; opacity: 0.5; transition: opacity 120ms; }
.dots button[aria-current="true"] { opacity: 1; }

/* ---------- mobile: media on top, text below ---------- */
@media (max-width: 800px) {
  :root { --bar-h: 20px; --pad: 16px; --mh: 42dvh; --th: calc(100dvh - 44px - 42dvh); }
  .bar { width: 100%; height: 44px; padding: 10px var(--pad); background: var(--bg); align-items: center; }
  .split { grid-template-columns: 100%; grid-template-rows: 42dvh 1fr; padding-top: 44px; }
  .pane-media { order: 1; height: 42dvh; }
  .pane-text { order: 2; height: var(--th); }
  .proj { padding-top: 18px; }
  .grid { padding-top: 56px; }
  .grid .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proj h2 { font-size: clamp(28px, 8vw, 40px); }
  .dots { flex-direction: row; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) { :root { --dur: 1ms; } }

/* ---------- about: last page. Left = who, right = the facts as a hard typographic grid ---------- */
.about-cell { background: var(--bg); }
.aboutdata { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: var(--pad); padding-top: calc(var(--pad) + 4px); }
.aboutdata::-webkit-scrollbar { width: 0; height: 0; display: none; }
.asec { margin: 0 0 clamp(28px, 4vw, 56px); }
.asec h3 { margin: 0; padding: 0 0 6px; font: 600 clamp(22px, 2.4vw, 34px)/1 var(--sans); letter-spacing: -0.02em; }
.arow { display: grid; grid-template-columns: minmax(5.5em, 8.5em) minmax(0, 1fr); gap: 4px 16px; padding: 9px 0 10px; align-items: baseline; }
.arow + .arow { border-top: 1px solid rgba(17, 17, 17, 0.16); }
.arow .am { font: 11px/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.6; }
.arow b { display: block; font-weight: 600; font-size: 15px; line-height: 1.25; letter-spacing: -0.005em; }
.arow div span { display: block; font-size: 13.5px; line-height: 1.3; opacity: 0.68; margin-top: 1px; }
.body a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.body a:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (max-width: 800px) {  .arow { grid-template-columns: 5.5em minmax(0, 1fr); } }

.about-h { font-size: clamp(28px, 3.5vw, 62px); line-height: 1.02; max-width: 15em; }

.meta .alinks { margin-left: auto; display: flex; gap: 18px; }

/* ---------- phones: one scrolling feed (hero image, title, text, then all media) ---------- */
html.mobile, html.mobile body { height: auto; overflow: visible; overscroll-behavior: auto; }
html.mobile body { position: static; }
.mobile .split { display: none; }
.mobile .bar { width: 100%; height: 44px; padding: 9px var(--pad) 0; gap: 10px; background: var(--bg); align-items: flex-start; pointer-events: auto; }
.mobile .icons { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; gap: 14px; padding-right: 6px; }
.mobile .icons::-webkit-scrollbar { display: none; }
.mobile .icons button, .mobile .icons .qIcon { flex: 0 0 22px; }
.mobile .links { flex: 0 0 auto; }
.feed { padding-top: 44px; }
.mproj { padding-bottom: 72px; scroll-margin-top: 44px; }
.mm { margin: 0; background: #e9e8e5; }
.mm img, .mm video { display: block; width: 100%; height: auto; aspect-ratio: auto 5 / 7; }
.mhero img, .mhero video { aspect-ratio: 4 / 5; object-fit: cover; }
.mm.vid { background: #000; display: grid; place-items: center; padding: 24px; }
.mm.vid img, .mm.vid video { width: auto; max-width: 100%; max-height: 100%; aspect-ratio: auto; border-radius: 20px; object-fit: contain; }
.mhero.vid { aspect-ratio: 4 / 5; }
.mm .play { position: absolute; right: 16px; bottom: 16px; background: var(--ink); color: #fff; font: 12px/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; padding: 10px 12px; }
.mm { position: relative; }
.mtext { padding: 22px var(--pad) 26px; }
.mtext h2 { margin: 0; font-weight: 600; font-size: clamp(30px, 9.4vw, 46px); line-height: 0.97; letter-spacing: -0.025em; text-wrap: balance; }
.mtext .credit { margin-top: 12px; }
.mtext .body { margin-top: 24px; font-size: 16px; line-height: 1.4; max-width: none; }
.mtext .meta { margin-top: 22px; }
.mtext .about-h { font-size: clamp(26px, 7.6vw, 40px); line-height: 1.02; }
.mrest { display: grid; gap: 6px; }
.m-about { padding: 8px var(--pad) 0; }
.mobile .grid { padding-top: 56px; }

/* ---------- loading: a blurred preview sits behind each image until the real one fades in ---------- */
.m, .mm, .card .thumb { position: relative; overflow: hidden; background-color: #e9e8e5; }
.m::before, .mm::before, .card .thumb::before {
  content: ""; position: absolute; inset: -40px; z-index: 0;
  background: var(--lq, none) center / cover no-repeat;
  filter: blur(12px) saturate(1.1); transform: scale(1.04);
}
.m.vid::before, .mm.vid::before { display: none; }
.m img, .mm img, .card .thumb img { position: relative; z-index: 1; }
.m img, .mm img { opacity: 0; transition: opacity 0.5s ease; }
.m img.ld, .mm img.ld { opacity: 1; }
.m video, .mm video { position: relative; z-index: 1; }
.m .play, .mm .play { z-index: 2; }
svg.ic { width: 20px; height: 20px; display: block; }
picture { display: contents; }
