/* ==========================================================================
   Calma Activa — hoja de estilos
   Dirección visual: cálida, luminosa y clara. Tipografía de palo seco
   en pesos altos, esquinas suaves y paleta jade + ámbar sobre crema.
   Sin fuentes externas ni recursos remotos: cero peticiones de red.
   ========================================================================== */

:root {
  /* Color base (viene de config.json) */
  --crema:        #faf8f5;
  --arena:        #f0ebe3;
  --blanco:       #ffffff;
  --verde:        #1c6b5a;
  --ambar:        #c26d1a;

  /* Derivados: los calcula configurar.py a partir de los cuatro anteriores */
  --verde-osc:    #13493d;
  --verde-claro:  #dde9e6;
  --ambar-claro:  #f6ebdf;
  --ambar-texto:  #57310c;
  --ambar-hover:  #a75e16;
  --ambar-tinta:  #170d03;
  --verde-suave:  rgba(28,107,90,.13);
  --linea:        #e6e2da;
  --arena-texto:  #6c6a66;
  --pie-lema:     #bfd6d1;
  --pie-titulo:   #92b8b0;
  --pie-enlace:   #e4edeb;
  --pie-base:     #a9c7c0;

  /* Neutros de texto: deliberadamente independientes de la paleta,
     para que el cuerpo del texto conserve el contraste con cualquier color. */
  --tinta:        #1f2622;
  --tinta-media:  #45514b;
  --tinta-suave:  #5e6863;

  /* Tipografía: una sola familia del sistema, diferenciada por peso.
     No se descarga ninguna fuente. */
  --tipo: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;

  /* Forma */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 24px;
  --r-xl: 40px;
  --pill: 999px;

  --sombra:    0 1px 3px rgba(31, 38, 34, .05), 0 10px 26px -18px rgba(31, 38, 34, .30);
  --sombra-md: 0 2px 6px rgba(31, 38, 34, .06), 0 24px 48px -28px rgba(31, 38, 34, .40);

  --wrap:  1120px;
  --prosa: 68ch;
  --alto-header: 72px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* El encabezado es sticky: sin esto, los enlaces a anclas quedan tapados. */
  scroll-padding-top: calc(var(--alto-header) + 12px);
}

body {
  margin: 0;
  background: var(--crema);
  color: var(--tinta);
  font-family: var(--tipo);
  font-size: 18px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--verde-osc); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ambar-texto); }

:focus-visible { outline: 3px solid var(--ambar); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-weight: 700; line-height: 1.24; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.05rem, 5.6vw, 3.15rem); letter-spacing: -.021em; margin-bottom: .7rem; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); letter-spacing: -.014em; margin: 2.6rem 0 .9rem; }
h3 { font-size: 1.25rem; letter-spacing: -.008em; margin: 2.1rem 0 .5rem; }

p { margin: 0 0 1.2rem; }
strong { font-weight: 700; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.saltar {
  position: absolute; left: -9999px; top: 0;
  background: var(--verde-osc); color: var(--blanco); padding: .8rem 1.2rem;
  border-radius: 0 0 var(--r-sm) 0; z-index: 99; font-weight: 700;
}
.saltar:focus { left: 0; top: 0; }

/* Campo trampa antispam: fuera de pantalla, nunca visible. */
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Etiqueta tipo píldora: recurso identitario del sitio --------------- */
.eyebrow {
  display: inline-block;
  background: var(--verde-claro);
  color: var(--verde-osc);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .01em;
  padding: .34rem .95rem;
  border-radius: var(--pill);
  margin: 0 0 1.1rem;
}
.eyebrow--ambar { background: var(--ambar-claro); color: var(--ambar-texto); }

/* --- Barra de progreso de lectura --------------------------------------- */
.progreso {
  position: fixed; inset: 0 auto auto 0; height: 3px; width: 0;
  background: var(--ambar); z-index: 60; border-radius: 0 3px 3px 0;
}

/* --- Encabezado ---------------------------------------------------------- */
.sitio-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--blanco);
  border-bottom: 1px solid var(--linea);
}
.header-fila {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--alto-header); gap: 1rem;
}

.marca { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--tinta); }
.marca svg { flex: none; border-radius: 12px; }
.marca strong { display: block; font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.marca span span { display: block; font-size: .76rem; font-weight: 400; color: var(--tinta-suave); line-height: 1.3; }

.nav-boton {
  display: none; background: var(--verde-claro); border: 0; border-radius: var(--r-sm);
  padding: .6rem .7rem; cursor: pointer; color: var(--verde-osc); line-height: 0;
}

.nav ul { display: flex; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block; font-size: .95rem; font-weight: 400; text-decoration: none;
  color: var(--tinta-suave); padding: .45rem .8rem; border-radius: var(--pill);
  white-space: nowrap;
}
.nav a:hover { background: var(--verde-claro); color: var(--verde-osc); }
.nav a[aria-current="page"] { background: var(--verde); color: var(--blanco); font-weight: 700; }

/* --- Portada ------------------------------------------------------------- */
.hero {
  background: var(--arena);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  padding: clamp(2.6rem, 6vw, 4.6rem) 0 clamp(2.8rem, 6vw, 4.6rem);
}
.hero-grid { display: grid; grid-template-columns: 1.04fr .96fr; gap: clamp(2rem, 4.5vw, 3.6rem); align-items: center; }
.hero .entrada { font-size: 1.15rem; color: var(--tinta-media); max-width: 44ch; }
.hero-figura { margin: 0; }
.hero-figura img { border-radius: var(--r-lg); box-shadow: var(--sombra-md); width: 100%; }
.hero-figura figcaption { font-size: .85rem; color: var(--arena-texto); margin-top: .8rem; }

/* --- Botones y enlaces --------------------------------------------------- */
.boton {
  display: inline-flex; align-items: center; gap: .55rem;
  font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--verde); color: var(--blanco); border: 0; border-radius: var(--pill);
  padding: .82rem 1.7rem; transition: background .18s ease, transform .18s ease;
}
.boton:hover { background: var(--verde-osc); color: var(--blanco); transform: translateY(-1px); }
.boton[disabled] { opacity: .6; cursor: default; transform: none; }
.boton--ambar { background: var(--ambar); color: var(--ambar-tinta); }
.boton--ambar:hover { background: var(--ambar-hover); color: var(--ambar-tinta); }

.enlace-flecha {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .95rem; font-weight: 700; text-decoration: none; color: var(--verde-osc);
}
.enlace-flecha:hover { color: var(--ambar-texto); gap: .7rem; }

/* --- Secciones ----------------------------------------------------------- */
.seccion { padding: clamp(2.8rem, 5.5vw, 4.2rem) 0; }
.seccion--clara { background: var(--blanco); }
.seccion--verde { background: var(--verde-claro); border-radius: var(--r-xl); margin: 0 12px; }

.titulo-seccion { margin-top: 0; }
.titulo-seccion--compacto { margin-bottom: 1.2rem; }

/* Utilidades mínimas. Existen para que ninguna página necesite el atributo
   style="", que la política de seguridad del .htaccess bloquea. */
.acciones { margin-top: 1.6rem; }
.rejilla--separada { margin-top: 2rem; }
.lista-limpia--separada { margin-bottom: 2rem; }

.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 1.6rem; }

.tarjeta {
  background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--r);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.tarjeta:hover { transform: translateY(-4px); box-shadow: var(--sombra-md); }
.tarjeta img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.tarjeta-cuerpo { padding: 1.3rem 1.4rem 1.5rem; display: flex; flex-direction: column; flex: 1; }
.tarjeta h3 { margin: 0 0 .5rem; font-size: 1.16rem; }
.tarjeta h3 a { text-decoration: none; color: inherit; }
.tarjeta h3 a:hover { color: var(--verde); }
.tarjeta p { font-size: .96rem; color: var(--tinta-suave); margin-bottom: 1.2rem; }
.tarjeta .enlace-flecha { margin-top: auto; align-self: flex-start; }

.lista-limpia { list-style: none; padding: 0; margin: 0; }
.lista-limpia li { border-bottom: 1px solid var(--linea); }
.lista-limpia li:last-child { border-bottom: 0; }
.lista-limpia a, .lista-limpia .actual {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.05rem .25rem; text-decoration: none; color: var(--tinta); font-weight: 400;
}
.lista-limpia a:hover { color: var(--verde); }
.lista-limpia a::after { content: "\2192"; color: var(--ambar); font-weight: 700; flex: none; }
/* Página actual dentro de la lista: se muestra, pero no enlaza a sí misma. */
.lista-limpia .actual { color: var(--tinta-suave); font-weight: 700; }

/* --- Artículo ------------------------------------------------------------ */
.articulo { padding: clamp(2.2rem, 5vw, 3.6rem) 0 1.5rem; }
.articulo .prosa { max-width: var(--prosa); }
.prosa .entradilla { font-size: 1.14rem; color: var(--tinta-media); }

.prosa ul, .prosa ol { padding-left: 0; margin: 0 0 1.5rem; list-style: none; counter-reset: paso; }
.prosa ul li, .prosa ol li { position: relative; padding-left: 2rem; margin-bottom: .7rem; }
.prosa ul li::before {
  content: ""; position: absolute; left: .35rem; top: .72rem;
  width: 9px; height: 9px; background: var(--ambar); border-radius: 50%;
}
.prosa ol li { counter-increment: paso; padding-left: 2.6rem; }
.prosa ol li::before {
  content: counter(paso); position: absolute; left: 0; top: .1rem;
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--verde); color: var(--blanco);
  font-size: .84rem; font-weight: 700; line-height: 1.75rem; text-align: center;
}

.prosa figure { margin: 2.4rem 0; }
.prosa figure img { border-radius: var(--r); width: 100%; }
.prosa figcaption { font-size: .88rem; color: var(--tinta-suave); margin-top: .7rem; }

.nota {
  background: var(--ambar-claro); border-radius: var(--r);
  padding: 1.3rem 1.5rem; margin: 2.4rem 0; font-size: .96rem; color: var(--ambar-texto);
}
.nota p:last-child { margin-bottom: 0; }

.migas { font-size: .88rem; color: var(--tinta-suave); margin-bottom: 1.5rem; }
.migas a { color: var(--tinta-suave); text-decoration: none; }
.migas a:hover { color: var(--verde); }

.meta { font-size: .88rem; color: var(--tinta-suave); margin: 0 0 1.8rem; }

/* --- Formulario ---------------------------------------------------------- */
.formulario { max-width: 480px; }
.campo { margin-bottom: 1.2rem; }
.campo label { display: block; font-size: .92rem; font-weight: 700; margin-bottom: .4rem; }
.campo input, .campo textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--tinta);
  padding: .8rem 1rem; background: var(--blanco);
  border: 1.5px solid var(--linea); border-radius: var(--r-sm);
}
.campo textarea { min-height: 140px; resize: vertical; }
.campo input:focus, .campo textarea:focus {
  border-color: var(--verde); outline: none; box-shadow: 0 0 0 4px var(--verde-suave);
}

.aviso-form {
  display: none; margin-top: 1rem; padding: .85rem 1.1rem;
  background: var(--verde-claro); color: var(--verde-osc);
  border-radius: var(--r-sm); font-size: .95rem; font-weight: 700;
}
.aviso-form.visible { display: block; }
.aviso-form--error { background: var(--ambar-claro); color: var(--ambar-texto); }

/* --- Pie ----------------------------------------------------------------- */
.sitio-footer {
  background: var(--verde-osc); color: var(--pie-lema);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  margin-top: 3.5rem; padding: 3.2rem 0 2rem; font-size: .96rem;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2.4rem; }
.pie-titulo {
  font-size: .88rem; letter-spacing: .02em; text-transform: uppercase;
  color: var(--pie-titulo); margin: 0 0 1rem; font-weight: 700; line-height: 1.4;
}
.pie-lema { margin: 0; max-width: 36ch; }
.sitio-footer a { color: var(--pie-enlace); text-decoration: none; }
.sitio-footer a:hover { color: var(--ambar); text-decoration: underline; }
.sitio-footer ul { list-style: none; margin: 0; padding: 0; }
.sitio-footer li { margin-bottom: .6rem; }
.footer-base {
  border-top: 1px solid rgba(255,255,255,.16); margin-top: 2.6rem;
  padding-top: 1.4rem; font-size: .87rem; color: var(--pie-base);
}

/* --- Aviso de cookies ---------------------------------------------------- */
.cookies {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 70;
  background: var(--blanco); border-radius: var(--r); box-shadow: var(--sombra-md);
  padding: 1.15rem 1.35rem; max-width: 760px; margin: 0 auto;
  display: none; gap: 1.1rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  font-size: .93rem; color: var(--tinta-suave);
}
.cookies.visible { display: flex; }
.cookies p { margin: 0; flex: 1 1 300px; }
.cookies .boton { padding: .65rem 1.4rem; font-size: .93rem; }

/* --- Aparición al desplazar ---------------------------------------------- */
.revelar { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.revelar.visible { opacity: 1; transform: none; }

/* --- Adaptación ---------------------------------------------------------- */
@media (max-width: 980px) {
  .nav a { padding: .45rem .6rem; font-size: .92rem; }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figura { order: -1; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 17px; }
  :root { --r-xl: 26px; }
  .nav-boton { display: block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--blanco); border-bottom: 1px solid var(--linea);
    max-height: 0; overflow: hidden; transition: max-height .28s ease;
    box-shadow: var(--sombra);
  }
  .nav.abierto { max-height: 520px; }
  .nav ul { flex-direction: column; gap: 0; padding: .5rem 24px 1.2rem; }
  .nav li + li { border-top: 1px solid var(--linea); }
  .nav a { padding: .95rem .4rem; font-size: 1.02rem; border-radius: var(--r-sm); }
  .seccion--verde { margin: 0; border-radius: var(--r-lg); }
  .footer-grid { grid-template-columns: 1fr; gap: 1.9rem; }
  .cookies { left: 10px; right: 10px; bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .revelar { opacity: 1; transform: none; }
  .tarjeta:hover, .boton:hover { transform: none; }
}

@media print {
  .sitio-header, .sitio-footer, .cookies, .progreso, .saltar, .migas { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .articulo .prosa { max-width: none; }
  .seccion--verde, .hero { background: none; border-radius: 0; }
  a { color: #000; }
}
