/* Dark mode — toggled via html[data-theme="dark"] */

html[data-theme="dark"] {
  --c-bg: #1b120b;
  --c-bg-alt: #241910;
  --c-bg-deep: #120c08;
  --c-fg-1: #f9f0e1;
  --c-fg-2: #e8dfd0;
  --c-fg-3: #c9bdae;
  --c-fg-4: #8b7b6c;
  --c-border: #3d3028;
  --c-border-strong: rgba(249, 240, 225, 0.45);
  --eyebrow-bg: var(--opan-cream);
  --eyebrow-fg: var(--opan-black);
}

html[data-theme="dark"] body {
  background: var(--c-bg);
  color: var(--c-fg-1);
}

html[data-theme="dark"] .ed-nav {
  background: #1b120b;
  color: #f9f0e1;
  border-bottom-color: rgba(249, 240, 225, 0.35);
}

html[data-theme="dark"] .ed-nav-tagline {
  color: var(--c-fg-3);
  border-left-color: var(--c-border-strong);
}

html[data-theme="dark"] .ed-nav-links a {
  color: #f9f0e1;
}

html[data-theme="dark"] .ed-nav-links a.is-current {
  color: var(--opan-red);
}

html[data-theme="dark"] .ed-theme-toggle {
  color: #f9f0e1;
  border-color: rgba(249, 240, 225, 0.35);
  background: transparent;
}

html[data-theme="dark"] .ed-theme-toggle:hover {
  background: rgba(249, 240, 225, 0.08);
}

html[data-theme="dark"] .ed-section {
  background: var(--c-bg);
}

html[data-theme="dark"] .ed-stats {
  background: var(--c-bg-alt);
  border-color: var(--c-border-strong);
}

html[data-theme="dark"] .ed-member-card,
html[data-theme="dark"] .ed-tool-card,
html[data-theme="dark"] .ed-practice-card,
html[data-theme="dark"] .ed-institution-card,
html[data-theme="dark"] .ed-bib-item,
html[data-theme="dark"] .ed-glimpse-frame,
html[data-theme="dark"] .ed-heatmap-panel,
html[data-theme="dark"] .ed-report-card {
  background: var(--c-bg-alt);
  border-color: var(--c-border-strong);
}

html[data-theme="dark"] .ed-form input,
html[data-theme="dark"] .ed-form textarea {
  background: #3d3028;
  color: #f9f0e1;
  border-color: var(--c-border-strong);
}

html[data-theme="dark"] .ed-mission-grid .ed-title,
html[data-theme="dark"] .ed-board-card h3 {
  color: #f9f0e1;
}

/* .ed-theme-card keeps a fixed white "paper" background in dark mode too,
   so its text needs fixed dark colors instead of following --c-fg-*. */
html[data-theme="dark"] .ed-theme-card h3 {
  color: var(--opan-black);
}

html[data-theme="dark"] .ed-theme-card p {
  color: var(--opan-graphite);
}

html[data-theme="dark"] .ed-card-hover:hover {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .ed-theme-article {
  background: var(--c-bg);
}

html[data-theme="dark"] .ed-theme-gallery-item {
  border-color: var(--c-border-strong);
}

/* World map: the legend chips and the Europe inset panel keep a fixed white
   "paper" background in every theme, so their text/labels need fixed dark
   colors instead of following --c-fg-* (which turns cream in dark mode). */
html[data-theme="dark"] .opan-chip {
  color: var(--opan-black);
  border-color: var(--opan-black);
}

html[data-theme="dark"] .opan-map-inset,
html[data-theme="dark"] .opan-inset-label {
  color: var(--opan-black);
}

.ed-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid var(--opan-black);
  background: transparent;
  color: var(--c-fg-1);
  font: 600 12px/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ed-theme-toggle:hover {
  background: rgba(27, 18, 11, 0.06);
}

.ed-theme-toggle-icon {
  font-size: 14px;
  line-height: 1;
}
