/* ============================================================
   Alve Ibrahim — portfolio
   Ported from the Claude Design source in design-source/.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --ac: #ff4a17;          /* accent */
  --bg: #eeece7;          /* paper */
  --ink: #101010;

  --ink-70: rgba(16, 16, 16, .7);
  --ink-50: rgba(16, 16, 16, .5);
  --ink-25: rgba(16, 16, 16, .25);
  --rule:   rgba(16, 16, 16, .14);

  --paper-70: rgba(238, 236, 231, .7);
  --paper-50: rgba(238, 236, 231, .5);
  --paper-25: rgba(238, 236, 231, .25);

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;

  --pad: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Intro timeline. Phases run back to back: spin, fill, hold, lift. */
  --l-spin: 2s;
  --l-fill: .5s;
  --l-hold: .35s;
  --l-lift: .45s;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Keep anchored sections clear of the sticky masthead. */
section[id] { scroll-margin-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: clip;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--ac); }
img { max-width: 100%; }
button { font: inherit; }
::selection { background: var(--ac); color: #fff; }

:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 3px;
}

.accent { color: var(--ac); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.skip:focus { left: 8px; top: 8px; color: var(--bg); }

/* ============================================================
   INTRO
   The mark flips on its Y axis — two faces, so every half turn
   swaps ink for accent on its own. It lands face-on, a panel of
   the same ink grows out of it to fill the screen, then the whole
   overlay slides off to the left and uncovers the page.
   ============================================================ */
html.is-loading { overflow: hidden; }

.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--bg);
  animation: loader-lift var(--l-lift) cubic-bezier(.76, 0, .24, 1)
             calc(var(--l-spin) + var(--l-fill) + var(--l-hold)) forwards;
}

.loader__mark {
  position: relative;
  width: clamp(72px, 9vw, 108px);
  aspect-ratio: 1;
  transform-style: preserve-3d;
  animation: loader-flip var(--l-spin) cubic-bezier(.62, .02, .34, 1) forwards;
}
.loader__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 40px);
  letter-spacing: -.04em;
}
.loader__face--front { background: var(--ink); color: var(--bg); }
.loader__face--back  { background: var(--ac); color: #2a0a00; transform: rotateY(180deg); }

/* Starts life at the mark's exact size and position, so the handover
   from spinning mark to growing panel is seamless. */
.loader__fill {
  position: absolute;
  width: clamp(72px, 9vw, 108px);
  aspect-ratio: 1;
  background: var(--ink);
  transform: scale(0);
  animation: loader-fill var(--l-fill) cubic-bezier(.7, 0, .3, 1) var(--l-spin) forwards;
}

@keyframes loader-flip { to { transform: rotateY(1440deg); } }   /* four turns, lands face-on */
@keyframes loader-fill { from { transform: scale(1); } to { transform: scale(32); } }
@keyframes loader-lift { to { transform: translate3d(-100%, 0, 0); } }

/* ---------- keyframes ---------- */
@keyframes mq     { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }
@keyframes blip   { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes steam  { 0% { opacity: 0; transform: translate3d(0, 4px, 0) scale(.7); } 18% { opacity: .75; } 100% { opacity: 0; transform: translate3d(-9px, -34px, 0) scale(1.5); } }
@keyframes glow   { 0%, 100% { opacity: .92; } 46% { opacity: .72; } 62% { opacity: 1; } }

/* ---------- chrome ---------- */
.progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 2px;
  width: 0;
  background: var(--ac);
  z-index: 60;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: linear-gradient(90deg, rgba(16, 16, 16, .07) 1px, transparent 1px);
  background-size: calc(100% / 6) 100%;
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(238, 236, 231, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  transition: transform .4s var(--ease);
}
/* Pulled out of the way while the ride scene is pinned — it otherwise
   covers the route ticker, which sits at the top of that scene. */
.masthead.is-tucked { transform: translateY(-100%); }
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px var(--pad);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -.5px;
}
.brand__name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  line-height: 1.3;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 34px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.nav a {
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  opacity: .62;
  transition: opacity .25s, border-color .25s;
}
.nav a.is-active { opacity: 1; border-bottom-color: var(--ac); }

.cta {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--ink);
  color: var(--bg);
  padding: 11px 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  transition: background .25s, color .25s;
}
.cta:hover { background: var(--ac); color: #fff; }

.blip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ac);
  animation: blip 1.8s ease-in-out infinite;
}
.blip--static { animation: none; flex: none; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  z-index: 2;
  padding: clamp(48px, 10vh, 120px) var(--pad) 0;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-70);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
}

.hero__body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(22px, 4vw, 60px);
  margin-top: clamp(22px, 4.5vw, 48px);
  padding-bottom: clamp(40px, 7vw, 90px);
}
.hero__text { flex: 1 1 360px; min-width: 0; }

.hero__title {
  margin: 0;
  font-size: clamp(72px, 15vw, 236px);
  line-height: .82;
  font-weight: 700;
  letter-spacing: -.045em;
}
.hero__letters { display: flex; overflow: hidden; }
.hero__letters > span { display: block; }

.hero__lede {
  margin: clamp(26px, 4vw, 48px) 0 0;
  max-width: 44ch;
  font-size: clamp(17px, 1.5vw, 23px);
  line-height: 1.5;
  text-wrap: pretty;
}
.hero__lede strong { font-weight: 700; }

/* --- portrait --- */
.portrait {
  flex: 0 1 clamp(280px, 44vw, 860px);
  max-width: 860px;
  min-width: 0;
  align-self: flex-start;
  margin: calc(-1 * clamp(14px, 3vw, 44px)) 0 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.portrait__frame { position: relative; line-height: 0; }
.portrait__stage { position: relative; background: var(--ink); overflow: hidden; }

.portrait__mesh {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(238, 236, 231, .07) 1px, transparent 1px),
    linear-gradient(rgba(238, 236, 231, .07) 1px, transparent 1px);
  background-size: 12.5% 12.5%;
}
.portrait__arcs, .portrait__eyes { position: absolute; inset: 0; width: 100%; height: 100%; }

.portrait__head {
  position: relative;
  transition: transform .5s var(--ease);
}
.portrait__head img { display: block; width: 100%; height: auto; }

[data-eye] { transition: transform .18s var(--ease); }

.lid {
  transform-box: fill-box;
  transform-origin: 50% 0;
  transform: scaleY(0);
  transition: transform .09s linear;
}
.lid.is-shut { transform: scaleY(1); }

.portrait__crop { position: absolute; width: 26px; height: 26px; }
.portrait__crop--tl { top: 12px; left: 12px;  border-left: 2px solid var(--ac); border-top: 2px solid var(--ac); }
.portrait__crop--br { bottom: 12px; right: 12px; border-right: 2px solid var(--ac); border-bottom: 2px solid var(--ac); }

.portrait__fig {
  position: absolute;
  top: 11px; right: 14px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: rgba(238, 236, 231, .55);
}

.portrait__caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-70);
  border-top: 1px solid var(--rule);
  padding-top: 8px;
}

/* ============================================================
   WORK — the tong (tea stall) scene
   ============================================================ */
.work {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--rule);
  padding: clamp(40px, 6vw, 80px) var(--pad) 0;
}
.work__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(20px, 3vw, 38px);
}
.work__head h2 {
  margin: 0;
  font-size: clamp(34px, 5.6vw, 76px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: .95;
}
.work__count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-70);
}

.tong {
  position: relative;
  overflow: hidden;
  margin: 0 calc(-1 * var(--pad));
  height: clamp(620px, 92vh, 960px);
  background: linear-gradient(#16202f 0%, #25293c 54%, #3a2f36 100%);
  color: var(--bg);
}
.tong__warmth {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(52% 46% at 78% 84%, rgba(255, 168, 74, .3), rgba(255, 168, 74, 0) 70%);
}

.tong__skyline {
  position: absolute;
  left: 0; right: 0;
  bottom: clamp(58px, 9vh, 104px);
  background-image: url(../img/scene/buildings.svg);
  background-repeat: repeat-x;
  background-size: auto 100%;
  pointer-events: none;
}
.tong__skyline--far  { height: clamp(120px, 23vh, 270px); background-position: -180px bottom; opacity: .28; filter: grayscale(.75) brightness(.5); }
.tong__skyline--near { height: clamp(88px, 17vh, 200px); background-position: 420px bottom;  opacity: .55; filter: grayscale(.5) brightness(.34); }

.tong__pavement {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: clamp(58px, 9vh, 104px);
  background: #1d2130;
  border-top: 1px solid rgba(238, 236, 231, .1);
}
.tong__kerb {
  position: absolute;
  left: 0; right: 0;
  bottom: clamp(52px, 8.2vh, 94px);
  height: 2px;
  background: rgba(238, 236, 231, .07);
}

.tong__ghost {
  position: absolute;
  right: clamp(8px, 2vw, 44px);
  top: clamp(12px, 2.2vw, 40px);
  font-size: clamp(92px, 16vw, 268px);
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: .8;
  color: transparent;
  -webkit-text-stroke: 1px rgba(238, 236, 231, .2);
  pointer-events: none;
  z-index: 1;
}

.tong__stall {
  position: absolute;
  right: clamp(-40px, -1vw, 4px);
  bottom: clamp(38px, 6.2vh, 76px);
  height: clamp(320px, 58vh, 640px);
  aspect-ratio: 1406 / 1391;
  z-index: 6;
  pointer-events: none;
}
.tong__stall img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  filter: brightness(.87) saturate(1.04) drop-shadow(0 30px 34px rgba(0, 0, 0, .42));
}
.tong__stall .steam--a { left: 28.6%; top: 46%; width: 2.4%; }
.tong__stall .steam--b { left: 30.8%; top: 46.6%; width: 2%; }

.steam {
  position: absolute;
  aspect-ratio: .5;
  border-radius: 50%;
  filter: blur(3px);
  background: rgba(238, 236, 231, .5);
  animation: steam 3.4s cubic-bezier(.3, .6, .4, 1) infinite;
}
.steam--b { background: rgba(238, 236, 231, .4); animation-delay: 1.3s; }

.tong__pole {
  position: absolute;
  right: clamp(46px, 10vw, 180px);
  top: 0;
  width: 2px;
  height: clamp(120px, 22vh, 230px);
  background: rgba(238, 236, 231, .22);
  z-index: 6;
  pointer-events: none;
}
.tong__lamp {
  position: absolute;
  right: calc(clamp(46px, 10vw, 180px) - 11px);
  top: clamp(112px, 21.4vh, 224px);
  width: 24px; height: 30px;
  border-radius: 50% 50% 46% 46%;
  background: #ffd489;
  box-shadow: 0 0 26px 12px rgba(255, 186, 92, .42);
  animation: glow 5.4s ease-in-out infinite;
  z-index: 6;
  pointer-events: none;
}

.tong__avatar {
  position: absolute;
  right: clamp(90px, 24vw, 400px);
  bottom: clamp(34px, 5.6vh, 72px);
  height: clamp(170px, 26vh, 340px);
  aspect-ratio: 936 / 1284;
  z-index: 7;
  pointer-events: none;
  filter: brightness(.95) drop-shadow(0 18px 20px rgba(0, 0, 0, .4));
}
.tong__avatar > img,
.tong__avatar-head img,
.tong__avatar-arm img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}
.tong__avatar-head {
  position: absolute;
  inset: 0;
  transform-origin: 37% 24%;
  transition: transform .72s cubic-bezier(.36, .68, .3, 1);
}
.tong__avatar-arm {
  position: absolute;
  inset: 0;
  transform-origin: 45.5% 46%;
  transition: transform .72s cubic-bezier(.36, .68, .3, 1);
}
.tong__cup-steam {
  position: absolute;
  left: 73%; top: 29%;
  width: 11%; height: 15%;
  transition: opacity .5s;
}
.tong__cup-steam .steam { bottom: 0; top: auto; animation-duration: 3s; }
.tong__cup-steam .steam--a { left: 2%;  width: 50%; }
.tong__cup-steam .steam--b { left: 38%; width: 42%; animation-delay: 1.2s; }

/* --- project cards --- */
.tong__deck {
  position: absolute;
  left: clamp(14px, 4vw, 60px);
  right: clamp(110px, 22vw, 380px);
  top: clamp(40px, 6vh, 72px);
  max-width: 1120px;
  min-height: clamp(400px, 62vh, 660px);
  z-index: 3;
}

.shard {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.shard.is-on { opacity: 1; pointer-events: auto; z-index: 3; transform: translate3d(0, 0, 0); }
.shard.is-before { transform: translate3d(-30px, 0, 0); z-index: 1; }
.shard.is-after  { transform: translate3d(30px, 0, 0);  z-index: 1; }

.shard__inner {
  display: flex;
  flex-wrap: wrap;
  box-shadow: 0 44px 80px -46px rgba(0, 0, 0, .8);
}
.shard__text {
  flex: 1 1 300px;
  min-width: 0;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}
.shard__head {
  background: var(--ink);
  color: var(--bg);
  padding: clamp(14px, 1.8vw, 24px) clamp(16px, 2vw, 28px) clamp(10px, 1.3vw, 16px);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}
.shard__code {
  font-size: clamp(38px, 5.4vw, 82px);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: .84;
}
.shard__idx {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--paper-50);
}
.shard__body {
  padding: clamp(16px, 2.2vw, 32px) clamp(18px, 2.4vw, 36px) clamp(18px, 2.4vw, 32px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.4vw, 20px);
  flex: 1;
}
.shard__kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-50);
}
.shard__body h3 {
  margin: 0;
  font-size: clamp(26px, 3.5vw, 54px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.03;
  text-wrap: pretty;
}
.shard__body p {
  margin: 0;
  font-size: clamp(14px, 1.15vw, 18px);
  line-height: 1.55;
  color: var(--ink-70);
  text-wrap: pretty;
  max-width: 46ch;
}

.chips {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font-family: var(--mono);
  font-size: clamp(10px, .78vw, 12px);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.chips li { border: 1px solid var(--ink-25); padding: 5px 10px; }

.shard__link {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(16, 16, 16, .3);
  padding: clamp(13px, 1.3vw, 19px) clamp(14px, 1.4vw, 20px);
  font-family: var(--mono);
  font-size: clamp(11px, .82vw, 13px);
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: background .3s, color .3s;
}
.shard__link:hover { background: var(--ink); color: var(--bg); }
.shard__link span:last-child { font-size: 15px; }

.shot {
  flex: 1 1 230px;
  min-width: 0;
  min-height: clamp(320px, 70vh, 700px);
  background: #0b0d11;
  display: flex;
}
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot--empty {
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(238, 236, 231, .18);
}
.shot--empty span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(238, 236, 231, .35);
}

/* --- carousel controls --- */
.tong__controls {
  position: absolute;
  left: clamp(14px, 4vw, 60px);
  bottom: clamp(14px, 2.4vh, 26px);
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
  z-index: 8;
}
.tong__arrows { display: flex; gap: 6px; }
.tong__arrows button {
  width: clamp(42px, 4vw, 54px);
  height: clamp(42px, 4vw, 54px);
  border-radius: 50%;
  border: 1px solid var(--paper-25);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 16px;
  cursor: pointer;
  transition: background .3s, color .3s;
}
.tong__arrows button:hover { background: var(--bg); color: var(--ink); }

.tong__tabs { display: flex; gap: clamp(10px, 1.4vw, 18px); }
.tong__tabs button {
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 4px 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  color: rgba(238, 236, 231, .62);
  cursor: pointer;
  transition: color .3s, border-color .3s;
}
.tong__tabs button.is-on { color: var(--ac); border-bottom-color: var(--ac); }

.tong__count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  color: rgba(238, 236, 231, .6);
}

.tong__flicker {
  position: absolute;
  inset: 0;
  background: #05070c;
  opacity: 0;
  transition: opacity .09s linear;
  pointer-events: none;
  z-index: 9;
}

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee {
  position: relative;
  z-index: 2;
  background: var(--ink);
  color: var(--bg);
  overflow: hidden;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: mq 28s linear infinite;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.marquee__set { display: flex; gap: 34px; padding-right: 34px; }

/* ============================================================
   SERVICES — hanging tags
   ============================================================ */
.services {
  position: relative;
  z-index: 2;
  padding: clamp(48px, 7vw, 100px) var(--pad) clamp(56px, 8vw, 110px);
  overflow: hidden;
}
.services__head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(20px, 3vw, 48px);
  align-items: start;
  margin-bottom: clamp(20px, 3vw, 36px);
}
.services__head h2 {
  margin: 0;
  font-size: clamp(34px, 5.6vw, 76px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: .95;
}
.services__head p {
  margin: 0;
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.55;
  max-width: 46ch;
  text-wrap: pretty;
  color: var(--ink-70);
}
.services__head a { border-bottom: 1px solid var(--ac); }

.services__hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(28px, 4vw, 52px);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-70);
}

.rails { display: flex; flex-direction: column; gap: clamp(48px, 7vw, 96px); }

.rail {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(16px, 2.4vw, 40px);
}

/* The rail itself: 9px bar with a highlight line, capped at both ends. */
.rail__bar {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 9px;
  z-index: 1;
  background: linear-gradient(
    var(--ink) 0 2px,
    rgba(238, 236, 231, .22) 2px 4px,
    var(--ink) 4px 100%
  );
}
.rail__bar::before,
.rail__bar::after {
  content: '';
  position: absolute;
  top: -5px;
  width: 12px; height: 19px;
  background: var(--ink);
}
.rail__bar::before { left: -6px; }
.rail__bar::after  { right: -6px; }
.rail__slot { flex: 1 1 250px; max-width: 360px; min-width: 0; position: relative; }

.tag {
  position: relative;
  z-index: 2;
  transform-origin: 50% 6px;
  perspective: 1400px;
  touch-action: pan-y;
  cursor: grab;
}
.tag:active { cursor: grabbing; }
.tag.is-held { z-index: 5; cursor: grabbing; }

.tag__clip {
  display: flex;
  justify-content: center;
}
.tag__clip > span {
  position: relative;
  width: 58px; height: 34px;
  background: var(--ac);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  clip-path: polygon(0 0, 100% 0, 100% 74%, 50% 100%, 0 74%);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  color: #2a0a00;
}
.tag__clip > span::after {
  content: '';
  position: absolute;
  left: 50%; top: 6px;
  width: 11px; height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--ink);
}

.tag__flip {
  position: relative;
  height: 288px;
  margin-top: -2px;
  transform-style: preserve-3d;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.tag__flip.is-turning { transform: rotateY(90deg); }

.tag__face {
  position: absolute;
  inset: 0;
  padding: clamp(16px, 1.6vw, 22px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tag__face--front { background: var(--ink); color: var(--bg); box-shadow: 0 18px 40px -24px rgba(16, 16, 16, .5); }
.tag__face--back  { background: var(--ac);  color: #1a0600; display: none; }

.tag.is-flipped .tag__face--front { display: none; }
.tag.is-flipped .tag__face--back  { display: flex; }

.tag__meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--paper-50);
}
.tag__face--back .tag__meta { color: inherit; opacity: .65; }

.tag__face h3 {
  margin: 0;
  font-size: clamp(20px, 1.8vw, 27px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.05;
  text-wrap: pretty;
}
.tag__face p {
  margin: 0;
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.45;
  text-wrap: pretty;
}
.tag__face--back a {
  margin-top: auto;
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(26, 6, 0, .4);
  padding-bottom: 3px;
}
.tag__face--back a:hover { color: var(--ink); }

.tag__list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: rgba(238, 236, 231, .62);
}
.tag__list li { display: flex; align-items: center; gap: 7px; }
.tag__list li::before {
  content: '';
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid rgba(238, 236, 231, .4);
}
.tag__list li.is-key { color: var(--bg); }
.tag__list li.is-key::before { border-top: 0; border-bottom: 6px solid var(--ac); }

.tag__rule {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--paper-50);
}
.tag__rule i { flex: 1; height: 1px; background: rgba(238, 236, 231, .28); }

/* ============================================================
   ABOUT — the rickshaw ride
   ============================================================ */
.about {
  position: relative;
  z-index: 2;
  background: var(--ink);
  color: var(--bg);
  padding: clamp(48px, 7vw, 110px) var(--pad);
}
.about__sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(#6fb7dd 0%, #9cd0e9 46%, #c9e4f1 100%);
  opacity: 0;
  pointer-events: none;
}
.about__label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--paper-50);
  border-bottom: 1px solid rgba(238, 236, 231, .18);
  padding-bottom: 12px;
}

.run {
  position: relative;
  z-index: 1;
  height: 640vh;
  margin: clamp(24px, 3vw, 44px) calc(-1 * var(--pad)) calc(-1 * clamp(48px, 7vw, 110px));
}
.stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }

.layer, .road {
  position: absolute;
  left: 0;
  width: calc(100% + 2600px);
  background-repeat: repeat-x;
  transform: translate3d(0, 0, 0);
}
.layer {
  bottom: var(--bottom);
  height: var(--h);
  background-position: 0 bottom;
  background-size: auto 100%;
  opacity: 0;
  filter: var(--grade, none);
}
/* Keep these URLs in the stylesheet: a url() carried in a custom property
   resolves against the sheet that substitutes it, not the element's document. */
.layer--buildings { background-image: url(../img/scene/buildings.svg); }
.layer--props     { background-image: url(../img/scene/props.svg); }
.road {
  bottom: 0;
  height: 26%;
  background-image: url(../img/scene/road.svg);
  background-position: 0 top;
  background-size: auto 200%;
  transform: translate3d(0, 100%, 0);
}

.sign {
  position: absolute;
  bottom: 25%;
  left: 0;
  transform: translate3d(120vw, 0, 0);
}
.sign--wide { height: 42%; }
.sign--tall { height: 54%; }
.sign img { height: 100%; width: auto; display: block; }

.sign__text {
  position: absolute;
  display: flex;
  flex-direction: column;
  color: var(--ink);
}
.sign--wide .sign__text {
  left: 6%; right: 6%; top: 12.5%; bottom: 52%;
  justify-content: center;
  gap: .4vh;
  padding: 0 4%;
}
.sign--tall .sign__text {
  left: 11%; right: 11%; top: 11.5%; bottom: 51%;
  gap: .6vh;
  padding: 1.4vh 4% 0;
}
.sign__year  { font-family: var(--mono); font-size: 1.1vh; letter-spacing: .2em; text-transform: uppercase; opacity: .55; }
.sign__where { font-size: 2.4vh; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.sign--tall .sign__where { font-size: 2.2vh; }
.sign__what  { font-size: 1.4vh; line-height: 1.25; opacity: .7; }
.sign__prize {
  margin: auto 0 1.2vh;
  font-family: var(--mono);
  font-size: 1.1vh;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ac);
}
.sign__band { position: absolute; background: var(--ac); }
.sign--wide .sign__band { left: 17%; right: 17%; top: 4%;   height: 6.5%; }
.sign--tall .sign__band { left: 12%; right: 12%; top: 4.6%; height: 5%; }

.rickshaw {
  position: absolute;
  bottom: 5%;
  left: 0;
  height: 27%;
  opacity: 0;
  transform: translate3d(-30vw, 0, 0);
}
.rickshaw__inner { position: relative; height: 100%; aspect-ratio: 1.2305; transform: scaleX(-1); }
.rickshaw__inner > img:first-child { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rickshaw__wheel { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: auto; }

.ticker {
  position: absolute;
  left: 0; right: 0;
  top: clamp(18px, 6vh, 64px);
  display: flex;
  align-items: stretch;
  background: var(--bg);
  color: var(--ink);
  border-top: 1px solid rgba(16, 16, 16, .3);
  border-bottom: 1px solid rgba(16, 16, 16, .3);
  overflow: hidden;
  transform: translateY(-420%);
}
.ticker__meter {
  flex: none;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px clamp(12px, 1.4vw, 18px);
}
.ticker__label { font-family: var(--mono); font-size: 9px; letter-spacing: .2em; opacity: .5; }
.ticker__pct {
  font-family: var(--mono);
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.ticker__pass {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .18em;
  border: 1px solid var(--paper-25);
  padding: 4px 7px;
  color: rgba(238, 236, 231, .4);
  transition: color .35s, border-color .35s;
}
.ticker__pass.is-there { color: var(--ac); border-color: var(--ac); }

.ticker__window { flex: 1; min-width: 0; display: flex; align-items: center; overflow: hidden; }
.ticker__marquee {
  display: flex;
  gap: clamp(20px, 2.4vw, 38px);
  white-space: nowrap;
  font-family: var(--mono);
  font-size: clamp(14px, 1.6vw, 22px);
  letter-spacing: -.01em;
  text-transform: uppercase;
}
.ticker__marquee .sep { opacity: .35; }
.ticker__bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--ac); }

/* ============================================================
   CONTACT + FOOTER
   ============================================================ */
.contact {
  position: relative;
  z-index: 2;
  padding: clamp(56px, 9vw, 130px) var(--pad) clamp(28px, 4vw, 48px);
}
.contact h2 {
  margin: 0;
  font-size: clamp(46px, 11vw, 168px);
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: .86;
  text-wrap: balance;
}
.contact__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(20px, 3vw, 48px);
  margin-top: clamp(32px, 5vw, 64px);
  border-top: 1px solid var(--rule);
  padding-top: clamp(20px, 3vw, 32px);
}
.contact__grid > a { display: flex; flex-direction: column; gap: 8px; }
.contact__key {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-70);
}
.contact__val { font-size: clamp(17px, 1.8vw, 26px); font-weight: 500; letter-spacing: -.02em; }
.contact__cta { display: flex; align-items: flex-start; }
.contact__cta .cta { padding: 16px 24px; }

.footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  border-top: 1px solid var(--rule);
  padding: 18px var(--pad) 28px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-70);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .masthead__inner { flex-wrap: wrap; row-gap: 12px; }
  .nav { order: 3; width: 100%; justify-content: space-between; }

  /* Card stacks and runs full width; the scene drops below it and laps the
     lower edge, rather than competing for the same horizontal space. */
  .tong {
    height: auto;
    min-height: 0;
    padding: clamp(36px, 6vh, 64px) 0 clamp(20px, 3vh, 32px);
  }
  .tong__deck {
    position: static;
    inset: auto;
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0 clamp(14px, 4vw, 60px);
  }
  .shard { position: absolute; }
  .shard.is-on { position: relative; }

  /* 70vh of screenshot is far too tall once the card is full width. */
  .shot { min-height: clamp(170px, 25vh, 280px); }

  .tong__stall {
    height: clamp(200px, 31vh, 320px);
    right: clamp(-56px, -7vw, 0px);
    bottom: clamp(86px, 11.2vh, 116px);
  }
  .tong__avatar {
    height: clamp(118px, 18vh, 190px);
    right: clamp(40px, 25vw, 170px);
    bottom: clamp(82px, 10.6vh, 110px);
  }
  .tong__pole, .tong__lamp { display: none; }

  /* The top margin is the gap the scene occupies, so the controls land
     underneath it rather than being crossed by the stall roof. */
  /* relative, not static: z-index is ignored on static elements, so the
     stall counter would paint straight over the controls. */
  .tong__controls {
    position: relative;
    inset: auto;
    margin: clamp(158px, 25vh, 262px) clamp(14px, 4vw, 60px) 0;
  }
}

@media (max-width: 620px) {
  .grid-overlay { background-size: calc(100% / 3) 100%; }
  .work__head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .tong__ghost { display: none; }
  .tong__controls { flex-wrap: wrap; row-gap: 14px; }
  .rail__slot { max-width: none; }
  .run { height: 420vh; }
  .footer { justify-content: flex-start; }

  /* Let the portrait use the full column rather than sitting in a 280px well. */
  .portrait { flex: 1 1 100%; max-width: none; margin-top: 4px; }
}

/* ============================================================
   REDUCED MOTION
   The scroll scene, pendulums and idle loops all stand down; the
   page stays fully legible because every animated element has a
   resting state that reads correctly on its own.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  /* No intro at all — go straight to the page. */
  .loader { display: none; }
  html.is-loading { overflow: auto; }

  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .steam, .tong__lamp { animation: none; opacity: .6; }
  .marquee__track { animation: none; }
  .run { height: auto; }
  .stage { position: relative; height: min(100vh, 620px); }
}
