/* ═══════════════════════════════════════════════════════════════
   REDHORMIGÓN — Design System v2
   Aesthetic: Editorial Spanish Industrial — Art Deco meets brutalism
   ═══════════════════════════════════════════════════════════════ */

/* ─── TOKENS ─── */
:root {
  --red-es: #c60b1e;
  --red-dark: #8b0614;
  --red-glow: rgba(198, 11, 30, 0.2);
  --yellow-es: #f1bf00;
  --yellow-dim: rgba(241, 191, 0, 0.15);

  --bg: #0a0a0a;
  --bg-2: #111111;
  --surface: #181818;
  --surface-2: #202020;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #ede8e0;
  --text-2: #b8b0a4;
  --muted: #8a8078;
  --mid: #161616;

  --pattern-bg: var(--bg);
  --pattern-line: rgba(255, 255, 255, 0.03);
  --pattern-dot: rgba(198, 11, 30, 0.08);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
  --shadow-red: 0 0 30px rgba(198, 11, 30, 0.15);
  --nav-height: 68px;
}

/* ─── LIGHT MODE ─── */
[data-theme="light"] {
  --bg: #f5f0e8;
  --bg-2: #ede8dc;
  --surface: #ffffff;
  --surface-2: #f0ece4;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.18);
  --text: #1a1410;
  --text-2: #4a3f35;
  --muted: #6b5f55;
  --mid: #f8f3eb;

  --pattern-bg: var(--bg);
  --pattern-line: rgba(0, 0, 0, 0.04);
  --pattern-dot: rgba(198, 11, 30, 0.06);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
  --shadow-red: 0 0 30px rgba(198, 11, 30, 0.08);
}

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

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  margin: 0;
  transition: background var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; }

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

/* ─── BACKGROUND PATTERN ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--pattern-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--pattern-line) 1px, transparent 1px);
  background-size: 60px 60px;
  transition: opacity var(--transition-slow);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(var(--pattern-dot) 1.5px, transparent 1.5px);
  background-size: 30px 30px;
  background-position: 15px 15px;
  opacity: 0.8;
  transition: opacity var(--transition-slow);
}

[data-theme="light"] body::before {
  background-image:
    linear-gradient(var(--pattern-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--pattern-line) 1px, transparent 1px);
  background-size: 40px 40px;
}

[data-theme="light"] body::after {
  background-image:
    repeating-linear-gradient(45deg, var(--pattern-dot) 0px, var(--pattern-dot) 1px, transparent 1px, transparent 14px),
    repeating-linear-gradient(-45deg, var(--pattern-dot) 0px, var(--pattern-dot) 1px, transparent 1px, transparent 14px);
  background-size: 20px 20px;
}

nav, main, footer, .hero-wrapper, .modal-backdrop { position: relative; z-index: 1; }

/* ─── ACCESIBILIDAD ─── */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  background: var(--red-es);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  outline: 3px solid var(--yellow-es);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--yellow-es);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ─── FLAG STRIPE ─── */
.flag-stripe {
  height: 5px;
  background: linear-gradient(to right,
    var(--red-es) 28%, var(--yellow-es) 28%, var(--yellow-es) 72%, var(--red-es) 72%);
}

/* ─── NAVIGATION ─── */
nav {
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  transition: background var(--transition-slow);
}

[data-theme="light"] nav {
  color: black;
  background: rgba(245, 240, 232, 0.9);
}

.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  gap: 1.5rem;
}

.logo {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-badge {
  width: 38px; height: 38px;
  background: var(--red-es);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 900; font-size: 20px;
  color: white;
  clip-path: polygon(0 0, 82% 0, 100% 18%, 100% 100%, 18% 100%, 0 82%);
  transition: transform var(--transition), box-shadow var(--transition);
}
.logo:hover .logo-badge {
  transform: scale(1.05);
  box-shadow: var(--shadow-red);
}
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.logo-text span { color: var(--red-es); }
.nav-tag {
  font-size: 10px; color: var(--muted);
  letter-spacing: 2.5px; text-transform: uppercase;
  font-family: 'IBM Plex Mono', monospace;
}

/* ─── HAMBURGER MENU ─── */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all var(--transition);
  position: relative;
}
.nav-toggle:hover {
  border-color: var(--red-es);
  color: var(--text);
}
.nav-toggle[aria-expanded="true"] {
  background: var(--surface);
  border-color: var(--red-es);
}

.nav-links {
  display: flex; align-items: center; gap: 0.25rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  transition: all var(--transition);
  font-weight: 500;
  white-space: nowrap;
}
[data-theme="light"] .nav-link {
  color: var(--text);
  border-color: transparent;
}
.nav-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.nav-link.external {
  color: white;
  border-color: rgba(198, 11, 30, 0.3);
}
[data-theme="light"] .nav-link.external {
  color: black;
  border-color: rgba(198, 11, 30, 0.3);
}
.nav-link.external:hover {
  background: rgba(198, 11, 30, 0.08);
  border-color: var(--red-es);
}

.nav-right {
  display: flex; align-items: center; gap: 1rem;
  flex-shrink: 0;
}

.nav-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: var(--muted);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* ─── THEME TOGGLE ─── */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-size: 16px;
  transition: all var(--transition);
  line-height: 1;
  display: flex; align-items: center; gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  min-height: 44px;
}
.theme-toggle:hover {
  border-color: var(--red-es);
  color: var(--text);
  background: var(--surface-2);
}
.theme-toggle .toggle-icon { font-size: 14px; }

/* ─── HERO ─── */
.hero-wrapper {
  position: relative;
  overflow: hidden;
  min-height: fit-content;
}

.hero-wrapper::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(198, 11, 30, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 5rem;
  align-items: start;
  min-height: fit-content;
}

.hero-eyebrow {
  display: flex; align-items: center; gap: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 2rem;
}
.hero-eyebrow::before {
  content: '';
  display: block; width: 40px; height: 1px;
  background: linear-gradient(to right, var(--red-es), transparent);
}
.hero-eyebrow .dot {
  width: 6px; height: 6px;
  background: var(--red-es);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -1px;
  margin: 0;
  color: var(--text);
}

.hero-sub {
  margin-top: 1.75rem;
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.75;
  font-weight: 300;
  max-width: 44ch;
}

.hero-stats {
  display: flex;
  gap: 0;
  margin-top: 3rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.hero-stat {
  flex: 1;
  padding: 1.25rem 1.5rem;
  border-right: 1px solid var(--border);
  transition: background var(--transition);
  min-height: 120px;
  min-width: 110px;
}
.hero-stat:last-child { border-right: none; }
.hero-stat:hover { background: var(--surface-2); }
.hero-stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem; font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero-stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--muted);
  margin-top: 6px; letter-spacing: 2px; text-transform: uppercase;
}

/* ─── SEARCH CARD ─── */
.search-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.search-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--red-es), var(--yellow-es), var(--red-es));
}

.search-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.stab {
  flex: 1;
  padding: 1rem;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--muted);
  border: none; background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  min-height: 44px;
}
.stab.active {
  background: var(--surface);
  color: var(--text);
  border-bottom-color: var(--red-es);
}
.stab:hover:not(.active) { color: var(--text); background: rgba(255, 255, 255, 0.02); }

.search-body { padding: 1.75rem; }
.search-panel[hidden] { display: none !important; }
.search-panel:not([hidden]) { display: block; }

/* ─── FORM ELEMENTS ─── */
.form-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; display: block;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 16px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--red-es);
  box-shadow: 0 0 0 3px rgba(198, 11, 30, 0.15);
}
.form-input::placeholder { color: var(--muted); }
.form-select option { background: var(--surface); color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.form-grid > :only-child { grid-column: 1 / -1; }
.form-row { margin-bottom: 1.25rem; }

.btn-primary {
  width: 100%; padding: 0.9rem;
  background: var(--red-es);
  color: white;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 500;
  letter-spacing: 3px; text-transform: uppercase;
  border: none; cursor: pointer;
  transition: all var(--transition);
  position: relative; overflow: hidden;
  min-height: 44px;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:hover::after { transform: translateX(100%); }

/* ─── MAIN ─── */
main { max-width: 1440px; margin: 0 auto; }
.section-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.5rem;
}
.section-title { font-size: 2rem; font-weight: 700; }

/* ─── MAP SECTION ─── */
.map-section {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.map-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--red-es) 40%, var(--yellow-es) 40%, var(--yellow-es) 60%, var(--red-es) 60%);
}

.map-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem;
}
.map-title {
  font-size: 1.5rem; font-weight: 700; margin-bottom: 0.8rem;
}
.map-subtitle {
  font-size: 12px; color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 1px;
}

.map-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2.5rem;
  align-items: start;
}

.map-container {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1rem;
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 560;
  overflow: hidden;
}

.map-container svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes dot-appear {
  from { opacity: 0; transform: scale(0); }
  to { opacity: 1; transform: scale(1); }
}

.map-dot {
  cursor: pointer;
  transition: r 0.2s ease, opacity 0.2s ease;
  animation: dot-appear 0.3s ease backwards;
}
.map-dot:hover { opacity: 0.85; }

.map-glow {
  pointer-events: none;
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.08; }
  50% { opacity: 0.18; }
}

.map-legend-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.legend-item {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 3px;
  font-size: 12px; cursor: pointer;
  padding: 10px;
  border: 1px solid transparent;
  transition: all var(--transition);
  width: 100%; text-align: left;
  color: var(--text-2); background: transparent;
  font-family: 'IBM Plex Sans', sans-serif;
}
.legend-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text);
}
.legend-item.active-legend {
  border-color: var(--red-es);
  background: rgba(198, 11, 30, 0.07);
  color: var(--text);
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-count {
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--muted);
  background: var(--surface-2);
  padding: 1px 6px;
  letter-spacing: 1px;
}

.active-filter-display {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
}
.active-filter-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--muted);
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 6px;
}
.active-filter-value {
  font-size: 13px; color: var(--text);
  font-weight: 500;
}
.btn-clear-filter {
  margin-top: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--muted);
  background: none; border: none; cursor: pointer;
  letter-spacing: 1.5px; text-transform: uppercase;
  text-decoration: underline;
  transition: color var(--transition);
  display: block;
  min-height: 44px;
  padding: 8px 0;
}
.btn-clear-filter:hover { color: var(--red-es); }

/* ─── FILTERS BAR ─── */
.section-header { margin-bottom: 2rem; }

.filters-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: flex-end;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 150px; flex: 1; }
.filter-actions { display: flex; gap: 8px; align-items: flex-end; }

.btn-filter {
  padding: 0.75rem 1.5rem;
  background: var(--red-es); color: white;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 500;
  letter-spacing: 2px; text-transform: uppercase;
  border: none; cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 44px;
}
.btn-filter:hover { background: var(--red-dark); }

.btn-reset {
  padding: 0.75rem 1rem;
  background: transparent; color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  border: 1px solid var(--border); cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 44px;
}
.btn-reset:hover { border-color: var(--border-strong); color: var(--text); }

/* ─── RESULTS ─── */
.results-info {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
}
.results-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; color: var(--muted);
  letter-spacing: 1px;
}
.results-count span { color: var(--text); font-weight: 500; }
.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 6px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: 1px;
  cursor: pointer;
  min-height: 44px;
}

/* ─── PLANT CARDS ─── */
.plants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  min-height: auto;
}

.plant-card {
  background: var(--bg);
  padding: 0;
  transition: background var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: auto;
  max-height: fit-content;
}
.plant-card:focus-visible {
  outline: 3px solid var(--yellow-es);
  outline-offset: -3px;
  z-index: 1;
}
.plant-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 0;
  background: linear-gradient(to bottom, var(--red-es), var(--yellow-es));
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.plant-card:hover { background: var(--surface); }
.plant-card:hover::before { height: 100%; }
.plant-card:focus-within { background: var(--surface); }
.plant-card:focus-within::before { height: 100%; }

.plant-card-inner {
  padding: 1.5rem 1.5rem 1.5rem 1.75rem;
  height: 100%;
  display: flex; flex-direction: column;
}

.plant-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1rem;
}
.plant-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid;
}
.badge-activa {
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
  background: rgba(34, 197, 94, 0.05);
}
.badge-mantenimiento {
  border-color: rgba(251, 191, 36, 0.4);
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.05);
}
.badge-inactiva {
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
  background: rgba(239, 68, 68, 0.05);
}
.plant-id {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--muted);
}
.plant-name {
  font-size: 1.1rem; font-weight: 700;
  line-height: 1.25; margin-bottom: 4px;
  transition: color var(--transition);
}
.plant-company { font-size: 12px; color: white; margin-bottom: 1rem; }
.plant-distance {
  margin: 0.25rem 0 1.25rem;
  padding: 1rem;
  background: rgba(241, 191, 0, 0.08);
  border: 1px solid rgba(241, 191, 0, 0.24);
  color: var(--yellow-es);
}
[data-theme="light"] .plant-company, [data-theme="light"] .plant-name{
  color: black;
}
.plant-distance span {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 900;
  line-height: 0.9;
}
.plant-distance small {
  display: block;
  margin-top: 0.5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-2);
}
.plant-footer {
  margin-top: 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
}
.plant-location-tag {
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 5px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.5px;
}
.btn-detail {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: white;
  border: 1px solid var(--red-es);
  padding: 8px 12px;
  background: none;
  transition: all var(--transition);
  cursor: pointer;
}
.btn-detail:hover { background: var(--red-es); color: white; }
[data-theme="light"] .btn-detail {
  color: black;
  border-color: var(--red-es);
}

/* ─── NO RESULTS ─── */
.no-results {
  text-align: center; padding: 5rem 2rem;
  grid-column: 1 / -1;
}
.no-results-title {
  font-size: 1.5rem; color: var(--muted);
  margin-bottom: 0.5rem;
}

/* ─── GENHORM BANNER ─── */
.genhorm-banner, .contact-section, footer {
  content-visibility: auto;
  contain-intrinsic-size: 200px;
}

.genhorm-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red-es);
  padding: 1.5rem 2rem;
  margin-bottom: 3rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.genhorm-banner::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 200px; height: 100%;
  background: linear-gradient(to left, rgba(198, 11, 30, 0.04), transparent);
  pointer-events: none;
}
.genhorm-banner:hover { border-left-color: var(--yellow-es); box-shadow: var(--shadow-md); }
.genhorm-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--yellow-es);
  border: 1px solid rgba(241, 191, 0, 0.3);
  padding: 2px 8px;
  background: rgba(241, 191, 0, 0.05);
  display: inline-block;
  margin-bottom: 6px;
}
.genhorm-title {
  font-size: 1.25rem; font-weight: 700; margin-bottom: 4px;
}
.genhorm-desc { font-size: 13px; color: var(--text-2); max-width: 50ch; }
.genhorm-cta {
  display: flex; align-items: center; gap: 1rem;
  flex-shrink: 0;
}
.btn-genhorm {
  background: transparent;
  border: 2px solid var(--red-es);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 44px;
}
.btn-genhorm:hover {
  background: var(--red-es);
  color: white;
  box-shadow: var(--shadow-red);
  transform: translateY(-1px);
}

/* ─── CONTACT SECTION ─── */
.contact-section {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2.5rem;
  margin-top: 3rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.contact-section::before {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(198, 11, 30, 0.04) 0%, transparent 70%);
  pointer-events: none;
}
.contact-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--red-es); margin-bottom: 0.75rem;
}
.contact-title {
  font-size: 2rem; font-weight: 700; line-height: 1.15;
  margin-bottom: 1rem;
}
.contact-desc { color: var(--text-2); font-size: 14px; line-height: 1.7; margin-bottom: 1.5rem; }
.contact-email {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1rem 1.5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
  min-height: 44px;
}
.contact-email:hover {
  border-color: var(--red-es);
  background: rgba(198, 11, 30, 0.05);
  color: var(--red-es);
}
.contact-email-icon { font-size: 16px; }

.contact-items { display: flex; flex-direction: column; gap: 1rem; }
.contact-item {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.contact-item:hover { border-color: var(--border-strong); background: var(--bg-2); }
.contact-item-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.contact-item-title {
  font-weight: 600; font-size: 14px; margin-bottom: 3px;
}
.contact-item-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ─── MODAL ─── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 999;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--mid, #161616);
  border: 1px solid var(--border-strong);
  max-width: 640px; width: 92%;
  max-height: 88vh; overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modal-enter 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-enter {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-flag-stripe {
  height: 4px;
  background: linear-gradient(to right,
    var(--red-es) 28%, var(--yellow-es) 28%, var(--yellow-es) 72%, var(--red-es) 72%);
}
.modal-head {
  padding: 1.75rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  position: absolute; top: 1.25rem; right: 1.25rem;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}
.modal-close:hover { color: var(--text); border-color: var(--red-es); }
.modal-body { padding: 1.75rem 2rem; }
.modal-section { margin-bottom: 1.75rem; }
.modal-section-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.modal-field {
  background: var(--surface);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
}
.modal-field-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--muted);
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 4px;
}
.modal-field-value { font-size: 13px; font-weight: 500; }

/* ─── FOOTER ─── */
footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem;
}
.footer-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.5px;
}
.footer-center { text-align: center; }
.footer-right { text-align: right; }
.footer-links {
  display: flex; gap: 1.5rem; justify-content: center;
  margin-top: 0.5rem;
}
.footer-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: var(--muted);
  text-decoration: none; letter-spacing: 1px;
  transition: color var(--transition);
  padding: 8px 4px;
}
.footer-link:hover { color: var(--red-es); }

/* ─── SKELETON LOADING ─── */
.skeleton {
  background: var(--surface);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-block {
  height: 14px;
  background: var(--surface-2);
  margin-bottom: 10px;
  border-radius: 2px;
}
.skeleton-block:first-child { width: 60%; height: 18px; }
.skeleton-block:nth-child(2) { width: 80%; }
.skeleton-block:nth-child(3) { width: 40%; }
.skeleton-block:last-child { width: 50%; margin-bottom: 0; }

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ─── SSR PAGES ─── */
.ssr-main { min-height: 80vh; }

.ssr-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ---- BREADCRUMBS ---- */
.ssr-bc {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem 0;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}
.ssr-bc-sep { margin: 0 0.25rem; color: var(--border-strong); }
.ssr-bc-link { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.ssr-bc-link:hover { color: var(--red-es); }
.ssr-bc-last { color: var(--text-2); }

/* ---- HERO COMPACT ---- */
.ssr-hero { grid-template-columns: 1fr; gap: 1rem; padding-bottom: 1rem; }
.ssr-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -1px;
  margin: 0;
  color: var(--text);
}
.ssr-hero-sub { margin-top: 0.75rem; color: var(--text-2); font-size: 1.05rem; }

/* ---- 2-COLUMN GRID ---- */
.ssr-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ---- CARD ---- */
.ssr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.ssr-card-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ---- TABLE ---- */
.ssr-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ssr-table tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.ssr-table td { padding: 0.65rem 0; vertical-align: top; }
.ssr-table td:first-child { color: var(--muted); width: 30%; }
.ssr-table td:last-child { color: var(--text); }
.ssr-table a { color: var(--red-es); text-decoration: none; font-weight: 500; }
.ssr-table a:hover { text-decoration: underline; }

/* ---- MAP CARD ---- */
.ssr-map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.ssr-map-card iframe { display: block; width: 100%; height: 350px; border: 0; }

/* ---- DESCRIPTION CARD ---- */
.ssr-desc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.ssr-desc-card p { color: var(--text-2); line-height: 1.7; font-size: 0.95rem; margin: 0; }

/* ---- NAV BOX ---- */
.ssr-nav-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 2rem;
}
.ssr-nav-label { color: var(--muted); font-size: 0.85rem; padding: 0.25rem 0; }
.ssr-nav-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- PROVINCE DIRECTORY GRID (/provincias) ---- */
.ssr-provincia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.ssr-provincia-card {
  text-decoration: none;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.25s, transform 0.2s, box-shadow 0.25s;
}
.ssr-provincia-card:hover {
  border-color: var(--red-es);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(198, 11, 30, 0.1);
}
.ssr-provincia-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.ssr-provincia-count {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---- SEO TEXT ---- */
.ssr-seo-text {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.ssr-seo-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.75rem;
  line-height: 1.3;
}
.ssr-seo-body {
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0;
}

/* ---- EMPTY STATE ---- */
.ssr-empty {
  color: var(--text-2);
  font-size: 1rem;
  text-align: center;
  padding: 3rem 1rem;
  background: var(--surface);
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
}

/* ---- PLANT LIST ---- */
.ssr-plant-list { display: grid; gap: 1rem; }
.ssr-plant-item {
  padding: 1.25rem;
  border-left: 3px solid transparent;
  transition: border-left-color 0.25s, box-shadow 0.25s;
}
.ssr-plant-item:hover {
  border-left-color: var(--red-es);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.ssr-plant-item a {
  color: var(--red-es);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
}
.ssr-plant-item a:hover { text-decoration: underline; }
.ssr-plant-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.ssr-plant-meta { color: var(--text-2); font-size: 0.85rem; margin-top: 0.25rem; }
.ssr-plant-right { text-align: right; font-size: 0.85rem; flex-shrink: 0; }
.ssr-plant-right a { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.ssr-plant-right a:hover { color: var(--red-es); }
.ssr-plant-dir { color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }
.ssr-plant-muni { color: var(--text-2); font-size: 0.75rem; margin-top: 0.2rem; }

/* ---- PROVINCE GRID (footer) ---- */
.ssr-province-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.35rem;
  padding-top: 0.25rem;
}
.ssr-province-grid a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.ssr-province-grid a:hover { background: var(--surface-2); color: var(--red-es); }

.ssr-province-links { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 2rem; }
.ssr-province-link { font-size: 0.85rem; }

@media (max-width: 768px) {
  .ssr-grid-2 { grid-template-columns: 1fr; }
  .ssr-province-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .ssr-provincia-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 480px) {
  .ssr-province-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .ssr-province-grid a { font-size: 0.8rem; padding: 0.3rem; }
  .ssr-provincia-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; gap: 3rem; }
  .hero h1 { font-size: clamp(2.5rem, 6vw, 3.5rem); color: var(--text); }
  .map-layout { grid-template-columns: 1fr; }
  .contact-section { grid-template-columns: 1fr; gap: 2rem; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-right { text-align: center; }
  .contact-title { font-size: 1.6rem; }
}

@media (max-width: 900px) {
  .hero { min-height: auto; grid-template-columns: 1fr; }
  .search-card { min-height: 420px; }
  .plants-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .filters-body { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem;
    gap: 0.25rem;
    box-shadow: var(--shadow-lg);
  }
  .nav-links.open { display: flex; }

  .nav-link {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 13px;
  }

  .nav-count { display: none; }

  .plants-grid { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn-filter,
  .filter-actions .btn-reset { flex: 1; text-align: center; }
  .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1.5rem 2rem; }
  main { padding: 1.5rem 1rem; }
  .nav-inner { padding: 0 1rem; }
  .nav-links { display: none; }
  .genhorm-banner { flex-direction: column; gap: 1.25rem; }
  .genhorm-cta { width: 100%; }
  .btn-genhorm { width: 100%; justify-content: center; }
  .map-section { padding: 1.5rem; }
  .map-title { font-size: 1.2rem; }
  .results-info { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .contact-section { padding: 1.5rem; }
  .modal { width: 95%; max-height: 92vh; }
  .modal-head { padding: 1.25rem 1.25rem 1rem; }
  .modal-body { padding: 1.25rem; }
  .modal-close { top: 0.75rem; right: 0.75rem; }
  .section-title { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  :root { --nav-height: 60px; }

  .logo-text { font-size: 18px; }
  .nav-tag { display: none; }
  .theme-toggle { padding: 0.4rem 0.5rem; }
  .theme-toggle span:last-child { display: none; }

  .hero { padding: 2rem 1rem 1.5rem; }
  .hero h1 { font-size: clamp(2rem, 10vw, 2.8rem); }
  .hero-sub { font-size: 0.9rem; }
  .hero-stats { flex-direction: column; }
  .hero-stat { border-right: none; border-bottom: 1px solid var(--border); padding: 1rem; }
  .hero-stat:last-child { border-bottom: none; }

  .search-body { padding: 1.25rem; }
  .stab { font-size: 10px; letter-spacing: 1px; padding: 0.75rem 0.5rem; }

  main { padding: 1rem; }
  .map-section { padding: 1rem; }
  .map-header { flex-direction: column; gap: 0.75rem; }
  .map-subtitle { font-size: 11px; }
  .map-container { padding: 0.5rem; }

  .filters-bar { padding: 1rem; }
  .plant-card-inner { padding: 1.25rem; }
  .plant-name { font-size: 1rem; }

  .contact-section { padding: 1.25rem; gap: 1.5rem; }
  .contact-title { font-size: 1.3rem; }
  .contact-email { font-size: 12px; padding: 0.75rem 1rem; width: 100%; justify-content: center; }

  .footer-inner { padding: 1.5rem 1rem; gap: 1rem; }
  .footer-links { flex-direction: column; gap: 0.5rem; }
  .footer-link { display: block; }

  .genhorm-banner { padding: 1.25rem; }
  .genhorm-title { font-size: 1.1rem; }

  .modal { width: 96%; }
  .modal-head { padding: 1rem 1rem 0.75rem; }
  .modal-body { padding: 1rem; }
  .modal-field { padding: 0.5rem 0.75rem; }
}
