/* ============================================================
   Motion - studio sketch
   Tokens: Void / Fog / Signal / Ember / Panel / Mute
   Type:   Sora (display) + Manrope (body)
   Shape:  panels and cards 16px, buttons full pill (one system)
   Theme:  dark only, locked page-wide (Void stage)
   ============================================================ */

:root {
  --void: #0A0B10;
  --fog: #E8EAF2;
  --signal: #5B8CFF;
  --ember: #FF6B4A;
  --panel: #14161F;
  --mute: #8B90A5;
  --line: rgba(232, 234, 242, 0.10);
  --line-strong: rgba(232, 234, 242, 0.18);

  --font-display: "Sora", "Avenir Next", system-ui, sans-serif;
  --font-body: "Manrope", "Avenir Next", system-ui, sans-serif;

  --radius: 16px;
  --pill: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 64px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }
body {
  background: var(--void);
  color: var(--fog);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
a { color: inherit; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--signal); color: var(--void); }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 1200px; margin-inline: auto; padding-inline: clamp(20px, 4vw, 40px); }

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

.skip {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  background: var(--panel); color: var(--fog);
  padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  transform: translateY(-64px); opacity: 0;
}
.skip:focus-visible { transform: none; opacity: 1; }

/* Film grain over the stage. Fixed + pointer-events none, never on scroll containers. */
.grain {
  position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--signal); color: var(--void);
  font-family: var(--font-body); font-weight: 600; font-size: 0.9375rem;
  border-radius: var(--pill); padding: 10px 20px; text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease), translate 0.25s var(--ease);
}
.btn:hover { background: var(--ember); translate: 0 -1px; }
.btn:active { translate: 0 1px; }
.btn-lg { font-size: 1.0625rem; padding: 14px 28px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); padding-inline: clamp(20px, 4vw, 40px);
  background: rgba(20, 22, 31, 0.78);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem;
}
.brand-mark .brand-dot { transition: transform 0.5s var(--ease); transform-origin: 16px 16px; }
.brand:hover .brand-dot { transform: rotate(160deg); transform-origin: 16px 16px; }
.nav-links { display: flex; align-items: center; gap: clamp(16px, 3vw, 32px); }
.nav-links a:not(.btn) {
  font-size: 0.9375rem; font-weight: 500; color: var(--mute); text-decoration: none;
  transition: color 0.25s var(--ease);
}
.nav-links a:not(.btn):hover { color: var(--fog); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; min-height: 100dvh;
  display: grid; align-items: center;
  padding-top: calc(var(--nav-h) + 32px); padding-bottom: 48px;
}
.hero-grid {
  display: grid; width: 100%;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}
.hero-title { font-size: clamp(3rem, 7vw, 5.25rem); line-height: 1.02; }
.thesis { display: grid; }
.thesis-ghost, .thesis-fill { grid-area: 1 / 1; }
.thesis-ghost {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(139, 144, 165, 0.55);
}
.thesis-fill { color: var(--fog); }
.hero-sub {
  margin-top: 28px; max-width: 34ch;
  font-size: clamp(1.0625rem, 1.4vw, 1.25rem); color: var(--mute);
}
.hero-cta { margin-top: 32px; }

/* Console: the live timeline the scroll drives */
.console {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(20px, 2.4vw, 30px);
}
.console-caption { font-size: 0.8125rem; font-weight: 500; color: var(--mute); }
.rail { position: relative; height: 64px; margin-top: 18px; }
.rail-line {
  position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: rgba(232, 234, 242, 0.14);
}
.rail-ticks {
  position: absolute; inset: 0; display: flex;
  justify-content: space-between; align-items: center; padding-inline: 9px;
}
.rail-ticks span { width: 1px; height: 9px; background: rgba(91, 140, 255, 0.38); }
.rail-fill {
  position: absolute; left: 0; right: 0; top: calc(50% - 1px);
  height: 2px; background: var(--signal);
  transform: scaleX(1); transform-origin: left center;
}
.orb-track { position: absolute; inset: 0; }
.orb {
  position: absolute; left: 0; top: calc(50% - 9px);
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--signal); box-shadow: 0 0 0 5px rgba(91, 140, 255, 0.16);
}
/* Static truth (no JS, or reduced motion): playhead rests at the end, rail full. */
html:not(.motion) .orb { left: calc(100% - 18px); }
.console-readout {
  display: flex; align-items: baseline; gap: 12px; margin-top: 6px;
}
.play-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.25rem, 3.2vw, 3rem); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.play-unit { font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; color: var(--mute); }
.play-label { font-size: 0.8125rem; color: var(--mute); }

/* ---------- Studio: statement + capabilities ---------- */
.studio { padding-block: clamp(6rem, 14vh, 10rem); }
.statement {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  max-width: 18ch;
}
.statement-body {
  margin-top: 28px; max-width: 58ch;
  font-size: 1.125rem; color: var(--mute);
}
.caps { margin-top: clamp(3.5rem, 7vh, 5.5rem); max-width: 760px; }
.caps-title { font-size: 1.0625rem; font-weight: 600; color: var(--fog); }
.caps-list {
  margin-top: 14px;
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px;
}
.caps-list li { padding-block: 14px; font-weight: 500; font-size: 1rem; }
.caps-list li:nth-child(n+3) { border-top: 1px solid var(--line); }

/* ---------- Method: pinned beats (desktop) ---------- */
.method { background: var(--void); }
.method-inner {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto;
  padding-top: calc(var(--nav-h) + 40px); padding-bottom: 56px;
}
.method-head h2 { font-size: clamp(2.2rem, 4vw, 3.2rem); }
.method-sub { margin-top: 10px; color: var(--mute); font-size: 1.0625rem; }
.beats { align-self: center; }
.beat-word { font-size: clamp(2.75rem, 6vw, 4.5rem); }
.beat-line { margin-top: 18px; max-width: 46ch; font-size: 1.125rem; color: var(--mute); }
.method-foot { display: grid; gap: 14px; }
.method-progress { height: 2px; background: rgba(232, 234, 242, 0.12); }
.method-progress-fill {
  height: 100%; background: var(--signal);
  transform: scaleX(1); transform-origin: left center;
}
.beat-labels {
  display: flex; justify-content: space-between;
  font-size: 0.8125rem; font-weight: 500; color: var(--mute);
  transition: color 0.4s var(--ease);
}
.beat-labels li.active { color: var(--signal); }

/* Stage mode (added by JS on desktop): beats stack in one grid cell and crossfade. */
.stage-mode .beats { display: grid; }
.stage-mode .beat { grid-area: 1 / 1; align-self: center; }
.stage-mode .method-progress-fill { transform: scaleX(0); }

/* ---------- Work: horizontal reel ---------- */
.reel {
  padding-top: calc(var(--nav-h) + 28px);
}
.reel-head {
  padding-bottom: 20px;
}
.reel-head h2 { font-size: clamp(2.2rem, 4vw, 3.2rem); }
.reel-sub { margin-top: 10px; color: var(--mute); font-size: 1.0625rem; }
.reel-viewport {
  min-height: calc(100vh - var(--nav-h) - 120px);
  min-height: calc(100dvh - var(--nav-h) - 120px);
  display: flex; align-items: center;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.reel-viewport::-webkit-scrollbar { display: none; }
.reel-viewport.pan-ready { overflow: hidden; scroll-snap-type: none; }
.reel-track {
  display: flex; align-items: center; gap: clamp(20px, 2.5vw, 32px);
  width: max-content;
  padding-inline: clamp(20px, 4vw, 40px);
  padding-bottom: 28px;
}
.card {
  flex: 0 0 auto; width: min(440px, 82vw);
  scroll-snap-align: center;
  transition: translate 0.35s var(--ease);
}
.card:hover { translate: 0 -6px; }
.card img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--line);
  filter: saturate(0.82) contrast(1.05);
  transition: border-color 0.3s var(--ease);
}
.card:hover img { border-color: rgba(91, 140, 255, 0.55); }
.card-meta { padding-top: 16px; }
.card-meta h3 { font-size: 1.25rem; font-weight: 600; }
.card-meta p { margin-top: 6px; font-size: 0.9375rem; color: var(--mute); }

/* ---------- Close ---------- */
.close { padding-block: clamp(7rem, 16vh, 11rem); }
.close-line { font-size: clamp(2.75rem, 6vw, 4.5rem); }
.close-cta {
  margin-top: 40px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.mail-plain {
  font-weight: 500; color: var(--fog); text-decoration: underline;
  text-decoration-color: var(--ember); text-underline-offset: 6px; text-decoration-thickness: 1.5px;
  transition: color 0.25s var(--ease);
}
.mail-plain:hover { color: var(--ember); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 30px; }
.footer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.brand-word.small { font-family: var(--font-display); font-weight: 700; font-size: 0.9375rem; }
.footer-copy { color: var(--mute); font-size: 0.875rem; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a {
  color: var(--mute); font-size: 0.875rem; font-weight: 500; text-decoration: none;
  transition: color 0.25s var(--ease);
}
.footer-links a:hover { color: var(--fog); }

/* ---------- Reveal + load-in system ----------
   html.motion is set by JS only when GSAP is present and motion is allowed.
   Without it, everything below ships in its final, visible state. */
[data-reveal] { transition: opacity 0.7s var(--ease), translate 0.7s var(--ease); }
html.motion [data-hero-anim] { opacity: 0; }
html.motion [data-reveal] { opacity: 0; translate: 0 28px; }
html.motion [data-reveal].in { opacity: 1; translate: 0 0; }

/* ---------- Responsive collapses ---------- */
@media (min-width: 641px) {
  .br-lg { display: inline; }
}
@media (max-width: 640px) {
  .br-lg { display: none; }
  .caps-list { grid-template-columns: 1fr; }
  .caps-list li + li { border-top: 1px solid var(--line); }
  .caps-list li:nth-child(n+3) { border-top: 0; }
}
@media (max-width: 900px) {
  .hero { align-items: start; padding-top: calc(var(--nav-h) + 40px); }
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .console { max-width: 560px; }
}
@media (max-width: 820px) {
  .method-inner { padding-bottom: 40px; min-height: 0; }
  .beats { display: flex; flex-direction: column; gap: 28px; }
  .beat-labels { font-size: 0.75rem; }
  /* MOT-WORK-01: head stacks above; first card ≥~86vw with snap-start + swipe cue */
  .reel { padding-top: calc(var(--nav-h) + 20px); }
  .reel-head { padding-inline: 20px; padding-bottom: 16px; }
  .reel-sub::after {
    content: " →";
    color: var(--signal);
    font-weight: 600;
  }
  .reel-viewport {
    min-height: 0;
    align-items: stretch;
    padding-bottom: 8px;
  }
  .reel-track {
    padding-inline: 20px;
    gap: 16px;
  }
  .card {
    width: min(440px, 86vw);
    scroll-snap-align: start;
  }
}
@media (max-width: 560px) {
  .brand-word { display: none; }
  .nav-links { gap: 12px; }
  .nav-links a:not(.btn) { font-size: 0.8125rem; }
  .btn { padding: 8px 14px; font-size: 0.8125rem; }
  .footer-row { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* ---------- Reduced motion: no scrub, no pins, no travel. Final states only. ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  html.motion [data-hero-anim],
  html.motion [data-reveal] { opacity: 1 !important; translate: none !important; transform: none !important; }
  .btn:hover, .card:hover { translate: none; }
  .brand:hover .brand-dot { transform: none; }
  html.motion .rail-fill { transform: scaleX(1) !important; }
  html.motion .orb { left: calc(100% - 18px) !important; transform: none !important; }
  html.motion .thesis-fill { clip-path: none !important; }
}
