@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,500&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;1,8..60,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --space-950: #090c11;
  --space-900: #0d1119;
  --space-850: #121826;
  --space-800: #182035;
  --space-700: #202b45;
  --ash-100: #eef1f6;
  --ash-200: #d7dce6;
  --ash-400: #8f9bb3;
  --line: rgba(238, 241, 246, 0.13);
  --line-soft: rgba(238, 241, 246, 0.07);
  --copper-400: #ec9a63;
  --copper-500: #dd7f3c;
  --copper-600: #b4632a;
  --ion-400: #7cd4ff;
  --ion-500: #46a9dd;
  --scar-500: #e2634f;
  --font-display: 'Fraunces', 'Source Serif 4', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--space-950);
  color: var(--ash-100);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 60% 45% at 85% -8%, rgba(70,169,221,0.12), transparent 60%),
    radial-gradient(ellipse 55% 40% at 5% 8%, rgba(221,127,60,0.10), transparent 55%);
  background-attachment: fixed;
}

a { color: var(--copper-400); }
a:hover { color: var(--copper-500); }

.container { max-width: 780px; margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: 1040px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  background: rgba(9, 12, 17, 0.88);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.brand { text-decoration: none; color: var(--ash-200); font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.02em; }
.lang-switch { display: flex; gap: 0.4rem; font-family: var(--font-mono); font-size: 0.78rem; }
.lang-btn { color: var(--ash-400); text-decoration: none; padding: 0.2rem 0.5rem; border-radius: 4px; }
.lang-btn.active { color: var(--copper-400); border: 1px solid var(--line); }
.lang-btn:hover { color: var(--copper-400); }

/* Hero */
.hero-scene {
  position: relative;
  padding: 4rem 0 2.5rem;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}
.hero-scene::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 900px 420px at 50% 120%, rgba(70,169,221,0.14), transparent 70%);
  pointer-events: none;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ion-400);
  margin-bottom: 1.1rem;
  position: relative;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin: 0 0 1.1rem;
  color: var(--ash-100);
  position: relative;
}
.hero-title em { font-style: italic; color: var(--copper-400); font-weight: 500; }
.hero-deck {
  font-size: 1.14rem;
  line-height: 1.62;
  color: var(--ash-200);
  max-width: 62ch;
  margin: 0 0 2.2rem;
  position: relative;
}
.hero-deck strong { color: var(--ash-100); font-weight: 600; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.stat-box { background: var(--space-900); padding: 1.1rem 1.2rem; }
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--copper-400);
  line-height: 1.1;
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.stat-value.ion { color: var(--ion-400); }
.stat-value.scar { color: var(--scar-500); }
.stat-label { font-size: 0.82rem; color: var(--ash-400); line-height: 1.4; }

/* Figures */
.figure { margin: 2.2rem 0 1.8rem; }
.figure:first-child { margin-top: 0; }
.figure figcaption {
  margin-top: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--ash-400);
}
.figure figcaption a { color: var(--ash-400); }
.figure figcaption a:hover { color: var(--copper-400); }

/* Sections */
section.block { padding: 3.2rem 0; border-bottom: 1px solid var(--line-soft); }
section.block:last-of-type { border-bottom: none; }
.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ash-400);
  margin-bottom: 0.7rem;
}
h2.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  line-height: 1.22;
  color: var(--ash-100);
  margin: 0 0 1.2rem;
  max-width: 30ch;
}
.prose p { margin: 0 0 1.15rem; color: var(--ash-200); }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ash-100); font-weight: 600; }
.prose em { color: var(--copper-400); font-style: italic; }

.pull {
  border-left: 3px solid var(--copper-500);
  padding: 0.2rem 0 0.2rem 1.2rem;
  margin: 1.6rem 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ash-100);
  font-style: italic;
}

/* Compare bars: Earth vs Moon */
.compare {
  display: grid;
  gap: 1.1rem;
  margin: 1.8rem 0 0;
}
.compare-row { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 0.9rem; }
.compare-label { font-family: var(--font-mono); font-size: 0.84rem; color: var(--ash-200); }
.compare-track { height: 30px; background: var(--space-800); border-radius: 6px; overflow: hidden; border: 1px solid var(--line-soft); }
.compare-fill { height: 100%; border-radius: 6px 0 0 6px; }
.compare-fill.earth { background: var(--copper-500); width: 1.9%; }
.compare-fill.moon { background: var(--ion-500); width: 100%; }
.compare-value { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 600; color: var(--ash-100); text-align: right; font-variant-numeric: tabular-nums; }

/* Explorer tool */
.tool {
  background: linear-gradient(180deg, var(--space-900), var(--space-850));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.8rem 1.6rem 2rem;
}
.tool-head { margin-bottom: 1.4rem; }
.tool-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ash-100);
  margin: 0 0 0.5rem;
}
.tool-desc { color: var(--ash-400); font-size: 0.95rem; max-width: 64ch; margin: 0; }

.map-wrap { position: relative; margin-top: 1.4rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: radial-gradient(ellipse 100% 100% at 50% 40%, #101a2c, #080b11); }
.map-svg { display: block; width: 100%; height: auto; }
.map-svg .landmass { fill: #1a2436; stroke: rgba(238,241,246,0.10); stroke-width: 0.4; }
.crater-dot { cursor: pointer; fill: var(--copper-400); fill-opacity: 0.78; stroke: var(--copper-600); stroke-width: 0.6; transition: opacity 0.3s ease, fill-opacity 0.3s ease, r 0.3s ease; }
.crater-dot.hidden-age { opacity: 0.06; pointer-events: none; }
.crater-dot:hover, .crater-dot.picked { fill: var(--ion-400); fill-opacity: 1; stroke: var(--ash-100); stroke-width: 1.4; }

.map-controls { margin-top: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.slider-row { display: flex; align-items: center; gap: 0.9rem; }
.slider-row label { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ash-400); min-width: 108px; }
input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--space-700);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--copper-400);
  border: 2px solid var(--space-950);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--copper-400);
  border: 2px solid var(--space-950);
  cursor: pointer;
}
.slider-readout { font-family: var(--font-mono); font-size: 0.84rem; color: var(--copper-400); min-width: 128px; text-align: right; font-variant-numeric: tabular-nums; }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ash-400);
  background: var(--space-800);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}
.chip.active { color: var(--space-950); background: var(--ion-400); border-color: var(--ion-400); font-weight: 600; }

.detail-panel {
  margin-top: 1.2rem;
  border-top: 1px solid var(--line-soft);
  padding-top: 1.1rem;
  min-height: 4.6rem;
}
.detail-empty { color: var(--ash-400); font-size: 0.9rem; font-family: var(--font-mono); }
.detail-name { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; color: var(--ash-100); margin: 0 0 0.3rem; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 1.4rem; font-family: var(--font-mono); font-size: 0.86rem; color: var(--ash-200); }
.detail-meta span { color: var(--ash-400); }
.detail-meta strong { color: var(--copper-400); font-weight: 600; }

.tool-foot {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.82rem;
  color: var(--ash-400);
}

/* Timeline list */
.timeline { margin: 1.6rem 0 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 1.4rem 1.6rem; border-left: 1px solid var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute; left: -4.5px; top: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--copper-500);
}
.timeline .year { font-family: var(--font-mono); font-size: 0.8rem; color: var(--copper-400); display: block; margin-bottom: 0.25rem; }
.timeline p { margin: 0; color: var(--ash-200); }

/* Sources */
.sources-list { margin: 0; padding: 0; list-style: none; }
.sources-list li { padding: 0.85rem 0; border-top: 1px solid var(--line-soft); font-size: 0.92rem; color: var(--ash-200); }
.sources-list li:first-child { border-top: none; }
.sources-list .src-what { color: var(--ash-400); font-size: 0.86rem; display: block; margin-top: 0.2rem; }
.status-note {
  font-size: 0.86rem;
  color: var(--ash-400);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-top: 1.4rem;
}

/* Footer */
.site-footer { padding: 2.4rem 1.5rem 3.2rem; text-align: center; color: var(--ash-400); font-size: 0.86rem; }
.footer-links { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; margin-top: 0.7rem; }
.footer-links a { color: var(--ash-400); text-decoration: none; }
.footer-links a:hover { color: var(--copper-400); }

.back-top {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  background: var(--space-800);
  border: 1px solid var(--line);
  color: var(--ash-200);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 40;
}
.back-top.visible { opacity: 1; pointer-events: auto; }

.no-js .js-only { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .crater-dot, .back-top { transition: none; }
}

@media (max-width: 640px) {
  .hero-scene { padding: 2.6rem 0 2rem; }
  section.block { padding: 2.4rem 0; }
  .tool { padding: 1.4rem 1.1rem 1.6rem; }
  .compare-row { grid-template-columns: 76px 1fr 70px; gap: 0.6rem; }
  .slider-row { flex-direction: column; align-items: stretch; gap: 0.4rem; }
  .slider-row label { min-width: 0; }
  .slider-readout { text-align: left; }
  .detail-meta { gap: 0.8rem 1.2rem; }
}
