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

:root {
  --bg-primary: #FAF6F1;
  --bg-alt: #F0EBE3;
  --bg-card: #FFFFFF;
  --bg-hero: #1a1a2e;
  --text-primary: #1a1a2e;
  --text-secondary: #5a5a6e;
  --text-muted: #8a8a9a;
  --accent: #c0392b;
  --accent-dim: rgba(192, 57, 43, 0.1);
  --secondary: #2c7a7b;
  --secondary-dim: rgba(44, 122, 123, 0.15);
  --mid: #6b8f71;
  --bottom: #b8c9bb;
  --card-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 4px 30px rgba(0, 0, 0, 0.1);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

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

a:hover {
  opacity: 0.8;
}

/* === Fade-in Animation === */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === 1. Hero (dark — editorial contrast) === */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  position: relative;
  background: linear-gradient(170deg, #1a1a2e 0%, #2d2d44 100%);
  color: #f0f0f0;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: #ffffff;
}

.hero-sub {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: rgba(255, 255, 255, 0.7);
  max-width: 600px;
  margin: 0 auto 60px;
  line-height: 1.6;
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  animation: pulse 2s ease-in-out infinite;
}

.scroll-arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid rgba(255, 255, 255, 0.4);
  border-bottom: 2px solid rgba(255, 255, 255, 0.4);
  transform: rotate(45deg);
}

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

/* === Sections === */
.section {
  padding: 100px 0;
}

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

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.section-intro {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 650px;
  margin-bottom: 48px;
  line-height: 1.7;
}

.subsection-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* === 2. Scroll Dot Visualization === */
.billion-section {
  padding-bottom: 60px;
}

.dot-vis-wrapper {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

.dot-sidebar {
  position: sticky;
  top: 20px;
  z-index: 10;
  background: rgba(26, 26, 46, 0.92);
  backdrop-filter: blur(8px);
  padding: 16px 20px;
  border-radius: 8px;
  display: inline-block;
  margin-bottom: 24px;
  color: #fff;
}

.dot-counter-value {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.dot-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

.dot-container {
  width: 100%;
}

.dot-phase {
  margin-bottom: 40px;
}

.dot-phase-label {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.dot-phase-count {
  font-weight: 400;
  color: var(--text-muted);
}

canvas {
  display: block;
  width: 100%;
  border-radius: 4px;
}

/* Spending comparison */
.spending-comparison {
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.comparison-heading {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.comparison-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.comparison-card {
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
}

.comparison-amount {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.comparison-result {
  font-size: 1.2rem;
  color: var(--text-primary);
}

.comparison-result strong {
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 900;
}

.time-analogies {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  padding-top: 32px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.analogy {
  font-size: 1.15rem;
  color: var(--text-secondary);
}

.analogy-number {
  color: var(--accent);
  font-weight: 700;
}

/* === 3. Distribution === */
.wealth-bars {
  margin-bottom: 60px;
}

.wealth-bar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.wealth-bar-label {
  width: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.wealth-bar-track {
  flex: 1;
  height: 44px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  overflow: hidden;
}

.wealth-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding-left: 12px;
  transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.wealth-bar-fill[data-color="accent"] { background: var(--accent); color: #fff; }
.wealth-bar-fill[data-color="secondary"] { background: var(--secondary); color: #fff; }
.wealth-bar-fill[data-color="mid"] { background: var(--mid); color: #fff; }
.wealth-bar-fill[data-color="bottom"] { background: var(--bottom); color: var(--text-primary); }

.wealth-bar-value {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.wealth-bar-fill[data-color="bottom"] .wealth-bar-value {
  position: absolute;
  right: -50px;
  color: var(--text-secondary);
}

.wealth-growth {
  text-align: center;
  margin-bottom: 60px;
}

.growth-comparison {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin-bottom: 20px;
}

.growth-box {
  text-align: center;
}

.growth-value {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.growth-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.growth-arrow {
  font-size: 2rem;
  color: var(--text-muted);
}

.growth-context {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* === Productivity Chart === */
.productivity-chart-wrapper {
  margin-bottom: 48px;
}

.chart-container {
  position: relative;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  border-radius: 12px;
  padding: 24px;
}

#productivity-chart {
  width: 100%;
  height: 300px;
}

.chart-legend {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  font-size: 0.9rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.productivity { background: var(--accent); }
.legend-dot.wages { background: var(--secondary); }

.chart-source {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* === Stat Cards === */
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.stat-card {
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  border-radius: 12px;
  padding: 32px;
}

.stat-value {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.stat-body {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* === 4. Numbered Arguments === */
.numbered-arguments {
  display: grid;
  gap: 0;
}

.numbered-arg {
  display: flex;
  gap: 24px;
  padding: 40px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.numbered-arg:last-child {
  border-bottom: none;
}

.arg-number {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arg-content {
  flex: 1;
}

.arg-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.arg-stat {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.6;
}

.big-number {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
}

.arg-body {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* === Tax Comparison === */
.tax-comparison {
  display: flex;
  gap: 20px;
  margin-top: 24px;
}

.tax-then, .tax-now {
  flex: 1;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
}

.tax-then {
  background: var(--secondary-dim);
}

.tax-now {
  background: var(--accent-dim);
}

.tax-rate {
  font-size: 2.5rem;
  font-weight: 900;
}

.tax-then .tax-rate { color: var(--secondary); }
.tax-now .tax-rate { color: var(--accent); }

.tax-era {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.tax-result {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

/* === 5. History === */
.history-content {
  max-width: 700px;
}

.history-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 24px;
}

.callout-quote {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.7;
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
  padding: 16px 0 16px 24px;
  margin: 32px 0 0 0;
}

/* === 6. Go Deeper + Footer === */
.footer-section {
  background: var(--bg-alt);
  padding-bottom: 60px;
}

.resources {
  display: grid;
  gap: 16px;
  margin-bottom: 60px;
}

.resource-link {
  display: block;
  padding: 24px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  border-radius: 12px;
  transition: box-shadow 0.3s, transform 0.2s;
  color: var(--text-primary);
}

.resource-link:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
  opacity: 1;
}

.resource-type {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.resource-title {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.resource-desc {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* === Footer Meta === */
.footer-meta {
  text-align: center;
  padding-top: 40px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.footer-meta p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.footer-inspired {
  color: var(--text-secondary) !important;
  margin-bottom: 16px !important;
}

.footer-sources {
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* === Responsive === */
@media (max-width: 768px) {
  .section {
    padding: 60px 0;
  }

  .stat-row,
  .comparison-row {
    grid-template-columns: 1fr;
  }

  .tax-comparison {
    flex-direction: column;
  }

  .growth-comparison {
    flex-direction: column;
    gap: 16px;
  }

  .growth-arrow {
    transform: rotate(90deg);
  }

  .time-analogies {
    flex-direction: column;
    gap: 20px;
  }

  .numbered-arg {
    gap: 16px;
  }

  .arg-number {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .dot-sidebar {
    position: fixed;
    top: auto;
    bottom: 20px;
    right: 20px;
    left: auto;
    margin-bottom: 0;
    z-index: 100;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.2rem;
  }

  .big-number {
    font-size: 1.5rem;
  }

  .tax-rate {
    font-size: 2rem;
  }

  .numbered-arg {
    flex-direction: column;
    gap: 12px;
  }

  .arg-number {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}
