:root {
  --bg: #0c0d0e;
  --fg: #ecebe6;
  --muted: #84837d;
  --line: rgba(236, 235, 230, 0.2);
  --accent: #ff5a1f;
  --gutter: clamp(20px, 3.4vw, 48px);
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
body.is-loading { overflow: hidden; }

a { color: inherit; }
::selection { background: var(--accent); color: var(--bg); }

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
/* while loading, the model is drawn above the shutter so it can scan in on screen */
#gl.on-top { z-index: 60; }

/* shared type */
.display, .chap h2, .hero__title, .stat__num, .specs dd, .ld-count b {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.035em;
}
.label {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
  font: 500 12px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.label b { font-weight: 500; color: var(--accent); }
.lead {
  margin-top: 22px;
  max-width: 36ch;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.5;
  color: #c9c8c2;
}
.fine { margin-top: 18px; font: 400 11px/1.6 var(--mono); color: var(--muted); max-width: 46ch; }
.acc { color: var(--accent); }

.link {
  display: inline-block;
  padding-bottom: 5px;
  border-bottom: 1px solid currentColor;
  font: 500 15px var(--sans);
  text-decoration: none;
  transition: color 0.2s;
}
.link:hover { color: var(--accent); }
.link--dim { color: var(--muted); }
.link--dim:hover { color: var(--fg); }

/* loader: two shutters part to reveal the page */
#loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  transition: visibility 0s linear 1.6s;
}
#loader.is-done { visibility: hidden; pointer-events: none; }

.ld-panel {
  position: absolute;
  left: 0; right: 0;
  height: 50.5%;
  background: var(--bg);
  transition: transform 1.1s cubic-bezier(.77, 0, .18, 1) 0.45s;
}
.ld-panel--top { top: 0; }
.ld-panel--bot { bottom: 0; }
#loader.is-done .ld-panel--top { transform: translateY(-101%); }
#loader.is-done .ld-panel--bot { transform: translateY(101%); }

.ld-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px var(--gutter) 28px;
  transition: opacity 0.4s ease;
}
#loader.is-done .ld-content { opacity: 0; }

.ld-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font: 500 11px var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.ld-foot { display: grid; gap: 18px; }
.ld-line { height: 1px; background: var(--line); }
.ld-line i { display: block; height: 100%; width: 0; background: var(--accent); }
.ld-bar--bot span:first-child { color: var(--fg); }
.ld-count { font: 500 12px var(--mono); color: var(--muted); }
.ld-count b {
  font-size: clamp(56px, 9vw, 128px);
  line-height: 0.8;
  letter-spacing: -0.05em;
  color: var(--fg);
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}

/* nav, readouts, progress */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px var(--gutter);
  font: 500 12px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  mix-blend-mode: difference;
}
.nav a { text-decoration: none; color: #fff; transition: opacity 0.2s; }
.nav a:hover { opacity: 0.55; }
.nav__brand { font-weight: 500; }
.nav__links { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 32px; }

.hud {
  position: fixed;
  right: var(--gutter);
  bottom: 24px;
  z-index: 10;
  font: 400 10px/1.9 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hud div { display: flex; gap: 28px; }
.hud span { color: var(--muted); min-width: 110px; }
.hud b { font-weight: 500; min-width: 84px; }

.rail {
  position: fixed;
  left: var(--gutter);
  bottom: 28px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  font: 400 11px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
}
.rail #railIdx { color: var(--fg); }
.rail__bar { width: 120px; height: 1px; background: var(--line); }
.rail__bar i { display: block; height: 100%; width: 0; background: var(--accent); }

/* sections */
main { position: relative; z-index: 5; }

.sec {
  min-height: 100vh;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
}

/* hero */
.sec--hero { padding-top: 14vh; padding-bottom: 5vh; overflow: hidden; }

.hero__meta {
  position: absolute;
  top: 84px;
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  gap: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font: 500 11px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero__meta span:first-child { color: var(--accent); }

.hero__title {
  font-size: clamp(44px, 7.4vw, 124px);
  line-height: 0.93;
  max-width: 10.5em;
}
.hero__title .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0 0.05em 0.12em;
  margin-bottom: -0.12em;
}
.hero__title .w > span {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 1.1s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc(var(--i) * 70ms + 350ms);
}
body:not(.is-loading) .hero__title .w > span { transform: none; }

.hero__row {
  margin-top: 38px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
}
.hero__lead { max-width: 40ch; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.55; color: #bdbcb6; }
.hero__links { display: flex; gap: 32px; }

.specs {
  margin-top: 6vh;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}
.specs > div { padding: 16px 24px 0 0; }
.specs > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.specs dt {
  font: 500 10px var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.specs dd { margin-top: 10px; font-size: clamp(28px, 3.4vw, 52px); line-height: 1; }
.specs small { font: 400 12px var(--mono); letter-spacing: 0.06em; color: var(--muted); }

/* pinned story */
.story { height: 900vh; position: relative; }
.stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }

.chap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--gutter);
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
}
.chap--left { align-items: flex-start; }
.chap--right { align-items: flex-end; text-align: right; }
.chap--right .label { flex-direction: row-reverse; }
.chap--right .lead { margin-left: auto; }
.chap--top { align-items: flex-start; justify-content: flex-start; padding-top: 19vh; }
.chap--bottom { align-items: flex-start; justify-content: flex-end; padding-bottom: 17vh; }

.chap h2 {
  font-size: clamp(56px, 10vw, 152px);
  line-height: 0.9;
}

.stat__pre { font: 500 clamp(17px, 1.6vw, 24px)/1.2 var(--sans); color: #c9c8c2; }
.stat__num {
  font-size: clamp(150px, 24vw, 340px);
  line-height: 0.82;
  letter-spacing: -0.06em;
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 10px;
}
.stat__num small { font: 500 12px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* 60 ticks, one per second */
.ticks {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  width: min(520px, 80vw);
  height: 26px;
  margin: 24px 0 26px;
}
.ticks i { flex: 1; height: 40%; background: var(--line); }
.ticks i:nth-child(5n) { height: 65%; }
.ticks i.on { background: var(--fg); }
.ticks i.head { height: 100%; background: var(--accent); }

.note {
  max-width: 40ch;
  padding-left: 18px;
  border-left: 1px solid var(--accent);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.5;
  color: #d6d5cf;
}

.caption {
  position: absolute;
  bottom: 14vh;
  left: var(--gutter);
  font: 400 11px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* callouts on the model */
.tag {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  font: 500 11px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tag i { position: relative; display: block; width: 64px; height: 1px; background: var(--fg); }
.tag i::before { content: ""; position: absolute; left: -2px; top: -2px; width: 5px; height: 5px; background: var(--accent); }
.tag--a { top: 52%; left: 62%; }
.tag--b { top: 58%; left: 16%; flex-direction: row-reverse; }
.tag--b i::before { left: auto; right: -2px; }
.tag--c { top: 72%; left: 52%; }

/* final chapter: the call to action sits on the stage with the model */
.chap--cta .cta__title { font-size: clamp(44px, 7.2vw, 112px); line-height: 0.93; max-width: 8.2em; }
.chap--cta .lead { max-width: 38ch; }
.cta__form {
  margin-top: 36px;
  width: min(520px, 100%);
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--fg);
}
.cta__form input {
  flex: 1;
  min-width: 0;
  padding: 16px 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--fg);
  font: 400 20px var(--sans);
}
.cta__form input::placeholder { color: #6a6963; }
.cta__form button {
  padding: 0 0 0 20px;
  background: none;
  border: 0;
  color: var(--fg);
  font: 500 15px var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s;
}
.cta__form button:hover { color: var(--accent); }
.cta__form:focus-within { border-bottom-color: var(--accent); }
.cta__form.is-sent button { color: var(--accent); }

/* reveal on scroll (hero only) */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s ease 0.9s, transform 0.9s cubic-bezier(.2,.7,.2,1) 0.9s;
}
body:not(.is-loading) .reveal { opacity: 1; transform: none; }

.foot {
  position: relative;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 26px var(--gutter) 34px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font: 400 11px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.foot nav { display: flex; gap: 28px; }
.foot a { text-decoration: none; transition: color 0.2s; }
.foot a:hover { color: var(--accent); }

@media (max-width: 1100px) { .nav__links { display: none; } }

@media (max-width: 720px) {
  .hud, .tag, .caption { display: none; }
  .rail { bottom: 20px; }
  .hero__meta { top: 74px; gap: 18px; }
  .hero__meta span:last-child { display: none; }
  .sec--hero { padding-top: 22vh; }
  .hero__links { gap: 24px; }
  .specs > div { padding-right: 10px; }
  .specs > div + div { padding-left: 12px; }
  .specs small { display: block; margin-top: 4px; }
  /* on phones the model sits low, so every chapter's copy goes up top */
  .chap, .chap--left, .chap--right, .chap--bottom, .chap--top {
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    padding-top: 15vh;
    padding-bottom: 0;
  }
  .chap--right .label { flex-direction: row; }
  .chap--right .lead { margin-left: 0; }
  .stat__num { font-size: clamp(110px, 34vw, 170px); }
  .cta__form input { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__title .w > span { transition: none; transform: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
  #loader, .ld-panel, .ld-content { transition: none; }
}
