/* =========================================================
   MOTION — A JSdigital Motion Study
   Plain CSS. No framework. Every rule below exists to move.
   ========================================================= */

:root {
  --bg: #060608;
  --bg-2: #0b0b10;
  --ink: #f4f4f8;
  --ink-dim: #8b8b9a;
  --accent: #00f0d8;      /* electric cyan */
  --accent-2: #ff3fc4;    /* magenta */
  --accent-soft: rgba(0, 240, 216, 0.15);
  --line: rgba(255, 255, 255, 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --scene-pad: clamp(1.5rem, 6vw, 4rem);
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: auto;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  overflow-x: hidden;
  cursor: default;
}

/* Scroll-as-timeline: each scene is a full-viewport "cut" */
.scenes {
  scroll-snap-type: y proximity;
}

.scene {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--scene-pad);
  scroll-snap-align: start;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

@media (prefers-reduced-motion: no-preference) {
  .scenes { scroll-snap-type: y proximity; }
}
@media (prefers-reduced-motion: reduce) {
  .scenes { scroll-snap-type: none; }
  html { scroll-behavior: smooth; }
}

/* ---------- top progress rail (scroll = playhead) ---------- */
.progress-rail {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.06);
  z-index: 500;
}
.progress-rail-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
  transition: width 0.08s linear;
}

/* ---------- cursor glow ---------- */
.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 520px;
  height: 520px;
  margin-left: -260px;
  margin-top: -260px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle, var(--accent-soft) 0%, rgba(255,63,196,0.06) 40%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  will-change: transform;
}
.cursor-glow.active { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .cursor-glow { display: none; }
}
@media (hover: none) {
  .cursor-glow { display: none; }
}

/* ---------- generative background canvas ---------- */
#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.55;
}

/* ---------- animated grid overlay (hero) ---------- */
.grid-overlay {
  position: absolute;
  inset: -2px;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 40%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 40%, transparent 90%);
}

@media (prefers-reduced-motion: no-preference) {
  .grid-overlay {
    animation: grid-drift 24s linear infinite;
  }
}
@keyframes grid-drift {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 64px 128px, 128px 64px; }
}

.noise-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(0,240,216,0.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(255,63,196,0.08), transparent 60%);
}
@media (prefers-reduced-motion: no-preference) {
  .noise-overlay { animation: drift-glow 14s ease-in-out infinite alternate; }
}
@keyframes drift-glow {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-2%, 2%, 0) scale(1.08); }
}

/* ============ SCENE 1 — HERO ============ */
.scene-hero {
  background: radial-gradient(ellipse 90% 70% at 50% 30%, #0d0d14 0%, var(--bg) 70%);
  text-align: center;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 900px;
}

.eyebrow {
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  color: var(--accent);
  margin: 0 0 1.5rem;
  font-weight: 600;
}

.kinetic-title {
  margin: 0;
  font-size: clamp(2.5rem, 9vw, 6.5rem);
  line-height: 0.98;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kinetic-title .line {
  display: block;
}

.accent {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rotator-wrap {
  margin: 2rem 0 3rem;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  color: var(--ink-dim);
  letter-spacing: 0.05em;
  font-weight: 500;
  min-height: 1.6em;
}

.rotator {
  color: var(--ink);
  font-weight: 700;
  display: inline-block;
}

.cursor-blink {
  color: var(--accent);
  margin-left: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  .cursor-blink { animation: blink 1s steps(1) infinite; }
}
@keyframes blink { 50% { opacity: 0; } }

.scroll-cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--ink-dim);
  font-weight: 600;
}

.scroll-cue-track {
  width: 22px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.scroll-cue-dot {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .scroll-cue-dot { animation: scroll-dot 1.8s ease-in-out infinite; }
}
@keyframes scroll-dot {
  0%   { transform: translateY(0); opacity: 1; }
  60%  { transform: translateY(14px); opacity: 0.2; }
  61%  { transform: translateY(0); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ============ Reveal-on-scroll system ============ */
.reveal-item {
  opacity: 0;
  transform: translateY(36px) scale(0.98);
  filter: blur(6px);
}

@media (prefers-reduced-motion: no-preference) {
  .reveal-item {
    transition:
      opacity 0.9s var(--ease),
      transform 0.9s var(--ease),
      filter 0.9s var(--ease);
    transition-delay: calc(var(--d, 0) * 90ms);
  }
}

.scene.in-view .reveal-item,
.reveal-item.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal-item {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* ============ SCENE 2 — STATS ============ */
.scene-stats {
  background: var(--bg-2);
}

.scene-heading {
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 3.5rem;
  max-width: 850px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  width: 100%;
  max-width: 1100px;
  margin-bottom: 3.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}

.stat-num {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.6rem;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--ink-dim);
  max-width: 16ch;
}

.progress-row {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.progress-bar { width: 100%; }

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
@media (prefers-reduced-motion: no-preference) {
  .progress-fill {
    transition: width 1.4s var(--ease-soft);
  }
}

.progress-label {
  font-size: 0.8rem;
  color: var(--ink-dim);
  letter-spacing: 0.03em;
}
.progress-label em {
  font-style: normal;
  color: var(--ink);
  font-weight: 700;
}

/* ============ SCENE 3 — PRINCIPLES ============ */
.scene-principles {
  background: var(--bg);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  width: 100%;
  max-width: 900px;
}

.p-card {
  position: relative;
  padding: 2rem 1.75rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.015);
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .p-card {
    transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), background 0.4s var(--ease);
  }
  .p-card:hover {
    transform: translateY(-6px);
    border-color: rgba(0,240,216,0.4);
    background: rgba(0,240,216,0.04);
  }
}

.p-num {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 0.9rem;
}

.p-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.p-card p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ============ SCENE 4 — CTA ============ */
.scene-cta {
  background: radial-gradient(ellipse 80% 60% at 50% 60%, #0d0d14 0%, var(--bg) 75%);
  text-align: center;
}

.cta-glow {
  position: absolute;
  width: 60vw;
  height: 60vw;
  max-width: 700px;
  max-height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,240,216,0.12), transparent 65%);
  z-index: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .cta-glow { animation: pulse-glow 5s ease-in-out infinite; }
}
@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}

.cta-title {
  position: relative;
  z-index: 2;
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.cta-title .line { display: block; }

.cta-sub {
  position: relative;
  z-index: 2;
  color: var(--ink-dim);
  letter-spacing: 0.25em;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 1.75rem 0 2.75rem;
}

.cta-btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.05rem 2.2rem;
  border-radius: 999px;
  background: var(--ink);
  color: #08080a;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .cta-btn {
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.35s var(--ease);
  }
  .cta-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 40px rgba(0,240,216,0.25);
    background: var(--accent);
  }
  .cta-btn .arrow {
    display: inline-block;
    transition: transform 0.35s var(--ease);
  }
  .cta-btn:hover .arrow { transform: translateX(4px); }
}

.footer-tag {
  position: relative;
  z-index: 2;
  margin-top: 4rem;
  font-size: 0.75rem;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
}

/* ============ Reduced-motion global overrides ============ */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
  #bgCanvas { display: none; }
  .grid-overlay, .noise-overlay, .cta-glow { animation: none; }
  .progress-fill { transition: none !important; width: var(--final-width, 0%); }
}

/* ============ Mobile ============ */
@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .scene { padding: 2rem 1.25rem; }
}
