/* ══════════════════════════════════════════════════════════
   TIERRA MÉTRICA — Hoja de estilos compartida
   Paleta derivada del logotipo oficial.
   ══════════════════════════════════════════════════════════ */

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

:root {
  /* ── Marca ──
     #464991, #5E9877 y #767574 están muestreados del logotipo oficial.
     El resto son variantes derivadas de esos tres. */
  --indigo:        #464991;  /* índigo del isotipo */
  --indigo-dark:   #313463;  /* fondos hero / footer */
  --indigo-darker: #262850;
  --indigo-mid:    #5457A8;  /* hover */
  --indigo-tint:   #ECEDF7;  /* fondo de chips y badges */

  --green:         #5E9877;  /* verde del wordmark — 3.4:1 sobre blanco,
                                sólo para rellenos y acentos, nunca texto */
  --green-dark:    #426B53;  /* texto y botones — 6.1:1, cumple AA */
  --green-darker:  #35573F;  /* hover de botón */
  --green-tint:    #EAF2ED;

  /* El gris del logo es #767574, pero a 4.5:1 se queda justo en el límite;
     para «VALUACIÓN» a 8px y para la categoría Desarrollo se usa oscurecido. */
  --slate:         #5C5B5A;  /* 6.6:1 sobre blanco */
  --slate-tint:    #EFEEEC;

  /* ── Neutros ── */
  --cream:      #F7F5F0;
  --cream-dark: #EEE9E0;
  --text:       #1a1a1a;
  --text-muted: #5a5a5a;
  --text-faint: #8a8a8a;
  --border:     rgba(0,0,0,0.09);
  --white:      #ffffff;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --radius:    10px;
  --radius-lg: 16px;
  --maxw:      1100px;
}

html { scroll-behavior: smooth; }

/* La barra de navegación es fija: sin este margen, al saltar a un ancla
   el encabezado de destino queda escondido debajo de ella. */
section[id], [id^="analisis"] { scroll-margin-top: 88px; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--white);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Foco visible para navegación por teclado */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ══ NAV ══ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 5%;
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center;
  justify-content: space-between; height: 72px;
  gap: 16px;
}

/* ── Logotipo ── */
.nav-logo { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.logo-mark { height: 34px; width: auto; flex-shrink: 0; display: block; }
.logo-text { line-height: 1; }
.logo-name {
  font-family: var(--font-body);
  font-size: 20px; font-weight: 700;
  color: var(--green); letter-spacing: -0.02em;
  display: block;
}
.logo-sub {
  font-size: 8px; font-weight: 500;
  color: var(--slate); letter-spacing: 0.34em;
  text-transform: uppercase;
  display: block; margin-top: 2px;
}

.nav-links { display: flex; align-items: center; gap: 30px; list-style: none; }
.nav-links a {
  font-size: 14px; color: var(--text-muted);
  text-decoration: none; font-weight: 400;
  transition: color .2s;
}
.nav-links a:hover { color: var(--indigo); }
.nav-links a.active { color: var(--indigo); font-weight: 500; }

/* Mismo verde que .btn-primary, para que el botón de la barra y el del
   cuerpo se lean como la misma acción. Blanco sobre #426B53 da 6.1:1. */
.nav-cta {
  font-size: 13px; font-weight: 500;
  background: var(--green-dark); color: var(--white);
  padding: 9px 20px; border-radius: var(--radius);
  text-decoration: none; border: none; cursor: pointer;
  transition: background .2s; white-space: nowrap;
}
.nav-cta:hover { background: var(--green-darker); }

/* ── Botón hamburguesa (sólo móvil) ── */
.nav-toggle {
  display: none;
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; width: 40px; height: 40px;
  cursor: pointer; padding: 0;
  align-items: center; justify-content: center;
}
.nav-toggle span {
  display: block; width: 18px; height: 1.5px;
  background: var(--indigo); position: relative;
  transition: background .2s;
}
.nav-toggle span::before, .nav-toggle span::after {
  content: ''; position: absolute; left: 0;
  width: 18px; height: 1.5px; background: var(--indigo);
  transition: transform .25s;
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after  { top: 6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after  { transform: translateY(-6px) rotate(-45deg); }

/* ══ BOTONES ══ */
.btn-primary {
  font-family: var(--font-body);
  font-size: 14px; font-weight: 500;
  background: var(--green-dark); color: var(--white);
  padding: 13px 28px; border-radius: var(--radius);
  border: none; cursor: pointer;
  text-decoration: none; display: inline-block;
  transition: background .2s;
}
.btn-primary:hover { background: var(--green-darker); }
.btn-outline {
  font-family: var(--font-body);
  font-size: 14px; color: rgba(255,255,255,0.85);
  padding: 13px 28px; border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.25);
  cursor: pointer; text-decoration: none;
  display: inline-block; background: transparent;
  transition: border-color .2s, color .2s;
}
.btn-outline:hover { border-color: rgba(255,255,255,0.6); color: #fff; }

/* ══ SUSCRIPCIÓN ══
   Compartida entre la portada y «Hablando de Tierra». */
.suscribe { background: var(--indigo-dark); padding: 60px 5%; }
.suscribe-inner {
  max-width: 860px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 40px; align-items: center;
}
.suscribe h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(24px, 3vw, 31px); color: var(--white);
  line-height: 1.25; margin-bottom: 10px;
}
.suscribe p { font-size: 14.5px; color: rgba(255,255,255,0.62); line-height: 1.7; }
.suscribe-form { display: flex; gap: 10px; flex-wrap: wrap; }
.suscribe-form input[type="email"] {
  flex: 1; min-width: 200px;
  font-family: var(--font-body); font-size: 14.5px;
  padding: 13px 16px; border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.07); color: var(--white);
}
.suscribe-form input[type="email"]::placeholder { color: rgba(255,255,255,0.42); }
.suscribe-form input[type="email"]:focus {
  outline: 2px solid var(--green); outline-offset: 1px;
  background: rgba(255,255,255,0.12);
}
.suscribe-nota { font-size: 11.5px; color: rgba(255,255,255,0.42); margin-top: 12px; line-height: 1.6; }
.suscribe-nota a { color: rgba(255,255,255,0.68); }
/* El campo trampa antispam: fuera de pantalla pero accesible al robot */
.oculto { position: absolute; left: -9999px; }

@media (max-width: 860px) {
  .suscribe-inner { grid-template-columns: 1fr; gap: 26px; }
}

/* ══ SECCIONES ══ */
.section { padding: 72px 5%; }
.section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-eyebrow {
  font-size: 11px; font-weight: 500;
  color: var(--green-dark);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 400; color: var(--indigo);
  line-height: 1.2; margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.section-sub {
  font-size: 15px; color: var(--text-muted);
  max-width: 520px; line-height: 1.7;
  margin-bottom: 40px;
}

/* ══ CTA FINAL ══ */
.cta-section { background: var(--indigo-dark); text-align: center; }
.cta-h {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 38px);
  color: var(--white); margin-bottom: 12px; font-weight: 400;
}
.cta-sub {
  font-size: 15px; color: rgba(255,255,255,0.6);
  margin-bottom: 32px; line-height: 1.6;
}
.cta-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ══ FOOTER ══ */
.footer { background: var(--indigo-darker); padding: 28px 5%; }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 12px;
}
.footer-copy { font-size: 12px; color: rgba(255,255,255,0.4); }
/* Sin flex-wrap los cinco enlaces desbordan la pantalla en móvil
   y hacen que toda la página se deslice de lado. */
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.footer-links a {
  font-size: 12px; color: rgba(255,255,255,0.4);
  text-decoration: none; transition: color .2s;
}
.footer-links a:hover { color: rgba(255,255,255,0.75); }

/* ══════════════════════════════════════════════════════════
   ARTÍCULOS DE ANÁLISIS
   ══════════════════════════════════════════════════════════ */
.article-hero {
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  padding: 40px 5% 44px;
}
.article-hero-inner { max-width: 760px; margin: 0 auto; }
.breadcrumb { font-size: 12px; color: var(--text-faint); margin-bottom: 22px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--indigo); text-decoration: underline; }
.article-cat {
  display: inline-block; font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.09em;
  background: var(--indigo-tint); color: var(--indigo);
  padding: 4px 11px; border-radius: 20px; margin-bottom: 14px;
}
.article-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 400; color: var(--indigo);
  line-height: 1.18; margin-bottom: 14px; letter-spacing: -0.01em;
}
.article-standfirst { font-size: 17px; color: var(--text-muted); line-height: 1.7; }
.article-meta {
  font-size: 12px; color: var(--text-faint);
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

.article-body { max-width: 760px; margin: 0 auto; padding: 52px 5% 64px; }
.article-body > p { font-size: 16px; line-height: 1.8; color: #333; margin-bottom: 22px; }
.article-body h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 400; color: var(--indigo);
  line-height: 1.25; margin: 44px 0 16px;
}
.article-body ul { margin: 0 0 24px 0; padding-left: 20px; }
.article-body li { font-size: 16px; line-height: 1.75; color: #333; margin-bottom: 10px; }
.article-body strong { font-weight: 600; color: var(--text); }
.article-body a { color: var(--indigo); text-decoration: underline; text-underline-offset: 2px; }

/* El botón de llamado vive dentro de .article-body, así que la regla de
   arriba lo pintaba de índigo y subrayado sobre el fondo verde. */
.article-body .btn-primary { color: var(--white); text-decoration: none; }

.pullquote {
  border-left: 3px solid var(--green);
  background: var(--green-tint);
  padding: 20px 24px; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 32px 0; font-size: 16px; line-height: 1.7; color: #2b4a38;
}

/* ── Figuras y gráficos ── */
.figure {
  margin: 36px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px 20px;
  background: var(--white);
}
.figure-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.figure-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; line-height: 1.5; }
.figure-scroll { overflow-x: auto; }
/* min-width fija un piso de legibilidad; por debajo el gráfico se desplaza
   dentro de su propio contenedor, nunca empuja el ancho de la página. */
.figure-scroll svg { display: block; min-width: 420px; max-width: 100%; height: auto; }
.figure-note {
  font-size: 11.5px; color: var(--text-faint);
  line-height: 1.55; margin-top: 18px;
  padding-top: 14px; border-top: 1px solid var(--border);
}

/* Leyenda (obligatoria con 2+ series) */
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 18px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

/* Vista de tabla — alternativa accesible a cada gráfico */
.figure details { margin-top: 14px; }
.figure summary {
  font-size: 12.5px; color: var(--indigo); cursor: pointer;
  font-weight: 500; padding: 4px 0;
}
.data-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.data-table th, .data-table td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.data-table th { font-weight: 600; color: var(--text); font-size: 12px; }
.data-table td { color: var(--text-muted); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Fuentes ── */
.sources {
  margin-top: 44px; padding-top: 22px;
  border-top: 1px solid var(--border);
}
.sources h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-faint); margin-bottom: 12px; font-weight: 600; }
.sources ol { padding-left: 18px; margin: 0; }
.sources li { font-size: 12.5px; color: var(--text-muted); line-height: 1.65; margin-bottom: 8px; }
.sources a { color: var(--text-muted); }

/* ── Aviso metodológico ── */
.disclaimer {
  background: var(--cream); border-radius: var(--radius);
  padding: 18px 20px; margin-top: 28px;
  font-size: 12.5px; color: var(--text-muted); line-height: 1.65;
}

/* ── CTA dentro del artículo ── */
.article-cta {
  background: var(--indigo-tint);
  border-radius: var(--radius-lg);
  padding: 30px 28px; margin-top: 44px; text-align: center;
}
.article-cta p { font-size: 15px; color: var(--indigo); margin-bottom: 18px; line-height: 1.6; }

/* ── Índice del blog ── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* ══ RESPONSIVE ══ */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  /* La altura era fija en 72px, así que al desplegarse el menú no cabía
     dentro de la barra y se dibujaba encima del contenido de la página,
     sin fondo propio. Con altura automática la barra crece y lo cubre. */
  .nav-inner { flex-wrap: wrap; height: auto; min-height: 72px; gap: 10px; }

  /* Compactar logo y botón para que quepan en un solo renglón junto a la
     hamburguesa; si no, el botón se va solo a una segunda fila. */
  .logo-name { font-size: 18px; }
  .nav-cta { font-size: 12.5px; padding: 9px 15px; }

  .nav-links {
    display: none;
    order: 3; width: 100%;
    flex-direction: column; align-items: stretch;
    gap: 0; padding: 6px 0 14px;
    border-top: 1px solid var(--border);
  }
  /* Fondo sólido propio: no depende de la transparencia de la barra */
  .nav-links.open {
    display: flex;
    background: var(--white);
    box-shadow: 0 14px 28px rgba(0,0,0,0.10);
  }
  .nav-links a {
    display: block; padding: 14px 4px; font-size: 15px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links li:last-child a { border-bottom: none; }
  .nav-cta { margin-left: auto; }
}

/* Con el menú abierto la barra deja de ser translúcida, para que los
   enlaces nunca compitan con lo que pasa por detrás. */
.nav:has(.nav-links.open) { background: var(--white); }
/* En pantallas estrechas el logotipo y el botón se encogen lo justo para
   compartir renglón con la hamburguesa. Sin esto el botón cae solo a una
   segunda fila y la barra se ve desequilibrada. */
@media (max-width: 430px) {
  .nav-cta { font-size: 12px; padding: 8px 13px; }
  .logo-mark { height: 28px; }
  .logo-name { font-size: 16px; }
  .logo-sub { font-size: 7.5px; letter-spacing: 0.24em; }
}

/* Por debajo de ~405px, "Solicitar información" ya no cabe junto al
   logotipo completo (360px de contenido contra 338 disponibles en un
   iPhone de 375). Se conserva el isotipo, que es la parte reconocible,
   y se cede el nombre; el enlace mantiene su aria-label. */
@media (max-width: 410px) {
  .logo-text { display: none; }
  .logo-mark { height: 30px; }
}
