/* === Design Tokens === */
:root {
  --bg: #FAFAF8;
  --text: #1A1A1A;
  --text-secondary: #555;
  --accent: #2D5F9A;
  --heading-font: Georgia, 'Times New Roman', serif;
  --body-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono-font: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace;
  --code-bg: #0D1117;
  --code-text: #E6EDF3;
  --code-blue: #58A6FF;
  --code-green: #3FB950;
  --code-purple: #D2A8FF;
}

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

html { scroll-behavior: smooth; font-size: 18px; }

body {
  font-family: var(--body-font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  overflow-x: hidden;
}

.section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  position: relative;
}

.prose { max-width: 680px; width: 100%; }

.prose h2 {
  font-family: var(--heading-font);
  font-size: 2.8rem;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.prose p { margin-bottom: 1.25rem; color: var(--text-secondary); }
.prose p:last-child { margin-bottom: 0; }

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

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

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

.hero-brand {
  font-family: var(--mono-font);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  opacity: 0;
}

.hero-title {
  font-family: var(--heading-font);
  font-size: 4rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  opacity: 0;
}

.hero-sub {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 2rem;
  opacity: 0;
}

.scroll-indicator {
  font-family: var(--mono-font);
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }

.section--inversion { min-height: 200vh; padding: 0; }

.split-screen {
  display: flex;
  width: 100%;
  height: 100vh;
  position: sticky;
  top: 0;
}

.split-left, .split-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.split-left { background: #f0e8e8; }
.split-right { background: #e8f0e8; }

.split-left h3, .split-right h3 {
  font-family: var(--heading-font);
  font-size: 1.8rem;
  margin-bottom: 2rem;
}

.web-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  padding: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  opacity: 0;
}

.web-item--old { background: rgba(200, 50, 50, 0.1); color: #8b2020; }
.web-item--new { background: rgba(50, 160, 50, 0.1); color: #1a6b1a; }
.web-item .icon { font-size: 1.4rem; }

.inversion-prose { padding: 4rem 2rem; display: flex; justify-content: center; }

.chart-container { max-width: 800px; width: 100%; margin: 2rem auto; }
#adoption-chart { width: 100%; height: auto; }

.stat-counter {
  font-family: var(--heading-font);
  font-size: 5rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.stat-label { text-align: center; color: var(--text-secondary); font-size: 1.1rem; }

.node-map-container { max-width: 900px; width: 100%; margin: 2rem auto; position: relative; }
#protocol-map { width: 100%; height: auto; }

.node-tooltip {
  position: absolute;
  background: var(--text);
  color: var(--bg);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  max-width: 240px;
  pointer-events: none;
  z-index: 10;
  line-height: 1.4;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 900px;
  width: 100%;
  margin-top: 2rem;
}

.service-card {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
}

.service-card h4 { font-family: var(--heading-font); font-size: 1.15rem; margin-bottom: 0.5rem; }
.service-card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }
.service-card .data-point { font-family: var(--mono-font); font-size: 0.8rem; color: var(--accent); margin-top: 0.75rem; }

.section--code { background: var(--code-bg); color: var(--code-text); transition: background 0.3s, color 0.3s; }
.prose--light h2 { color: var(--code-text); }
.prose--light p { color: #8b949e; }

.pipeline-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 3rem auto;
  max-width: 800px;
  flex-wrap: wrap;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1.5rem;
  border: 1px solid #30363d;
  border-radius: 8px;
  opacity: 0.2;
  transition: opacity 0.4s, border-color 0.4s;
}

.pipeline-step.active { opacity: 1; border-color: var(--code-green); }
.pipeline-step .step-icon { font-size: 1.8rem; margin-bottom: 0.5rem; }
.pipeline-step .step-label { font-family: var(--mono-font); font-size: 0.8rem; color: #8b949e; }
.pipeline-arrow { font-size: 1.4rem; color: #30363d; padding: 0 0.5rem; }

.code-block {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem auto;
  max-width: 680px;
  font-family: var(--mono-font);
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
}

.code-block .line { opacity: 0; display: block; }
.code-block .line.visible { opacity: 1; }
.code-comment { color: #8b949e; }
.code-keyword { color: var(--code-purple); }
.code-string { color: var(--code-green); }
.code-function { color: var(--code-blue); }

.code-block-label {
  font-family: var(--mono-font);
  font-size: 0.75rem;
  color: #8b949e;
  margin-bottom: 0.5rem;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.platform-note {
  max-width: 680px;
  margin: 2rem auto;
  padding: 1.25rem;
  border-left: 3px solid var(--code-blue);
  background: rgba(88, 166, 255, 0.05);
  font-size: 0.9rem;
  color: #8b949e;
  line-height: 1.6;
}

.cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 900px;
  width: 100%;
  margin-top: 2rem;
}

.cta-card {
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 2rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}

.cta-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cta-card h3 { font-family: var(--heading-font); font-size: 1.3rem; margin-bottom: 0.75rem; }
.cta-card p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.5; }
.cta-card .cta-link { display: inline-block; margin-top: 1rem; font-family: var(--mono-font); font-size: 0.85rem; color: var(--accent); }

.section--footer { min-height: auto; padding: 3rem 2rem; border-top: 1px solid #e5e5e5; }
.footer-brand { font-family: var(--mono-font); font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .scroll-indicator { animation: none; opacity: 0.6; }
  .web-item, .service-card, .protocol-node, .edge-line,
  .code-block .line, .pipeline-step { opacity: 1 !important; transform: none !important; }
}

@media (max-width: 768px) {
  html { font-size: 16px; }
  .hero-title { font-size: 2.5rem; }
  .prose h2 { font-size: 2rem; }
  .split-screen { flex-direction: column; }
  .split-left, .split-right { height: 50vh; }
  .stat-counter { font-size: 3.5rem; }
  .pipeline-diagram { flex-direction: column; }
  .pipeline-arrow { transform: rotate(90deg); }
}
