/* ─────────────────────────────────────────────────────────────
   Character Studio · Landing page
   Design tokens match the Remotion showcase reel (cds_video_intro/theme.ts)
   Parallax: single --scroll custom property, driven by rAF-debounced listener.
   ───────────────────────────────────────────────────────────── */

:root {
  --scroll: 0;

  --bg: #0B0B10;
  --bg-warm: #13121A;
  --panel: #1C1B27;
  --border: #2A2835;

  --text: #F5F3FF;
  --text-sec: #A1A0B3;
  --text-muted: #65636E;

  --accent: #8B7CFF;
  --accent-warm: #FFB56B;
  --accent-cool: #7FD8E8;
  --glow: rgba(139,124,255,0.45);
  --glow-warm: rgba(255,181,107,0.4);

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', var(--font-ui);

  --maxw: 1200px;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #0B0B10; }

a { color: inherit; text-decoration: none; }
img { display: block; }

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

/* ─── Reveal-on-scroll ────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 900ms cubic-bezier(0.16,1,0.3,1),
              transform 900ms cubic-bezier(0.16,1,0.3,1);
  will-change: opacity, transform;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Nav ─────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(11,11,16,0.55);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.nav-brand {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 2.5px;
}
.nav-cta {
  padding: 10px 18px;
  background: var(--accent);
  color: #0B0B10;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139,124,255,0.4);
}

/* ─── Section base ────────────────────────────────────────── */
section {
  position: relative;
  padding: 140px 32px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 62px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-align: center;
  max-width: 900px;
  margin: 0 auto 32px;
}

.section-sub {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 72px;
  color: var(--text-sec);
  font-size: 17px;
  line-height: 1.6;
}

/* ─── HERO ────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 120px 32px 80px;
  overflow: hidden;
  position: relative;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
}

.hero-row-wrap {
  position: absolute;
  left: 0; right: 0;
  white-space: nowrap;
  will-change: transform;
}
.hero-row-wrap.layer-slow {
  top: 6%;
  transform: translate3d(0, calc(var(--scroll) * -0.05px), 0);
}
.hero-row-wrap.layer-med {
  top: 38%;
  transform: translate3d(0, calc(var(--scroll) * -0.15px), 0);
}
.hero-row-wrap.layer-fast {
  top: 70%;
  transform: translate3d(0, calc(var(--scroll) * -0.28px), 0);
}

.hero-row-anim {
  display: inline-flex;
  gap: 18px;
  animation: drift 80s linear infinite;
  will-change: transform;
}
.hero-row-anim.reverse {
  animation-direction: reverse;
  animation-duration: 65s;
}
.hero-row-wrap.layer-fast .hero-row-anim {
  animation-duration: 55s;
}
.hero-row-anim img {
  width: 180px;
  height: 180px;
  border-radius: 18px;
  object-fit: cover;
  filter: blur(0.3px) saturate(1.05);
  border: 1px solid rgba(255,255,255,0.06);
}
@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.hero-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 0%, var(--bg) 75%),
    linear-gradient(180deg, var(--bg) 0%, transparent 18%, transparent 82%, var(--bg) 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 880px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 7px 14px;
  background: rgba(139,124,255,0.12);
  border: 1px solid rgba(139,124,255,0.3);
  border-radius: 40px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 28px;
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 104px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin-bottom: 28px;
}

.hero-sub {
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.55;
  color: var(--text-sec);
  max-width: 600px;
  margin: 0 auto 40px;
}

.waitlist-form {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
}
.waitlist-form input {
  flex: 1;
  padding: 16px 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s, background 0.2s;
}
.waitlist-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.07);
}
.waitlist-form button {
  padding: 16px 24px;
  background: var(--accent);
  color: #0B0B10;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s;
}
.waitlist-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(139,124,255,0.5);
}
.waitlist-form.submitted input { opacity: 0.5; }
.waitlist-form.submitted button { background: #3DD17A; }
.waitlist-form.full input,
.waitlist-form.full button {
  opacity: 0.55;
  cursor: not-allowed;
}
.waitlist-form.full button {
  background: var(--text-muted);
  box-shadow: none;
}
.waitlist-form.full button:hover {
  transform: none;
  box-shadow: none;
}

.hero-note {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-muted);
  opacity: 0.7;
}
.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  animation: scroll-pulse 2.4s ease-in-out infinite;
}
@keyframes scroll-pulse {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ─── UNIVERSE ────────────────────────────────────────────── */
.universe {
  padding-bottom: 40px;
}
.universe-wall {
  position: relative;
  margin-top: 40px;
}
.wall-row {
  overflow: hidden;
  margin-bottom: 16px;
  mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 94%, transparent 100%);
}
.wall-inner {
  display: inline-flex;
  gap: 16px;
  animation: drift 60s linear infinite;
  will-change: transform;
}
.wall-inner.reverse {
  animation-direction: reverse;
  animation-duration: 75s;
}
.wall-row-1 .wall-inner { animation-duration: 52s; }
.wall-row-2 .wall-inner { animation-duration: 68s; }
.wall-row-3 .wall-inner { animation-duration: 60s; }
.wall-row-4 .wall-inner { animation-duration: 80s; }

.wall-inner img {
  width: 180px;
  height: 180px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.4s;
}
.wall-inner img:hover {
  transform: scale(1.04);
  border-color: var(--accent);
}

/* Pause animation when section is off-screen (set by JS) */
.wall-inner[data-paused="true"] { animation-play-state: paused; }
.hero-row-anim[data-paused="true"] { animation-play-state: paused; }

/* ─── STEPS ───────────────────────────────────────────────── */
.steps {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-warm) 50%, var(--bg) 100%);
}
.steps-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.step {
  padding: 40px 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  position: relative;
  transition: transform 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.step:hover {
  transform: translateY(-6px);
  border-color: rgba(139,124,255,0.35);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 40px rgba(139,124,255,0.12);
}
.step-number {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 16px;
}
.step h3 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.step p {
  color: var(--text-sec);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 28px;
}
.step-visual {
  height: 100px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Step 1 — DNA strands */
.step-visual.dna { gap: 8px; }
.dna-strand {
  width: 4px;
  height: 60px;
  background: linear-gradient(180deg, var(--accent-warm), var(--accent), var(--accent-cool));
  border-radius: 2px;
  animation: dna-pulse 2.2s ease-in-out infinite;
}
.dna-strand.delay-1 { animation-delay: 0.3s; }
.dna-strand.delay-2 { animation-delay: 0.6s; }
@keyframes dna-pulse {
  0%, 100% { transform: scaleY(1); opacity: 0.7; }
  50% { transform: scaleY(1.3); opacity: 1; }
}

/* Step 2 — generate grid */
.step-visual.grid {
  display: grid;
  grid-template-columns: repeat(3, 18px);
  gap: 6px;
  padding: 14px;
  justify-content: center;
  align-content: center;
}
.step-visual.grid span {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-cool));
  animation: grid-pop 2.4s ease-in-out infinite;
}
.step-visual.grid span:nth-child(1) { animation-delay: 0.0s; }
.step-visual.grid span:nth-child(2) { animation-delay: 0.1s; }
.step-visual.grid span:nth-child(3) { animation-delay: 0.2s; }
.step-visual.grid span:nth-child(4) { animation-delay: 0.3s; }
.step-visual.grid span:nth-child(5) { animation-delay: 0.4s; }
.step-visual.grid span:nth-child(6) { animation-delay: 0.5s; }
.step-visual.grid span:nth-child(7) { animation-delay: 0.6s; }
.step-visual.grid span:nth-child(8) { animation-delay: 0.7s; }
.step-visual.grid span:nth-child(9) { animation-delay: 0.8s; }
@keyframes grid-pop {
  0%, 100% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* Step 3 — deploy rings */
.step-visual.deploy { position: relative; }
.deploy-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px var(--glow);
  position: relative;
  z-index: 2;
}
.deploy-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 30px; height: 30px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: deploy-pulse 2.6s ease-out infinite;
}
.deploy-ring.r2 { animation-delay: 0.9s; }
.deploy-ring.r3 { animation-delay: 1.8s; }
@keyframes deploy-pulse {
  0% { width: 30px; height: 30px; opacity: 0.8; }
  100% { width: 90px; height: 90px; opacity: 0; }
}

/* ─── WIDGET (call with character) ───────────────────────── */
.widget-section {
  padding-bottom: 160px;
  overflow: hidden;
}
.widget-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(139,124,255,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(127,216,232,0.08) 0%, transparent 50%);
  pointer-events: none;
  transform: translate3d(0, calc(var(--scroll) * -0.08px), 0);
}
.widget-container {
  position: relative;
  width: 420px;
  max-width: 90vw;
  aspect-ratio: 1;
  margin: 0 auto 32px;
}
.widget-halo {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 65%);
  animation: halo-pulse 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes halo-pulse {
  0%, 100% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 1; }
}
.widget-portrait {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(139,124,255,0.35);
  box-shadow: 0 30px 60px rgba(0,0,0,0.7), 0 0 80px var(--glow);
}
.widget-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.widget-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ─── FAQ ────────────────────────────────────────────────── */
.faq {
  background: var(--bg-warm);
}
.faq-list {
  max-width: 780px;
  margin: 0 auto;
}
.faq-item {
  padding: 24px 28px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.faq-item[open] {
  border-color: rgba(139,124,255,0.35);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  color: var(--accent);
  font-size: 22px;
  font-weight: 300;
  transition: transform 0.3s;
  margin-left: 16px;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
}
.faq-item p {
  margin-top: 14px;
  color: var(--text-sec);
  font-size: 15px;
  line-height: 1.65;
}

/* ─── FINAL CTA ──────────────────────────────────────────── */
.cta {
  padding: 160px 32px;
  overflow: hidden;
}
.cta-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cta-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(24px) saturate(1.2) brightness(0.55);
  transform: translate3d(0, calc(var(--scroll) * -0.12px), 0) scale(1.1);
  will-change: transform;
}
.cta-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 0%, rgba(11,11,16,0.8) 70%),
    linear-gradient(180deg, var(--bg) 0%, transparent 20%, transparent 80%, var(--bg) 100%);
}
.cta-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}
.cta-badge {
  display: inline-block;
  padding: 7px 14px;
  background: rgba(139,124,255,0.15);
  border: 1px solid rgba(139,124,255,0.4);
  border-radius: 40px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 28px;
}
.cta h2 {
  font-family: var(--font-display);
  font-size: clamp(44px, 6vw, 80px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 20px;
}
.cta p {
  font-size: 18px;
  color: var(--text-sec);
  margin-bottom: 36px;
}
.cta-note {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Footer ─────────────────────────────────────────────── */
.footer {
  padding: 48px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-brand {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 2.5px;
  color: var(--text-sec);
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-sec); transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 780px) {
  .nav { padding: 0 20px; }
  section { padding: 100px 20px; }

  .hero-row-anim img,
  .wall-inner img {
    width: 120px;
    height: 120px;
    border-radius: 12px;
  }

  .waitlist-form {
    flex-direction: column;
    gap: 10px;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .widget-container {
    width: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
