/* Vitacore Motion Lab. The site's palette and type, with a few lab-only tokens. */
:root {
  --bg: #000;
  --fg: rgba(255, 255, 255, 0.92);
  --muted: #b3b3b3;
  --dim: rgba(255, 255, 255, 0.5);
  --blue: #444efe;
  --cyan: #00a6ff;
  --lav: #a9adff;
  --line: rgba(255, 255, 255, 0.1);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --head: "ff-good-headline-web-pro", "Avenir Next Condensed", "Helvetica Neue", Arial, sans-serif;
  --body: "proxima-nova", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
canvas { display: block; }

.h-display {
  font-family: var(--head);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 0.95;
  margin: 0;
}
.eyebrow {
  font-family: var(--head);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(20px, 2vw, 28px);
  color: var(--lav);
  margin: 0;
}
.lede {
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.45;
  color: var(--muted);
  max-width: 640px;
  margin: 0;
}
.lede strong { color: var(--fg); font-weight: 600; }
.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* Local nav, like Apple's product bar: name, chapters, a thin progress line */
.lnav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.lnav b { font-family: var(--head); font-style: italic; font-weight: 500; font-size: 19px; white-space: nowrap; }
.lnav nav { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.lnav a { color: var(--dim); text-decoration: none; font-size: 13px; white-space: nowrap; transition: color 0.2s; }
.lnav a:hover, .lnav a.on { color: #fff; }
.lnav button {
  font: 12px var(--mono);
  color: var(--fg);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.lnav .bar {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* Technique notes: what Apple does there, and what this scene does instead */
.note {
  position: absolute;
  left: 28px;
  bottom: 28px;
  z-index: 30;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid rgba(169, 173, 255, 0.25);
  border-radius: 12px;
  background: rgba(10, 10, 20, 0.7);
  backdrop-filter: blur(10px);
  font: 11.5px/1.5 var(--mono);
  color: rgba(255, 255, 255, 0.7);
  transition: opacity 0.3s;
}
.note i { font-style: normal; color: var(--lav); }
.note-static { position: relative; left: auto; bottom: auto; margin: 40px auto 0; }
body:not(.notes) .note { opacity: 0; pointer-events: none; }

/* A pinned scene: the section is as tall as the scroll it takes, the stage stays on screen */
.pin { position: relative; height: calc(var(--len, 300vh) + 100vh); }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.stage > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  gap: 22px;
}
[data-kf] { will-change: transform, opacity; }

/* 01 Hero */
.hero-word {
  font-size: clamp(88px, 17vw, 260px);
  color: #fff;
  text-shadow: 0 0 60px rgba(68, 78, 254, 0.35);
  animation: focus-in 1.6s var(--ease) both;
}
@keyframes focus-in {
  from { opacity: 0; filter: blur(14px); letter-spacing: 0.08em; }
  to { opacity: 1; filter: none; letter-spacing: -0.01em; }
}
.scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 48px;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.6));
  animation: hint 2.4s ease-in-out infinite;
}
@keyframes hint {
  0%, 100% { transform: translateX(-50%) scaleY(0.4); transform-origin: top; opacity: 0.3; }
  50% { transform: translateX(-50%) scaleY(1); opacity: 1; }
}

/* Staggered reveals for content that just scrolls past (Apple's StaggeredFadeIn) */
.reveal > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: calc(var(--i, 0) * 120ms);
}
.reveal.in > * { opacity: 1; transform: none; }

.section {
  position: relative;
  padding: 160px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
}

/* 02 Zoom: a microscope readout over the canvas */
.hud {
  position: absolute;
  top: 76px;
  right: 28px;
  z-index: 20;
  display: grid;
  gap: 6px;
  text-align: right;
}
.hud .mono b { color: #fff; font-weight: 500; }
.scalebar {
  position: absolute;
  right: 28px;
  bottom: 32px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.scalebar span:last-child {
  display: block;
  height: 3px;
  background: #fff;
  box-shadow: 0 0 12px rgba(0, 166, 255, 0.8);
  transition: width 0.05s linear;
}
.zoom-label {
  position: absolute;
  left: 50%;
  top: 92px;
  transform: translateX(-50%);
  z-index: 20;
  text-align: center;
  width: min(720px, 90vw);
}
.zoom-label .h-display { font-size: clamp(30px, 3.4vw, 48px); }
.zoom-label p { margin: 10px auto 0; color: var(--muted); font-size: 17px; line-height: 1.45; max-width: 560px; }
.zoom-label > div { position: absolute; inset: 0 0 auto; opacity: 0; }
.zoom-label > div::before {
  content: "";
  position: absolute;
  inset: -70px -140px -50px;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.5) 60%, transparent);
}
.legend { display: flex; gap: 18px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.legend span { display: inline-flex; gap: 8px; align-items: center; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* 03 Numbers over a dot matrix that lights from the centre as it scrolls in */
.numbers { position: relative; padding: 180px 24px; overflow: hidden; }
.numbers::before, .numbers::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.09) 1px, transparent 1.6px);
  background-size: 12px 12px;
}
.numbers::after {
  background-image: radial-gradient(circle, rgba(0, 166, 255, 0.55) 1px, transparent 1.7px);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 calc(var(--p, 0) * 70%), transparent calc(var(--p, 0) * 70% + 18%));
  mask-image: radial-gradient(circle at 50% 50%, #000 calc(var(--p, 0) * 70%), transparent calc(var(--p, 0) * 70% + 18%));
  opacity: calc(1 - var(--p, 0) * 0.6);
}
.numbers .grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 72px 40px;
  max-width: 1100px;
  margin: 64px auto 0;
  text-align: center;
}
.stat strong {
  display: block;
  font-family: var(--head);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(44px, 5vw, 72px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.stat strong small { font-size: 0.42em; color: var(--lav); margin-left: 0.15em; }
.stat span { display: block; margin-top: 10px; color: var(--muted); font-size: 15px; }
.stat i { display: block; margin: 14px auto 0; width: 40px; height: 2px; border-radius: 2px; background: var(--blue); transform: scaleX(0); transition: transform 1s var(--ease) 0.6s; }
.reveal.in .stat i { transform: scaleX(1); }

/* 04 Layers, in CSS 3D */
.layers-scene { perspective: 1800px; }
.stack {
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(440px, 62vw);
  aspect-ratio: 1 / 1.05;
  transform-style: preserve-3d;
}
.layer {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: filter 0.4s;
}
.layer svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tag {
  position: absolute;
  left: 100%;
  top: 30%;
  width: 280px;
  padding-left: 64px;
  transform-origin: 0 50%;
  text-align: left;
}
.tag::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 52px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan));
}
.tag::after {
  content: "";
  position: absolute;
  left: -4px;
  top: 8.5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.tag b { display: block; font-family: var(--head); font-style: italic; font-weight: 500; font-size: 22px; color: #fff; }
.tag span { display: block; margin-top: 4px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.layers-title { position: absolute; top: 96px; left: 0; right: 0; text-align: center; padding: 0 24px; }
.layers-title .h-display { font-size: clamp(40px, 5vw, 72px); }

/* 05 to 08: canvas scenes with a title block and readouts */
.scene-title {
  position: absolute;
  top: 88px;
  left: 56px;
  z-index: 20;
  max-width: 460px;
}
.scene-title .h-display { font-size: clamp(36px, 4vw, 60px); margin-top: 6px; }
.scene-title p { margin: 14px 0 0; color: var(--muted); font-size: 17px; line-height: 1.45; }
.readout {
  position: absolute;
  z-index: 20;
  display: grid;
  gap: 4px;
}
.readout .big {
  font-family: var(--head);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(32px, 3.4vw, 52px);
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.readout .big sup { font-size: 0.5em; }
.phase-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.phase-list li { font: 12px var(--mono); color: rgba(255, 255, 255, 0.35); transition: color 0.3s; display: flex; gap: 10px; align-items: center; }
.phase-list li::before { content: ""; width: 14px; height: 1px; background: currentColor; transition: width 0.3s var(--ease); }
.phase-list li.on { color: #fff; }
.phase-list li.on::before { width: 28px; background: var(--cyan); }

/* 09 Read-along paragraph, then cards that slide sideways */
.read {
  max-width: 980px;
  margin: 0 auto;
  font-family: var(--head);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(32px, 4vw, 58px);
  line-height: 1.15;
  text-align: left;
}
.read span { opacity: 0.16; transition: opacity 0.15s linear; }
.read span.lit { opacity: 1; }
.track { position: absolute; top: 50%; left: 0; display: flex; gap: 28px; padding: 0 8vw; transform: translateY(-46%); }
.card {
  position: relative;
  flex: none;
  width: min(420px, 78vw);
  height: min(520px, 64vh);
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(160deg, #121219, #07070b);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.card canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.card > div { position: relative; }
.card b { font-family: var(--head); font-style: italic; font-weight: 500; font-size: 30px; display: block; }
.card p { margin: 8px 0 0; color: var(--muted); font-size: 16px; line-height: 1.4; }
.card .mono { position: absolute; top: 28px; left: 32px; }
.cards-title { position: absolute; top: 96px; left: 8vw; right: 8vw; }
.cards-title .h-display { font-size: clamp(38px, 4.6vw, 66px); }

/* 10 Closing: the headline opens out of a slit, then the rules */
.closing .h-display { font-size: clamp(64px, 11vw, 170px); }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 1100px; margin: 0 auto; text-align: left; }
.rules > div { border: 1px solid var(--line); border-radius: 20px; padding: 28px 30px; background: rgba(255, 255, 255, 0.02); }
.rules h3 { margin: 0 0 14px; font-family: var(--head); font-style: italic; font-weight: 500; font-size: 26px; }
.rules ul { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: var(--muted); line-height: 1.5; font-size: 15.5px; }
.rules li b { color: var(--fg); font-weight: 600; }

@media (max-width: 860px) {
  .lnav nav { display: none; }
  .numbers .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scene-title { left: 24px; right: 24px; top: 76px; }
  .scene-title p { display: none; }
  .rules { grid-template-columns: 1fr; }
  .tag { width: 180px; padding-left: 40px; }
  .tag::before { width: 30px; }
  .tag span { display: none; }
  .note { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-word, .scroll-hint { animation: none; }
  .reveal > * { opacity: 1; transform: none; transition: none; }
}
