:root {
  --bg-primary: #0a0e14;
  --bg-surface: #121820;
  --bg-card: #161e29;
  --bg-card-hover: #1c2635;
  --bg-highlight: #212c3d;
  --border-subtle: #243042;
  --border-active: #3b4c66;
  
  --text-primary: #f0f6fc;
  --text-secondary: #9aa7b8;
  --text-muted: #6b7787;
  
  --copper: #f78166;
  --copper-glow: rgba(247, 129, 102, 0.15);
  --pcb-green: #3fb950;
  --pcb-green-bg: rgba(63, 185, 80, 0.12);
  --clean-blue: #58a6ff;
  --clean-blue-bg: rgba(88, 166, 255, 0.12);
  --melt-amber: #d29922;
  --melt-amber-bg: rgba(210, 153, 34, 0.15);
  --furnace-red: #f85149;
  --furnace-red-bg: rgba(248, 81, 73, 0.15);
  --gold: #e3b341;
  --gold-bg: rgba(227, 179, 65, 0.12);
  --purple: #a371f7;
  --purple-bg: rgba(163, 113, 247, 0.12);
  
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --max-w: 1120px;
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(88, 166, 255, 0.05) 0%, transparent 60%),
    radial-gradient(circle at 85% 20%, rgba(247, 129, 102, 0.04) 0%, transparent 40%),
    linear-gradient(rgba(36, 48, 66, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 48, 66, 0.15) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
}

a {
  color: var(--clean-blue);
  text-decoration: none;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

a:hover, a:focus-visible {
  color: #79c0ff;
  text-decoration: underline;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--clean-blue);
  outline-offset: 2px;
}

.site-wrap {
  width: 100%;
  max-width: var(--max-w);
  padding: 24px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 60px;
}

/* Nav & Lang switch */
.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 500;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 8px var(--copper);
}

.lang-switch {
  display: flex;
  gap: 12px;
  align-items: center;
}

.lang-switch a {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.lang-switch a.active {
  color: var(--text-primary);
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  text-decoration: none;
}

/* Header & Hero */
.hero {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--copper);
  font-weight: 600;
}

.hero-title {
  font-size: clamp(32px, 5.5vw, 56px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.hero-title span.accent {
  background: linear-gradient(135deg, #f78166 0%, #d29922 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-deck {
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 920px;
}

/* Big Stat Callout Banner */
.stat-banner {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--pcb-green);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
}

.stat-multiplier {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: clamp(48px, 7vw, 76px);
  font-weight: 900;
  line-height: 1;
  color: var(--pcb-green);
  text-shadow: 0 0 20px rgba(63, 185, 80, 0.25);
  border-right: 1px dashed var(--border-subtle);
  padding-right: 32px;
}

.stat-multiplier-sub {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-banner-text {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.stat-banner-text strong {
  color: var(--text-primary);
}

/* Section Common */
.section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--clean-blue);
  font-weight: 600;
}

.section-title {
  font-size: clamp(24px, 3.5vw, 34px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.section-desc {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 860px;
}

/* Module 1: The Embodied Iceberg */
.iceberg-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.iceberg-visual {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.component-bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comp-btn {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.comp-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.comp-btn.active {
  background: var(--bg-highlight);
  border-color: var(--copper);
  box-shadow: 0 0 12px var(--copper-glow);
}

.comp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  font-weight: 600;
}

.comp-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.comp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--copper), var(--melt-amber));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.comp-pct {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--copper);
}

.iceberg-detail-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.iceberg-detail-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.iceberg-detail-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}

.iceberg-detail-stat {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--copper);
  font-weight: 600;
}

.iceberg-detail-body {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.iceberg-detail-foot {
  padding-top: 16px;
  border-top: 1px dashed var(--border-subtle);
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Module 2: The Two Destinies (Comparison) */
.destiny-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.device-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.device-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.device-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.device-tab.active {
  background: var(--clean-blue-bg);
  border-color: var(--clean-blue);
  color: #ffffff;
  font-weight: 600;
}

.destiny-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.destiny-col {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.destiny-col.melting {
  border-top: 3px solid var(--furnace-red);
}

.destiny-col.refurb {
  border-top: 3px solid var(--pcb-green);
  background: linear-gradient(180deg, var(--pcb-green-bg) 0%, var(--bg-card) 60%);
}

.destiny-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.destiny-col-title {
  font-size: 18px;
  font-weight: 700;
}

.destiny-col.melting .destiny-col-title { color: var(--furnace-red); }
.destiny-col.refurb .destiny-col-title { color: var(--pcb-green); }

.destiny-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.destiny-col.melting .destiny-badge {
  background: var(--furnace-red-bg);
  color: var(--furnace-red);
}

.destiny-col.refurb .destiny-badge {
  background: var(--pcb-green-bg);
  color: var(--pcb-green);
}

.destiny-num-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.destiny-big-val {
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
}

.destiny-col.melting .destiny-big-val { color: var(--text-primary); }
.destiny-col.refurb .destiny-big-val { color: var(--pcb-green); }

.destiny-big-unit {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.destiny-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex-grow: 1;
}

.destiny-bar-comparison {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-subtle);
}

.destiny-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.destiny-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.destiny-bar-fill-melt {
  height: 100%;
  background: var(--furnace-red);
  border-radius: 4px;
}

.destiny-bar-fill-refurb {
  height: 100%;
  background: var(--pcb-green);
  border-radius: 4px;
}

/* Module 3: Carbon Density & The Weight Paradox */
.density-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.density-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.density-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.density-table th {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.density-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(36, 48, 66, 0.5);
  color: var(--text-secondary);
}

.density-table tr:hover td {
  background: var(--bg-card);
  color: var(--text-primary);
}

.density-device-name {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.density-badge-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--pcb-green);
}

.density-bar-mini {
  width: 100%;
  max-width: 160px;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.density-bar-mini-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--clean-blue), var(--pcb-green));
  border-radius: 3px;
}

/* Module 4: Material Benchmark (Gold vs Copper) */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.material-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.material-card.gold-card {
  border-top: 3px solid var(--gold);
  background: linear-gradient(180deg, var(--gold-bg) 0%, var(--bg-card) 45%);
}

.material-card.tantalum-card {
  border-top: 3px solid var(--purple);
  background: linear-gradient(180deg, var(--purple-bg) 0%, var(--bg-card) 45%);
}

.material-card.silicon-card {
  border-top: 3px solid var(--copper);
  background: linear-gradient(180deg, var(--copper-glow) 0%, var(--bg-card) 45%);
}

.material-card.copper-card {
  border-top: 3px solid var(--clean-blue);
  background: linear-gradient(180deg, var(--clean-blue-bg) 0%, var(--bg-card) 45%);
}

.material-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.material-name {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.material-cat {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.material-carbon-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.material-carbon {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.material-card.gold-card .material-carbon { color: var(--gold); }
.material-card.tantalum-card .material-carbon { color: var(--purple); }
.material-card.silicon-card .material-carbon { color: var(--copper); }
.material-card.copper-card .material-carbon { color: var(--clean-blue); }

.material-carbon-unit {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.material-notes {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Callout deep dive comparison box */
.deepdive-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--clean-blue);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.deepdive-box h4 {
  font-size: 18px;
  color: #ffffff;
  font-weight: 700;
}

.deepdive-box p strong {
  color: var(--text-primary);
}

/* Module 5: Fleet & Scale Workshop */
.fleet-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.preset-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--clean-blue);
}

.preset-btn.active {
  background: var(--clean-blue-bg);
  border-color: var(--clean-blue);
  color: #ffffff;
  font-weight: 600;
}

.inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.input-group {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-highlight);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}

.stepper-btn:hover {
  background: var(--border-active);
}

.stepper-val {
  flex-grow: 1;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  padding: 4px 8px;
  -moz-appearance: textfield;
}

.stepper-val::-webkit-outer-spin-button,
.stepper-val::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Impact Dashboard Output */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.result-card.highlight {
  border-color: var(--pcb-green);
  background: linear-gradient(135deg, var(--pcb-green-bg) 0%, var(--bg-card) 70%);
}

.result-card-label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.result-card-value {
  font-family: var(--font-mono);
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.result-card.highlight .result-card-value {
  color: var(--pcb-green);
}

.result-card-sub {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Methodological Sources & Collapsible Details */
.sources-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sources-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sources-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.sources-list li {
  padding-left: 20px;
  position: relative;
  line-height: 1.5;
}

.sources-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--copper);
  font-family: var(--font-mono);
}

/* Footer */
.site-footer {
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-wrap: wrap;
  gap: 16px;
}

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

/* Fallback no-JS notices */
noscript .no-js-note {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--melt-amber);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .iceberg-card {
    grid-template-columns: 1fr;
  }
  .destiny-grid {
    grid-template-columns: 1fr;
  }
  .stat-banner {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px;
  }
  .stat-multiplier {
    border-right: none;
    border-bottom: 1px dashed var(--border-subtle);
    padding-right: 0;
    padding-bottom: 16px;
  }
}

@media (max-width: 480px) {
  .site-wrap {
    padding: 16px 14px 60px;
    gap: 40px;
  }
  .iceberg-card, .destiny-card, .density-card, .fleet-card, .deepdive-box, .sources-card {
    padding: 20px 16px;
  }
  .comp-btn {
    padding: 10px 12px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
