/* base.css — tokens, reset, tipografía, botones y pills. Fuente de verdad: Design.md */

:root {
  /* Color (Design.md > Colors) */
  --ink: #0f172a;
  --emerald: #059669;        /* acentos, bordes, anillo de foco */
  --emerald-text: #047857;   /* emerald para texto/relleno con contraste AA (#059669 sobre blanco = 3.8:1) */
  --cyan: #0284c7;
  --mint: #10b981;
  --paper: #ffffff;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #3d4a42;     /* on-surface-variant */
  --mint-50: #ecfdf5;
  --mint-200: #a7f3d0;

  /* Pills por categoría: fondo claro + texto oscuro de la misma familia (AA) */
  --cat-espacio-bg: #eef2ff;            --cat-espacio-fg: #4338ca;
  --cat-salud-bg: #fff1f2;              --cat-salud-fg: #be123c;
  --cat-tecnologia-bg: #f8fafc;         --cat-tecnologia-fg: #334155;
  --cat-medio-ambiente-bg: #ecfdf5;     --cat-medio-ambiente-fg: #047857;
  --cat-fisica-bg: #f0f9ff;             --cat-fisica-fg: #0369a1;
  --cat-animales-y-naturaleza-bg: #f7fee7; --cat-animales-y-naturaleza-fg: #3f6212;
  --cat-cerebro-y-mente-bg: #fff7ed;    --cat-cerebro-y-mente-fg: #c2410c;
  --cat-curiosidades-bg: #fefce8;       --cat-curiosidades-fg: #854d0e;

  /* Tipografía */
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --fs-display: 2.25rem;  --lh-display: 2.75rem;  --ls-display: -0.015em;
  --fs-headline-lg: 1.75rem; --lh-headline-lg: 2.25rem; --ls-headline-lg: -0.01em;

  /* Radios */
  --r-sm: 0.25rem;
  --r-md: 0.375rem;
  --r-lg: 0.5rem;
  --r-full: 9999px;

  /* Espaciado (múltiplos de 0.25rem) */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --margin: 1.25rem;
  --gutter: 1rem;

  /* Elevación */
  --shadow-2: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(5, 150, 105, 0.04);
}

@media (min-width: 768px) {
  :root { --margin: 2rem; --gutter: 1.5rem; }
}
@media (min-width: 1024px) {
  :root {
    --margin: 3rem; --gutter: 2.5rem;
    --fs-display: 3.75rem; --lh-display: 4.25rem; --ls-display: -0.025em;
    --fs-headline-lg: 2.5rem; --lh-headline-lg: 3rem; --ls-headline-lg: -0.02em;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65rem;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
figure, blockquote, ul, ol, p, h1, h2, h3, h4 { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--ink); }

/* Foco visible general: anillo #059669 (Design.md > Accesibilidad) */
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; border-radius: var(--r-sm); }

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

.skip-link {
  position: absolute; left: var(--space-md); top: -3rem; z-index: 100;
  background: var(--ink); color: #fff; padding: var(--space-sm) var(--space-md); border-radius: var(--r-md);
}
.skip-link:focus { top: var(--space-sm); }

.container { width: 100%; max-width: 80rem; margin-inline: auto; padding-inline: var(--margin); }

/* Escalas tipográficas */
.t-display { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: 600; }
.t-headline-lg { font-size: var(--fs-headline-lg); line-height: var(--lh-headline-lg); letter-spacing: var(--ls-headline-lg); font-weight: 500; }
.t-headline-md { font-size: 1.75rem; line-height: 2.25rem; letter-spacing: -0.01em; font-weight: 500; }
.t-headline-sm { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; }
.t-lead { font-size: 1.125rem; line-height: 1.875rem; }
.t-small { font-size: 0.875rem; line-height: 1.4rem; }
.t-label-caps { font-size: 0.6875rem; line-height: 1rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.t-label { font-size: 0.8125rem; line-height: 1.25rem; font-weight: 500; letter-spacing: 0.01em; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  padding: 0.625rem 1.25rem; border-radius: var(--r-full); border: 1px solid transparent;
  font-weight: 500; font-size: 0.9375rem; line-height: 1.25rem; white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--emerald-text); }
.btn--eco { background: var(--mint-50); color: var(--emerald-text); border-color: var(--mint-200); }
.btn--eco:hover { background: var(--emerald-text); color: #fff; border-color: var(--emerald-text); }

/* Ghost: subrayado hairline que crece de izquierda a derecha */
.btn-ghost {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: 0.25rem 0; background: none; border: 0; font-weight: 500; font-size: 0.9375rem; color: var(--ink);
}
.btn-ghost::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--cyan); transform: scaleX(0); transform-origin: left; transition: transform 200ms ease;
}
.btn-ghost:hover::after, .btn-ghost:focus-visible::after { transform: scaleX(1); }

/* Pills de categoría */
.pill {
  position: relative; z-index: 2; display: inline-block; align-self: flex-start;
  padding: 0.25rem 0.75rem; border-radius: var(--r-full); border: 1px solid transparent;
  font-size: 0.6875rem; line-height: 1rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  transition: filter 150ms ease;
}
.pill:hover { filter: brightness(0.96); }
.pill--espacio { background: var(--cat-espacio-bg); color: var(--cat-espacio-fg); }
.pill--salud { background: var(--cat-salud-bg); color: var(--cat-salud-fg); }
.pill--tecnologia { background: var(--cat-tecnologia-bg); color: var(--cat-tecnologia-fg); border-color: var(--line); }
.pill--medio-ambiente { background: var(--cat-medio-ambiente-bg); color: var(--cat-medio-ambiente-fg); }
.pill--fisica { background: var(--cat-fisica-bg); color: var(--cat-fisica-fg); }
.pill--animales-y-naturaleza { background: var(--cat-animales-y-naturaleza-bg); color: var(--cat-animales-y-naturaleza-fg); }
.pill--cerebro-y-mente { background: var(--cat-cerebro-y-mente-bg); color: var(--cat-cerebro-y-mente-fg); }
.pill--curiosidades { background: var(--cat-curiosidades-bg); color: var(--cat-curiosidades-fg); }

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