/* ===== Design Tokens ===== */
:root {
  /* Backgrounds (depth progression) */
  --ocean-abyss:    #060E1A;
  --ocean-deep:     #0B1628;
  --ocean-mid:      #162A4A;
  --ocean-surface:  #1E3A5F;
  --ocean-shallow:  #2A4A6B;
  --ocean-foam:     #3D6B8E;

  /* Accent */
  --beam-gold:      #F5A623;
  --beam-gold-dim:  rgba(245, 166, 35, 0.3);
  --beam-gold-glow: rgba(245, 166, 35, 0.15);

  /* Text */
  --text-primary:   #E8ECF1;
  --text-secondary: #8B9BB4;
  --text-muted:     #5A6A80;

  /* Status */
  --status-healthy: #4ECDC4;
  --status-warning: #F5A623;
  --status-error:   #FF6B6B;
  --status-info:    #5B9BD5;

  /* Fonts */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Source Sans 3', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
}

/* ===== Keyframes ===== */
@keyframes beam-sweep {
  0%   { opacity: 0; transform: translateX(-100%); }
  50%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(100%); }
}

@keyframes beam-pulse {
  0%, 100% { opacity: 0.85; box-shadow: 0 0 8px var(--beam-gold-dim); }
  50%      { opacity: 1; box-shadow: 0 0 20px var(--beam-gold-dim), 0 0 40px var(--beam-gold-glow); }
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bounce-down {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

@keyframes conductor-dash {
  to { stroke-dashoffset: -20; }
}

@keyframes node-breathe {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

@keyframes terminal-reveal {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:focus-visible {
  outline: 2px solid var(--beam-gold);
  outline-offset: 2px;
}

.cta-btn-link:focus-visible {
  outline-offset: 4px;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--ocean-abyss);
  overflow-x: hidden;
}

/* ===== Reveal Animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal.visible .stagger:nth-child(1) { transition-delay: 0ms; }
.reveal.visible .stagger:nth-child(2) { transition-delay: 100ms; }
.reveal.visible .stagger:nth-child(3) { transition-delay: 200ms; }
.reveal.visible .stagger:nth-child(4) { transition-delay: 300ms; }
.reveal.visible .stagger:nth-child(5) { transition-delay: 400ms; }
.reveal.visible .stagger:nth-child(6) { transition-delay: 500ms; }

.stagger {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.reveal.visible .stagger {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Section base ===== */
section {
  padding: 120px 80px;
  position: relative;
}

/* ===== 1. Hero ===== */
#hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--ocean-abyss);
  position: relative;
  overflow: hidden;
  padding: 80px;
}

#hero-graph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

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

.hero-headline {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 400;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero-headline::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--beam-gold-glow), transparent);
  animation: beam-sweep 2s ease-in-out forwards;
  pointer-events: none;
}

.hero-subhead {
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
}

/* CTA Button Link */
.cta-btn-link {
  display: inline-block;
  background: var(--beam-gold);
  color: var(--ocean-abyss);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  height: 48px;
  line-height: 48px;
  padding: 0 32px;
  border-radius: 6px;
  text-decoration: none;
  animation: beam-pulse 3s ease-in-out infinite;
  transition: box-shadow var(--transition-fast);
}

.cta-btn-link:hover {
  animation-play-state: paused;
  box-shadow: 0 0 24px var(--beam-gold-dim);
}

.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  animation: bounce-down 2s ease-in-out infinite;
  z-index: 1;
  transition: opacity 0.4s ease;
}

.scroll-indicator svg {
  width: 24px;
  height: 24px;
}

/* ===== 2. Blind Spot ===== */
#blind-spot {
  background: linear-gradient(180deg, var(--ocean-abyss), var(--ocean-deep));
}

.section-headline {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 56px;
}

/* ===== 3. Thesis ===== */
#thesis {
  background: var(--ocean-deep);
  position: relative;
  overflow: hidden;
}

/* Topographic background — SVG contour lines */
.thesis-topo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.06;
  pointer-events: none;
}

.thesis-content {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
}

.thesis-content p {
  margin-bottom: 48px;
  color: var(--text-primary);
}

.thesis-content p:last-child {
  margin-bottom: 0;
}

.pull-quote {
  border-left: 3px solid var(--beam-gold);
  background: var(--beam-gold-glow);
  padding: 24px 24px 24px 24px;
  margin: 48px 0;
  font-style: italic;
  font-size: 22px;
  line-height: 1.5;
  color: var(--text-primary);
  border-radius: 0 6px 6px 0;
}

/* ===== 4. Four Quadrants ===== */
.quadrant-diagram {
  max-width: 500px;
  margin: 0 auto 48px;
}

.quadrant-diagram svg {
  width: 100%;
  height: auto;
}

.quadrant-box {
  fill: var(--ocean-mid);
  stroke: var(--ocean-surface);
  stroke-width: 1;
}

.quadrant-label {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: var(--text-primary);
  text-anchor: middle;
  dominant-baseline: central;
}

.quadrant-line {
  stroke: var(--beam-gold);
  stroke-width: 1.5;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  transition: stroke-dashoffset 1.5s ease-out;
}

.quadrant-diagram.visible .quadrant-line {
  stroke-dashoffset: 0;
}

.quadrant-diagram.visible .quadrant-line:nth-child(2) { transition-delay: 200ms; }
.quadrant-diagram.visible .quadrant-line:nth-child(3) { transition-delay: 400ms; }
.quadrant-diagram.visible .quadrant-line:nth-child(4) { transition-delay: 600ms; }

.quadrant-center {
  font-family: var(--font-display);
  font-size: 18px;
  fill: var(--beam-gold);
  text-anchor: middle;
  dominant-baseline: central;
  opacity: 0;
  transition: opacity 0.6s ease-out 1s;
}

.quadrant-diagram.visible .quadrant-center {
  opacity: 1;
}

.quadrant-glow {
  fill: var(--beam-gold-glow);
  filter: blur(12px);
  opacity: 0;
  transition: opacity 0.6s ease-out 1s;
}

.quadrant-diagram.visible .quadrant-glow {
  opacity: 1;
}

.quadrant-body {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.quadrant-body p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.quadrant-body p:last-child {
  margin-bottom: 0;
}

.quadrant-body strong {
  color: var(--text-primary);
}

/* ===== Quadrant list ===== */
.quadrant-list {
  list-style: none;
  max-width: 680px;
  margin: 0 auto 40px;
  text-align: left;
}

.quadrant-list li {
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-left: 8px;
  font-size: 17px;
  line-height: 1.55;
}

.quadrant-list li strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
}

/* ===== 5. Features ===== */
.feature-section {
  padding: 100px 80px;
}

.feature-section:nth-child(odd) {
  background: var(--ocean-deep);
}

.feature-section:nth-child(even) {
  background: var(--ocean-abyss);
}

.feature-grid {
  display: grid;
  grid-template-columns: 55% 45%;
  gap: 48px;
  max-width: 1000px;
  margin: 0 auto;
  align-items: center;
}

.feature-grid.reverse {
  grid-template-columns: 45% 55%;
}

.feature-grid.reverse .feature-copy {
  order: -1;
}

.feature-copy {
  border-left: 2px solid var(--beam-gold);
  padding-left: 24px;
}

.feature-tagline {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.feature-copy p {
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.6;
}

/* Feature illustrations */
.feature-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-visual svg {
  width: 100%;
  max-width: 400px;
  height: auto;
}

/* Terminal mockup */
.terminal-mock {
  background: var(--ocean-mid);
  border: 1px solid var(--ocean-surface);
  border-radius: 8px;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  width: 100%;
  max-width: 400px;
  overflow-x: auto;
}

.terminal-mock > div {
  white-space: nowrap;
}

.terminal-mock .prompt {
  color: var(--beam-gold);
}

.terminal-mock .success {
  color: var(--status-healthy);
}

.terminal-mock .warning {
  color: var(--status-warning);
}

.terminal-mock .error-text {
  color: var(--status-error);
}

/* Reverse engineering split */
.reverse-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 400px;
}

.reverse-col {
  background: var(--ocean-mid);
  border: 1px solid var(--ocean-surface);
  border-radius: 6px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
}

.reverse-col h4 {
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.reverse-col .code-line {
  color: var(--text-muted);
}

.reverse-col .feature-line {
  color: var(--text-primary);
}

.reverse-col .confidence {
  color: var(--status-healthy);
  float: right;
}

/* Traceability columns */
.trace-visual {
  width: 100%;
  max-width: 400px;
}

.trace-visual svg {
  width: 100%;
  height: auto;
}

/* Health mini dashboard */
.health-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 360px;
}

.health-card {
  background: var(--ocean-mid);
  border: 1px solid var(--ocean-surface);
  border-radius: 6px;
  padding: 12px;
}

.health-card .label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.health-card .score {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
}

.health-card .score.healthy { color: var(--status-healthy); }
.health-card .score.warning { color: var(--status-warning); }
.health-card .score.error   { color: var(--status-error); }

.health-card .sparkline {
  margin-top: 6px;
  height: 20px;
}

/* Conductor loop */
.conductor-visual {
  width: 100%;
  max-width: 340px;
}

.conductor-visual svg {
  width: 100%;
  height: auto;
}

.conductor-visual .loop-path {
  stroke: var(--beam-gold);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 8 6;
  animation: conductor-dash 1.5s linear infinite;
}

.conductor-visual .loop-label {
  font-family: var(--font-mono);
  font-size: 12px;
  fill: var(--text-primary);
  text-anchor: middle;
}

.conductor-visual .loop-node {
  fill: var(--ocean-mid);
  stroke: var(--beam-gold);
  stroke-width: 1.5;
  animation: node-breathe 2.5s ease-in-out infinite;
}

.conductor-visual .loop-node:nth-of-type(1) { animation-delay: 0s; }
.conductor-visual .loop-node:nth-of-type(2) { animation-delay: 0.6s; }
.conductor-visual .loop-node:nth-of-type(3) { animation-delay: 1.2s; }
.conductor-visual .loop-node:nth-of-type(4) { animation-delay: 1.8s; }

/* Terminal typing reveal */
.reveal.visible .terminal-mock > div {
  animation: terminal-reveal 0.3s ease-out both;
}
.reveal.visible .terminal-mock > div:nth-child(1) { animation-delay: 0s; }
.reveal.visible .terminal-mock > div:nth-child(2) { animation-delay: 0.4s; }
.reveal.visible .terminal-mock > div:nth-child(3) { animation-delay: 0.8s; }
.reveal.visible .terminal-mock > div:nth-child(4) { animation-delay: 1.2s; }
.reveal.visible .terminal-mock > div:nth-child(5) { animation-delay: 1.6s; }
.reveal.visible .terminal-mock > div:nth-child(6) { animation-delay: 2.0s; }
.reveal.visible .terminal-mock > div:nth-child(7) { animation-delay: 2.4s; }

/* ===== 6. Dogfooding ===== */
#dogfooding {
  background: var(--ocean-mid);
}

.dogfood-content {
  max-width: 720px;
  margin: 0 auto;
}

.dogfood-content > p {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.dogfood-block {
  background: var(--ocean-deep);
  border: 1px solid var(--ocean-surface);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 16px;
}

.dogfood-block .tag {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.dogfood-block .tag-overlap {
  color: var(--status-warning);
}

.dogfood-block .tag-unused {
  color: var(--status-error);
}

.dogfood-block .tag-drift {
  color: var(--status-info);
}

.dogfood-block:has(.tag-overlap) {
  border-left: 3px solid var(--status-warning);
}

.dogfood-block:has(.tag-unused) {
  border-left: 3px solid var(--status-error);
}

.dogfood-block:has(.tag-drift) {
  border-left: 3px solid var(--status-info);
}

.dogfood-block p {
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
}

.dogfood-closing {
  text-align: center;
  font-size: 20px;
  color: var(--text-primary);
  margin-top: 24px;
}

/* ===== 7. Stats ===== */
#stats {
  background: var(--ocean-deep);
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
}

.stat-block {
  flex: 1;
  text-align: center;
  padding: 24px 20px;
  position: relative;
}

.stat-block + .stat-block::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--ocean-surface);
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  color: var(--beam-gold);
  margin-bottom: 12px;
}

.stat-context {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 200px;
  margin: 0 auto;
}

/* ===== 8. Final CTA ===== */
#cta {
  background: var(--ocean-abyss);
  text-align: center;
  padding: 120px 80px;
  position: relative;
}

.cta-graph-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.05;
  pointer-events: none;
}

.cta-headline {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  display: inline-block;
}

.cta-headline.sweep::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--beam-gold-glow), transparent);
  animation: beam-sweep 2s ease-in-out forwards;
  pointer-events: none;
}

/* The Shift — essay block */
.cta-shift {
  max-width: 640px;
  margin: 0 auto 56px;
  text-align: left;
}

.cta-shift p {
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.7;
  margin-bottom: 20px;
}

.cta-shift p strong {
  color: var(--text-primary);
}

.cta-shift p.cta-shift-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--beam-gold);
  margin-bottom: 28px;
}

.cta-shift p.cta-shift-bridge {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 32px;
  margin-bottom: 0;
}

.cta-divider {
  width: 48px;
  height: 1px;
  background: var(--beam-gold-dim);
  margin: 0 auto 56px;
}

/* CTA body + perks */
#cta .cta-body {
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 40px;
  font-size: 19px;
}

.cta-perks-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--beam-gold);
  margin-bottom: 16px;
}

.cta-perks {
  list-style: none;
  max-width: 440px;
  margin: 0 auto 40px;
  text-align: left;
}

.cta-perks li {
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.6;
  padding-left: 20px;
  margin-bottom: 8px;
  position: relative;
}

.cta-perks li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--beam-gold);
}

.cta-buttons {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== 9. Footer ===== */
footer {
  background: var(--ocean-abyss);
  border-top: 1px solid var(--ocean-mid);
  padding: 32px 80px;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.footer-brand .name {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-primary);
}

.footer-brand .meaning {
  font-size: 14px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--beam-gold);
}

.footer-links .sep {
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 1200px) {
  section, .feature-section, #cta, #hero {
    padding-left: 48px;
    padding-right: 48px;
  }

  footer {
    padding-left: 48px;
    padding-right: 48px;
  }

  .stats-row {
    flex-wrap: wrap;
  }

  .stat-block {
    flex: 0 0 33.33%;
  }

  /* Remove dividers that wrap weirdly */
  .stat-block:nth-child(4)::before {
    display: none;
  }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
  section, .feature-section, #cta, #hero {
    padding: 60px 24px;
  }

  footer {
    padding: 24px;
  }

  .hero-headline {
    font-size: 40px;
    line-height: 1.1;
  }

  .hero-subhead {
    font-size: 17px;
    line-height: 1.6;
  }

  .section-headline {
    font-size: 28px;
    line-height: 1.2;
  }

  .cta-headline {
    font-size: 28px;
    line-height: 1.2;
  }

  /* Thesis */
  .thesis-content p {
    margin-bottom: 32px;
  }

  .pull-quote {
    font-size: 19px;
    margin: 32px 0;
  }

  /* Quadrants */
  .quadrant-diagram {
    max-width: 300px;
  }

  /* All quadrant lines animate at once on mobile */
  .quadrant-diagram.visible .quadrant-line {
    transition-delay: 0ms !important;
  }

  /* Features: stack */
  .feature-grid,
  .feature-grid.reverse {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .feature-grid.reverse .feature-copy {
    order: 0;
  }

  .feature-tagline {
    font-size: 22px;
  }

  .feature-visual {
    justify-content: center;
  }

  /* Reverse engineering: stack columns on mobile */
  .reverse-split {
    grid-template-columns: 1fr;
  }

  /* Dogfooding closing text */
  .dogfood-closing {
    font-size: 17px;
  }

  /* Stats: stack */
  .stats-row {
    flex-direction: column;
    align-items: center;
  }

  .stat-block {
    flex: none;
    width: 100%;
    max-width: 300px;
  }

  .stat-block + .stat-block::before {
    display: none;
  }

  .stat-number {
    font-size: 36px;
  }

  .stat-context {
    font-size: 15px;
  }

  /* Footer: stack */
  .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}
