/* ==========================================================================
   Helsinki Wild Mushroom Foraging Field Companion
   Design System refactored in accordance with Refactoring UI (Adam Wathan & Steve Schoger)
   ========================================================================== */

:root {
  /* ------------------------------------------------------------------------
     1. Spacing Scale (Refactoring UI Chapter 3: Layout & Spacing)
     Consistent 4px/8px mathematical rhythm scale
     ------------------------------------------------------------------------ */
  --space-0-5: 0.125rem; /* 2px */
  --space-1:   0.25rem;  /* 4px */
  --space-1-5: 0.375rem; /* 6px */
  --space-2:   0.5rem;   /* 8px */
  --space-2-5: 0.625rem; /* 10px */
  --space-3:   0.75rem;  /* 12px */
  --space-4:   1rem;     /* 16px */
  --space-5:   1.25rem;  /* 20px */
  --space-6:   1.5rem;   /* 24px */
  --space-8:   2rem;     /* 32px */
  --space-10:  2.5rem;   /* 40px */
  --space-12:  3rem;     /* 48px */
  --space-16:  4rem;     /* 64px */

  /* ------------------------------------------------------------------------
     2. Typography & Modular Type Scale (Chapter 4: Designing Text)
     ------------------------------------------------------------------------ */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Charter", "Bitstream Charter", "Sitka Text", Georgia, Cambria, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;

  --text-2xs:  0.6875rem; /* 11px - Micro badges, tracked eyebrows */
  --text-xs:   0.75rem;   /* 12px - Badges, captions */
  --text-sm:   0.84375rem;/* 13.5px - Meta, secondary info */
  --text-base: 0.9375rem; /* 15px - Primary body text */
  --text-md:   1rem;      /* 16px - Controls, search inputs */
  --text-lg:   1.125rem;  /* 18px - Subheads, card titles */
  --text-xl:   1.25rem;   /* 20px - Section subheads */
  --text-2xl:  1.5rem;    /* 24px - Section headers */
  --text-3xl:  1.875rem;  /* 30px - Modal headers */
  --text-4xl:  2.25rem;   /* 36px - Site hero title */

  --leading-none:    1;
  --leading-tight:   1.2;
  --leading-snug:    1.375;
  --leading-normal:  1.5;
  --leading-relaxed: 1.65;
  --leading-loose:   1.8;

  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide:  0.025em;
  --tracking-wider: 0.05em;

  /* ------------------------------------------------------------------------
     3. Radii Scale (Chapter 8: Finishing Touches)
     ------------------------------------------------------------------------ */
  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  20px;
  --radius-full: 9999px;
  --radius:      12px;

  /* Max Measure Container */
  --measure: 74rem;

  /* ------------------------------------------------------------------------
     4. Dark Forest Palette (Default Theme)
     Deep obsidian-evergreen tones - eliminating muddy gray and harsh pitch black
     ------------------------------------------------------------------------ */
  --bg: #0c100e;
  --bg-subtle: #111714;
  --card-bg: #151d19;
  --card-hover: #1c2621;
  --card-active: #222f29;
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(255, 255, 255, 0.16);

  --rule: rgba(255, 255, 255, 0.09);
  --rule-subtle: rgba(255, 255, 255, 0.05);

  --fg: #f4f7f5;
  --muted: #95a59c;
  --faint: #64756c;

  /* Forest Emerald Primary Brand */
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --accent-border: rgba(16, 185, 129, 0.3);
  --accent-focus: rgba(16, 185, 129, 0.35);

  /* Danger / Deadly */
  --danger: #f87171;
  --danger-hover: #ef4444;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.3);

  /* Warning / Caution / Parboil */
  --warning: #fbbf24;
  --warning-hover: #f59e0b;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --warning-border: rgba(251, 191, 36, 0.3);

  /* Success / Choice */
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --success-border: rgba(52, 211, 153, 0.3);

  /* Info / Blue */
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.12);
  --info-border: rgba(56, 189, 248, 0.3);

  /* Multi-layer Depth & Shadows in Dark Mode (Chapter 6: Creating Depth) */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.45), 0 1px 2px -1px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -4px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-card-hover: 0 10px 22px -3px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.12);
  --shadow-glow: 0 0 15px rgba(16, 185, 129, 0.15);
  --shadow: var(--shadow-card);
}

[data-theme="light"] {
  /* Crisp Nordic Daylight Palette */
  --bg: #f8faf9;
  --bg-subtle: #f0f4f2;
  --card-bg: #ffffff;
  --card-hover: #f4f8f6;
  --card-active: #eaefec;
  --card-border: #e2e8e5;
  --card-border-hover: #cbd5d0;

  --rule: #e5ebe8;
  --rule-subtle: #eff4f1;

  --fg: #111815;
  --muted: #53645d;
  --faint: #889991;

  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: rgba(5, 150, 105, 0.08);
  --accent-border: rgba(5, 150, 105, 0.25);
  --accent-focus: rgba(5, 150, 105, 0.25);

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(220, 38, 38, 0.25);

  --warning: #d97706;
  --warning-hover: #b45309;
  --warning-soft: rgba(217, 119, 6, 0.08);
  --warning-border: rgba(217, 119, 6, 0.25);

  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.08);
  --success-border: rgba(5, 150, 105, 0.25);

  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.08);
  --info-border: rgba(2, 132, 199, 0.25);

  /* Multi-layer Soft Shadows in Light Mode */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-card-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.09), 0 4px 8px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 15px rgba(5, 150, 105, 0.12);
  --shadow: var(--shadow-card);
}

/* --------------------------------------------------------------------------
   Reset & Base Typography (Chapter 4: Modern Clean Sans-Serif Stack)
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  background-color: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--fg);
  text-wrap: balance;
  letter-spacing: var(--tracking-tight);
}

p, li, dd {
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Main Container Wrap */
.wrap {
  width: min(100%, var(--measure));
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-16);
}

/* --------------------------------------------------------------------------
   Top Navigation (Brand Badge, Forest Offline Pill, Emergency & Language)
   -------------------------------------------------------------------------- */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--rule);
  font-size: var(--text-sm);
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--fg);
  text-decoration: none;
  border: none;
  letter-spacing: var(--tracking-tight);
  transition: color 0.15s ease;
}

.brand-badge:hover {
  color: var(--accent);
  border: none;
}

.brand-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.brand-title {
  letter-spacing: -0.015em;
}

.forest-cache-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 4px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.forest-cache-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.cache-pill-icon {
  font-size: 0.85rem;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.emergency-dials {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dial-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dial-pill.poison {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}

.dial-pill.poison:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
}

.dial-pill.emergency {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

.dial-pill.emergency:hover {
  background: var(--danger);
  color: #ffffff;
  transform: translateY(-1px);
}

.lang-switcher-wrapper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.compare-toggle-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.compare-toggle-btn:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.compare-toggle-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.lang-row {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  background: none;
  border: none;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 42px;
  line-height: 1.2;
}

.lang-btn:hover {
  color: var(--fg);
}

.lang-btn.active {
  background: var(--card-bg);
  color: var(--fg);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--card-border);
}

.lang-btn.secondary-btn.active-secondary {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.lang-btn.disabled-lang {
  opacity: 0.3;
  cursor: not-allowed;
}

.theme-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.theme-btn:hover {
  color: var(--fg);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Site Header & Editorial Grounding Quote (Refactoring UI: Clear Hierarchy)
   -------------------------------------------------------------------------- */
.site-header {
  margin-bottom: var(--space-6);
}

.site-title {
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 var(--space-2) 0;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.site-subtitle {
  font-size: var(--text-base);
  color: var(--muted);
  margin: 0 0 var(--space-3) 0;
  line-height: var(--leading-relaxed);
  max-width: 48rem;
}

.ground-quote {
  font-family: var(--font-serif);
  font-style: italic;
  padding: var(--space-2-5) var(--space-4);
  margin: var(--space-3) 0 var(--space-6);
  border-left: 3px solid var(--accent);
  background: linear-gradient(to right, var(--accent-soft), transparent 85%);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: var(--leading-relaxed);
}

.ground-quote a {
  font-style: normal;
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  display: inline-block;
  margin-left: var(--space-2);
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px dotted var(--accent-border);
}

.ground-quote a:hover {
  border-bottom-style: solid;
}

/* Offline In-The-Wild Status Banner */
.offline-status-banner {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-border);
  color: var(--fg);
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4);
  text-align: center;
}

.offline-banner-content {
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

/* --------------------------------------------------------------------------
   Navigation Tabs (Segmented Control Layout - Finishing Touches)
   -------------------------------------------------------------------------- */
.nav-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  padding: var(--space-1);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: none;
  border: 1px solid transparent;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--fg);
  background: var(--card-hover);
}

.tab-btn.active {
  color: var(--fg);
  background: var(--card-bg);
  border-color: var(--card-border);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Curated Tier Switcher & Banner (Tab 1: Species Catalog)
   -------------------------------------------------------------------------- */
.view-mode-bar {
  display: inline-flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
}

.view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 6px 14px;
  border: 1px solid transparent;
  background: none;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-mode-btn:hover {
  color: var(--fg);
}

.view-mode-btn.active {
  background: var(--card-bg);
  color: var(--fg);
  border-color: var(--card-border);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.tier-intro-banner {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.tier-intro-banner.intermediate-theme {
  border-left-color: var(--warning);
}

.tier-intro-header {
  margin-bottom: var(--space-3);
}

.tier-badge-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.tier-badge {
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.tier-badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning-border);
}

.tier-count {
  font-size: var(--text-xs);
  color: var(--muted);
}

.tier-intro-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}

.tier-intro-subtitle {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--space-1);
}

.tier-intro-desc {
  font-size: var(--text-base);
  color: var(--fg);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

.tier-features-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.tier-feature-pill {
  font-size: var(--text-xs);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  color: var(--muted);
  font-weight: 500;
}

.tier-video-card {
  display: flex;
  gap: var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  align-items: stretch;
}

@media (max-width: 680px) {
  .tier-video-card {
    flex-direction: column;
  }
}

.tier-video-thumb-link {
  position: relative;
  width: 190px;
  min-width: 190px;
  height: 118px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000000;
  display: block;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 680px) {
  .tier-video-thumb-link {
    width: 100%;
    min-width: 100%;
    height: 160px;
  }
}

.tier-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.tier-video-thumb-link:hover .tier-video-thumb {
  transform: scale(1.04);
  opacity: 1;
}

.tier-video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: rgba(220, 38, 38, 0.92);
  color: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.tier-video-thumb-link:hover .tier-video-play-btn {
  transform: translate(-50%, -50%) scale(1.1);
  background: #dc2626;
}

.tier-video-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  backdrop-filter: blur(4px);
}

.tier-video-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.tier-video-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
}

.tier-video-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.tier-channel-link {
  font-size: var(--text-xs);
  color: var(--muted);
  text-decoration: none;
}

.tier-channel-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.tier-video-title {
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0 0 var(--space-1) 0;
  line-height: var(--leading-snug);
}

.tier-video-title a {
  color: var(--fg);
  text-decoration: none;
}

.tier-video-title a:hover {
  color: var(--accent);
}

.tier-video-desc {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: var(--leading-normal);
  margin: 0 0 var(--space-3) 0;
}

.tier-video-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.tier-channel-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 0.15s ease;
}

.tier-channel-btn:hover {
  color: var(--fg);
  border-color: var(--card-border-hover);
}

.tier-actions-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.tier-action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--accent);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.tier-action-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.tier-action-btn.secondary {
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--card-border);
}

.tier-action-btn.secondary:hover {
  background: var(--card-hover);
  border-color: var(--card-border-hover);
}

/* --------------------------------------------------------------------------
   Search & Filter Controls Panel (Refactoring UI: Breathable Spacing & Hierarchy)
   -------------------------------------------------------------------------- */
.controls-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
}

.search-box {
  position: relative;
  margin-bottom: var(--space-4);
}

.search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.05rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: var(--space-3) var(--space-8) var(--space-3) 2.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  color: var(--fg);
  font-size: var(--text-base);
  outline: none;
  transition: all 0.15s ease;
}

.search-box input:focus {
  border-color: var(--accent);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.search-clear-btn {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: var(--space-1);
  line-height: 1;
  border-radius: var(--radius-full);
  transition: color 0.15s ease;
}

.search-clear-btn:hover {
  color: var(--fg);
}

.search-quick-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1-5);
  margin-top: -0.25rem;
  margin-bottom: var(--space-4);
  font-size: var(--text-xs);
}

.quick-tags-label {
  color: var(--muted);
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-right: var(--space-1);
}

.quick-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.quick-tag-chip:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.quick-tag-chip.highlight {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.filters-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
}

.filters-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 4px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filters-toggle-btn:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.filters-toggle-btn.has-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.active-filters-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #ffffff;
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 0 4px;
  line-height: 1;
}

.filters-reset-btn {
  background: none;
  border: none;
  font-size: var(--text-xs);
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  padding: var(--space-1) var(--space-2);
  transition: color 0.15s ease;
}

.filters-reset-btn:hover {
  color: var(--danger);
}

.catalog-filter-drawer {
  margin-top: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--rule);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.family-filters-row {
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--rule);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  align-items: center;
}

.filter-label {
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--muted);
  margin-right: var(--space-1);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.pill-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  color: var(--fg);
  border-color: var(--card-border-hover);
}

.pill-btn.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.season-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  align-items: center;
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--rule);
}

.month-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  color: var(--muted);
  font-size: var(--text-xs);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.month-btn:hover {
  color: var(--fg);
}

.month-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Mushroom Cards & Grid (Refactoring UI: Multi-Layer Elevation & Visual Hierarchy)
   -------------------------------------------------------------------------- */
.mushroom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

.mushroom-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.mushroom-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-card-hover);
}

.card-image-wrap {
  position: relative;
  height: 210px;
  background-color: var(--bg-subtle);
  overflow: hidden;
}

.card-image-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

[data-theme="light"] .card-image-wrap::after {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.mushroom-card:hover .card-image-wrap img {
  transform: scale(1.04);
}

.card-badges {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  z-index: 2;
}

.badge {
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  line-height: 1.2;
}

.badge-choice   { background-color: rgba(5, 150, 105, 0.92); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.2); }
.badge-good     { background-color: rgba(2, 132, 199, 0.92); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.2); }
.badge-edible   { background-color: rgba(75, 85, 99, 0.92); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.2); }
.badge-parboil  { background-color: rgba(217, 119, 6, 0.92); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.2); }
.badge-deadly   { background-color: rgba(220, 38, 38, 0.92); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.2); }
.badge-inedible { background-color: rgba(107, 114, 128, 0.92); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.2); }
.badge-medicinal { background-color: rgba(124, 58, 237, 0.92); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.2); }

.star-rating {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: rgba(0, 0, 0, 0.65);
  color: #fbbf24;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 2;
  letter-spacing: 0.05em;
}

.card-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title-area {
  margin-bottom: var(--space-3);
}

.card-finnish-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--fg);
  line-height: var(--leading-snug);
  margin: 0;
  letter-spacing: var(--tracking-tight);
}

.card-secondary-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.card-latin-name {
  font-style: italic;
  font-size: var(--text-xs);
  color: var(--accent);
  margin-top: 2px;
}

.card-english-name {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 2px;
}

.card-secondary-alias {
  color: var(--faint);
  font-size: var(--text-xs);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  margin-bottom: var(--space-3);
  font-size: var(--text-xs);
}

.meta-tag {
  background: var(--bg-subtle);
  color: var(--muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--rule-subtle);
}

.card-morphology {
  background: var(--bg-subtle);
  border: 1px solid var(--rule-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

.morphology-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.morphology-label {
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.morphology-item span:not(.morphology-label) {
  color: var(--fg);
  line-height: 1.35;
}

.card-morph-secondary {
  font-size: var(--text-2xs);
  color: var(--faint);
}

.card-alert {
  background: var(--danger-soft);
  color: var(--danger);
  border-left: 3px solid var(--danger);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-3);
}

.card-tip {
  background: var(--warning-soft);
  color: var(--warning);
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-3);
}

.card-lookalike-pill {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1-5) var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-lookalike-pill:hover {
  background: var(--card-hover);
  border-color: var(--warning);
  color: var(--fg);
  transform: translateY(-1px);
}

.card-lk-icon { font-size: 0.9rem; }
.card-lk-label { font-weight: 600; }
.card-lk-name { color: var(--fg); }
.card-lk-deadly { font-size: 0.9rem; }

.card-footer {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule-subtle);
  font-size: var(--text-2xs);
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-ref-id {
  font-family: var(--font-mono);
  color: var(--faint);
  font-size: var(--text-2xs);
}

.card-view-cue {
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--accent);
  opacity: 0.75;
  transition: all 0.15s ease;
}

.mushroom-card:hover .card-view-cue {
  opacity: 1;
  color: var(--accent-hover);
  transform: translateX(2px);
}

.card-lookalike-alert {
  background: var(--warning-soft);
  color: var(--warning);
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-3);
}

.card-secondary-lk-alert {
  color: var(--muted);
  font-size: var(--text-2xs);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Detail View & Photo Swipe Carousel
   -------------------------------------------------------------------------- */
.mushroom-detail-view {
  font-family: var(--font-sans);
}

.detail-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  padding: var(--space-2-5) var(--space-4);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 0.5rem;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.detail-top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.btn-back-catalog {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  background: var(--fg);
  color: var(--bg);
  border: none;
  height: 32px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-xs);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.btn-back-catalog:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
}

.detail-nav-species-name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.bilingual-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

@media (max-width: 640px) {
  .bilingual-container {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
}

.bilingual-primary {
  color: var(--fg);
  line-height: var(--leading-relaxed);
  font-size: var(--text-base);
}

.bilingual-secondary {
  color: var(--muted);
  line-height: var(--leading-relaxed);
  font-size: var(--text-sm);
}

.detail-carousel-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
}

.carousel-viewport-wrapper {
  position: relative;
  width: 100%;
  background: #000000;
  overflow: hidden;
}

.detail-carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-behavior: smooth;
  width: 100%;
}

.detail-carousel-track::-webkit-scrollbar {
  display: none;
}

.detail-carousel-slide {
  flex: 0 0 100%;
  min-width: 100%;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
}

@media (min-width: 640px) {
  .detail-carousel-slide {
    height: 480px;
  }
}

.detail-carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.slide-caption-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
  color: #ffffff;
  padding: var(--space-6) var(--space-4) var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  pointer-events: none;
}

.slide-caption-title {
  font-size: var(--text-sm);
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.slide-photo-count {
  font-size: var(--text-2xs);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  white-space: nowrap;
}

.carousel-arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  z-index: 10;
}

.carousel-arrow-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) scale(1.08);
}

.carousel-arrow-btn.prev { left: var(--space-3); }
.carousel-arrow-btn.next { right: var(--space-3); }

.detail-carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-2-5);
  background: var(--card-bg);
  border-top: 1px solid var(--card-border);
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--rule);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.carousel-dot.active {
  background: var(--accent);
  width: 22px;
  border-radius: var(--radius-xs);
}

.detail-hero-info {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
}

.detail-title-block {
  margin-bottom: var(--space-4);
}

.detail-finnish-title {
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: var(--leading-tight);
  color: var(--fg);
  letter-spacing: var(--tracking-tight);
}

.detail-latin-title {
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--accent);
  margin-top: var(--space-1);
}

.detail-section-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
}

.detail-section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--fg);
  border-bottom: 1px solid var(--rule);
  padding-bottom: var(--space-2);
}

.detail-danger-card {
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-left: 5px solid var(--danger);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.detail-danger-title {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--danger);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.detail-header-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.detail-species-primary-name {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--fg);
  line-height: var(--leading-tight);
  margin: 0;
  letter-spacing: var(--tracking-tight);
}

.detail-species-secondary-name {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--muted);
  margin-left: var(--space-2);
}

.detail-species-latin-name {
  font-style: italic;
  font-size: var(--text-base);
  color: var(--accent);
  margin-top: var(--space-1);
}

.detail-species-alt-names {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--space-1);
}

.detail-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule-subtle);
  font-size: var(--text-sm);
  color: var(--fg);
}

.detail-meta-bar strong {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  display: inline-block;
  margin-right: var(--space-1);
}

.diagnostic-anatomy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.diagnostic-anatomy-item {
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
}

.diagnostic-anatomy-label {
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-1-5);
}

.diagnostic-anatomy-value {
  font-size: var(--text-sm);
  color: var(--fg);
  line-height: var(--leading-normal);
}

.secondary-trait-text {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--space-1);
}

.lookalike-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.lookalike-interactive-card {
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.lookalike-interactive-card:hover {
  transform: translateY(-3px);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-sm);
}

.lookalike-img-container {
  position: relative;
  height: 160px;
  background: #000000;
  overflow: hidden;
}

.lookalike-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.lookalike-interactive-card:hover .lookalike-img-container img {
  transform: scale(1.04);
}

.lookalike-content {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.lookalike-tag-header {
  margin-bottom: var(--space-1-5);
}

.lookalike-badge {
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  display: inline-block;
  line-height: 1.2;
}

.badge-risk-edible {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-risk-deadly {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge-risk-inedible {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-risk-parboil {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.lookalike-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 2px 0;
}

.lookalike-sub-title {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--muted);
}

.lookalike-subtitle {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.lookalike-morph-snippet {
  font-size: var(--text-xs);
  color: var(--fg);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  margin-top: auto;
}

.detail-action-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}

.detail-pager-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--fg);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.detail-pager-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.detail-pager-btn.next-pager {
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Comparator & Deadly Toxin Section (Tab 2)
   -------------------------------------------------------------------------- */
.comparator-section {
  font-family: var(--font-sans);
}

.comparator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.comparator-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-6);
}

.comparator-card-header,
.comparator-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--card-border);
  background: var(--bg-subtle);
}

.comparator-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}

.comparator-side-by-side,
.comparator-pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--card-border);
}

@media (max-width: 768px) {
  .comparator-side-by-side,
  .comparator-pair-grid {
    grid-template-columns: 1fr;
  }
}

.comparator-half,
.comparator-item {
  background: var(--card-bg);
  padding: var(--space-5);
}

.comparator-half.edible-side,
.comparator-item.edible {
  border-top: 4px solid var(--success);
  background: var(--card-bg);
}

.comparator-half.deadly-side,
.comparator-item.toxic {
  border-top: 4px solid var(--danger);
  background: var(--card-bg);
}

.comparator-species-name {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-1);
  color: var(--fg);
}

.comparator-img-wrap {
  margin: var(--space-3) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 220px;
  cursor: pointer;
  border: 1px solid var(--card-border);
}

.comparator-img-wrap img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.comparator-img-wrap:hover img {
  transform: scale(1.03);
}

.diff-checklist {
  list-style: none;
  margin-top: var(--space-3);
  padding: 0;
}

.diff-checklist li {
  padding: var(--space-1-5) 0;
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-sm);
  border-bottom: 1px dashed var(--rule);
  color: var(--fg);
}

.comparator-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}

.comparator-table th, .comparator-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.comparator-table th {
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wider);
}

/* --------------------------------------------------------------------------
   Transit Spots & Trails (Tab 4)
   -------------------------------------------------------------------------- */
.transit-spots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.spot-card,
.transit-spot-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.spot-card:hover,
.transit-spot-card:hover {
  transform: translateY(-3px);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-card-hover);
}

.spot-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.spot-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}

.spot-zone,
.zone-badge {
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}

.spot-transit,
.spot-transit-line {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: var(--space-3);
  line-height: var(--leading-normal);
}

.spot-trailhead-box,
.trailhead-box {
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  margin-top: auto;
}

.spot-trailhead-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1);
  font-size: var(--text-xs);
}

.prime-item-label {
  font-weight: 700;
  color: var(--fg);
}

.prime-item-value {
  color: var(--fg);
}

.prime-item-secondary {
  width: 100%;
  font-size: var(--text-2xs);
  color: var(--muted);
  margin-left: var(--space-4);
}

.btn-location-map,
.gmaps-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.btn-location-map:hover,
.gmaps-btn:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
}

.spot-species-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  margin-top: var(--space-2);
}

.species-tag {
  font-size: var(--text-2xs);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  color: var(--muted);
  font-weight: 500;
}

.btn-recipe-video,
.btn-video-link-sm {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-recipe-video:hover,
.btn-video-link-sm:hover {
  background: var(--danger);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Culinary, Preservation & Video Masterclasses (Tab 5)
   -------------------------------------------------------------------------- */
.inherited-cooking-notice {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.inherited-notice-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.inherited-notice-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 700;
  color: var(--accent);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.inherited-notice-text {
  color: var(--fg);
}

.inherited-species-link {
  color: var(--accent);
  text-decoration: underline;
}

.cooking-gallery-section {
  margin: var(--space-8) 0;
}

.cooking-gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.gallery-filter-btn {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.gallery-filter-btn:hover {
  color: var(--fg);
  border-color: var(--card-border-hover);
}

.gallery-filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.cooking-gallery-grid,
.video-masterclasses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

.cooking-gallery-card,
.culinary-video-card,
.video-recipe-card,
.video-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cooking-gallery-card:hover,
.culinary-video-card:hover,
.video-recipe-card:hover,
.video-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-card-hover);
}

.cooking-gallery-thumb-wrap,
.video-thumb-wrap {
  position: relative;
  height: 190px;
  background: #000000;
  display: block;
  overflow: hidden;
  text-decoration: none;
}

.cooking-gallery-thumb,
.video-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.cooking-gallery-thumb-wrap:hover .cooking-gallery-thumb,
.video-thumb-wrap:hover img {
  transform: scale(1.04);
  opacity: 1;
}

.cooking-gallery-play-btn,
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(220, 38, 38, 0.92);
  color: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  font-size: 1.25rem;
  transition: transform 0.15s ease, background 0.15s ease;
}

.cooking-gallery-thumb-wrap:hover .cooking-gallery-play-btn,
.video-thumb-wrap:hover .video-play-btn {
  transform: translate(-50%, -50%) scale(1.1);
  background: #dc2626;
}

.cooking-gallery-duration {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-2);
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  backdrop-filter: blur(4px);
}

.cooking-gallery-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  backdrop-filter: blur(8px);
}

.cooking-gallery-badge.nordic {
  background: rgba(14, 165, 233, 0.92);
  color: #ffffff;
}

.cooking-gallery-badge.chinese {
  background: rgba(220, 38, 38, 0.92);
  color: #ffffff;
}

.cooking-gallery-badge.foraging {
  background: rgba(16, 185, 129, 0.92);
  color: #ffffff;
}

.cooking-gallery-info,
.video-info {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.cooking-gallery-creator {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--space-1);
}

.gallery-creator-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.gallery-creator-link:hover {
  text-decoration: underline;
}

.cooking-gallery-card-title,
.video-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--fg);
  margin-bottom: var(--space-1);
  line-height: var(--leading-snug);
}

.cooking-gallery-card-subtitle {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.cooking-gallery-card-desc {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-4);
  flex-grow: 1;
}

.cooking-gallery-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule-subtle);
}

.gallery-channel-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  transition: all 0.15s ease;
}

.gallery-channel-pill:hover {
  background: var(--accent);
  color: #ffffff;
}

.cooking-gallery-card-header {
  padding: var(--space-5);
}

.cooking-card-body {
  padding: 0 var(--space-5) var(--space-5);
  font-size: var(--text-sm);
  color: var(--fg);
  line-height: var(--leading-relaxed);
}

.video-meta {
  font-size: var(--text-xs);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Integrated Monograph Reader (Full Monographs & Longform Handbook)
   -------------------------------------------------------------------------- */
.live-reader-container {
  font-family: var(--font-serif);
}

.integrated-monograph-header {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
}

.integrated-monograph-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  font-family: var(--font-sans);
}

.integrated-monograph-title {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--fg);
  margin-bottom: var(--space-1);
  line-height: var(--leading-tight);
}

.integrated-monograph-subtitle {
  font-size: var(--text-base);
  color: var(--muted);
  margin-bottom: var(--space-3);
}

.integrated-monograph-desc {
  font-size: var(--text-base);
  color: var(--fg);
  line-height: var(--leading-relaxed);
  max-width: 50rem;
}

.integrated-monograph-body {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  margin-bottom: var(--space-8);
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  box-shadow: var(--shadow-card);
}

.integrated-monograph-body h1,
.integrated-monograph-body h2,
.integrated-monograph-body h3 {
  color: var(--fg);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  line-height: var(--leading-snug);
}

.integrated-monograph-body p {
  margin-bottom: var(--space-4);
}

.integrated-monograph-body ul,
.integrated-monograph-body ol {
  margin-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.integrated-monograph-body li {
  margin-bottom: var(--space-1-5);
}

.integrated-monograph-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: var(--space-8) 0;
}

.btn-back-to-grid {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 6px 14px;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.btn-back-to-grid:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
}

.reader-badge {
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-border);
}

.reader-readtime {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--muted);
}

.integrated-monograph-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  margin-top: var(--space-6);
  border-top: 1px solid var(--rule);
}

.reader-pager-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  color: var(--muted);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reader-pager-btn:hover {
  color: var(--fg);
  border-color: var(--card-border-hover);
}

.reader-alert {
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: var(--space-5) 0;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  font-family: var(--font-sans);
}

.reader-alert.note {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  color: var(--fg);
}

.reader-alert.warning {
  background: var(--warning-soft);
  border-left: 4px solid var(--warning);
  color: var(--fg);
}

.reader-alert.danger {
  background: var(--danger-soft);
  border-left: 4px solid var(--danger);
  color: var(--fg);
}

.inline-species-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--accent);
  border-bottom: none;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all 0.15s ease;
}

.inline-species-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.inline-video-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 5px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--fg);
  border-bottom: none;
  margin-top: var(--space-2);
  transition: all 0.15s ease;
}

.inline-video-btn:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Lightbox Gallery Modal & Forest Cache Modal
   -------------------------------------------------------------------------- */
.gallery-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.gallery-modal-backdrop.open {
  display: flex;
}

.gallery-modal-content {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  width: min(100%, 56rem);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.gallery-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-sans);
}

.gallery-modal-title h3 {
  font-size: var(--text-lg);
  margin: 0;
  color: var(--fg);
}

.gallery-modal-title span {
  font-size: var(--text-xs);
  color: var(--muted);
  font-style: italic;
}

.gallery-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.gallery-close-btn:hover {
  color: var(--fg);
}

.gallery-stage {
  position: relative;
  background: #000000;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-main-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  transition: all 0.2s ease;
}

.gallery-nav-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) scale(1.08);
}

.gallery-nav-btn.prev { left: var(--space-3); }
.gallery-nav-btn.next { right: var(--space-3); }

.gallery-caption-bar {
  padding: var(--space-3) var(--space-5);
  background: var(--card-bg);
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.gallery-thumbnails-strip {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  overflow-x: auto;
  background: var(--bg);
  border-top: 1px solid var(--rule);
}

.gallery-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
}

.gallery-thumb.active {
  border-color: var(--accent);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Forest Cache Modal */
.forest-cache-modal-card {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  width: min(100%, 38rem);
  padding: var(--space-6);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-xl);
}

.forest-cache-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
}

.cache-status-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-xs);
}

.cache-status-info strong {
  display: block;
  font-size: var(--text-base);
  color: var(--fg);
  margin-bottom: var(--space-1);
}

.cache-status-info p {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: var(--leading-normal);
}

.cache-badge-ok {
  font-size: var(--text-2xs);
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}

.cache-progress-container {
  margin-top: var(--space-3);
}

.cache-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--rule);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-1);
}

.cache-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.cache-progress-text {
  font-size: var(--text-xs);
  color: var(--muted);
}

.btn-cache-action {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.btn-cache-action.primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-cache-action.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-cache-action.secondary {
  background: var(--card-bg);
  color: var(--muted);
  border: 1px solid var(--card-border);
}

.btn-cache-action.secondary:hover {
  background: var(--card-hover);
  color: var(--fg);
}

/* --------------------------------------------------------------------------
   Habitats, Trees & Phenology Styles (Tab 3)
   -------------------------------------------------------------------------- */
.habitat-site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.habitat-site-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.habitat-site-card:hover {
  transform: translateY(-3px);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-card-hover);
}

.habitat-site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.habitat-site-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}

.habitat-badge {
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}

.habitat-prop-block {
  font-size: var(--text-sm);
  color: var(--fg);
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  line-height: var(--leading-normal);
}

.habitat-prop-label {
  font-weight: 700;
  color: var(--fg);
  display: inline-block;
  margin-right: var(--space-1);
}

.phenology-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.phenology-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.phenology-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.phenology-month-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  margin-bottom: var(--space-2);
  align-self: flex-start;
}

.phenology-month-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 var(--space-1) 0;
}

.chanterelle-dilemma-card,
.tree-diagnostic-container {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-card);
}

.chanterelle-dilemma-card {
  border-left: 4px solid var(--accent);
}

.habitats-tree-img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  margin: var(--space-3) 0 var(--space-2);
}

.habitats-img-caption {
  font-size: var(--text-xs);
  color: var(--muted);
  text-align: center;
  margin-bottom: var(--space-4);
  font-style: italic;
}

.tree-cols-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.tree-col-card {
  background: var(--bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
}

.tree-col-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 var(--space-1) 0;
}

.tree-col-latin {
  font-size: var(--text-xs);
  color: var(--accent);
  margin-bottom: var(--space-3);
  font-style: italic;
}

.tree-feature-row {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--fg);
  margin-bottom: var(--space-2);
  border-bottom: 1px dashed var(--rule);
  padding-bottom: var(--space-1-5);
}

.tree-feature-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.btn-toggle-monograph {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--card-border);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.btn-toggle-monograph:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Site Footer (Living Guides & Philosophy Ecosystem)
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--rule);
}

.footer-ecosystem-title {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-3);
  color: var(--fg);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-6) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.footer-links li {
  color: var(--muted);
}

.footer-links a {
  color: var(--accent);
}

.footer-meta {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: var(--leading-relaxed);
}

/* --------------------------------------------------------------------------
   Responsive Layout Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .site-title {
    font-size: var(--text-3xl);
  }
  
  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .top-controls {
    width: 100%;
    justify-content: space-between;
  }

  .mushroom-grid {
    grid-template-columns: 1fr;
  }

  .view-mode-bar {
    flex-direction: column;
    border-radius: var(--radius-lg);
    width: 100%;
  }

  .view-mode-btn {
    width: 100%;
    justify-content: flex-start;
  }
}
