:root {
  --bg: #1a1a1a;
  --bg-alt: #222;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #c9a84c;
  --accent-dim: #8a7332;
  --green: #4a7c59;
  --green-dim: #2d4a36;
  --border: #333;
  --font: 'Georgia', 'Times New Roman', serif;
  --font-sans: 'Helvetica Neue', 'Arial', sans-serif;
  --font-mono: 'Courier New', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  font-size: 17px;
}

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

a:hover {
  color: #e0c060;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(10px);
  z-index: 100;
}

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

.site-logo {
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: normal;
  letter-spacing: 0.05em;
}

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

.site-logo a:hover {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: normal;
  line-height: 1.3;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.6rem;
  margin: 2rem 0 1rem;
}

h3 {
  font-size: 1.2rem;
  margin: 1.5rem 0 0.5rem;
}

p {
  margin-bottom: 1.2rem;
}

blockquote {
  border-left: 3px solid var(--accent-dim);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Hero */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 2.8rem;
  letter-spacing: 0.03em;
}

.hero .subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: 0.5rem;
  font-style: italic;
}

.hero .description {
  max-width: 600px;
  margin: 1.5rem auto;
  color: var(--text-muted);
}

/* Episode cards */
.episode-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin: 2rem 0;
}

.episode-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem 2rem;
  transition: border-color 0.2s, background 0.2s;
}

.episode-card:hover {
  border-color: var(--accent-dim);
  background: rgba(201, 168, 76, 0.03);
}

.episode-card .ep-number {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.episode-card h2 {
  margin: 0.3rem 0;
  font-size: 1.4rem;
}

.episode-card h2 a {
  color: var(--text);
}

.episode-card h2 a:hover {
  color: var(--accent);
}

.episode-card .description {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.episode-card .meta {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

/* Data story cards */
.story-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  transition: border-color 0.2s, background 0.2s;
}

.story-card:hover {
  border-color: var(--green-dim);
  background: rgba(74, 124, 89, 0.03);
}

.story-card .tag {
  display: inline-block;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 0.5rem;
}

.story-card h2 a {
  color: var(--text);
}

.story-card h2 a:hover {
  color: var(--accent);
}

/* Map */
.map-container {
  width: 100%;
  height: 500px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 1.5rem 0;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.map-legend {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  color: var(--text);
  z-index: 10;
  max-width: 250px;
}

.map-legend h4 {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.map-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.3rem 0;
}

.map-legend .legend-color {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Map controls */
.map-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-family: var(--font-sans);
}

.map-controls button {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.map-controls button:hover,
.map-controls button.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Species explorer */
.species-explorer {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.species-explorer input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
}

.species-explorer input:focus {
  outline: none;
  border-color: var(--accent);
}

.species-results {
  margin-top: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.species-result {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

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

.species-result .scientific-name {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.species-result .common-name {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.species-result .rank-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  margin-left: 0.5rem;
}

.rank-G1, .rank-G2 { background: #8b0000; color: #fff; }
.rank-G3 { background: #cc6600; color: #fff; }
.rank-G4 { background: #cccc00; color: #000; }
.rank-G5 { background: #2d7a3e; color: #fff; }

/* Data viz */
.chart-container {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  margin: 2rem 0;
  background: var(--bg-alt);
}

.chart-container h3 {
  color: var(--accent);
  margin-top: 0;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bar-label {
  width: 180px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex-grow: 1;
  height: 24px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.bar-value {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  color: var(--text);
}

/* Article styles */
.article-body {
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-body p {
  margin-bottom: 1.5rem;
}

.article-body .lead {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}

.article-body .data-callout {
  background: var(--bg-alt);
  border-left: 3px solid var(--green);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  border-radius: 0 4px 4px 0;
}

.article-body .data-callout .label {
  font-size: 0.75rem;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .site-nav { gap: 1rem; font-size: 0.8rem; }
  .hero h1 { font-size: 2rem; }
  .container, .container-narrow { padding: 0 1rem; }
  .map-container { height: 350px; }
  .bar-label { width: 120px; font-size: 0.75rem; }
  .map-controls button { font-size: 0.75rem; padding: 0.4rem 0.7rem; }
}