/* ===== CUSTOM PROPERTIES ===== */
:root {
  --bg-deep: #f5f2ed;
  --bg-base: #efe9e1;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8f5f0;
  --bg-elevated: #ffffff;

  --accent: #E85D3A;
  --accent-dim: rgba(232, 93, 58, 0.08);
  --accent-glow: rgba(232, 93, 58, 0.15);
  --accent-secondary: #D4A017;
  --accent-secondary-dim: rgba(212, 160, 23, 0.08);

  --text-primary: #1a1a2e;
  --text-body: #374151;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;

  --border: #e5e1dc;
  --border-light: #d1cdc6;

  --font-display: 'Clash Display', system-ui, sans-serif;
  --font-body: 'Satoshi', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);

  --container: 1200px;
  --nav-height: 60px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

::selection {
  background: var(--accent);
  color: #ffffff;
}

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

/* ===== NAVIGATION ===== */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(245, 242, 237, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background 0.3s;
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.logo-mark { flex-shrink: 0; }

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

.nav-link {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.04);
  opacity: 1;
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
}

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

.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  transition: all 0.3s;
}

/* ===== SECTIONS ===== */
.section {
  padding: 7rem 0;
  position: relative;
}

.section-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.section-intro {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 700px;
  margin-bottom: 3rem;
  line-height: 1.7;
}

/* ===== HERO ===== */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#hero-canvas {
  width: 100%;
  height: 100%;
}

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

.hero-logo-large {
  margin: 0 auto 2rem;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 7vw, 5.5rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2vw, 1.35rem);
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.hero-author {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 2.5rem;
}

.hero-intro {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.hero-intro--emphasis {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  margin: 1rem auto 1rem;
  letter-spacing: -0.01em;
}

/* Hero Read More Collapsible */
.hero-readmore {
  max-width: 640px;
  margin: 0 auto 2.5rem;
  text-align: left;
}

.hero-readmore-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: 'Satoshi', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0;
  transition: color 0.2s;
}

.hero-readmore-btn:hover {
  color: var(--accent);
}

.hero-readmore-btn .toggle-chevron {
  transition: transform 0.3s var(--ease-out);
}

.hero-readmore-btn[aria-expanded="true"] .toggle-chevron {
  transform: rotate(180deg);
}

.hero-readmore-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease-out), opacity 0.4s ease;
  opacity: 0;
}

.hero-readmore-content.expanded {
  max-height: 800px;
  opacity: 1;
}

.hero-readmore-content p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-top: 1rem;
}

.hero-readmore-content p:first-child {
  margin-top: 0.75rem;
}

.scroll-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: bobble 2s ease-in-out infinite;
}

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

/* ===== THESIS COMMENTARY ===== */
.thesis-commentary {
  max-width: 780px;
  margin-bottom: 2.5rem;
}

.thesis-commentary p {
  font-size: 1.05rem;
  color: var(--text-body);
  line-height: 1.8;
}

/* ===== EQUATIONS COLLAPSIBLE ===== */
.equations-toggle {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.equations-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.equations-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.equations-toggle-btn[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.toggle-chevron {
  transition: transform 0.3s var(--ease);
  flex-shrink: 0;
}

.equations-toggle-btn[aria-expanded="true"] .toggle-chevron {
  transform: rotate(180deg);
}

.equations-collapsible {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease), opacity 0.4s;
  opacity: 0;
}

.equations-collapsible.expanded {
  max-height: 600px;
  opacity: 1;
  margin-top: 1rem;
}

/* ===== EQUATIONS ===== */
.equation-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
}

.equation-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.equation-main {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.equation-vars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.eq-var {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.eq-symbol {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  min-width: 1.5rem;
}

.equation-inline {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 2rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-body);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.eq-separator {
  color: var(--text-dim);
}

.computed-val {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.thesis-quote {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 500;
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
  padding-left: 1.5rem;
  margin: 2.5rem 0;
  line-height: 1.4;
}

/* ===== SURPLUS RANGE ===== */
.surplus-range {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.surplus-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
}

.surplus-card--mid {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.surplus-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.surplus-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.surplus-card--mid .surplus-value {
  color: var(--accent);
}

/* ===== IMPERATIVES ===== */
.imperatives-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.imperative-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease);
  cursor: pointer;
}

.imperative-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent);
}

.imperative-card:hover {
  border-color: var(--card-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

.imperative-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.imperative-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--card-accent);
  background: rgba(0,0,0,0.04);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.imperative-category {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.imperative-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.imperative-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.imperative-signal {
  font-size: 0.78rem;
  color: var(--accent-secondary);
  font-weight: 500;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.imperative-models {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.imperative-model-tag {
  font-size: 0.65rem;
  color: var(--text-dim);
  background: rgba(0,0,0,0.04);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

/* ===== CHARTS ===== */
.chart-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 400px;
}

@media (max-width: 768px) {
  .chart-container canvas {
    max-height: 280px;
  }
}

.chart-container--adoption canvas {
  max-height: 320px;
}

/* ===== SLIDERS ===== */
.sliders-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slider-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-val {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Custom range input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  touch-action: none;
  position: relative;
  z-index: 10;
  padding: 8px 0;
  margin: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
}

.constraint-note {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

.sigma-labels {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ===== MODEL TAGS ===== */
.model-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.model-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--tag-color) 15%, transparent);
  color: var(--tag-color);
  border: 1px solid color-mix(in srgb, var(--tag-color) 30%, transparent);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

a.model-tag:hover {
  background: color-mix(in srgb, var(--tag-color) 25%, transparent);
  transform: translateY(-1px);
}

/* ===== DISTRIBUTION ===== */
.distribution-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.dist-stat {
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dist-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dist-stat-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.scenario-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}

.scenario-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.scenario-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.scenario-card--active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 4px 20px rgba(232, 93, 58, 0.1);
}

.scenario-card--active:hover {
  border-color: var(--accent);
}

.scenario-prob {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.scenario-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.scenario-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.scenario-ls {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-secondary);
  font-weight: 600;
}

/* ===== DUAL CHARTS ===== */
.dual-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-panel-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.dual-chart-panel .chart-container {
  margin-bottom: 0;
}

/* ===== HEATMAP ===== */
.heatmap-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  min-width: 600px;
}

.heatmap-table th {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  text-align: center;
  white-space: nowrap;
}

.heatmap-table th:first-child {
  text-align: left;
  min-width: 160px;
}

.heatmap-table td {
  padding: 0.85rem 1rem;
  border-radius: 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  cursor: default;
  transition: transform 0.15s;
}

.heatmap-table td:first-child {
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent !important;
  color: var(--text-body);
}

.heatmap-table td:not(:first-child):hover {
  transform: scale(1.08);
  z-index: 2;
}

.heatmap-table td .heatmap-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-body);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.heatmap-table td:hover .heatmap-tooltip {
  display: block;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.heatmap-gradient {
  width: 180px;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #c5ebe0, #ecd56e, #f0a050, #e05535);
}

/* ===== HORIZONTAL TIMELINE ===== */
.h-timeline {
  position: relative;
  margin-bottom: 2.5rem;
  padding-top: 1rem;
}

.h-timeline-track {
  position: relative;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 0;
}

.h-timeline-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}

.h-timeline-phases {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-top: -14px;
}

.h-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 0 0.5rem;
  transition: all 0.2s;
  position: relative;
}

.h-phase-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 3px solid var(--border-light);
  transition: all 0.3s var(--ease);
  position: relative;
  z-index: 2;
}

.h-phase:hover .h-phase-dot {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.h-phase--active .h-phase-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.h-phase-badge {
  display: none;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: var(--accent);
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  white-space: nowrap;
  margin-top: 0.35rem;
}

.h-phase--active .h-phase-badge {
  display: block;
}

.h-phase-label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.5rem;
  white-space: nowrap;
}

.h-phase--active .h-phase-label {
  color: var(--text-primary);
}

.h-phase-date {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  white-space: nowrap;
}

.h-phase--selected .h-phase-dot {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scale(1.15);
}

.h-phase--selected .h-phase-label {
  color: var(--accent);
}

/* Phase detail card */
.phase-detail {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  position: relative;
  transition: all 0.3s var(--ease);
}

.phase-detail::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 12px 12px 0 0;
}

.phase-detail-period {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.phase-detail-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.phase-detail-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.25rem;
  max-width: 700px;
}

.phase-detail-models {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.phase-model-link {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.phase-model-link:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  transform: translateY(-1px);
}

/* ===== POLICY ===== */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.policy-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.3s var(--ease);
}

.policy-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}

.policy-icon {
  color: var(--accent);
  margin-bottom: 1rem;
}

.policy-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.65rem;
}

.policy-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== FOOTER ===== */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
}

.footer-inner {
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-body);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.footer-based {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.footer-links {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-sep { margin: 0 0.5rem; }

/* ===== FADE-IN ANIMATIONS ===== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

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

/* Chart containers, slider panels, and scenario cards must always be visible.
   Chart.js requires visible containers to calculate dimensions correctly. */
.chart-container,
.sliders-panel,
.scenario-cards,
.dual-charts,
.chart-container--adoption,
.heatmap-container,
.heatmap-legend {
  opacity: 1 !important;
  transform: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .imperatives-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(245, 242, 237, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
  }

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

  .nav-toggle { display: flex; }

  .nav-title { font-size: 0.8rem; }

  .section { padding: 4rem 0; }

  .imperatives-grid { grid-template-columns: 1fr; }

  .surplus-range { grid-template-columns: 1fr; }

  .scenario-cards { grid-template-columns: 1fr; }

  .dual-charts { grid-template-columns: 1fr; }

  .policy-grid { grid-template-columns: 1fr; }

  .sliders-panel { grid-template-columns: 1fr; }

  .equation-inline { flex-direction: column; gap: 0.5rem; }

  .equation-block { padding: 1.5rem; }

  .hero-title { font-size: clamp(2rem, 10vw, 3.5rem); }

  /* Horizontal timeline responsive */
  .h-timeline-phases {
    gap: 0.25rem;
  }

  .h-phase-label {
    font-size: 0.68rem;
  }

  .h-phase-date {
    font-size: 0.6rem;
  }

  .phase-detail {
    padding: 1.5rem;
  }
}

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

  .hero-section { padding: 5rem 1.25rem; }

  .h-phase-date {
    display: none;
  }
}
