/* ============================================
   Larry Motion Site — larry.css

   Two rendering modes:
   1. Default (no html.js): stacked full-height sections
      over keyframe stills. Used for no-JS, reduced
      motion, and GSAP CDN failure.
   2. html.js: fixed stage + scroll driver. GSAP owns
      beat opacity; nothing translates on scroll.
   ============================================ */

:root {
  --teal: #06B9C1;
  --teal-dark: #048a90;
  --cream: #FFF8E7;
  --night: #0a0e1a;
  --text-light: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.78);
  --text-faint: rgba(255, 255, 255, 0.5);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --vh100: 100vh;
}

@supports (height: 100svh) {
  :root { --vh100: 100svh; }
}

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

body {
  font-family: var(--font-body);
  background: var(--night);
  color: var(--text-light);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Mode 1 — stacked sections (default / fallback)
   ============================================ */

#video-canvas,
#static-fallback,
#overlay,
.beat-dots,
.scroll-driver {
  display: none;
}

.beat-layer {
  position: relative;
  min-height: var(--vh100);
  display: flex;
  padding: 4rem 2rem;
  background-size: cover;
  background-position: center;
}

.beat-inner {
  max-width: 720px;
  width: 100%;
  margin: auto;
  text-align: center;
}

/* Keyframe stills + readability scrim per beat — Mode 1 (no-JS) only.
   These are ID selectors, which always beat the html.js .beat-layer
   override below on specificity regardless of source order, so they
   MUST be scoped out of motion mode or they paint over the scrubbing
   canvas: each stays opaque for a beat's whole active span, hiding the
   canvas the entire time except during the beat-to-beat opacity
   crossfade, which reads as a "4 keyframes + onion-skin" stop-motion. */
html:not(.js) #hero { background-image: linear-gradient(rgba(10,14,26,.25), rgba(10,14,26,.45)), url('/assets/frames/key-day.webp'); }
html:not(.js) #how  { background-image: linear-gradient(rgba(10,14,26,.4),  rgba(10,14,26,.55)), url('/assets/frames/key-sunset.webp'); }
html:not(.js) #why  { background-image: linear-gradient(rgba(10,14,26,.45), rgba(10,14,26,.6)),  url('/assets/frames/key-dusk.webp'); }
html:not(.js) #join { background-image: linear-gradient(rgba(10,14,26,.5),  rgba(10,14,26,.65)), url('/assets/frames/key-night.webp'); }

/* ============================================
   Mode 2 — fixed stage (html.js)
   ============================================ */

html.js .stage {
  position: fixed;
  inset: 0;
  z-index: 0;
}

html.js #video-canvas {
  display: block;
  position: absolute;
  inset: 0;
}

html.js #static-fallback {
  position: absolute;
  inset: 0;
}

html.js #static-fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

html.js #overlay {
  display: block;
  position: absolute;
  inset: 0;
  /* Light vignette only — GSAP nudges 0.35 → 0.6 across the scroll.
     (It used to reach 0.92, which buried the night video under black;
     text readability now comes from text-shadow, not from darkening
     the motion that is the whole point of the site.) */
  opacity: 0.35;
  background: linear-gradient(
    180deg,
    rgba(10, 14, 26, 0.35) 0%,
    rgba(10, 14, 26, 0.45) 55%,
    rgba(10, 14, 26, 0.65) 100%
  );
  pointer-events: none;
}

/* Beat text switches on a hard, lag-free cut tied directly to which beat
   is nearest (no scroll-scrubbed opacity tween): a scrubbed crossfade
   trails the actual scroll position by its scrub-smoothing time, and at
   real scroll speed that lag reads as the previous beat's text lingering,
   semi-visible, well past when it should be gone. A short REAL-TIME (not
   scroll-linked) CSS transition can't desync from scroll position no
   matter how fast you scroll — worst case it's ~0.2s behind wall-clock
   time, not "10-20 frames" behind scroll input. */
/* Text is its own animation layer, fully independent of the scrubbed
   background: entrances are REAL-TIME CSS transitions (wall-clock), so
   they can never trail scroll position the way scrub-linked opacity did.
   Exit is fast (0.15s) so the outgoing beat is gone almost immediately;
   entrance is a staggered rise-and-fade. */
html.js .beat-layer {
  position: absolute;
  inset: 0;
  min-height: 0;
  overflow-y: auto;          /* safety valve if a beat outgrows a small screen */
  background-image: none;    /* canvas is the background */
  pointer-events: none;      /* only the active beat is interactive */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

html.js .beat-layer.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease, visibility 0s linear 0s;
}

/* Readability comes from text treatment, not from blacking out the video */
html.js .beat-inner {
  text-shadow: 0 2px 18px rgba(10, 14, 26, 0.65), 0 1px 4px rgba(10, 14, 26, 0.5);
}

/* Staggered entrance for each beat's content blocks */
html.js .beat-inner > *:not(.scroll-indicator) {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

html.js .active .beat-inner > *:not(.scroll-indicator) {
  opacity: 1;
  transform: none;
}

html.js .active .beat-inner > *:nth-child(1) { transition-delay: 0.05s; }
html.js .active .beat-inner > *:nth-child(2) { transition-delay: 0.14s; }
html.js .active .beat-inner > *:nth-child(3) { transition-delay: 0.23s; }
html.js .active .beat-inner > *:nth-child(4) { transition-delay: 0.32s; }
html.js .active .beat-inner > *:nth-child(5) { transition-delay: 0.41s; }
html.js .active .beat-inner > *:nth-child(6) { transition-delay: 0.5s; }

/* The three why-lines land one by one (they share a single parent block) */
html.js .why-line {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
html.js .active .why-line { opacity: 1; transform: none; }
html.js .active .why-line:nth-child(1) { transition-delay: 0.1s; }
html.js .active .why-line:nth-child(2) { transition-delay: 0.24s; }
html.js .active .why-line:nth-child(3) { transition-delay: 0.38s; }

html.js .scroll-driver {
  display: block;
  height: 500vh;
}

/* Bookmark dots */
html.js .beat-dots {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: fixed;
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

html.js .beat-dots a {
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
  text-decoration: none;
}

html.js .beat-dots a:hover { background: rgba(255, 255, 255, 0.7); }

html.js .beat-dots a.active {
  background: var(--teal);
  transform: scale(1.35);
}

/* ============================================
   Chrome: logo + sticky CTA
   ============================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.4rem;
  z-index: 30;
  pointer-events: none;
}

.site-header .logo,
.site-header .cta-mini {
  pointer-events: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cta-mini {
  font-size: 0.9rem;
  padding: 0.6rem 1.4rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
}

.cta-mini.visible {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   Beat 1: Hero
   ============================================ */

#hero .beat-inner {
  max-width: 800px;
}

.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

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

.hero-differentiators {
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 2.5rem;
}

.hero-differentiators strong {
  color: var(--text-light);
  font-weight: 600;
}

.cta-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.cta-primary {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem 2.5rem;
  border: none;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  letter-spacing: 0.01em;
}

.cta-primary:hover {
  background: var(--teal-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(6, 185, 193, 0.4);
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.scroll-indicator span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-faint);
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(180deg, var(--text-faint), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(1); }
  50% { opacity: 0.8; transform: scaleY(1.2); }
}

/* ============================================
   Beat 2: How It Works
   ============================================ */

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  margin-bottom: 2rem;
}

/* Visually hidden, available to screen readers and crawlers */
.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;
}

.beat-story {
  max-width: 440px;
  text-align: left;
}

.beat-story .eyebrow {
  text-align: center;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

/* Storybook lines, not SaaS cards */
.step {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}

.step-num {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--teal);
  min-width: 1.1em;
  text-align: right;
}

.step-text {
  font-size: 1.05rem;
  color: var(--text-light);
  line-height: 1.45;
}

/* Larry's real voice — the "show me" moment */
.voice-exchange {
  padding-left: 2rem;
}

.ve-child {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.ve-larry {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--cream);
}

/* ============================================
   Beat 3: Why It's Different — three lines, no cards
   ============================================ */

.why-line {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0.5rem 0;
}

/* ============================================
   Beat 4: Join Us
   ============================================ */

.final-beat {
  max-width: 500px;
}

.final-heading {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.final-subhead {
  font-size: 1.1rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 2rem;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Mode pills: backer / updates / investor, all upfront */
.form-modes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.mode-pill {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.mode-pill:hover {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--text-light);
}

.mode-pill.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.mode-note {
  font-size: 0.85rem;
  color: var(--text-faint);
  line-height: 1.45;
  min-height: 2.5em; /* both notes fit without the form jumping */
  margin-bottom: 0.25rem;
}

.form-field input {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-field input::placeholder {
  color: var(--text-faint);
}

.form-field input:focus {
  border-color: var(--teal);
}

.signup-form .cf-turnstile {
  margin: 0 auto;
}

.cta-submit {
  width: 100%;
  margin-top: 0.5rem;
}

.form-message {
  padding: 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  margin-top: 1rem;
}

.form-message.success {
  background: rgba(6, 185, 193, 0.15);
  border: 1px solid var(--teal);
  color: var(--teal);
}

.form-message.error {
  background: rgba(255, 100, 100, 0.15);
  border: 1px solid rgba(255, 100, 100, 0.4);
  color: rgba(255, 150, 150, 1);
}

/* Footer */
.site-footer {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  font-size: 0.8rem;
}

.footer-link {
  color: var(--teal);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--teal-dark);
}

.footer-copy {
  color: var(--text-faint);
}

/* ============================================
   Mobile
   ============================================ */

@media (max-width: 768px) {
  html.js .scroll-driver { height: 420vh; }

  html.js .beat-dots { right: 0.8rem; gap: 0.8rem; }

  .beat-layer {
    padding: 3rem 1.25rem;
  }

  .site-header { padding: 0.8rem 1rem; }
  .cta-mini { font-size: 0.8rem; padding: 0.5rem 1.1rem; }
  .logo-icon { width: 40px; height: 40px; border-radius: 10px; }
  .logo-text { font-size: 1.1rem; }

  .steps { gap: 0.6rem; margin-bottom: 1.25rem; }
  .step-text { font-size: 1rem; }

  .voice-exchange { padding-left: 1.25rem; }
  .ve-larry { font-size: 1.05rem; }

  .final-beat {
    max-width: 100%;
  }

  /* Full white text for readability on mobile */
  .hero-differentiators,
  .step-text,
  .final-subhead {
    color: #ffffff;
  }
}

/* ============================================
   Reduced Motion (belt-and-braces; JS also drops html.js)
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .scroll-indicator { display: none; }

  * {
    animation: none !important;
    transition: none !important;
  }
}
