/* Fauna Command Center — accent overrides (shared rules in hub-base.css) */
.fa-root { --hub-accent: var(--guide-color-action); }

/* ═══ Species Cards with Conservation Status Badges ═════════════════════════ */

.fauna-species-card {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-3, #F7F5F0);
  transition: background 0.15s, transform 0.1s;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.fauna-species-card:hover { background: var(--bg-4, #EDEAE2); transform: translateX(2px); }

.fauna-species-icon {
  font-size: var(--guide-fs-2xl);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fauna-species-info { flex: 1; min-width: 0; }
.fauna-species-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary, #1A1A1F);
  display: flex;
  align-items: center;
  gap: 6px;
}
.fauna-species-latin {
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--text-tertiary, #6B6B73);
  margin-top: 1px;
}
.fauna-species-desc {
  font-size: var(--text-xxs);
  color: var(--text-secondary, #4A4A52);
  line-height: 1.35;
  margin-top: 3px;
}

/* Conservation status badges */
.fauna-status-badge {
  display: inline-block;
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.3px;
  line-height: 16px;
}
.fauna-status-badge--endangered { background: var(--guide-color-status-danger-bg); color: var(--guide-color-status-crit); }
.fauna-status-badge--threatened { background: #FEF3C7; color: var(--guide-color-ochre); }
.fauna-status-badge--candidate  { background: var(--guide-color-paper-2); color: var(--guide-color-plum); }
.fauna-status-badge--concern    { background: var(--guide-color-status-ok-bg, #F0FDF4); color: var(--guide-color-moss); }
.fauna-status-badge--stable     { background: color-mix(in srgb, var(--guide-color-lake) 10%, transparent); color: var(--guide-color-lake); }

/* ─── Fish Habitat Bars ─────────────────────────────────────────────────────── */

.fish-habitat-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
}
.fish-habitat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  min-width: 90px;
  color: var(--text-primary, #1A1A1F);
}
.fish-habitat-track {
  flex: 1;
  height: 8px;
  background: var(--bg-0, #e5ddd0);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.fish-habitat-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.fish-habitat-fill--excellent { background: var(--guide-color-moss); }
.fish-habitat-fill--good      { background: #4ade80; }
.fish-habitat-fill--fair       { background: #fde047; }
.fish-habitat-fill--poor       { background: var(--guide-color-clay); }
.fish-habitat-fill--critical   { background: var(--guide-color-status-crit); }

.fish-habitat-value {
  font-size: var(--text-xs);
  font-weight: 700;
  min-width: 36px;
  text-align: right;
  color: var(--text-primary, #1A1A1F);
}
.fish-habitat-threshold {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(0,0,0,0.35);
}

/* ─── Wildlife Corridor Cards ────────────────────────────────────────────── */

.fauna-corridor-card {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-3, #F7F5F0);
  transition: background 0.15s, transform 0.1s;
  cursor: pointer;
}
.fauna-corridor-card:hover { background: var(--bg-4, #EDEAE2); transform: translateX(2px); }

.fauna-corridor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.fauna-corridor-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary, #1A1A1F);
}
.fauna-corridor-score {
  font-size: var(--text-xxs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--guide-color-plum) 12%, transparent);
  color: var(--guide-color-plum);
}
.fauna-corridor-species {
  font-size: var(--text-xs);
  color: var(--text-secondary, #4A4A52);
  margin-top: 2px;
}
.fauna-corridor-barriers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.fauna-corridor-barrier-tag {
  font-size: var(--guide-fs-2xs);
  padding: 1px 5px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--guide-color-status-crit) 8%, transparent);
  color: var(--guide-color-status-crit);
  font-weight: 600;
}

/* ─── Spawning Calendar ──────────────────────────────────────────────────── */

.spawning-calendar {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}
.spawning-calendar th {
  padding: 3px 4px;
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  color: var(--text-tertiary, #6B6B73);
  text-align: center;
  border-bottom: 2px solid var(--border-default, var(--guide-color-border-default, rgba(0,0,0,0.1)));
}
.spawning-calendar td {
  padding: 2px 3px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.04));
}
.spawning-calendar .spawning-species-name {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-primary, #1A1A1F);
}
.spawning-window {
  display: inline-block;
  width: 100%;
  height: 14px;
  border-radius: 3px;
  transition: opacity 0.2s;
}
.spawning-window--active  { background: var(--guide-color-moss); opacity: 0.85; }
.spawning-window--peak    { background: var(--guide-color-moss); opacity: 1; }
.spawning-window--risk    { background: var(--guide-color-status-crit); opacity: 0.7; }
.spawning-window--inactive { background: transparent; }
.spawning-temp-tag {
  font-size: var(--guide-fs-2xs);
  color: var(--text-muted, #706F6D);
  display: block;
  margin-top: 1px;
}

/* ─── ESA Threat Gauges ──────────────────────────────────────────────────── */

.esa-gauge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.esa-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  background: var(--bg-3, #F7F5F0);
  border-radius: 6px;
  text-align: center;
}
.esa-gauge-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: 800;
  border: 3px solid currentColor;
  margin-bottom: 4px;
}
.esa-gauge-ring--critical { color: var(--guide-color-status-crit); }
.esa-gauge-ring--warning  { color: var(--guide-color-ochre); }
.esa-gauge-ring--ok       { color: var(--guide-color-moss); }

.esa-gauge-label {
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  color: var(--text-secondary, #4A4A52);
  line-height: 1.2;
}
.esa-gauge-status {
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6B6B73);
  margin-top: 1px;
}

/* ─── Fauna Layer Toggles ────────────────────────────────────────────────── */

/* ─── Fauna Insight Cards ────────────────────────────────────────────────── */

.fauna-insight-card {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--guide-color-line);
  transition: background 0.15s;
}
.fauna-insight-card:hover { background: var(--bg-4, #EDEAE2); }

.fauna-insight-header {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 3px;
}
.fauna-insight-icon {
  width: 18px;
  height: 18px;
  color: var(--hub-accent, #B45309);
  flex-shrink: 0;
}
.fauna-insight-card--critical .fauna-insight-icon { color: var(--guide-color-status-crit); }
.fauna-insight-card--warn .fauna-insight-icon     { color: var(--guide-color-ochre); }
.fauna-insight-card--info .fauna-insight-icon     { color: var(--guide-color-lake); }

.fauna-insight-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary, #1A1A1F);
}
.fauna-insight-body {
  font-size: var(--text-xxs);
  color: var(--text-secondary, #4A4A52);
  line-height: 1.4;
  margin-left: 24px;
}

/* ─── Basin Fisheries Table Enhancements ─────────────────────────────────── */

.basin-grade-badge {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  color: var(--guide-color-text-on-accent, #fff);
  font-weight: 700;
  font-size: var(--text-xs);
  text-align: center;
}

/* ─── Cite chip — peer-reviewed science indicator ────────────────────────── */

.fauna-cite-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px 1px 4px;
  border-radius: 9px;
  background: rgba(132, 166, 90, 0.10);
  border: 1px solid rgba(132, 166, 90, 0.32);
  color: var(--ai-accent-deep, #647F45);
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  line-height: 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  text-decoration: none;
  vertical-align: middle;
}
.fauna-cite-chip::before {
  content: 'i';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ai-accent-deep, #647F45);
  color: var(--guide-color-text-on-accent, #fff);
  font-family: var(--font-mono, monospace);
  font-size: var(--guide-fs-2xs);
  font-style: italic;
  font-weight: 700;
}
.fauna-cite-chip:hover {
  background: rgba(132, 166, 90, 0.18);
  border-color: rgba(132, 166, 90, 0.55);
}
.fauna-cite-chip:active { transform: translateY(0); }
.fauna-cite-chip[data-where="sidecar"]::after {
  content: '·';
  margin-left: 2px;
  opacity: 0.6;
}

/* ─── Scientific Methods Drawer ──────────────────────────────────────────── */

.fauna-methods-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(26,26,31,0.45);
  z-index: var(--guide-z-max, 9998);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--motion-ease, ease);
}
.fauna-methods-drawer-backdrop[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}
.fauna-methods-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 92vw);
  background: var(--bg-1, #F2EFE8);
  box-shadow: var(--shadow-xl, -8px 0 32px rgba(0,0,0,0.18));
  z-index: var(--guide-z-max, 9999);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s var(--motion-ease, ease);
}
.fauna-methods-drawer[data-open="true"] { transform: translateX(0); }

.fauna-methods-drawer-head {
  padding: 14px 18px;
  background: var(--guide-color-raised);
  border-bottom: 1px solid var(--border-subtle, var(--guide-color-border-subtle, rgba(0,0,0,0.06)));
  display: flex; align-items: center; justify-content: space-between;
}
.fauna-methods-drawer-title {
  font-size: var(--guide-fs-lg);
  font-weight: 800;
  color: var(--text-primary, #1A1A1F);
  display: flex; align-items: center; gap: 8px;
}
.fauna-methods-drawer-title::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ai-accent, #84A65A);
  box-shadow: 0 0 0 3px rgba(132,166,90,0.18);
}
.fauna-methods-drawer-close {
  border: none;
  background: transparent;
  color: var(--text-secondary, #4A4A52);
  font-size: var(--guide-fs-lg);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.fauna-methods-drawer-close:hover { background: var(--bg-4, #EDEAE2); }

.fauna-methods-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 22px;
}
.fauna-methods-section-label {
  font-size: var(--guide-fs-2xs);
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--text-tertiary, #6B6B73);
  margin: 14px 0 6px;
}
.fauna-methods-card {
  padding: 10px 12px;
  background: var(--bg-3, #F7F5F0);
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--guide-color-line);
  margin-bottom: 8px;
}
.fauna-methods-card[data-status="planned"] { opacity: 0.78; }
.fauna-methods-card-title {
  font-size: var(--guide-fs-sm);
  font-weight: 700;
  color: var(--text-primary, #1A1A1F);
  display: flex; gap: 6px; align-items: center;
}
.fauna-methods-card-where {
  font-size: var(--guide-fs-2xs); font-weight: 700; letter-spacing: 0.5px;
  padding: 1px 6px; border-radius: 8px; text-transform: var(--guide-label-case, uppercase);
  background: rgba(15,118,110,0.10); color: var(--mt-teal, #0F766E);
}
.fauna-methods-card-where[data-w="browser"] { background: rgba(59,90,122,0.10); color: var(--mt-slate, #3B5A7A); }
.fauna-methods-card-where[data-status="planned"] { background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.05); color: var(--text-tertiary, #6B6B73); }
.fauna-methods-card-desc {
  font-size: var(--guide-fs-xs);
  color: var(--text-secondary, #4A4A52);
  line-height: 1.5;
  margin: 6px 0 4px;
}
.fauna-methods-card-cite {
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6B6B73);
  font-style: italic;
  border-top: 1px dashed var(--border-subtle, var(--guide-color-border-subtle, rgba(0,0,0,0.06)));
  padding-top: 4px;
  margin-top: 4px;
}
.fauna-methods-card-cite a { color: var(--mt-teal, #0F766E); text-decoration: none; }
.fauna-methods-card-cite a:hover { text-decoration: underline; }

/* ─── Sources tail (under AI answers) ─────────────────────────────────────── */

.fauna-sources-tail {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(132,166,90,0.06);
  border-radius: var(--radius-md, 8px);
}
.fauna-sources-tail-title {
  font-size: var(--guide-fs-2xs);
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--ai-accent-deep, #647F45);
  margin-bottom: 4px;
}
.fauna-sources-tail-list {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.fauna-sources-tail-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 9px;
  background: var(--bg-1, #F2EFE8);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0,0,0,0.10)));
  color: var(--text-secondary, #4A4A52);
}
.fauna-sources-tail-chip[data-status="ok"]::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--severity-success, #157347);
}
.fauna-sources-tail-chip[data-status="degraded"]::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--severity-warn, #B45309);
}
.fauna-sources-tail-chip[data-status="key_required"]::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--mt-slate, #3B5A7A);
}

/* ─── Observation feed (eBird + iNat + GBIF photo grid) ───────────────────── */

.fauna-obs-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}
.fauna-obs-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  background: var(--bg-4, #EDEAE2);
  cursor: pointer;
}
.fauna-obs-card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.fauna-obs-card-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 4px 6px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.65));
  color: var(--guide-color-text-on-accent, #fff);
  font-size: var(--guide-fs-2xs);
  line-height: 1.25;
}
.fauna-obs-card-name { font-weight: 700; }
.fauna-obs-card-date { opacity: 0.85; font-size: var(--guide-fs-2xs); }
.fauna-obs-card-source {
  position: absolute; top: 4px; right: 4px;
  font-size: var(--guide-fs-2xs);
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 8px;
  background: rgba(255,255,255,0.92);
  color: var(--text-primary, #1A1A1F);
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.4px;
}
/* One source pill style: a plain label, not a hue per provider. */
.fauna-obs-more { margin-top: var(--guide-sp-2); }
.fauna-obs-more > summary { cursor: pointer; font-size: var(--guide-fs-sm); font-weight: 600; color: var(--guide-color-action); padding: var(--guide-sp-2) 0; }
.fauna-obs-more[open] > summary { margin-bottom: var(--guide-sp-2); }

/* ─── Thermal regime strip (365-day color band) ────────────────────────────── */

.fauna-thermal-strip {
  width: 100%;
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border-subtle, var(--guide-color-border-subtle, rgba(0,0,0,0.06)));
  background: var(--bg-3, #F7F5F0);
}
.fauna-thermal-strip-day { flex: 1 0 auto; height: 100%; }
.fauna-thermal-strip-day[data-band="cold"]    { background: #1E3A8A; }
.fauna-thermal-strip-day[data-band="cool"]    { background: #0F766E; }
.fauna-thermal-strip-day[data-band="optimal"] { background: var(--guide-color-moss); }
.fauna-thermal-strip-day[data-band="warm"]    { background: var(--guide-color-ochre); }
.fauna-thermal-strip-day[data-band="hootowl"] { background: var(--guide-color-status-crit); }
.fauna-thermal-strip-day[data-band="lethal"]  { background: var(--guide-color-plum); }
.fauna-thermal-strip-legend {
  display: flex; gap: 8px; font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6B6B73);
  margin-top: 4px;
  flex-wrap: wrap;
}
.fauna-thermal-strip-legend-swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 3px; vertical-align: middle;
}

/* ─── E-flow functional cards (5 components) ──────────────────────────────── */

.fauna-eflow-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.fauna-eflow-card {
  padding: 6px 8px;
  background: var(--bg-3, #F7F5F0);
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--guide-color-line);
  text-align: center;
}
.fauna-eflow-card-label {
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--text-tertiary, #6B6B73);
}
.fauna-eflow-card-value {
  font-size: var(--guide-fs-lg);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary, #1A1A1F);
  margin: 2px 0;
}
.fauna-eflow-card-delta {
  font-size: var(--guide-fs-2xs);
  color: var(--text-secondary, #4A4A52);
}

@media (max-width: 768px) {
  .fauna-eflow-grid { grid-template-columns: repeat(2, 1fr); }
  .fauna-methods-drawer { width: 100vw; }
}

/* ═══ Mobile Responsive ═════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .esa-gauge-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .fauna-species-card {
    padding: 6px 8px;
  }
  .fauna-species-icon {
    font-size: var(--guide-fs-lg);
    width: 26px;
    height: 26px;
  }
  .fauna-corridor-card {
    padding: 6px 8px;
  }
  .spawning-calendar th,
  .spawning-calendar td {
    padding: 2px;
    font-size: var(--guide-fs-2xs);
  }
  .fish-habitat-label {
    min-width: 70px;
    font-size: var(--guide-fs-2xs);
  }
  .fauna-insight-body {
    margin-left: 0;
    margin-top: 4px;
  }
}

@media (max-width: 480px) {
  .esa-gauge-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  .esa-gauge {
    padding: 4px;
  }
  .esa-gauge-ring {
    width: 36px;
    height: 36px;
    font-size: var(--text-sm);
    border-width: 2px;
  }
  .fauna-species-card {
    flex-direction: column;
    gap: 4px;
  }
  .fauna-species-icon {
    font-size: var(--text-lg);
    width: 22px;
    height: 22px;
  }
  .fauna-corridor-barriers {
    gap: 3px;
  }
  .spawning-calendar {
    font-size: var(--guide-fs-2xs);
  }
  .spawning-window {
    height: 10px;
  }
  .fish-habitat-label {
    min-width: 60px;
    font-size: var(--guide-fs-2xs);
  }
  .fish-habitat-track {
    height: 6px;
  }
  
  
  .fauna-insight-title {
    font-size: var(--text-xxs);
  }
  .fauna-insight-body {
    font-size: var(--text-xs);
  }
}

/* Dark-theme overrides — amber text (#D97706) fails on dark surfaces; pastel
   badge backgrounds are swapped for semi-transparent dark-mode equivalents. */
[data-theme="dark"] .fauna-status-badge--endangered { background: color-mix(in srgb, var(--guide-color-brick) 15%, transparent); color: var(--guide-color-status-crit); }
[data-theme="dark"] .fauna-status-badge--threatened { background: color-mix(in srgb, var(--guide-color-ochre-fill) 15%, transparent); color: var(--guide-color-status-watch); }
[data-theme="dark"] .fauna-status-badge--candidate  { background: rgba(129,140,248,0.15); color: #818CF8; }
[data-theme="dark"] .fauna-status-badge--concern    { background: rgba(74,222,128,0.12); color: #4ADE80; }

[data-theme="dark"] .esa-gauge-ring--warning        { color: var(--guide-color-status-watch); }
[data-theme="dark"] .fauna-insight-card--warn .fauna-insight-icon { color: var(--guide-color-status-watch); }

/* Thermal strip warm band — D97706 amber fine on orange bg, but warm-day strip itself
   is a data visualization with explicit bg color; keep as-is. */
