/* ============================================
   1. RESET & BASE
   ============================================ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 120px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ============================================
   2. CUSTOM PROPERTIES
   ============================================ */

:root {
  /* Background layers */
  --bg-primary:    #0a0a0f;
  --bg-secondary:  #111118;
  --bg-elevated:   #1a1a24;
  --bg-cta:        #0d0d14;

  /* Text */
  --text-primary:    #f0f0f5;
  --text-secondary:  #a0a0b0;
  --text-muted:      #6a6a7a;

  /* Accent */
  --accent:          #3b82f6;
  --accent-hover:    #2563eb;
  --accent-glow:     rgba(59, 130, 246, 0.15);
  --accent-subtle:   rgba(59, 130, 246, 0.08);
  --accent-green:    #10b981;

  /* Borders */
  --border:          rgba(255, 255, 255, 0.06);
  --border-card:     rgba(255, 255, 255, 0.08);
  --border-hover:    rgba(59, 130, 246, 0.3);

  /* Shadows */
  --shadow-card:     0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow:     0 0 40px var(--accent-glow);

  /* Typography */
  --font-heading:  'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body:     'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, monospace;

  /* Type scale */
  --text-hero:    clamp(2.5rem, 5vw, 4.5rem);
  --text-h2:      clamp(1.75rem, 3.5vw, 3rem);
  --text-h2-large: clamp(2.25rem, 4.5vw, 4rem);
  --text-h3:      clamp(1.25rem, 2vw, 1.75rem);
  --text-body:    clamp(1rem, 1.2vw, 1.125rem);
  --text-small:   0.875rem;
  --text-stat:    clamp(2.5rem, 5vw, 4rem);

  /* Spacing */
  --section-padding: clamp(4rem, 8vw, 8rem);
  --container-max: 1200px;
  --container-narrow: 800px;
}

/* ============================================
   3. GLOBAL STYLES
   ============================================ */

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-h2);
}

h3 {
  font-size: var(--text-h3);
  margin-bottom: 0.75rem;
}

p {
  color: var(--text-secondary);
}

p + p {
  margin-top: 1.25rem;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding: var(--section-padding) 0;
  position: relative;
}

.section--alt {
  background: var(--bg-secondary);
}

.section-headline {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  text-align: center;
}

.section-headline--large {
  font-size: var(--text-h2-large);
}

.section-body {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
}

.section-label {
  display: block;
  text-transform: uppercase;
  font-size: var(--text-small);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
  text-align: center;
}

.section-subtitle {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 2.5rem;
  font-family: var(--font-heading);
  font-weight: 500;
}

/* ============================================
   4. UTILITY CLASSES
   ============================================ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ============================================
   5. ANIMATION CLASSES
   ============================================ */

.animate-on-scroll,
.animate-on-load {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out, filter 0.7s ease-out;
}

.animate-on-load {
  filter: blur(4px);
}

.animate-on-scroll.visible,
.animate-on-load.visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.stagger-1 { transition-delay: 0ms; }
.stagger-2 { transition-delay: 150ms; }
.stagger-3 { transition-delay: 300ms; }
.stagger-4 { transition-delay: 450ms; }

@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll,
  .animate-on-load {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}

/* ============================================
   6. COMPONENTS
   ============================================ */

/* --- 6a. Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-card);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  background: var(--accent-subtle);
}

.btn-small {
  padding: 0.5rem 1.25rem;
  font-size: var(--text-small);
}

/* --- 6b. Cards --- */

.card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

.card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  color: var(--accent);
}

.card h3 {
  color: var(--text-primary);
}

.card-label {
  display: inline-block;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.card-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.card-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.card--accent {
  border-left: 3px solid var(--accent);
  background: rgba(59, 130, 246, 0.04);
  box-shadow: inset 0 0 40px rgba(59, 130, 246, 0.03);
}

.card--accent h3 {
  color: var(--accent);
  margin-bottom: 1rem;
}

/* --- 6c. Nav --- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 0;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}

.nav--scrolled {
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
  padding: 0.75rem 0;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
}

.nav-logo-img {
  height: 36px;
  max-height: 36px;
  width: auto;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a:not(.btn) {
  color: var(--text-secondary);
  font-size: var(--text-small);
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a:not(.btn):hover {
  color: var(--text-primary);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- 6d. FAQ --- */

.faq-list {
  margin-top: 2.5rem;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:first-child {
  border-top: 1px solid var(--border);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.5rem 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.faq-question:hover {
  color: var(--accent);
}

.faq-chevron {
  flex-shrink: 0;
  margin-left: 1rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.faq-item--open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-answer p {
  padding-bottom: 1.5rem;
}

/* --- 6e. Waitlist Form --- */

.waitlist-form-wrapper {
  text-align: center;
}

.waitlist-form {
  margin-top: 2rem;
}

.form-group {
  display: flex;
  gap: 0.75rem;
  max-width: 500px;
  margin: 0 auto;
}

.form-group input[type="email"] {
  flex: 1;
  padding: 0.875rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="email"]::placeholder {
  color: var(--text-muted);
}

.form-group input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group .btn {
  white-space: nowrap;
}

.form-error {
  margin: 0.75rem auto 0;
  max-width: 500px;
  font-size: var(--text-small);
  color: #ef4444;
}

.form-microcopy {
  margin-top: 1rem;
  font-size: var(--text-small);
  color: var(--text-muted);
}

.form-success {
  padding: 1.5rem;
  color: var(--accent-green);
  font-weight: 500;
  font-size: 1.125rem;
}

/* --- 6f. Pipeline --- */

.pipeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-top: 3rem;
}

.pipeline-step {
  flex: 1;
  text-align: center;
  padding: 1.5rem;
  position: relative;
}

.pipeline-number {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--accent);
  opacity: 0.3;
  margin-bottom: 1rem;
  line-height: 1;
}

.pipeline-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  margin: 0 auto 1.25rem;
  color: var(--accent);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pipeline-step:hover .pipeline-icon {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.pipeline-step h3 {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.pipeline-step p {
  font-size: var(--text-small);
  line-height: 1.6;
}

.pipeline-connector {
  width: 40px;
  min-width: 40px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin-top: 5.5rem;
  opacity: 0.4;
  transform: scaleX(0);
  transition: transform 0.5s ease-out;
}

.pipeline-connector.visible {
  transform: scaleX(1);
}

.technical-note {
  margin-top: 3rem;
  padding: 1.25rem 1.5rem;
  background: var(--accent-subtle);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  font-size: var(--text-small);
  text-align: center;
}

/* --- 6g. Stats --- */

.card--stat {
  text-align: center;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: var(--text-stat);
  font-weight: 700;
  color: var(--accent-green);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem;
  color: var(--accent);
}

/* --- 6h. Badge / Not-For --- */

.not-for {
  margin-top: 2rem;
  padding: 1.5rem 2rem;
  border-left: 3px solid var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 10px 10px 0;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

/* --- 6i. Section CTA --- */

.section-cta {
  text-align: center;
  margin-top: 3rem;
}

.section-cta p {
  margin-bottom: 1.25rem;
  font-size: 1.125rem;
}

/* --- 6j. Pull Quote --- */

.pull-quote {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
  padding: 1rem 0 1rem 1.5rem;
  margin: 2rem 0;
}

/* ============================================
   7. SECTION-SPECIFIC STYLES
   ============================================ */

/* --- 7a. Hero --- */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  padding-top: 5rem;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-headline {
  font-size: var(--text-hero);
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.hero-subheadline {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  max-width: 680px;
  margin: 0 auto 2.5rem;
  line-height: 1.8;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Hero media — product video frame */
.hero-media {
  position: relative;
  max-width: 900px;
  margin: 3rem auto 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  /* Reserve a 16/9 frame so there is zero CLS while the video loads */
  aspect-ratio: 16 / 9;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mute/unmute toggle — overlaid bottom-right of the hero video.
   Wired by initHeroVideo() in js/main.js. */
.hero-sound {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-sound:hover { background: rgba(0, 0, 0, 0.78); }
.hero-sound:active { transform: scale(0.94); }
.hero-sound:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hero-sound svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* Show the muted icon by default; swap to the sound icon once unmuted. */
.hero-sound .icon-sound { display: none; }
.hero-sound.is-unmuted .icon-muted { display: none; }
.hero-sound.is-unmuted .icon-sound { display: block; }

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 50%, var(--bg-secondary) 0%, var(--bg-primary) 70%),
    radial-gradient(1px 1px at 20% 30%, rgba(59, 130, 246, 0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 70%, rgba(59, 130, 246, 0.1) 0%, transparent 100%);
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* --- 7b. Solution --- */

.solution-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.solution-body {
  max-width: 800px;
  margin: 0 auto 2.5rem;
}

.differentiator {
  max-width: 800px;
  margin: 0 auto;
}

/* --- 7c. Section CTA (Final) --- */

.section--cta {
  background: var(--bg-cta);
  position: relative;
  overflow: hidden;
}

.section--cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 60%);
  pointer-events: none;
}

.section--cta .section-headline {
  position: relative;
}

.section--cta .section-body {
  position: relative;
}

.section--cta .waitlist-form-wrapper {
  position: relative;
}

/* --- 7d. About --- */

.about-body {
  line-height: 1.9;
}

.about-body p {
  color: var(--text-secondary);
}

/* --- 7e. Footer --- */

.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-logo {
  display: flex;
  align-items: center;
}

.footer-logo-img {
  height: 28px;
  max-height: 28px;
  width: auto;
  object-fit: contain;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: var(--text-small);
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text-secondary);
}

.footer-copyright p {
  font-size: var(--text-small);
  color: var(--text-muted);
}

/* ============================================
   8. RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .card-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-grid--3 .card:last-child {
    grid-column: 1 / -1;
    max-width: 50%;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.5rem 2rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links a:not(.btn) {
    font-size: 1rem;
    padding: 0.5rem 0;
  }

  .nav-links .btn {
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
  }

  .nav-toggle {
    display: flex;
  }

  .hero {
    min-height: 90vh;
    padding-top: 5rem;
  }

  .hero-headline {
    font-size: clamp(2rem, 6vw, 3rem);
  }

  .card-grid--2,
  .card-grid--3 {
    grid-template-columns: 1fr;
  }

  .card-grid--3 .card:last-child {
    max-width: 100%;
  }

  /* Pipeline: vertical layout */
  .pipeline {
    flex-direction: column;
    align-items: stretch;
    padding-left: 2rem;
    position: relative;
  }

  .pipeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--accent), transparent);
    opacity: 0.2;
  }

  .pipeline-step {
    text-align: left;
    padding: 1.5rem 0;
    position: relative;
  }

  .pipeline-step::before {
    content: '';
    position: absolute;
    left: -2.4rem;
    top: 2.5rem;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-glow);
  }

  .pipeline-icon {
    margin: 0 0 1rem;
  }

  .pipeline-connector {
    display: none;
  }

  .pipeline-number {
    font-size: 1.75rem;
  }

  /* Form stacked */
  .form-group {
    flex-direction: column;
  }

  .form-group .btn {
    width: 100%;
  }

  /* Footer stacked */
  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1.25rem;
  }

  .section {
    padding: clamp(3rem, 6vw, 4rem) 0;
  }

  .card {
    padding: 1.5rem;
  }

  .hero-ctas {
    flex-direction: column;
    align-items: center;
  }

  .hero-ctas .btn {
    width: 100%;
    max-width: 300px;
  }

  .form-group {
    flex-direction: column;
  }
}

@media (min-width: 1400px) {
  :root {
    --container-max: 1280px;
  }
}
