/* ==================================================================
   Nicholas Child — product & interface design folio
   Tokens + layout modelled on emekarajis.com
================================================================== */

:root {
  --ink: #0c1114;
  --ink-2: #141b1f;
  --bone: #ece6dd;
  --mute: #8c979b;
  --red: #ff2b1c;
  --line: #ece6dd21;
  --wide: "Archivo", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --gut: clamp(16px, 4.4vw, 72px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
html, body { margin: 0; }

body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--wide);
  font-stretch: 100%;
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

.wrap { padding-inline: var(--gut); max-width: 1600px; }
.mono { font-family: var(--mono); letter-spacing: 0; font-size: .8125rem; line-height: 1.6; }
.disp {
  font-family: var(--wide);
  text-transform: uppercase;
  letter-spacing: -.01em;
  text-wrap: balance;
  font-weight: 900;
  font-stretch: 125%;
  line-height: .9;
}
.red { color: var(--red); }
.hero .slash { padding-right: 32px; }

/* ---------------- ambient background ---------------- */
.light {
  z-index: 0;
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 55% at 62% 34%, #ffaa6e14, #ffaa6e00 60%),
    radial-gradient(90% 80% at 50% 118%, #ff2b1c1c, transparent 62%);
}
.grain {
  z-index: 6;
  pointer-events: none;
  opacity: .07;
  mix-blend-mode: soft-light;
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

/* ---------------- nav ---------------- */
.nav {
  z-index: 5;
  padding: calc(var(--safe-top) + 18px) var(--gut) 14px;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}
.nav .logo { line-height: 0; display: block; }
.nav .logo img {
  width: auto;
  height: clamp(22px, 2.4vw, 30px);
  display: block;
}
.nav ul {
  font-family: var(--wide);
  letter-spacing: .02em;
  font-stretch: 112%;
  gap: clamp(16px, 2.6vw, 40px);
  font-size: .8125rem;
  font-weight: 700;
  display: flex;
}
.nav a { padding-block: 6px; position: relative; }
.nav ul a::after {
  content: "";
  background: var(--red);
  transform-origin: 0;
  height: 2px;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  transform: scaleX(0);
}
.nav ul a:hover::after, .nav ul a.on::after { transform: scaleX(1); }

/* ---------------- shared type blocks ---------------- */
.sec-head {
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: clamp(40px, 6vw, 80px);
  display: flex;
}
.sec-head .disp { font-size: clamp(2.8rem, 8.2vw, 9rem); }
.sec-head p { color: var(--mute); max-width: 24rem; }

/* ---------------- hero ---------------- */
.hero {
  height: 100svh;
  padding-top: calc(var(--safe-top) + 92px);
  padding-bottom: clamp(24px, 4svh, 44px);
  grid-template-rows: 1fr auto;
  display: grid;
  position: relative;
  overflow: hidden;
  /* Full-bleed so the heading can centre in the viewport on wide screens. */
  max-width: none;
}
.hero h1 {
  letter-spacing: -.02em;
  white-space: nowrap;
  z-index: 1;
  align-self: center;
  /* Longest line (& VISUAL DESIGNER) fills 80vw — 10% inset each side. */
  font-size: clamp(1.75rem, 6.1vw, calc(80vw * 0.07621));
  line-height: .9;
  display: block;
  /* Shrink to the longest line and centre with 10% side padding;
     lines stay right-aligned within the block. */
  width: max-content;
  max-width: 80vw;
  justify-self: center;
  margin-inline: auto;
  text-align: right;
}
.hero h1 > span { display: block; }
.hero h1 > span:first-child { padding-right: 56px; }
.hero h1 > span:nth-child(3) { padding-right: 120px; }
.hero h1 .red { display: inline; }
/* Short viewports: keep the hero scrollable instead of clipping */
@media (max-height: 620px) {
  .hero { height: auto; min-height: 100svh; }
}
/* ---------------- logo slide ---------------- */
.logo-slide {
  --logo-gap: clamp(44px, 6.4vw, 96px);
  overflow: hidden;
  position: relative;
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  padding-block: clamp(12px, 2vw, 20px);
  background: none;
  border: 0;
}
.logo-slide__fade {
  pointer-events: none;
  z-index: 1;
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--ink) 0%,
    transparent 12%,
    transparent 88%,
    var(--ink) 100%
  );
}
.logo-slide__track {
  align-items: center;
  gap: var(--logo-gap);
  width: max-content;
  display: flex;
  animation: logo-slide 42s linear infinite;
}
.logo-slide ul {
  align-items: center;
  gap: var(--logo-gap);
  flex: none;
  display: flex;
  margin: 0;
  padding: 0;
}
.logo-slide li {
  flex: none;
  color: #fff;
  opacity: .55;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  font-family: var(--wide);
  font-size: clamp(.9rem, 1.35vw, 1.15rem);
  font-weight: 800;
  font-stretch: 112%;
  transition: opacity .25s;
}
.logo-slide li img {
  width: auto;
  --logo-h: clamp(1.265rem, 1.87vw, 1.65rem);
  display: block;
  height: calc(var(--logo-h) * var(--logo-scale, 1));
  max-width: none;
}
.logo-slide li img.logo-svg { filter: brightness(0) invert(1); }
/* optical balance: wide marks shorter, compact marks taller */
.logo-slide li { display: flex; align-items: center; height: calc(clamp(1.15rem, 1.7vw, 1.5rem) * 1.7); }
.logo-slide li img.logo-bupa        { --logo-scale: 1; }
.logo-slide li img.logo-nissan      { --logo-scale: .68; }
.logo-slide li img.logo-tbwa        { --logo-scale: .9; }
.logo-slide li img.logo-jwt         { --logo-scale: 1.2; }
.logo-slide li img.logo-anz         { --logo-scale: 1.1; }
.logo-slide li img.logo-medibank    { --logo-scale: .85; }
.logo-slide li img.logo-playstation { --logo-scale: .95; }
.logo-slide li img.logo-schweppes   { --logo-scale: 1.07; }
.logo-slide li img.logo-westpac     { --logo-scale: .87; }
.logo-slide li img.logo-suzuki      { --logo-scale: .86; }
.logo-slide li img.logo-hp          { --logo-scale: .85; }
.logo-slide li img.logo-opel        { --logo-scale: .86; }
.logo-slide li img.logo-disney      { --logo-scale: 1.05; }
.logo-slide li img.logo-ford        { --logo-scale: 1.12; }
.logo-slide li img.logo-rebel       { --logo-scale: 1.05; }
.logo-slide li img.logo-cargocrew   { --logo-scale: 1.6; }
.logo-slide li img.logo-officeworks { --logo-scale: .9; }
.logo-slide li img.logo-kitchenwarehouse { --logo-scale: 1.1; }
@keyframes logo-slide {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-50% - var(--logo-gap) / 2)); }
}
@media (prefers-reduced-motion: reduce) {
  .logo-slide__track { animation: none; }
}

/* ---------------- about ---------------- */
.about { padding-block: clamp(110px, 16vw, 220px) clamp(80px, 10vw, 140px); }
.about-grid {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: start;
  gap: 48px clamp(32px, 6vw, 110px);
  display: grid;
}
.about-copy { padding-left: 64px; }
.hello { justify-content: space-between; align-items: baseline; gap: 20px; display: flex; }
.hello .disp { color: var(--red); font-size: clamp(3rem, 7vw, 7rem); }
.statement {
  font-family: var(--wide);
  text-transform: uppercase;
  text-wrap: balance;
  max-width: 24em;
  margin-top: 24px;
  font-size: clamp(1.35rem, 2.5vw, 2.35rem);
  font-weight: 900;
  font-stretch: 118%;
  line-height: 1.08;
}
.cols { color: var(--mute); columns: 2; column-gap: 48px; margin-top: 30px; display: block; }
.cols p + p { margin-top: 1em; }
.cols p { text-wrap: balance; hyphens: none; }
.tools { gap: 14px; max-width: 680px; margin-top: clamp(40px, 5vw, 64px); display: grid; }
.tools p { color: var(--mute); }
.tools ul {
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 24px;
  padding-top: 18px;
  display: grid;
}
.tools li {
  font-family: var(--wide);
  color: var(--bone);
  opacity: .62;
  font-size: clamp(.9rem, 1.36vw, 1.23rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1;
  transition: opacity .25s;
}
.tools li:has(svg) { align-items: center; gap: .5em; display: flex; }
.tools li svg { fill: currentColor; flex: none; width: auto; height: 1.5em; }
/* Full wordmark logos, tinted by the text colour via a mask.
   Sized to balance the icon + name pairs, on the same row height. */
.tools li:has(.wordmark) { align-items: center; min-height: 1.5em; display: flex; }
.wordmark { background: currentColor; height: 1.05em; display: block; -webkit-mask: var(--mark) left center / contain no-repeat; mask: var(--mark) left center / contain no-repeat; }
.wordmark--eleven { --mark: url("assets/elevenlabs.png"); aspect-ratio: 818 / 107; }
.about-hat { align-self: center; justify-items: center; gap: 8px; display: grid; position: relative; }
.about-hat::before {
  content: "";
  pointer-events: none;
  border-radius: 50%;
  position: absolute;
  inset: 8% 4% 14%;
  background: radial-gradient(closest-side, #ff782829, #ff782800);
}
.about-hat .slot { width: 100%; aspect-ratio: 1; max-width: 560px; }
.about-hat:has(.about-photo)::before { display: none; }
.about-photo { width: 100%; height: auto; max-width: 560px; aspect-ratio: 1; object-fit: cover; object-position: 50% 30%; border-radius: 64px; display: block; }
.about-hat .cap { color: var(--mute); text-align: center; }

/* ---------------- work ---------------- */
.work { padding-block: 0; position: relative; }
.work-pin {
  min-height: 100svh;
  padding-top: calc(var(--safe-top) + 96px);
  padding-bottom: clamp(24px, 4svh, 48px);
  grid-template-rows: auto 1fr;
  display: grid;
  overflow: hidden;
}
body.work-scroll .work-pin {
  position: sticky;
  top: 0;
  height: 100svh;
  min-height: 100svh;
}
body.work-scroll .track { scroll-snap-type: none; }
.work .sec-head { flex-wrap: nowrap; align-items: center; margin-bottom: 64px; }
.work .sec-head .disp {
  font-size: clamp(2.6rem, 7vw, 7.4rem);
  padding-left: 64px;
  /* Cancel the P's left side bearing so its ink lines up with the
     About column edge above. */
  margin-left: -.074em;
}
.work-side { align-items: center; gap: clamp(12px, 2vw, 28px); display: flex; }
.work-side p { color: var(--mute); max-width: 20rem; }
.counter { font-variant-numeric: tabular-nums; color: var(--bone); white-space: nowrap; }
.counter b { color: var(--red); font-weight: 500; }
.track {
  padding-right: var(--gut);
  /* First card starts at the gutter, in line with the nav logo. */
  padding-left: var(--gut);
  margin-left: 0;
  margin-right: 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  align-items: stretch;
  gap: clamp(16px, 2.4vw, 36px);
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
}
.track::-webkit-scrollbar { display: none; }
.proj {
  scroll-snap-align: start;
  flex: none;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: start;
  gap: 16px;
  width: min(84vw, 560px, 100svh - 300px);
  min-width: min(84vw, 280px);
  display: grid;
}
.proj-open { all: unset; cursor: pointer; min-height: 0; display: block; position: relative; }
.proj-open:focus-visible { outline: 2px solid var(--red); outline-offset: 6px; }
.cover {
  display: block;
  aspect-ratio: 1;
  background: #05080c;
  border-radius: 64px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.cover--img {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  height: 100%;
  transition: transform .9s cubic-bezier(.2, .7, .2, 1);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-origin: center center;
}
.cover canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-origin: center center;
  transform: scale3d(1, 1, 1);
}
.cover--img {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-origin: center center;
  transform: scale3d(1, 1, 1);
}
.proj-open:hover .cover canvas,
.proj-open:hover .cover--img { transform: scale3d(1.008, 1.008, 1); }
.proj-meta { align-items: baseline; display: block; }
.proj-meta .n {
  color: var(--bone);
  font-family: var(--wide);
  text-transform: uppercase;
  font-weight: 900;
  font-stretch: 125%;
  line-height: 1;
  font-size: clamp(1.4rem, 2.8vw, 2.6rem);
  white-space: nowrap;
}
.proj-meta .n b { color: var(--red); font-weight: inherit; }
/* ---------------- experience ---------------- */
.exp { padding-block: clamp(80px, 10vw, 140px); }
.exp .sec-head .disp { font-size: clamp(2.2rem, 6vw, 6.5rem); }
.exp-intro { color: var(--mute); max-width: 40rem; margin-top: 24px; }
.exp-grid {
  grid-template-columns: minmax(0, 1fr) clamp(140px, 24vw, 380px);
  gap: 24px;
  margin-top: clamp(40px, 6vw, 80px);
  display: grid;
}
.roles-list { border-top: 1px solid var(--line); }
.job {
  border-bottom: 1px solid var(--line);
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 8px 20px;
  padding-block: clamp(20px, 2.6vw, 34px);
  display: grid;
}
.job .yr { padding-top: .5rem; }
.job h3 {
  font-family: var(--wide);
  text-transform: uppercase;
  font-size: clamp(1.6rem, 3.6vw, 3.3rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1;
}
.job p { color: var(--mute); grid-column: 2; }
.exp-lane { position: relative; }
.exp-lane .slot { aspect-ratio: 1; width: 100%; position: sticky; top: 30svh; }

/* ---------------- method ---------------- */
.method { height: 420svh; position: relative; }
.m-stage {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: 24px;
  height: 100svh;
  padding-top: 80px;
  display: grid;
  position: sticky;
  top: 0;
}
.m-text { align-content: center; gap: clamp(18px, 3svh, 36px); min-width: 0; display: grid; }
.m-text .disp { font-size: clamp(2.4rem, 5.6vw, 6rem); }
.steps { border-top: 1px solid var(--line); display: grid; }
.step {
  border-bottom: 1px solid var(--line);
  opacity: .34;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  gap: 4px 12px;
  padding-block: 14px;
  transition: opacity .4s;
  display: grid;
}
.step.on { opacity: 1; }
.step .n { color: var(--red); padding-top: .3rem; }
.step h3 {
  font-family: var(--wide);
  text-transform: uppercase;
  font-size: clamp(1.05rem, 1.7vw, 1.5rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1.05;
}
.step p {
  color: var(--mute);
  grid-column: 2;
  grid-template-rows: 0fr;
  max-width: 30rem;
  transition: grid-template-rows .5s cubic-bezier(.2, .7, .2, 1);
  display: grid;
}
.step p > span { overflow: hidden; }
.step.on p { grid-template-rows: 1fr; }
.m-objects { height: min(78svh, 760px); position: relative; }
.m-objects .slot { position: absolute; }
.m-objects .slot canvas { width: 100%; height: 100%; display: block; }
.m-objects [data-slot="big"] { width: 72%; height: 76%; top: 12%; left: 14%; }
.m-objects [data-slot="tl"] { width: 28%; height: 30%; top: 0; left: 2%; }
.m-objects [data-slot="br"] { width: 30%; height: 30%; bottom: 0; right: 0; }
.m-note { color: var(--mute); position: absolute; bottom: -6px; right: 0; }

/* ---------------- contact ---------------- */
.contact { padding-block: clamp(90px, 12vw, 170px) clamp(40px, 6vw, 80px); position: relative; }
.c-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: 40px; display: grid; }
.ast {
  font-family: var(--wide);
  color: var(--red);
  margin-bottom: 18px;
  font-size: clamp(3rem, 6vw, 6rem);
  font-weight: 900;
  line-height: .6;
  display: block;
}
.c-head .disp { font-size: clamp(2.4rem, 6.4vw, 7rem); }
.c-head p { color: var(--mute); max-width: 32rem; margin-top: 24px; }
.trio { height: min(92svh, 860px); position: relative; }
.trio .slot { width: 76%; position: absolute; left: 12%; }
.trio .slot .cover { height: 100%; aspect-ratio: auto; }
.trio .slot canvas { width: 100%; height: 100%; display: block; }
#cSlot1 { height: 30%; top: 0; }
#cSlot2 { height: 26%; top: 31%; }
#cSlot3 { height: 36%; top: 62%; }
.card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 0;
  margin-top: clamp(64px, 8vw, 110px);
  display: grid;
}
.card > div:not(.foot) { padding: clamp(24px, 4vw, 56px); }
.card h3 {
  font-family: var(--wide);
  text-transform: uppercase;
  font-size: clamp(1.8rem, 3.6vw, 3.2rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1;
}
.card .open { color: var(--mute); max-width: 30rem; margin-top: 14px; }
.reach { border-left: 1px solid var(--line); align-content: center; gap: 14px; display: grid; }
.reach .big {
  font-family: var(--mono);
  letter-spacing: -.01em;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  font-size: clamp(1.25rem, 2.3vw, 2rem);
  display: flex;
}
.reach .big a { user-select: all; }
.reach .big a:hover { color: var(--red); }
.copy {
  font-family: var(--mono);
  color: var(--mute);
  border: 1px solid var(--line);
  cursor: pointer;
  background: 0 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .75rem;
}
.copy:hover { color: var(--bone); border-color: var(--bone); }
.foot {
  border-top: 1px solid var(--line);
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 clamp(24px, 4vw, 56px);
  display: grid;
}
.foot > * {
  border-right: 1px solid var(--line);
  justify-content: center;
  align-items: center;
  min-height: 79px;
  padding-inline: clamp(24px, 4vw, 56px);
  display: flex;
}
.foot > :last-child { border-right: 0; }
.foot a:hover { color: var(--red); }

/* ---------------- project page ---------------- */
/* Big title and headline, a lead image, a details row, then a
   gallery of image tiles and prev/next across the bottom. */
.pj { padding-bottom: clamp(24px, 4vw, 48px); }
.d-close {
  font-family: var(--wide);
  color: var(--bone);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  background: #0c1114bf;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: .875rem;
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1;
  transition: background .25s, color .25s;
}
.d-close:hover { background: var(--bone); color: var(--ink); }

.red { color: var(--red); }

/* Project pages run the full width of the window, 40px in from
   each edge (logo, Close, text, images, prev/next and footer). */
body:has(.pj) .wrap { max-width: none; padding-inline: 40px; }

/* Header: a very large title, then a one-line headline */
.pj-head {
  gap: clamp(40px, 7vw, 110px);
  padding-top: calc(var(--safe-top) + 110px);
  padding-bottom: clamp(28px, 3.5vw, 48px);
  display: grid;
}
.pj-head h1 { font-size: clamp(3rem, 10vw, 10rem); line-height: .9; }
.pj-headline { text-wrap: pretty; max-width: 50%; font-size: clamp(1.15rem, 1.7vw, 1.6rem); line-height: 1.3; }

/* Everything below the header shares one column and one gap */
.pj-stack { --pj-g: clamp(14px, 2.4vw, 36px); gap: var(--pj-g); display: grid; }
.pj-tile {
  background: #11181d;
  border-radius: 2px;
  margin: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.pj-tile[hidden] { display: none; }
.pj-tile > img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  inset: 0;
}
.pj-tile--hero { aspect-ratio: 3 / 2; }

/* Details: small labelled facts in two columns on the left half,
   body text on the right half */
.pj-details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 32px var(--pj-g);
  padding-block: clamp(36px, 6vw, 96px);
  display: grid;
}
.pj-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px var(--pj-g); margin: 0; display: grid; }
.pj-meta div { border-top: 1px solid var(--line); padding-top: 12px; align-content: start; display: grid; }
.pj-meta dt, .pj-meta dd { margin: 0; font-size: clamp(1rem, 1.3vw, 1.2rem); line-height: 1.3; }
.pj-meta dt { color: var(--mute); }
.pj-body { gap: 1em; max-width: 40rem; display: grid; }
.pj-body p { text-wrap: pretty; font-size: clamp(1.05rem, 1.45vw, 1.35rem); line-height: 1.45; }

/* Gallery: pair of tall tiles, one full-width tile, repeat */
.pj-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pj-g); display: grid; }
.pj-slot--half { aspect-ratio: 3 / 4; }
.pj-slot--full { aspect-ratio: 3 / 2; grid-column: 1 / -1; }
/* Slots still waiting for a real image are dimmed and tagged */
.pj-tile.is-placeholder > img { filter: grayscale(1); opacity: .32; }
.pj-tile.is-placeholder::after {
  content: "Placeholder";
  color: var(--mute);
  font-family: var(--mono);
  font-size: .75rem;
  position: absolute;
  bottom: 14px;
  left: 16px;
}
/* A tile that presents a framed object (the slider) centred on it */
.pj-tile--stage {
  aspect-ratio: auto;
  place-items: center;
  padding: clamp(28px, 6vw, 88px) clamp(16px, 4vw, 64px);
  display: grid;
}
.pj .d-nav { margin-top: clamp(40px, 6vw, 90px); }

/* before / after slider */
/* The frame: a padded, rounded surround in the same tone as the
   phone mockup's bezel, with the images inset on a matching curve. */
.ba {
  background: #1b232a;
  border: 1px solid var(--line);
  border-radius: calc(clamp(18px, 2.2vw, 30px) + 10px);
  box-sizing: border-box;
  width: min(100%, 620px);
  margin: 0;
  justify-self: center;
  padding: calc(clamp(4px, .5vw, 7px) + 10px);
}
.ba-stage {
  --pos: 50%;
  /* Always the full width of the column, in an iPad's portrait
     proportions (3:4). No height cap: a cap would squash the
     shape on wide desktop columns. */
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #05080c;
  border-radius: clamp(14px, 1.7vw, 23px);
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}
.ba-layer { position: absolute; inset: 0; }
.ba-layer > * {
  object-fit: cover;
  object-position: top center;
  pointer-events: none;
  width: 100%;
  height: 100%;
  display: block;
}
.ba-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
/* With the pixel dissolve on, a JS-painted grid mask replaces the
   straight clip (which stays as the no-JS fallback). */
.ba-stage--px .ba-before {
  clip-path: none;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  image-rendering: pixelated;
}
.ba-stage--px .ba-before > * { image-rendering: auto; }
/* No divider line: just the knob, riding the seam between the two. */
.ba-handle {
  width: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
}
.ba-handle i {
  background: var(--bone);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  transition: transform .2s;
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
}
.ba-handle i::before,
.ba-handle i::after {
  content: "";
  border: 6px solid transparent;
  position: absolute;
  top: 50%;
  translate: 0 -50%;
}
.ba-handle i::before { border-right-color: var(--ink); left: 4px; }
.ba-handle i::after { border-left-color: var(--ink); right: 4px; }
.ba-stage:hover .ba-handle i,
.ba-stage.is-dragging .ba-handle i { transform: scale(1.08); }
/* Keyboard access: invisible range input, focus ring on the knob */
.ba-range {
  opacity: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  margin: 0;
  position: absolute;
  inset: 0;
}
.ba-stage:has(.ba-range:focus-visible) .ba-handle i { outline: 2px solid var(--red); outline-offset: 3px; }

.pj-foot {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  padding-bottom: 30px;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
  color: var(--mute);
  display: flex;
}
.pj-foot a:hover { color: var(--red); }
.d-nav { border-top: 1px solid var(--line); grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; }
.d-pn {
  cursor: pointer;
  color: var(--bone);
  text-align: left;
  background: 0 0;
  border: 0;
  align-items: center;
  gap: clamp(16px, 2vw, 28px);
  min-width: 0;
  padding: 32px 0;
  display: flex;
}
.d-prev { border-right: 1px solid var(--line); padding-right: clamp(20px, 3vw, 48px); }
.d-next { text-align: right; justify-content: flex-end; padding-left: clamp(20px, 3vw, 48px); }
.d-pn .arr { font-family: var(--mono); color: var(--red); font-size: clamp(1.6rem, 2.6vw, 2.4rem); line-height: 1; transition: transform .3s; }
.d-pn-name {
  transition: color .25s;
  font-family: var(--wide);
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: clamp(1.4rem, 3vw, 2.8rem);
  font-weight: 900;
  font-stretch: 125%;
  line-height: 1;
  overflow: hidden;
}
.d-pn-t { gap: 6px; min-width: 0; display: grid; }
.d-pn-t .mono { color: var(--mute); }
.d-prev:hover .arr { transform: translateX(-6px); }
.d-next:hover .arr { transform: translateX(6px); }
.d-pn:hover .d-pn-name { color: var(--red); }
@media (max-width: 760px) {
  .d-nav { grid-template-columns: minmax(0, 1fr); }
  .d-prev { border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .d-next { padding-left: 0; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .nav ul { display: none; }
  .hero { padding-top: calc(var(--safe-top) + 84px); }
  .roles { text-align: left; justify-self: start; font-size: clamp(1.7rem, 8.4vw, 3rem); }
  .roles span:nth-child(2) { padding-right: 0; }
  .about-grid, .c-grid { grid-template-columns: minmax(0, 1fr); }
  .about-copy { padding-left: 0; }
  .cols { columns: 1; }
  .tools ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-pin { min-height: 0; padding-top: calc(var(--safe-top) + 76px); }
  .work .sec-head { flex-wrap: wrap; }
  .work .sec-head .disp { padding-left: 0; }
  .work-side p { display: none; }
  .proj { width: 84vw; }
  .cover { min-height: clamp(220px, 44svh, 520px); }
  .proj-meta { grid-template-columns: auto minmax(0, 1fr); }
  .exp-grid { grid-template-columns: minmax(0, 1fr) 92px; }
  .exp-lane .slot { top: 40svh; }
  .job { grid-template-columns: minmax(0, 1fr); }
  .job p { grid-column: 1; }
  .method { height: auto; }
  .m-stage {
    grid-template-rows: 40svh minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    align-items: start;
    gap: 12px;
    height: auto;
    padding-block: 70px;
    position: static;
  }
  .m-objects { order: -1; height: 40svh; min-height: 0; }
  .m-text { align-content: start; gap: 12px; padding-bottom: 16px; }
  .m-text .disp { font-size: clamp(1.6rem, 7vw, 2.4rem); }
  .step { padding-block: 9px; }
  .step h3 { font-size: .95rem; }
  .step p { font-size: .8125rem; }
  .step p { grid-template-rows: 1fr; }
  .m-note { display: none; }
  .trio { order: -1; height: min(70svh, 560px); margin-bottom: 12px; }
  .card { grid-template-columns: minmax(0, 1fr); }
  .reach { border-left: 0; border-top: 1px solid var(--line); }
  .foot { grid-template-columns: minmax(0, 1fr); height: auto; }
  .foot > * { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; padding: 20px clamp(24px, 4vw, 56px); display: block; }
  body:has(.pj) .wrap { padding-inline: var(--gut); }
  .pj-head { padding-top: calc(var(--safe-top) + 96px); }
  .pj-headline { max-width: none; }
  .pj-details { grid-template-columns: minmax(0, 1fr); }
  .pj-gallery { grid-template-columns: minmax(0, 1fr); }
  .pj-slot--half { aspect-ratio: 4 / 5; }
}

/* ---------------- page transition ---------------- */
/* Ink veil: slides in from the right when a project link is
   followed, then the arriving page slides it back off to the
   left. Both pages carry a static .pg-veil--reveal in their
   markup; transition.js clears it once it has slid away. */
.pg-veil {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--ink);
  pointer-events: none;
}
.pg-veil--cover {
  transform: translateX(100%);
  animation: pg-veil-in 0.38s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}
.pg-veil--reveal {
  animation: pg-veil-out 0.38s cubic-bezier(0.76, 0, 0.24, 1) 0.05s both;
}
@keyframes pg-veil-in {
  to { transform: translateX(0); }
}
@keyframes pg-veil-out {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* Card → hero expand (see transition.js) */
.pg-expand {
  position: fixed;
  z-index: 400;
  pointer-events: none;
  overflow: hidden;
}
.pg-expand-bg { inset: 0; background: var(--ink); }
.pg-expand-img { background-size: cover; background-position: center; position: absolute; inset: 0; }
/* Index arriving from a project Close: the veil holds still and
   shows the hero image until landFromProject() takes over. A project
   arriving from a card's expand does the same, minus the ink, until
   settleArrival() hands over to the real tile. */
.from-project .pg-veil--reveal,
.from-card .pg-veil--reveal { animation: none; }
.from-card .pg-veil--reveal { background: none; }
.from-project .pg-veil--reveal::after,
.from-card .pg-veil--reveal::after {
  content: "";
  background: var(--pj-img) center / cover no-repeat;
  border-radius: 2px;
  width: var(--pj-width, 100%);
  height: var(--pj-height, 56vw);
  position: absolute;
  top: var(--pj-top, 0);
  left: var(--pj-left, 0);
}
/* Arrived via the expand: everything but the image rises in. */
.from-card .pj-head,
.from-card .pj-stack > :not(.pj-tile--hero):not(script),
.from-card .nav { animation: pj-rise .6s cubic-bezier(.2, .7, .2, 1) both; }
.from-card .pj-stack > :not(.pj-tile--hero):not(script) { animation-delay: .08s; }
@keyframes pj-rise {
  from { opacity: 0; transform: translateY(18px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .pg-veil { display: none; }
}

/* Hold the lead tile hidden until project.js has laid out the header
   and starts the settle from the clone (see settleArrival). */
.from-card .pj-tile--hero { visibility: hidden; }
