/*
  Layout: every section is drawn on a 1920 × 1083 design frame; --u is one design pixel.
  - Phones and narrow windows: a normal vertical page.
  - Wide screens (html.flip, set by main.js): each section becomes a full-screen page that
    turns like a magazine page. --gx / --gy are the side and top gutters around the frame,
    so backgrounds can bleed to the window edges without white gaps.
*/
:root {
  --paper: #ffffff;
  --mist: #dedede;
  --ink: #141414;
  --ink-soft: #2c2c2c;
  --ink-mute: #5c5854;
  --sindoor: #c24646;
  --signal: #b32124;
  --nav-ink: #1c1c1c;
  --nav: "Jost", "Futura", "Century Gothic", "Helvetica Neue", Arial, sans-serif;
  --leaf: #1e5c3a;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --gx: 0px;
  --gy: 0px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--sindoor); outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page { container-type: inline-size; overflow-x: clip; }
.page > * { --u: calc(100cqw / 1920); }

/* ---------- Nav ---------- */
/* Red dot + name on the left; Work / Play / About / Resume on the right. The red rule marks where you are. */
.nav {
  position: absolute; inset: 0 0 auto 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(62 * var(--u)) calc(120 * var(--u)) 0 calc(117 * var(--u));
  font-family: var(--nav); font-size: max(12px, calc(19 * var(--u))); line-height: 1.6;
  text-transform: uppercase; color: var(--nav-ink);
  animation: navIn 1s .5s ease-out both;
}
@keyframes navIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.nav a { text-decoration: none; color: inherit; }
.brand { display: inline-flex; align-items: center; font-weight: 500; letter-spacing: .26em; transition: opacity .45s ease; }
.sig-home { display: none; }
.dot { flex: none; width: max(7px, calc(15 * var(--u))); height: max(7px, calc(15 * var(--u))); border-radius: 50%; background: var(--signal); }
.nav ul { display: flex; gap: calc(54 * var(--u)); list-style: none; margin: 0; padding: 0; }
.nav li a { position: relative; display: block; font-weight: 400; letter-spacing: .18em; }
.nav li a::after {
  content: ""; position: absolute; left: 0; right: .18em; bottom: calc(-16 * var(--u)); height: max(2px, calc(3 * var(--u)));
  background: var(--signal); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease);
}
.nav li a:hover::after, .nav li a:focus-visible::after, .nav li a[aria-current]::after { transform: scaleX(1); }

.progress, .folio, .scroll-hint { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; aspect-ratio: 1920 / 1083; overflow: hidden; background: #cfcfcf; }
.hero-bg {
  position: absolute; inset: 0;
  background: #d6d6d6 url("assets/hero-wide.jpg?v=b4d2c42e") 50% 100% / auto 100% no-repeat;
  transform-origin: 50% 100%;
  animation: develop 1.8s var(--ease) both;
}
/* "Mechanical Engineer → Multidisciplinary Designer | NID", centred in the open floor below the portrait.
   The first role is set lighter; a hairline draws across to the second, like an arrow, as the page opens. */
.hero-tag {
  position: absolute; z-index: 2; left: 50%; top: 93.1%; translate: -50% -50%; margin: 0;
  display: flex; align-items: center; gap: calc(22 * var(--u)); white-space: nowrap;
  font-family: var(--nav); font-weight: 500; font-size: max(10px, calc(15 * var(--u))); letter-spacing: .32em;
  text-transform: uppercase; color: var(--nav-ink);
}
.hero-tag .ht-from { color: rgba(28, 28, 28, .5); font-weight: 400; }
.hero-tag .ht-to { font-weight: 500; }
.ht-turn { position: relative; display: block; width: calc(96 * var(--u)); min-width: 34px; height: 9px; }
.ht-turn i { position: absolute; left: 0; right: 4px; top: 50%; height: 1px; background: rgba(28, 28, 28, .55);
  transform-origin: left; animation: htDraw .9s 1.9s cubic-bezier(.65, 0, .25, 1) both; }
.ht-turn i::after { content: ""; position: absolute; right: -4px; top: -3.5px; width: 7px; height: 7px;
  border-top: 1px solid rgba(28, 28, 28, .7); border-right: 1px solid rgba(28, 28, 28, .7); transform: rotate(45deg); }
@keyframes htDraw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* in sequence: the engineer, then the arrow, then the designer, then the NID mark */
@keyframes htIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.hero-tag .ht-from { display: inline-block; animation: htIn .9s .9s ease-out both; }
.ht-turn i::after { animation: htTip .25s 2.75s ease-out both; }
@keyframes htTip { from { opacity: 0; } to { opacity: 1; } }
.hero-tag .ht-to { display: inline-block; animation: htIn .9s 2.85s ease-out both; }
.hero-tag .ht-sep, .hero-tag img { animation: navIn .8s 3.6s ease-out both; }
.hero-tag .ht-sep { width: 1px; height: calc(30 * var(--u)); min-height: 16px; background: rgba(28, 28, 28, .4); margin-left: calc(8 * var(--u)); }
.hero-tag img { height: calc(36 * var(--u)); min-height: 18px; width: auto; }
@keyframes develop {
  from { filter: contrast(.85) brightness(1.08); transform: scale(1.06); }
  to { filter: none; transform: none; }
}

/* ---------- Philosophy ---------- */
.philosophy {
  position: relative;
  display: grid; grid-template-columns: 632fr 84fr 1204fr;
  height: calc(675 * var(--u)); margin-top: calc(300 * var(--u));
}
.phil-sig { position: absolute; left: calc(117 * var(--u)); top: calc(-150 * var(--u)); width: calc(190 * var(--u)); }
.phil-title { grid-column: 1; background: var(--mist); position: relative; overflow: hidden; }
.phil-title h2 {
  position: absolute; left: calc(80 * var(--u)); top: calc(520 * var(--u)); margin: 0;
  font-family: var(--display); font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .07);
  font-size: calc(80 * var(--u)); line-height: 1; letter-spacing: -0.005em; white-space: nowrap;
}
.phil-body { grid-column: 3; position: relative; overflow: hidden; background: #e9e9e9; }
.phil-img { position: absolute; inset: 0; background: url("assets/ripple.jpg?v=41ff4fd7") right center / cover no-repeat; transform-origin: 80% 50%; }
.phil-body p {
  position: absolute; left: calc(139 * var(--u)); top: calc(310 * var(--u));
  width: calc(480 * var(--u)); margin: 0;
  font-size: calc(19 * var(--u)); line-height: 1.45; color: var(--ink-soft);
}
.phil-body strong { font-weight: 600; color: var(--ink); }

/* ---------- Work ---------- */
/* Phones: each card sticks and the next one slides up over it. */
.projects { padding-top: calc(220 * var(--u)); }
.proj-info { display: none; }
.stack {
  position: relative; width: calc(1240 * var(--u)); max-width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14vh; padding-bottom: 4vh;
}
.card {
  position: sticky; top: calc(14vh + var(--i) * 14px); z-index: calc(1 + var(--i));
  display: block; aspect-ratio: 3 / 2; border-radius: calc(36 * var(--u)); overflow: hidden;
  background: #ddd; text-decoration: none;
  box-shadow: 0 1px 2px rgba(20, 16, 12, .08), 0 calc(22 * var(--u)) calc(44 * var(--u)) rgba(20, 16, 12, .16);
}
.card-dim { position: absolute; inset: 0; z-index: 2; background: #0b0b0f; opacity: 0; pointer-events: none; }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.card:hover img { transform: scale(1.03); }
.card .view {
  position: absolute; z-index: 1; right: calc(30 * var(--u)); bottom: calc(28 * var(--u));
  display: inline-flex; gap: .6em; align-items: center;
  background: rgba(255, 255, 255, .94); color: var(--ink);
  font-size: max(12px, calc(15 * var(--u))); letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  padding: .75em 1.25em; border-radius: 999px; opacity: 0; transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
}
.card .view b { font-weight: 500; transition: transform .3s ease; }
.card:hover .view, .card:focus-visible .view { opacity: 1; transform: none; }
.card:hover .view b { transform: translateX(3px); }

/* ---------- Archives (other work) ---------- */
/* A centred heading and a plain two-column grid of project covers. */
.others { padding: calc(150 * var(--u)) calc(177 * var(--u)) calc(160 * var(--u)); }
.others-h {
  margin: 0 0 calc(72 * var(--u)); text-align: center;
  font-family: var(--display); font-weight: 800; font-size: max(34px, calc(62 * var(--u))); line-height: 1; letter-spacing: -0.01em; color: var(--ink);
}
.others-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(58 * var(--u)) calc(38 * var(--u)); list-style: none; margin: 0 auto; padding: 0; max-width: calc(1566 * var(--u)); }
.tile { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; background: #e6e6e6; text-decoration: none; color: var(--ink); }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.tile:hover img, .tile:focus-visible img { transform: scale(1.03); }
.tile .view {
  position: absolute; right: calc(24 * var(--u)); bottom: calc(22 * var(--u));
  display: inline-flex; gap: .6em; align-items: center;
  background: rgba(255, 255, 255, .94); color: var(--ink);
  font-size: max(12px, calc(15 * var(--u))); letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  padding: .75em 1.25em; border-radius: 999px; opacity: 0; transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
}
.tile:hover .view, .tile:focus-visible .view { opacity: 1; transform: none; }

/* wide screens: the card stack fills the first screen of the work page; once all three
   projects have been shown, the page scrolls down to the Archives (driven by main.js) */
.flip .work-in { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.flip .projects { padding: 0; }
.flip .work-top { position: relative; height: 100vh; }
.flip .proj-info {
  display: flex; flex-direction: column; position: absolute; z-index: 2;
  left: calc(var(--gx) + 132 * var(--u)); top: calc(var(--gy) + 236 * var(--u));
  width: calc(520 * var(--u)); height: calc(680 * var(--u));
  transition: opacity .9s ease .1s, transform 1.1s var(--ease) .1s;
}
.flip .projects:not(.is-in) .proj-info { opacity: 0; transform: translateY(30px); }
.flip .stack {
  position: absolute; display: block; gap: 0; padding: 0; margin: 0; max-width: none;
  left: calc(var(--gx) + 760 * var(--u)); top: calc(var(--gy) + 236 * var(--u));
  width: calc(1020 * var(--u)); height: calc(680 * var(--u));
  transition: opacity .9s ease .15s, translate 1.2s var(--ease) .15s;
}
.flip .projects:not(.is-in) .stack { opacity: 0; translate: 0 8%; }
.flip .card { position: absolute; inset: 0; top: 0; transform-origin: 50% 60%; will-change: transform, opacity; }
.flip .others { padding: calc(110 * var(--u)) calc(var(--gx) + 177 * var(--u)) calc(var(--gy) + 160 * var(--u)); }

/* ---------- Play ---------- */
/* Three full-screen cards (calligraphy, clay, bikes); each opens its own designed page. */
.play { position: relative; padding: 96px 20px 0; }
.play-art { display: block; overflow: hidden; }
.play-art img { display: block; width: 100%; height: auto; transition: transform 1.1s var(--ease); }
.play-art:hover img { transform: scale(1.02); }
.play-text { padding-top: 24px; }
.play-title { margin: 0 0 14px; font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1.04; letter-spacing: -0.01em; color: #3d3d3d; }
.play-title a { text-decoration: none; color: inherit; }
.play-sub, .play-line { margin: 0 0 12px; font-size: 14px; line-height: 1.45; color: #2f2f2f; }
.play-line { margin-top: 18px; }
.play-cta { display: inline-block; margin-top: 18px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(20, 20, 20, .35); padding-bottom: 3px; transition: border-color .3s ease; }
.play-cta::after { content: " →"; }
.play-cta:hover { border-color: var(--ink); }
.play-line br { display: none; }

/* wide screens: laid out as designed (1920 x 1080 frame) */
.flip .play { padding: 0; }
.flip .play-art { position: absolute; }
.flip .play-art img { width: 100%; height: 100%; object-fit: cover; }
.flip .play-text { position: absolute; padding: 0; }
.flip .play-title { font-size: calc(71 * var(--u)); line-height: 1; margin: 0; }
.flip .play-sub { font-size: calc(18.3 * var(--u)); margin: calc(30 * var(--u)) 0 0; }
.flip .play-line { font-size: calc(18.3 * var(--u)); line-height: 1.42; margin: calc(44 * var(--u)) 0 0; }
.flip .play-line br { display: inline; }
.flip .play-cta { position: absolute; margin: 0; font-size: calc(18.3 * var(--u)); letter-spacing: 0; border-bottom-color: transparent; white-space: nowrap; }
.flip .play-cta:hover { border-bottom-color: var(--ink); }
/* calligraphy: words left, photographs right */
.flip .play--calligraphy .play-art { left: calc(var(--gx) + 960 * var(--u)); top: 0; bottom: 0; right: 0; }
.flip .play--calligraphy .play-art img { object-position: left center; }
.flip .play--calligraphy .play-text { left: calc(var(--gx) + 244 * var(--u)); top: calc(var(--gy) + 543 * var(--u)); }
.flip .play--calligraphy .play-title { position: relative; top: calc(6 * var(--u)); }
.flip .play--calligraphy .play-cta { left: calc(6 * var(--u)); top: calc(251 * var(--u)); }
/* clay: title top left, photographs across */
.flip .play--clay .play-art { left: calc(var(--gx) + 130 * var(--u)); top: calc(var(--gy) + 42 * var(--u)); right: 0; height: calc(962 * var(--u)); }
.flip .play--clay .play-art img { object-position: left top; }
.flip .play--clay .play-text { left: calc(var(--gx) + 145 * var(--u)); top: calc(var(--gy) + 214 * var(--u)); }
.flip .play--clay .play-title { font-size: calc(60 * var(--u)); line-height: 1.5; }
.flip .play--clay .play-line { margin-top: calc(38 * var(--u)); }
.flip .play--clay .play-cta { left: calc(901 * var(--u)); top: calc(736 * var(--u)); }
/* bikes: like clay, title top left and photographs across */
.flip .play--bike .play-art { left: calc(var(--gx) + 120 * var(--u)); top: 0; bottom: 0; right: 0; }
.flip .play--bike .play-art img { object-position: left bottom; }
.flip .play--bike .play-text { left: calc(var(--gx) + 125 * var(--u)); top: calc(var(--gy) + 214 * var(--u)); }
.flip .play--bike .play-title { font-size: calc(60 * var(--u)); line-height: 1.4; }
.flip .play--bike .play-line { margin-top: calc(15 * var(--u)); }
.flip .play--bike .play-cta { left: calc(2 * var(--u)); top: calc(260 * var(--u)); }
.play-art { position: relative; }


/* the words on the Play cards, cut straight from the designs (wide screens) */
.play-words { display: none; }
.flip .play-words { display: block; position: absolute; left: var(--gx); top: var(--gy); width: calc(1920 * var(--u)); height: calc(1080 * var(--u)); pointer-events: none; }
.flip .play-words a { position: absolute; display: block; pointer-events: auto; }
.flip .play-words img { display: block; width: 100%; height: auto; }
/* the typed version stays for screen readers and search, out of sight on wide screens */
.flip .play-text { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }

/* ---------- Find me ---------- */
/* As designed: the bike photo floats with white above and below and runs flush to the right edge. */
.find { position: relative; height: calc(1082 * var(--u)); margin-top: calc(323 * var(--u)); }
.find-strip { position: absolute; left: 0; top: 0; bottom: 0; width: calc(365 * var(--u)); background: var(--mist); }
.find-strip .sig { position: absolute; left: calc(85 * var(--u)); top: calc(62 * var(--u)); width: calc(200 * var(--u)); }
.find-strip .label {
  position: absolute; right: calc(-6 * var(--u)); bottom: calc(142 * var(--u));
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--display); font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .07);
  font-size: calc(112 * var(--u)); line-height: .8; letter-spacing: .01em; margin: 0;
}
.find-panel {
  position: absolute; left: calc(408 * var(--u)); top: 0; bottom: 0; width: calc(1032 * var(--u));
  background: var(--mist);
  clip-path: polygon(0 0, 100% 0, calc(607 * var(--u)) 100%, 0 100%);
}
.find-panel h2 {
  position: absolute; left: calc(60 * var(--u)); top: calc(205 * var(--u)); margin: 0;
  font-family: var(--display); font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .07);
  font-size: calc(128 * var(--u)); line-height: 1.2; letter-spacing: -0.005em; white-space: nowrap;
}
.find-panel .about {
  position: absolute; left: calc(74 * var(--u)); top: calc(630 * var(--u)); width: calc(510 * var(--u));
  font-size: calc(19 * var(--u)); line-height: 1.42; color: var(--ink-soft);
}
.about p { margin: 0 0 1.35em; }
.socials { position: absolute; left: calc(74 * var(--u)); top: calc(945 * var(--u)); display: flex; gap: calc(26 * var(--u)); }
.socials a { display: block; width: calc(40 * var(--u)); height: calc(40 * var(--u)); transition: transform .25s ease; }
.socials a:hover { transform: translateY(-3px); }
.socials svg, .socials img { display: block; width: 100%; height: 100%; }
.socials img { padding: 8.3%; box-sizing: border-box; }   /* same visual size as the drawn icons */
.contact { position: absolute; left: calc(74 * var(--u)); top: calc(1000 * var(--u)); margin: 0; display: flex; gap: .8em; align-items: center;
  font-size: max(12px, calc(17 * var(--u))); color: var(--ink-soft); }
.contact a { text-decoration: none; border-bottom: 1px solid rgba(20, 20, 20, .3); transition: border-color .3s ease; }
.contact a:hover { border-color: currentColor; }
.flip .contact { top: calc(var(--gy) + 1000 * var(--u)); }
.rider {
  position: absolute; margin: 0; overflow: hidden;
  left: calc(1120 * var(--u)); right: 0; top: calc(120 * var(--u)); height: calc(813 * var(--u));
  clip-path: polygon(calc(320 * var(--u)) 0, 100% 0, 100% 100%, 0 100%);
}
.rider img { width: 100%; height: 100%; object-fit: cover; object-position: 40% 50%; }

/* ---------- Phones ---------- */
@media (max-width: 899px), (max-height: 519px) {
  .page > * { --u: 1px; }
  .nav { position: fixed; padding: 14px 16px; font-size: 11px; transition: background .35s ease, box-shadow .35s ease; }
  .past-hero .nav { background: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .06); }
  .sig-home { display: block; position: absolute; left: 16px; top: 50%; width: 84px; opacity: 0; pointer-events: none; transform: translateY(-50%); transition: opacity .35s ease; }
  .sig-home img { width: 100%; height: auto; }
  .past-hero .brand { opacity: 0; pointer-events: none; }
  .past-hero .sig-home { opacity: 1; pointer-events: auto; }
  .brand { letter-spacing: .2em; }
  .hero { aspect-ratio: 1.12; }
  /* phones: the two roles stack, with the line turning downward between them */
  .hero-tag { flex-wrap: wrap; justify-content: center; row-gap: 6px; column-gap: 9px; width: 92%; white-space: normal; text-align: center;
    font-size: 9px; letter-spacing: .18em; top: 89%; }
  .hero-tag .ht-from { flex-basis: 100%; }
  .hero-tag .ht-turn { display: none; }
  .hero-tag .ht-from::after { content: " ↓"; letter-spacing: 0; opacity: .7; }
  .hero-tag .ht-to { animation-delay: 1.9s; }
  .hero-tag .ht-sep, .hero-tag img { animation-delay: 2.6s; }
  .hero-tag .ht-sep { height: 14px; min-height: 14px; margin-left: 0; }
  .hero-tag img { height: 16px; min-height: 0; }
  .nav ul { gap: 13px; }
  .nav li a { letter-spacing: .12em; }
  .nav li a::after { bottom: -6px; right: .12em; }
  .hero-bg { background-position: 50% 100%; }

  .philosophy { display: block; height: auto; margin-top: 110px; }
  .phil-sig { left: 16px; top: -62px; width: 120px; }
  .phil-title { height: 168px; }
  .phil-title h2 { left: 20px; top: 40px; font-size: 50px; line-height: 1.04; }
  .phil-body { min-height: 300px; margin-top: 16px; }
  .phil-img { background-position: 82% center; }
  .phil-body p { left: 20px; top: 50%; transform: translateY(-50%); width: 58%; font-size: 14.5px; }

  .projects { padding: 72px 20px 0; }
  .stack { width: 100%; gap: 10vh; }
  .card { top: calc(12vh + var(--i) * 10px); border-radius: 20px; }
  .card .view { opacity: 1; transform: none; right: 12px; bottom: 12px; font-size: 11px; }
  .others { padding: 96px 20px 0; }
  .others-h { font-size: 40px; margin-bottom: 32px; }
  .others-grid { grid-template-columns: 1fr; gap: 20px; }
  .tile .view { opacity: 1; transform: none; right: 12px; bottom: 12px; font-size: 11px; }
  .find { height: auto; margin: 72px 0 0; display: grid; }
  .find-strip, .find-panel, .rider, .socials, .contact { position: static; }
  .contact { margin-top: 16px; font-size: 13.5px; flex-wrap: wrap; }
  .find-strip { width: auto; height: auto; padding: 24px 20px 0; }
  .find-strip .sig { position: static; width: 130px; }
  .find-strip .label { display: none; }
  .find-panel { width: auto; clip-path: none; padding: 8px 20px 36px; }
  .find-panel h2 { position: static; font-size: 54px; line-height: 1.02; margin: 18px 0 22px; white-space: normal; }
  .find-panel .about { position: static; width: auto; font-size: 15.5px; max-width: 34em; }
  .socials { gap: 18px; margin-top: 8px; }
  .socials a { width: 34px; height: 34px; }
  .rider { width: 100%; height: auto; aspect-ratio: 800 / 813; clip-path: polygon(41% 0, 100% 0, 100% 100%, 0 100%); }
}

/* =====================================================================
   Magazine mode (wide screens): full-screen pages that turn on scroll
   ===================================================================== */
html.flip { scrollbar-width: none; overscroll-behavior: none; }
/* wide screens: the site moves between full screens itself; the page never scrolls natively */
html.flip, html.flip body { height: 100%; overflow: hidden; touch-action: none; }
html.flip::-webkit-scrollbar { display: none; }
.flip .page { container-type: normal; overflow: visible; }
.flip .page > * { --u: var(--fu, 1px); }

/* The menu stays on every page; after the cover the name gives way to the red signature, top left. */
.flip .nav {
  position: fixed;
  padding: calc(var(--gy) + 62 * var(--u) + env(safe-area-inset-top, 0px)) calc(var(--gx) + 120 * var(--u)) 0 calc(var(--gx) + 117 * var(--u));
}
.flip .nav ul { transition: opacity .45s ease; }
/* while the work page scrolls up beneath it, the bar sits on plain white */
.flip .nav::before {
  content: ""; position: absolute; inset: 0 0 calc(-26 * var(--u)); z-index: -1; pointer-events: none;
  background: #fff; opacity: 0; transition: opacity .3s ease;
}
.flip.work-down .nav::before { opacity: 1; }
.flip.work-down .folio { opacity: 0; }
.flip .sig-home {
  display: block; position: absolute; left: calc(var(--gx) + 117 * var(--u));
  top: calc(var(--gy) + 77 * var(--u) + env(safe-area-inset-top, 0px)); width: calc(150 * var(--u));
  opacity: 0; pointer-events: none; transform: translateY(-50%);
  clip-path: inset(0 100% 0 0); transition: opacity .4s ease, clip-path .9s cubic-bezier(.65, 0, .25, 1);
}
.flip .sig-home img { width: 100%; height: auto; }
.flip.past-hero .brand { opacity: 0; pointer-events: none; }
.flip.past-hero .sig-home { opacity: 1; pointer-events: auto; clip-path: inset(0 0 0 0); }

.flip .track { position: fixed; inset: 0; overflow: hidden; background: var(--paper); }
.flip .panel {
  position: absolute; inset: 0; margin: 0; padding: 0; width: auto; height: auto; aspect-ratio: auto;
  overflow: hidden; background: var(--paper);
  transform-origin: 0 50%;
  visibility: hidden; will-change: transform;
}
.flip .panel.vis { visibility: visible; }
/* a soft shade along the edge of the page gliding in, and a light dimming of the page beneath (opacity set by main.js) */
.pg-under, .pg-edge { display: none; }
.flip .pg-under, .flip .pg-edge { display: block; position: absolute; inset: 0; pointer-events: none; opacity: 0; will-change: opacity; }
.flip .pg-under { z-index: 59; background: rgba(16, 13, 10, .32); }
.flip .pg-edge { z-index: 60; right: auto; width: 22%; background: linear-gradient(90deg, rgba(0, 0, 0, .14) 0%, rgba(0, 0, 0, .03) 27%, rgba(0, 0, 0, 0) 100%); }
.flip [data-speed] { will-change: translate; }

.flip .progress {
  display: block; position: fixed; left: 0; right: 0; bottom: 0; height: 3px; z-index: 31;
  background: var(--sindoor); transform-origin: left; transform: scaleX(0); will-change: transform;
}
.flip .folio {
  display: block; position: fixed; z-index: 31; margin: 0;
  right: calc(var(--gx) + 96 * var(--u)); bottom: calc(var(--gy) + 40 * var(--u));
  font-size: 12px; letter-spacing: .2em; color: var(--ink-mute); font-variant-numeric: tabular-nums;
  transition: opacity .4s ease;
}
.folio-n { color: var(--ink); font-weight: 600; }
.flip:not(.past-hero) .folio { opacity: 0; }

/* Cover */
.flip .scroll-hint {
  display: flex; align-items: center; gap: 14px; position: absolute; z-index: 2; margin: 0;
  left: calc(var(--gx) + 96 * var(--u)); bottom: calc(var(--gy) + 56 * var(--u));
  font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft);
  transition: opacity .5s ease; animation: navIn 1s 1.2s ease-out both;
}
.scroll-hint i { position: relative; display: block; width: 72px; height: 1px; background: rgba(20, 20, 20, .25); overflow: hidden; }
.scroll-hint i::after { content: ""; position: absolute; inset: 0; background: var(--ink); animation: hint 1.8s cubic-bezier(.6, 0, .2, 1) infinite; }
@keyframes hint { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.flip.scrolled .scroll-hint { opacity: 0; }

/* Philosophy */
.flip .philosophy { display: block; }
.flip .phil-sig { display: none; }
.flip .phil-title, .flip .phil-body { position: absolute; top: calc(var(--gy) + 214 * var(--u)); height: calc(675 * var(--u)); }
.flip .phil-title { left: 0; width: calc(var(--gx) + 632 * var(--u)); }
.flip .phil-title h2 { left: calc(var(--gx) + 80 * var(--u)); }
.flip .phil-body { left: calc(var(--gx) + 716 * var(--u)); right: 0; }

.eyebrow {
  margin: 0 0 calc(56 * var(--u)); font-family: var(--body); font-weight: 600;
  font-size: max(11px, calc(15 * var(--u))); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-mute);
}
.eyebrow::before { content: ""; display: inline-block; vertical-align: middle; width: calc(36 * var(--u)); height: 1px; margin-right: 14px; background: var(--sindoor); }
.proj-list { display: grid; list-style: none; margin: 0; padding: 0; flex: 1; }
.proj { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: flex-start; visibility: hidden; }
.proj.on { visibility: visible; }
.proj > * { opacity: 0; transform: translateY(18px); transition: opacity .45s ease, transform .6s var(--ease); }
.proj.on > * { opacity: 1; transform: none; }
.proj.on > :nth-child(2) { transition-delay: .06s; }
.proj.on > :nth-child(3) { transition-delay: .12s; }
.proj.on > :nth-child(4) { transition-delay: .18s; }
.proj.on > :nth-child(5) { transition-delay: .24s; }
.proj-num { margin: 0 0 calc(10 * var(--u)); font-size: max(12px, calc(16 * var(--u))); font-weight: 600; letter-spacing: .14em; color: var(--sindoor); font-variant-numeric: tabular-nums; }
.proj-title {
  margin: 0 0 calc(22 * var(--u)); font-family: var(--display); font-weight: 800;
  font-size: calc(84 * var(--u)); line-height: .98; letter-spacing: -0.015em; color: var(--ink); text-wrap: balance;
}
.proj-line { margin: 0 0 calc(28 * var(--u)); max-width: 30em; font-size: max(13px, calc(19 * var(--u))); line-height: 1.5; color: var(--ink-soft); }
.tags { display: flex; flex-wrap: wrap; gap: calc(10 * var(--u)); list-style: none; margin: 0 0 calc(40 * var(--u)); padding: 0; }
.tags li {
  font-size: max(11px, calc(14 * var(--u))); letter-spacing: .04em; color: var(--ink-soft);
  padding: .45em .95em; border: 1px solid #bdb9b4; border-radius: 999px;
}
.proj-link {
  display: inline-flex; align-items: center; gap: .7em; text-decoration: none;
  font-size: max(12px, calc(15 * var(--u))); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
  padding-bottom: 6px; border-bottom: 1px solid var(--ink);
}
.proj-link::after { content: "→"; font-weight: 500; transition: transform .3s ease; }
.proj-link:hover::after { transform: translateX(4px); }
.stack-count {
  display: none; margin: 0; align-items: center; gap: 14px;
  font-size: 12px; letter-spacing: .2em; color: var(--ink-mute); font-variant-numeric: tabular-nums;
}
.flip .stack-count { display: flex; }
.stack-n { color: var(--ink); font-weight: 600; }
.stack-bar { position: relative; width: calc(120 * var(--u)); height: 1px; background: #c4c0bb; overflow: hidden; }
.stack-bar i { position: absolute; inset: 0; background: var(--ink); transform-origin: left; transform: scaleX(.34); }

/* Find me: grey strip and panel bleed to the top, bottom and left; the photo bleeds right and down */
.flip .find { height: auto; margin: 0; }
.flip .find-strip { width: calc(var(--gx) + 365 * var(--u)); }
.flip .find-strip .sig { display: none; }
.flip .find-strip .label { bottom: calc(var(--gy) + 142 * var(--u)); }
.flip .find-panel {
  left: calc(var(--gx) + 408 * var(--u)); width: calc(1032 * var(--u) + .3928 * var(--gy));
  clip-path: polygon(0 0, 100% 0, calc(100% - 39.28vh) 100%, 0 100%);
}
.flip .find-panel h2 { top: calc(var(--gy) + 205 * var(--u)); }
.flip .find-panel .about { top: calc(var(--gy) + 630 * var(--u)); }
.flip .socials { top: calc(var(--gy) + 945 * var(--u)); }
.flip .rider {
  left: calc(var(--gx) + 1120 * var(--u)); right: 0;
  top: 0; height: calc(var(--gy) + 933 * var(--u)); bottom: auto; width: auto;
  clip-path: polygon(calc(.3928 * (var(--gy) + 933 * var(--u))) 0, 100% 0, 100% 100%, 0 100%);
}

/* Reveals: each page animates in as it is uncovered */
.flip [data-reveal] {
  transition: opacity .9s ease var(--d, 0s), transform 1.2s var(--ease) var(--d, 0s), clip-path 1.6s cubic-bezier(.65, 0, .25, 1) var(--d, 0s);
}
.flip .panel:not(.is-in) [data-reveal="rise"] { opacity: 0; transform: translateY(40px); }
.flip .panel:not(.is-in) [data-reveal="fade"] { opacity: 0; }
.flip .panel:not(.is-in) [data-reveal="draw"] { clip-path: inset(0 100% 0 0); }
.flip [data-reveal="draw"] { clip-path: inset(0 0 0 0); }
.flip .panel:not(.is-in) [data-reveal="zoom"] { transform: scale(1.12); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* case and play pages: a Back button beside the signature */
.bar-left { display: flex; align-items: center; gap: max(18px, calc(36 * var(--u))); }
.back-btn { display: inline-flex; align-items: center; gap: .55em; text-decoration: none; color: inherit;
  font-family: var(--nav); font-size: max(11px, calc(16 * var(--u))); letter-spacing: .18em; text-transform: uppercase;
  padding: .45em .9em; border: 1px solid rgba(20, 20, 20, .25); border-color: color-mix(in srgb, currentColor 32%, transparent); border-radius: 999px; transition: border-color .3s ease, background .3s ease; }
.back-btn span { transition: transform .3s ease; }
.back-btn:hover { border-color: currentColor; }
.back-btn:hover span { transform: translateX(-3px); }


/* ---------- Phones and tablets: tidy top bar, small headings, readable widths ---------- */
.mob-only { display: none; }
@media (max-width: 899px), (max-height: 519px) {
  .mob-only { display: block; }
  .eyebrow.mob-only { margin: 0 0 22px; font-size: 11px; }
  .card .view { display: none; }                        /* the card designs carry their own titles */
  .tile .view { display: none; }
  .projects > .work-in > .work-top > .eyebrow.mob-only, .play-eyebrow.mob-only { padding: 0; }
  .play-eyebrow.mob-only { margin: 0 0 22px; }
  .play-text, .find-panel .about { max-width: 34em; }
  .stack, .others-grid { max-width: 720px; margin-left: auto; margin-right: auto; }
  .others-h { text-align: left; }
  /* case and play pages: a slim bar; Back shrinks to a round arrow */
  .nav.nav--bar { padding-top: 10px !important; padding-bottom: 10px !important; gap: 10px; }
  .nav.nav--bar ul { gap: 12px; }
  .nav.nav--bar li a { font-size: 10.5px; letter-spacing: .1em; }
  .sig-bar img { width: 74px !important; }
  .bar-left { gap: 8px; }
  .back-btn { width: 30px; height: 30px; padding: 0; justify-content: center; letter-spacing: 0; font-size: 13px; flex: none; }
  .back-btn .back-word { display: none; }
  .play > * { max-width: 720px; margin-left: auto; margin-right: auto; }
}
@media (min-width: 600px) and (max-width: 899px), (min-width: 600px) and (max-height: 519px) {
  .others-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}

/* "Work in progress" marker next to a project number */
.proj-num .wip { margin-left: 12px; padding: 3px 9px; border: 1px solid currentColor; border-radius: 999px; font-style: normal;
  font-size: .78em; letter-spacing: .14em; text-transform: uppercase; vertical-align: 1px; white-space: nowrap; }
