/* ═══════════════════════════════════════════════════════
   Ojarim — Pollinator Atlas
   Main Stylesheet
   Veydrin Order | AGPL-3.0
   ═══════════════════════════════════════════════════════ */

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

/* ────────────── TOKENS ────────────── */
:root {
  /* Dark theme (default) */
  --bg:           #111114;
  --surface:      #1a1a1f;
  --surface2:     #222228;
  --surface3:     #2a2a32;
  --border:       #35353d;
  --amber:        #f0a400;
  --amber-glow:   rgba(240,164,0,0.15);
  --amber-dim:    rgba(240,164,0,0.06);
  --sage:         #79aa6d;
  --sage-light:   #9ec490;
  --sky:          #7ab3d4;
  --cream:        #f4e9d4;
  --muted:        #8a8a94;
  --text:         #e0d4bc;
  --danger:       #d45555;
  --focus-ring:   #f0a400;

  /* Layout */
  --header-h:     64px;
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    12px;
  --radius-pill:  50px;

  /* Type */
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
}

/* ────────────── BASE ────────────── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* ────────────── SCREEN READER ONLY ────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ────────────── SKIP LINK ────────────── */
.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  background: var(--amber);
  color: var(--bg);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  z-index: 10000;
  text-decoration: none;
}

.skip-link:focus {
  inset-inline-start: 0;
}

/* ────────────── FOCUS ────────────── */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ────────────── HEADER ────────────── */
.site-header {
  height: var(--header-h);
  background: var(--surface);
  border-block-end: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-inline: 1.75rem;
  gap: 1.5rem;
  position: relative;
  flex-shrink: 0;
}

.site-header::after {
  content: '';
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='48'%3E%3Cpolygon points='28,1 55,15 55,33 28,47 1,33 1,15' fill='none' stroke='%23f0a40018' stroke-width='1'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1;
  text-decoration: none;
}

.logo svg {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--amber);
  line-height: 1;
  letter-spacing: -0.01em;
}

.logo-text .tagline {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Data badge */
.data-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: var(--sage);
  background: rgba(121,170,109,0.08);
  border: 1px solid rgba(121,170,109,0.2);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  z-index: 1;
}

.data-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--sage);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

/* Header nav */
.main-nav {
  margin-inline-start: auto;
  display: flex;
  gap: 0.4rem;
  z-index: 1;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.45rem 1.2rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.tab-btn:hover:not(.active) {
  border-color: var(--amber);
  color: var(--amber);
}

.tab-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--bg);
  font-weight: 600;
}

/* More dropdown */
.nav-more {
  position: relative;
}

.nav-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 2000;
}

.nav-more-menu[hidden] {
  display: none;
}

.nav-more-menu .tab-btn {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
}

.nav-more-menu .tab-btn:hover,
.nav-more-menu .tab-btn:focus-visible {
  background: var(--surface2);
}

#nav-more-btn {
  gap: 0.25rem;
}

#nav-more-btn.has-active {
  color: var(--amber);
  border-color: rgba(240,164,0,0.3);
}

/* Language switcher */
.lang-switcher {
  z-index: 1;
  position: relative;
}

.lang-switcher select {
  appearance: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 0.35rem 2rem 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.lang-switcher::after {
  content: '▾';
  position: absolute;
  inset-inline-end: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.7rem;
  pointer-events: none;
}

.header-btn {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1;
  transition: border-color 0.18s, color 0.18s;
}

.header-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* Share button */
.share-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--sage);
  border-color: rgba(121,170,109,0.3);
  border-radius: var(--radius-pill);
  z-index: 1;
}

.share-btn:hover,
.share-btn:focus-visible {
  color: var(--sage-light);
  border-color: var(--sage);
}

/* Theme switcher */
.theme-switcher {
  position: relative;
  z-index: 2001;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.theme-menu[hidden] {
  display: none;
}

.theme-option {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.theme-option:hover,
.theme-option:focus-visible {
  background: var(--surface2);
}

.theme-option[aria-selected="true"] {
  color: var(--amber);
  font-weight: 600;
}

/* ────────────── MAIN CONTENT ────────────── */
main {
  position: relative;
  width: 100%;
}

.mode {
  display: none;
}

.mode.active {
  display: block;
}

.dashboard-mode.mode.active {
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h) - 36px);
  max-height: calc(100dvh - var(--header-h) - 36px);
}

/* ────────────── DISCOVERY MAP ────────────── */
#discovery-mode {
  position: relative;
}

#map {
  width: 100%;
  height: calc(100vh - var(--header-h) - 36px);
  height: calc(100dvh - var(--header-h) - 36px);
  background: var(--bg);
}

.leaflet-tile-pane {
  filter: invert(90%) hue-rotate(180deg) saturate(0.7) brightness(0.85);
}

/* Map filters */
.map-filters {
  position: absolute;
  top: 1rem;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 0.4rem;
  background: rgba(17,17,20,0.9);
  backdrop-filter: blur(12px);
  padding: 0.45rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  padding: 0.38rem 1rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 30px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  white-space: nowrap;
}

.filter-btn.active {
  background: var(--amber-glow);
  border-color: var(--amber);
  color: var(--amber);
}

.filter-btn:hover:not(.active) {
  color: var(--text);
}

/* Map legend */
.map-legend {
  position: absolute;
  bottom: 1.5rem;
  inset-inline-start: 1.5rem;
  z-index: 1000;
  background: rgba(17,17,20,0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
}

.legend-title {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.65rem;
  margin-block-end: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  margin-block-end: 0.3rem;
}

.legend-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend-icon svg {
  width: 100%;
  height: 100%;
}

/* Map status */
.map-status {
  position: absolute;
  bottom: 1.5rem;
  inset-inline-end: 1.5rem;
  z-index: 1000;
  background: rgba(17,17,20,0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.74rem;
  color: var(--muted);
  transition: color 0.2s;
}

.map-status.loading { color: var(--amber); }
.map-status.error   { color: var(--danger); }

/* ────────────── OBSERVATION POPUP ────────────── */
.leaflet-popup-content-wrapper {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5) !important;
  padding: 0 !important;
}

.leaflet-popup-tip-container { display: none; }
.leaflet-popup-content { margin: 0 !important; color: var(--text); width: auto !important; }

.obs-popup {
  min-width: 230px;
  max-width: 280px;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.obs-popup-photo {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.obs-popup-body { padding: 0.85rem; }

.obs-type-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-block-end: 0.45rem;
}

.pill-bumble-bee   { background: rgba(240,164,0,0.15);  color: var(--amber); }
.pill-honey-bee    { background: rgba(240,164,0,0.12);  color: #d4940a; }
.pill-solitary-bee { background: rgba(200,160,60,0.15); color: #c8a03c; }
.pill-butterfly    { background: rgba(158,196,144,0.15); color: var(--sage-light); }
.pill-hoverfly     { background: rgba(122,179,212,0.15); color: var(--sky); }
.pill-moth         { background: rgba(180,160,200,0.15); color: #b4a0c8; }

.obs-common {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--cream);
  margin-block-end: 0.15rem;
}

.obs-sci {
  font-size: 0.73rem;
  font-style: italic;
  color: var(--muted);
  margin-block-end: 0.55rem;
}

.obs-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.obs-action {
  margin-block-start: 0.6rem;
  padding: 0.4rem 0.75rem;
  background: var(--amber-glow);
  border: 1px solid rgba(240,164,0,0.3);
  border-radius: var(--radius-sm);
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  width: 100%;
  text-align: center;
}

.obs-action:hover {
  background: rgba(240,164,0,0.25);
}

.obs-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-block-start: 0.4rem;
  font-size: 0.72rem;
  color: var(--sage);
  text-decoration: none;
  font-weight: 500;
}

.obs-link:hover { color: var(--sage-light); }

/* ────────────── SPECIES CARD MODAL ────────────── */
.species-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.species-modal-overlay.active {
  display: flex;
}

.species-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.species-card-close {
  position: absolute;
  top: 0.75rem;
  inset-inline-end: 0.75rem;
  background: rgba(0,0,0,0.4);
  border: none;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.species-card-photo {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.species-card-body {
  padding: 1.25rem;
}

.species-card-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--cream);
  margin-block-end: 0.15rem;
}

.species-card-sci {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  margin-block-end: 0.75rem;
}

.species-card-desc {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.7;
  margin-block-end: 1rem;
}

.species-card-field {
  margin-block-end: 0.75rem;
}

.species-card-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-block-end: 0.2rem;
}

.species-card-value {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

/* Threat indicator */
.threat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.threat-lc  { background: rgba(76,175,80,0.15);  color: #4caf50; }
.threat-nt  { background: rgba(139,195,74,0.15);  color: #8bc34a; }
.threat-vu  { background: rgba(255,183,77,0.15);  color: #ffb74d; }
.threat-en  { background: rgba(255,152,0,0.15);   color: #ff9800; }
.threat-cr  { background: rgba(244,67,54,0.15);   color: #f44336; }
.threat-dd  { background: rgba(158,158,158,0.15); color: #9e9e9e; }
.threat-ne  { background: rgba(189,189,189,0.1);  color: #bdbdbd; }

.species-card-action {
  margin-block-start: 1rem;
  padding: 0.65rem 1rem;
  background: var(--amber-glow);
  border: 1px solid rgba(240,164,0,0.3);
  border-radius: var(--radius-sm);
  color: var(--amber);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.5;
}

/* Tier 2 - Source links */
.species-sources {
  margin-block-start: 1rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--border);
}

.species-sources h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-block-end: 0.6rem;
}

.source-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0;
  border-block-end: 1px solid rgba(53,53,61,0.5);
}

.source-link:last-child { border: none; }

.source-link a {
  color: var(--sage);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
}

.source-link a:hover { color: var(--sage-light); }

.source-link .source-desc {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ────────────── COLONY HEALTH ────────────── */
.dashboard-mode {
  padding: 2rem 2.5rem;
  max-width: 1280px;
  margin-inline: auto;
}

.mode-header {
  margin-block-end: 2rem;
}

.mode-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--cream);
  margin-block-end: 0.35rem;
  line-height: 1.2;
}

.mode-header p {
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 600px;
  line-height: 1.6;
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-block-start: 0.6rem;
  font-size: 0.7rem;
  color: var(--sage);
  background: rgba(121,170,109,0.08);
  border: 1px solid rgba(121,170,109,0.18);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-block-end: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 2px;
  background: var(--amber);
  opacity: 0.6;
}

.stat-card.crisis::before  { background: var(--danger); opacity: 0.8; }
.stat-card.positive::before { background: var(--sage); }

.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-block-end: 0.6rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--amber);
  line-height: 1;
  margin-block-end: 0.4rem;
}

.stat-card.crisis .stat-value   { color: var(--danger); }
.stat-card.positive .stat-value { color: var(--sage-light); }
.stat-unit { font-size: 1rem; font-family: var(--font-body); }

.stat-sub { font-size: 0.74rem; color: var(--muted); line-height: 1.4; }
.stat-sub.alert { color: var(--danger); }
.stat-sub.ok    { color: var(--sage); }

/* Charts layout */
.charts-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.25rem;
  margin-block-end: 1.5rem;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.chart-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cream);
  margin-block-end: 0.25rem;
}

.chart-sub {
  font-size: 0.76rem;
  color: var(--muted);
  margin-block-end: 1.25rem;
}

/* Data table toggle (accessibility alternative to charts) */
.data-table-toggle {
  font-size: 0.72rem;
  color: var(--sage);
  background: none;
  border: 1px solid rgba(121,170,109,0.3);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  margin-block-start: 0.75rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-block-start: 0.75rem;
  display: none;
}

.data-table.visible { display: table; }

.data-table th,
.data-table td {
  padding: 0.4rem 0.6rem;
  text-align: start;
  border-block-end: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.data-table td { color: var(--text); }

/* Stressors */
.stressor-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stressor-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-block-end: 0.3rem;
}

.stressor-name { color: var(--text); }
.stressor-pct  { color: var(--amber); font-weight: 600; }

.bar-bg {
  height: 5px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--sage) 0%, var(--amber) 100%);
}

/* Bottom info cards */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.info-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cream);
  margin-block-end: 0.75rem;
}

.info-card p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.75;
}

.info-card p strong { color: var(--text); }

/* ────────────── THREAT DASHBOARD ────────────── */
.threat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.threat-scale {
  display: flex;
  gap: 0.35rem;
  margin-block-end: 2rem;
  flex-wrap: wrap;
}

.threat-scale-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.threat-scale-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ────────────── BLOOM CALENDAR ────────────── */
.bloom-region-select {
  margin-block-end: 1.5rem;
}

.bloom-region-select select {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 0.6rem 2.5rem 0.6rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  max-width: 400px;
}

.bloom-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.bloom-month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.bloom-month-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--cream);
  margin-block-end: 0.6rem;
}

.bloom-plant {
  font-size: 0.78rem;
  color: var(--text);
  padding: 0.3rem 0;
  border-block-end: 1px solid rgba(53,53,61,0.3);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.bloom-plant:last-child { border: none; }

.bloom-plant-name { flex: 1; }

.bloom-pollinators {
  font-size: 0.68rem;
  color: var(--muted);
}

/* ────────────── EDUCATORS ────────────── */
.educator-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.educator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.educator-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cream);
  margin-block-end: 0.25rem;
}

.educator-grade {
  font-size: 0.72rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-block-end: 0.75rem;
}

.educator-card p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.educator-download {
  margin-block-start: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--amber-glow);
  border: 1px solid rgba(240,164,0,0.3);
  border-radius: var(--radius-sm);
  color: var(--amber);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  align-self: flex-start;
}

.educator-download:hover {
  background: rgba(240,164,0,0.25);
}

/* ────────────── PARTNERS ────────────── */
.partners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.partner-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.partner-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--cream);
  margin-block-end: 0.2rem;
}

.partner-role {
  font-size: 0.7rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-block-end: 0.6rem;
}

.partner-card p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}

.partner-contributions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-block-start: 0.75rem;
}

.partner-tag {
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  background: var(--amber-dim);
  border: 1px solid rgba(240,164,0,0.15);
  border-radius: var(--radius-sm);
  color: var(--amber);
}

/* ────────────── ABOUT PANEL ────────────── */
.about-panel {
  position: fixed;
  inset-inline-end: 0;
  top: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
  z-index: 3000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 2rem 1.5rem;
}

[dir="rtl"] .about-panel {
  transform: translateX(-100%);
}

.about-panel.open {
  transform: translateX(0);
}

.about-panel h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--cream);
  margin-block-end: 1rem;
}

.about-panel p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
  margin-block-end: 0.75rem;
}

.about-panel a {
  color: var(--sage);
  text-decoration: none;
}

.about-panel a:hover { color: var(--sage-light); }

.donate-link {
  display: block;
  margin-block-start: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--amber-glow);
  border: 1px solid rgba(240,164,0,0.3);
  border-radius: var(--radius-sm);
  color: var(--amber);
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  font-size: 0.88rem;
}

.donate-link:hover {
  background: rgba(240,164,0,0.25);
  color: var(--amber);
}

/* ────────────── FOOTER ────────────── */
.site-footer {
  background: var(--surface);
  border-block-start: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.7rem;
  color: var(--muted);
  flex-shrink: 0;
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--sage);
  text-decoration: none;
  font-size: 0.7rem;
}

.footer-links a:hover { color: var(--sage-light); }

.footer-creed {
  margin-inline-start: auto;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ────────────── OFFLINE BANNER ────────────── */
.offline-banner {
  background: var(--amber-dim);
  border-block-end: 1px solid rgba(240,164,0,0.2);
  color: var(--amber);
  font-size: 0.78rem;
  padding: 0.5rem 1.5rem;
  text-align: center;
  display: none;
}

.offline-banner.visible {
  display: block;
}

/* ────────────── LOADING ────────────── */
#map-spinner {
  position: absolute;
  top: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
  pointer-events: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

#map-spinner.hidden { display: none; }

/* ────────────── RESPONSIVE ────────────── */
@media (max-width: 900px) {
  .site-header {
    gap: 0.75rem;
    padding-inline: 1rem;
  }
  .stats-row          { grid-template-columns: repeat(2, 1fr); }
  .charts-layout      { grid-template-columns: 1fr; }
  .bottom-row         { grid-template-columns: 1fr; }
  .bloom-grid         { grid-template-columns: repeat(2, 1fr); }
  .dashboard-mode     { padding: 1.5rem 1rem; }
}

@media (max-width: 640px) {
  .site-header {
    padding-inline: 0.75rem;
    gap: 0.5rem;
  }

  .main-nav {
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    background: var(--surface);
    border-block-start: 1px solid var(--border);
    padding: 0.5rem;
    gap: 0.25rem;
    margin: 0;
    z-index: 1500;
    justify-content: center;
  }

  .tab-btn {
    font-size: 0.72rem;
    padding: 0.4rem 0.6rem;
  }

  .data-badge { display: none; }

  #map {
    height: calc(100vh - var(--header-h) - 52px - 36px);
    height: calc(100dvh - var(--header-h) - 52px - 36px);
  }

  .dashboard-mode.mode.active {
    max-height: calc(100vh - var(--header-h) - 52px - 36px);
    max-height: calc(100dvh - var(--header-h) - 52px - 36px);
  }

  .site-footer {
    padding: 0.35rem 0.75rem;
    font-size: 0.62rem;
  }

  .footer-links { gap: 0.5rem; }
  .footer-links a { font-size: 0.62rem; }
  .footer-creed { font-size: 0.62rem; }

  .stats-row    { grid-template-columns: 1fr; }
  .bloom-grid   { grid-template-columns: 1fr; }

  .map-filters {
    top: 0.5rem;
    padding: 0.3rem;
    gap: 0.25rem;
    max-width: calc(100% - 1rem);
  }

  .filter-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }

  .nav-more-menu {
    top: auto;
    bottom: calc(100% + 6px);
  }

  .share-label {
    display: none;
  }

  .welcome-card {
    padding: 1rem 0;
  }

  .welcome-title {
    font-size: 2rem;
  }

  .welcome-audiences {
    grid-template-columns: 1fr;
  }

  .welcome-trust span {
    font-size: 0.6rem;
    padding: 0.2rem 0.5rem;
  }
}

@media (max-width: 380px) {
  .logo-text h1 { font-size: 1rem; }
  .logo-text .tagline { display: none; }
  .tab-btn { font-size: 0.65rem; padding: 0.35rem 0.5rem; }
  .header-btn { padding: 0.3rem 0.4rem; font-size: 0.75rem; }
}

/* ────────────── WELCOME OVERLAY ────────────── */
#welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#welcome-overlay.leaving {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

#welcome-overlay.gone {
  display: none;
}

.welcome-card {
  max-width: 540px;
  width: 100%;
  text-align: center;
  padding: 2rem 0;
}

.welcome-hero {
  margin-block-end: 1rem;
}

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

.welcome-bee {
  width: 80px;
  height: 80px;
  animation: beeFloat 3s ease-in-out infinite;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  color: var(--amber);
  letter-spacing: 0.04em;
  margin-block-end: 0.25rem;
}

.welcome-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-block-end: 2rem;
}

.welcome-features {
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-block-end: 2rem;
}

.welcome-feature {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.welcome-feature-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 2rem;
  text-align: center;
}

.welcome-feature strong {
  display: block;
  color: var(--cream);
  font-size: 0.88rem;
  margin-block-end: 0.15rem;
}

.welcome-feature span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.welcome-cta {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 0.75rem;
  padding: 0.85rem 2rem;
  background: var(--amber);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(240, 164, 0, 0.25);
}

.welcome-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(240, 164, 0, 0.35);
}

.welcome-share-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 1.5rem;
  padding: 0.65rem 2rem;
  background: transparent;
  color: var(--sage);
  border: 1px solid rgba(121, 170, 109, 0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.welcome-share-btn:hover {
  background: rgba(121, 170, 109, 0.08);
}

.welcome-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-block-end: 1.75rem;
}

.welcome-trust span {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--sage);
  background: rgba(121, 170, 109, 0.08);
  border: 1px solid rgba(121, 170, 109, 0.2);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.welcome-audiences {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  text-align: start;
  margin-block-end: 1.5rem;
}

@media (max-width: 480px) {
  .welcome-audiences {
    grid-template-columns: 1fr;
  }
}

.welcome-audience {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.welcome-audience-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-block-end: 0.5rem;
}

.welcome-audience-icon {
  font-size: 1.25rem;
}

.welcome-audience-header strong {
  font-size: 0.88rem;
  color: var(--cream);
}

.welcome-audience p {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.welcome-audience a {
  color: var(--sage);
  text-decoration: none;
}

.welcome-audience a:hover {
  color: var(--sage-light);
  text-decoration: underline;
}

.welcome-privacy {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto 0.5rem;
}

.welcome-privacy a {
  color: var(--sage);
  text-decoration: none;
}

.welcome-privacy a:hover {
  text-decoration: underline;
}

/* ────────────── BADGE GRID ────────────── */
.badge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.badge-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  text-align: center;
}

.badge-item.locked {
  opacity: 0.45;
}

.badge-item.unlocked {
  opacity: 1;
}

.badge-icon {
  font-size: 1.5rem;
  margin-block-end: 0.25rem;
}

.badge-name {
  font-size: 0.75rem;
  font-weight: 600;
  margin-block-end: 0.1rem;
}

.badge-tier {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-progress {
  margin-block-start: 0.35rem;
}

.badge-pct {
  font-size: 0.6rem;
  color: var(--muted);
}

@keyframes badgePop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.badge-item.unlocked .badge-icon {
  animation: badgePop 0.5s ease;
}

/* ────────────── BADGE TOAST ────────────── */
.badge-toast {
  position: fixed;
  bottom: 1.5rem;
  inset-inline-start: 50%;
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
  z-index: 9000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: none;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.badge-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.badge-toast.hide {
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
}

.badge-toast-icon {
  font-size: 2rem;
}

.badge-toast-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.badge-toast-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.badge-toast-tier {
  display: inline-block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.4rem;
  border: 1px solid;
  border-radius: 3px;
  margin-block-start: 0.2rem;
}

/* ────────────── 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;
  }

  .spinner { animation: none; border-top-color: var(--amber); }
}
