:root {
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-display: "Outfit", system-ui, sans-serif;
  --color-bg: #eef1f6;
  --color-surface: #ffffff;
  --color-text: #141820;
  --color-text-muted: #5c6575;
  --color-border: #e2e6ee;
  --color-brand: #0d4f8b;
  --color-brand-dark: #08365f;
  --color-accent: #c2410c;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --radius-md: 0.75rem;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 9999;
  padding: var(--space-3) var(--space-4);
  background: var(--color-brand);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-md);
}

.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

.container {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Por encima de Leaflet (paneles ~400–700, controles ~1000) para que el sticky no quede tapado al scroll */
/* sticky + contexto para el panel del menú móvil */
.site-header {
  position: sticky;
  top: 0;
  z-index: 2000;
  background: radial-gradient(circle at top left, #0f172a 0, #020617 42%, #020617 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.45);
}

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

.site-header-inner {
  position: relative;
  display: grid;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-height: 2.75rem;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

@media (min-width: 768px) {
  /* Escritorio: barra clara — marca + enlaces a la izquierda, CTAs a la derecha (sin menú hamburguesa) */
  .site-header-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem 1.75rem;
    min-height: 3.35rem;
  }

  .site-brand {
    flex: 0 0 auto;
  }

  .site-header-nav {
    position: static;
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0;
    margin: 0;
    min-width: 0;
    flex: 0 1 auto;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .site-header-actions {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .site-header-menu-btn {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  /* Por si el icono del menú se pintara: solo hamburguesa en escritorio */
  .site-header .site-header-menu-svg__bars {
    display: block !important;
  }

  .site-header .site-header-menu-svg__close {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .site-header {
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.38);
  }

  /*
   * Una sola fila: [ marca ············· CTA (+pill / ghost) · menú ]
   * DOM: marca, hamburguesa, nav, acciones → order pone acciones antes que la hamburguesa.
   */
  .site-header-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    min-height: 0;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .site-brand {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    max-width: min(52%, calc(100% - 11.5rem));
    align-self: center;
  }

  .site-header .site-brand-mark {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.4rem;
    box-shadow:
      0 0 0 1px rgba(15, 23, 42, 0.65),
      0 4px 12px rgba(15, 23, 42, 0.45);
  }

  .site-header .site-brand-name {
    font-size: 0.98rem;
  }

  .site-header .site-brand-tagline {
    font-size: 0.625rem;
  }

  .site-header-actions {
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
    margin-left: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem 0.4rem;
  }

  .site-header-menu-btn {
    order: 3;
    flex: 0 0 auto;
    align-self: center;
  }

  .site-header .site-header-actions .btn.btn-primary,
  .site-header-actions .btn-primary.site-header-actions__cta,
  .site-header-actions .btn-primary#btn-reportar-problema {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    min-height: 2.5rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
    box-shadow: 0 1px 6px rgba(194, 65, 12, 0.3);
  }

  .site-header-actions .btn-ghost.site-header-actions__context {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
  }

  /* Pill “Datos públicos”: más compacto si aparece (≥480px en viewport móvil) */
  .site-header .site-header-pill {
    flex-shrink: 1;
    min-width: 0;
    padding: 0.2rem 0.4rem;
    font-size: 0.625rem;
    letter-spacing: 0.04em;
  }

  .site-header-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 2100;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.4rem 0.65rem 0.55rem;
    margin: 0;
    background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  }

  .site-header-nav.site-header-nav--tabs {
    border-radius: 0 0 0.5rem 0.5rem;
  }

  .site-header.is-nav-open .site-header-nav {
    display: flex;
  }
}

.site-header-nav {
  list-style: none;
}

/* Vencer color de enlace por defecto del navegador (a:link) */
.site-header .site-header-nav-link,
.site-header .site-header-nav-link:link,
.site-header .site-header-nav-link:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #f1f5f9 !important;
  text-decoration: none !important;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.site-header .site-header-nav-link:hover,
.site-header .site-header-nav-link:focus-visible {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(203, 213, 225, 0.45);
  text-decoration: none !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
}

@media (max-width: 767px) {
  .site-header .site-header-nav-link,
  .site-header .site-header-nav-link:link,
  .site-header .site-header-nav-link:visited {
    justify-content: flex-start;
    border-radius: 0.4rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
  }

  .site-header .site-header-nav-link.is-active {
    background: rgba(56, 189, 248, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
    color: #f8fafc !important;
  }
}

/* Mapa / Estadísticas — escritorio: texto + indicador inferior (sin caja “segmented” pesada) */
@media (min-width: 768px) {
  .site-header-nav.site-header-nav--tabs {
    padding: 0.1rem 0 0;
    gap: 0.35rem;
    align-items: flex-end;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link,
  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link:link,
  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link:visited {
    color: #94a3b8 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0.35rem 0.35rem 0 0;
    padding: 0.45rem 0.85rem 0.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-bottom: 2px solid transparent !important;
    -webkit-font-smoothing: antialiased;
  }

  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link:hover,
  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link:focus-visible {
    color: #e2e8f0 !important;
    background: rgba(255, 255, 255, 0.06) !important;
    outline: none;
  }

  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link.is-active,
  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link[aria-current="page"] {
    color: #f8fafc !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border-bottom: 2px solid #38bdf8 !important;
  }

  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link.is-active:hover,
  header#site-header.site-header .site-header-nav.site-header-nav--tabs .site-header-nav-link.is-active:focus-visible {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1) !important;
  }
}

.site-header-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.site-header-menu-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(203, 213, 225, 0.5);
}

.site-header-menu-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45);
}

@media (max-width: 767px) {
  .site-header-menu-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.42rem;
    border-color: rgba(148, 163, 184, 0.26);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
  }

  .site-header-menu-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(148, 163, 184, 0.38);
  }

  .site-header-menu-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
  }

  .site-header-menu-svg {
    width: 18px;
    height: 18px;
  }
}

.site-header-menu-svg {
  display: block;
  flex-shrink: 0;
}

.site-header-menu-svg__close {
  display: none;
}

.site-header.is-nav-open .site-header-menu-svg__bars {
  display: none;
}

.site-header.is-nav-open .site-header-menu-svg__close {
  display: block;
}

body.site-header-nav-open {
  overflow: hidden;
}

@media (min-width: 768px) {
  body.site-header-nav-open {
    overflow: auto;
  }
}

.site-header .btn-ghost {
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.04);
}

.site-header .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(203, 213, 225, 0.55);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.site-brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  flex-shrink: 0;
  background: conic-gradient(from 210deg, #38bdf8, #0ea5e9, #1d4ed8, #22c55e, #38bdf8);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.7),
    0 8px 18px rgba(15, 23, 42, 0.55);
}

.site-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.site-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  color: #e5f2ff;
  letter-spacing: -0.02em;
}

.site-brand-tagline {
  font-size: 0.6875rem;
  color: #9ca3af;
  font-weight: 500;
}

.site-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.site-header-pill {
  display: none;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

@media (min-width: 480px) {
  .site-header-pill {
    display: inline-block;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.875rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.35);
}

.btn-primary:hover {
  background: #9a3412;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  box-shadow: none;
}

.btn-ghost:hover {
  background: #f8fafc;
  color: var(--color-text);
  transform: none;
}

.main-wrap {
  flex: 1;
}

.site-footer {
  margin-top: auto;
  flex-shrink: 0;
  border-top: 2px solid #cbd5e1;
  background: linear-gradient(180deg, #eef2f7 0%, #ffffff 45%);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.04);
}

.site-footer-inner {
  padding: var(--space-5) 0 calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.site-footer-accent {
  width: 3rem;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-brand), #38bdf8);
  opacity: 0.85;
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
}

.site-footer-nav a {
  color: var(--color-brand);
  text-decoration: none;
}

.site-footer-nav a:hover {
  text-decoration: underline;
}

.page-home .site-footer-inner {
  padding: var(--space-2) 0 var(--space-3);
}

.site-footer-copy {
  margin: 0;
  max-width: 36rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  text-align: center;
}
