/* ============================================================
   QGIS Perú — hoja de estilos principal
   Mobile-first, sin frameworks ni dependencias externas.
   Paleta: verde QGIS #589632 + acento rojo peruano #d91023.
   Modo claro/oscuro: prefers-color-scheme + toggle (data-theme).
   ============================================================ */

/* ---------- Variables de tema ---------- */
:root {
  --verde: #589632;
  --verde-oscuro: #3d6b21;
  --verde-claro: #7fbf4d;
  --rojo-pe: #d91023;

  --fondo: #f7f9f4;
  --superficie: #ffffff;
  --superficie-alt: #eef3e8;
  --texto: #1d2a14;
  --texto-suave: #47523d;
  --borde: #d4ddc9;
  --enlace: #3d6b21;
  --enlace-visitado: #55622e;
  --sombra: 0 2px 10px rgba(29, 42, 20, 0.10);
  --foco: #b3520e;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="claro"]) {
    --fondo: #131a0e;
    --superficie: #1c2415;
    --superficie-alt: #232e1a;
    --texto: #eef3e8;
    --texto-suave: #b9c4ac;
    --borde: #37452a;
    --enlace: #9ed374;
    --enlace-visitado: #b9c98a;
    --sombra: 0 2px 10px rgba(0, 0, 0, 0.45);
    --foco: #ffb26b;
    color-scheme: dark;
  }
}

:root[data-theme="oscuro"] {
  --fondo: #131a0e;
  --superficie: #1c2415;
  --superficie-alt: #232e1a;
  --texto: #eef3e8;
  --texto-suave: #b9c4ac;
  --borde: #37452a;
  --enlace: #9ed374;
  --enlace-visitado: #b9c98a;
  --sombra: 0 2px 10px rgba(0, 0, 0, 0.45);
  --foco: #ffb26b;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  background: var(--fondo);
  color: var(--texto);
  -webkit-text-size-adjust: 100%;
}

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

a {
  color: var(--enlace);
}

a:visited {
  color: var(--enlace-visitado);
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3 {
  line-height: 1.2;
  color: var(--texto);
}

h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
h3 { font-size: 1.15rem; }

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  background: var(--superficie-alt);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.95em;
}

.contenedor {
  width: min(72rem, 100% - 2.5rem);
  margin-inline: auto;
}

/* ---------- Skip link ---------- */
.saltar {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--verde-oscuro);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 8px 0;
}

.saltar:focus {
  left: 0;
  color: #fff;
}

/* ---------- Cabecera y navegación sticky ---------- */
.cabecera {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--superficie);
  border-bottom: 3px solid var(--verde);
  box-shadow: var(--sombra);
}

.barra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-block: 0.55rem;
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--texto);
  margin-right: auto;
}

.marca:visited { color: var(--texto); }

.marca svg {
  width: 2rem;
  height: 2rem;
  flex: none;
}

.marca .pe {
  color: var(--rojo-pe);
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--superficie-alt);
  color: var(--texto);
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  cursor: pointer;
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  flex-basis: 100%;
  flex-direction: column;
  gap: 0.15rem;
  padding-bottom: 0.6rem;
}

.menu.abierto {
  display: flex;
}

.menu a {
  display: block;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
  color: var(--texto);
  border-radius: 8px;
  font-weight: 500;
}

.menu a:visited { color: var(--texto); }

.menu a:hover {
  background: var(--superficie-alt);
}

.menu a[aria-current="page"] {
  background: var(--verde);
  color: #fff;
}

.tema-toggle {
  background: var(--superficie-alt);
  color: var(--texto);
  border: 1px solid var(--borde);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  cursor: pointer;
  line-height: 1;
}

.tema-toggle .icono-luna { display: none; }

:root[data-theme="oscuro"] .tema-toggle .icono-sol { display: none; }
:root[data-theme="oscuro"] .tema-toggle .icono-luna { display: inline; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="claro"]) .tema-toggle .icono-sol { display: none; }
  :root:not([data-theme="claro"]) .tema-toggle .icono-luna { display: inline; }
}

@media (min-width: 52rem) {
  .nav-toggle { display: none; }

  .menu {
    display: flex;
    flex-basis: auto;
    flex-direction: row;
    padding-bottom: 0;
  }
}

/* ---------- Héroe ---------- */
.heroe {
  /* Splash QGIS 3.32 "Lima" (encuentro de usuarios, Países Bajos 2023) con
     velo oscuro para mantener contraste AA del texto blanco */
  background:
    linear-gradient(150deg, rgba(20, 43, 9, 0.78), rgba(20, 43, 9, 0.55) 65%),
    url("../img/splash_qgis_lima.jpg") center / cover no-repeat var(--verde-oscuro);
  color: #fff;
  padding-block: clamp(3rem, 9vw, 6rem);
}

.heroe h1 {
  color: #fff;
  margin: 0 0 0.6rem;
  max-width: 26ch;
}

.heroe p {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  max-width: 55ch;
  margin: 0 0 1.6rem;
}

.heroe .lema {
  display: inline-block;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.2rem;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.boton {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
}

.boton-primario {
  background: #fff;
  color: var(--verde-oscuro);
}

.boton-primario:visited { color: var(--verde-oscuro); }

.boton-secundario {
  border-color: #fff;
  color: #fff;
}

.boton-secundario:visited { color: #fff; }

.boton:hover {
  transform: translateY(-2px);
  transition: transform 120ms ease;
}

/* Variantes para secciones sobre fondo claro/alt */
.boton-verde {
  background: var(--verde);
  color: #fff;
}

.boton-verde:visited { color: #fff; }

.boton-verde:hover { background: var(--verde-oscuro); }

.boton-contorno {
  border-color: var(--verde);
  color: var(--enlace);
}

.boton-contorno:visited { color: var(--enlace); }

/* Encabezado de páginas interiores */
.heroe-pagina {
  background: linear-gradient(150deg, var(--verde-oscuro), var(--verde));
  color: #fff;
  padding-block: clamp(2rem, 6vw, 3.5rem);
}

.heroe-pagina h1 {
  color: #fff;
  margin: 0 0 0.4rem;
}

.heroe-pagina p {
  margin: 0;
  max-width: 60ch;
  font-size: 1.1rem;
}

/* ---------- Secciones y tarjetas ---------- */
.seccion {
  padding-block: clamp(2.2rem, 6vw, 3.8rem);
}

.seccion-alt {
  background: var(--superficie-alt);
}

.seccion > .contenedor > h2 {
  margin-top: 0;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--verde);
  margin: 0 0 0.3rem;
}

:root[data-theme="oscuro"] .kicker { color: var(--verde-claro); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="claro"]) .kicker { color: var(--verde-claro); }
}

.tarjetas {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1fr;
  margin-block: 1.5rem 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .tarjetas { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 62rem) {
  .tarjetas { grid-template-columns: repeat(3, 1fr); }
  .tarjetas-2 { grid-template-columns: repeat(2, 1fr); }
}

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-top: 4px solid var(--verde);
  border-radius: 12px;
  padding: 1.2rem 1.3rem;
  box-shadow: var(--sombra);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tarjeta h3 {
  margin: 0;
}

.tarjeta p {
  margin: 0;
  color: var(--texto-suave);
}

.tarjeta .pie {
  margin-top: auto;
  padding-top: 0.6rem;
  font-weight: 600;
}

.tarjeta-acento {
  border-top-color: var(--rojo-pe);
}

.etiqueta {
  display: inline-block;
  align-self: flex-start;
  background: var(--superficie-alt);
  border: 1px solid var(--borde);
  color: var(--texto-suave);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.1rem 0.7rem;
  letter-spacing: 0.03em;
}

/* ---------- Línea de tiempo (eventos) ---------- */
.linea-tiempo {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  position: relative;
  border-left: 3px solid var(--verde);
  display: grid;
  gap: 1.4rem;
}

.linea-tiempo > li {
  position: relative;
  padding-left: 1.4rem;
}

.linea-tiempo > li::before {
  content: "";
  position: absolute;
  left: calc(-0.45rem - 1.5px);
  top: 0.45rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--rojo-pe);
  border: 3px solid var(--fondo);
}

.linea-tiempo h3 {
  margin: 0 0 0.2rem;
}

.linea-tiempo .anio {
  font-weight: 800;
  color: var(--verde);
  font-size: 1.3rem;
}

:root[data-theme="oscuro"] .linea-tiempo .anio { color: var(--verde-claro); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="claro"]) .linea-tiempo .anio { color: var(--verde-claro); }
}

.linea-tiempo ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--texto-suave);
}

/* ---------- Tablas ---------- */
.tabla-envoltura {
  overflow-x: auto;
  margin-block: 1.2rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 10px;
}

caption {
  text-align: left;
  font-weight: 700;
  padding-block: 0.5rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--borde);
  vertical-align: top;
}

thead th {
  background: var(--verde);
  color: #fff;
}

/* ---------- Formulario (maqueta) ---------- */
.formulario {
  display: grid;
  gap: 1rem;
  max-width: 38rem;
}

.campo {
  display: grid;
  gap: 0.3rem;
}

.campo label {
  font-weight: 600;
}

.campo input,
.campo textarea,
.campo select {
  font: inherit;
  color: var(--texto);
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  width: 100%;
}

.campo textarea {
  min-height: 8rem;
  resize: vertical;
}

.ayuda {
  font-size: 0.88rem;
  color: var(--texto-suave);
  margin: 0;
}

.boton-envio {
  justify-self: start;
  background: var(--verde);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.6rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.boton-envio:hover {
  background: var(--verde-oscuro);
}

.aviso {
  border-left: 4px solid var(--rojo-pe);
  background: var(--superficie);
  border-radius: 0 10px 10px 0;
  padding: 0.9rem 1.1rem;
  box-shadow: var(--sombra);
}

.aviso-ok {
  border-left-color: var(--verde);
}

.aviso p { margin: 0.2rem 0; }

[hidden] { display: none !important; }

/* ---------- Estadísticas ---------- */
.cifras {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-block: 1.5rem 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

@media (min-width: 48rem) {
  .cifras { grid-template-columns: repeat(4, 1fr); }
}

.cifras .num {
  display: block;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--verde);
}

:root[data-theme="oscuro"] .cifras .num { color: var(--verde-claro); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="claro"]) .cifras .num { color: var(--verde-claro); }
}

.cifras li {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 1rem 0.6rem;
}

/* ---------- Pie de página ---------- */
.pie-sitio {
  background: var(--verde-oscuro);
  color: #eef3e8;
  margin-top: 2rem;
  padding-block: 2.2rem 1.4rem;
  border-top: 4px solid var(--rojo-pe);
}

.pie-sitio a {
  color: #d9ecc7;
}

.pie-sitio a:visited { color: #d9ecc7; }

.pie-columnas {
  display: grid;
  gap: 1.6rem;
  grid-template-columns: 1fr;
}

@media (min-width: 48rem) {
  .pie-columnas { grid-template-columns: repeat(3, 1fr); }
}

.pie-sitio h2 {
  color: #fff;
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.pie-sitio ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.pie-legal {
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.9rem;
}

/* ---------- Utilidades ---------- */
.solo-lectores {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lista-espaciada > li {
  margin-bottom: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .boton:hover { transform: none; transition: none; }
}
