/* ============================================================
   Codia · Base
   Reset, tipografía, enlaces, botones y utilidades.
   ============================================================ */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--t-md);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

/* Debe ir DESPUÉS de la regla de arriba: `display: block` en un <svg>
   le gana al `display: none` que el navegador aplica por defecto al
   atributo `hidden`, y los dos íconos del botón de tema se verían juntos. */
[hidden] { display: none !important; }

::selection { background: var(--accent); color: var(--on-accent); }

/* ---- Titulares -------------------------------------------
   Space Grotesk es geométrica y no tiene itálica real, así que
   el énfasis en los titulares ya no se hace en cursiva: se hace
   con el gradiente de marca sobre el texto. */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--t-3xl); line-height: 0.98; letter-spacing: -0.03em; }
h2 { font-size: var(--t-2xl); letter-spacing: -0.025em; line-height: 1.04; }
h3 { font-size: var(--t-xl); }
h4 { font-size: var(--t-lg); }

/* Una palabra resaltada dentro de un titular: el único
   énfasis tipográfico del sitio, usado con cuentagotas. */
h1 em, h2 em {
  font-style: normal;
  font-weight: inherit;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

p { margin: 0 0 var(--s-4); max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; color: var(--ink); }

/* ---- Enlaces ---------------------------------------------- */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: color .15s ease, text-decoration-color .15s ease;
}
a:hover { color: var(--accent-2); text-decoration-color: currentColor; }

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

/* ---- Etiqueta monoespaciada ------------------------------- */
.label {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
}
.label--accent { color: var(--accent); }

/* Folio: el número grande en serif que abre cada sección.
   Marca orden real de lectura, no es decoración. */
.folio {
  display: block;
  font-family: var(--f-display);
  font-size: var(--t-folio);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
  margin-bottom: var(--s-2);
}

/* ---- Bajada ----------------------------------------------- */
.lead {
  font-size: var(--t-lg);
  line-height: 1.48;
  color: var(--ink-2);
  max-width: 44ch;
}

/* ---- Botones ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--f-body);
  font-size: var(--t-base);
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  padding: 16px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn--primary {
  background: var(--gradient-brand);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule-strong);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* ---- Enlace con flecha ------------------------------------ */
.arrow {
  font-family: var(--f-body);
  font-size: var(--t-base);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding-bottom: 2px;
}
.arrow::after { content: "\2192"; transition: transform .15s ease; }
.arrow:hover { border-bottom-color: currentColor; }
.arrow:hover::after { transform: translateX(4px); }

/* ---- Utilidades ------------------------------------------- */
.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--s-5); }
@media (min-width: 760px) { .wrap { padding: 0 var(--s-7); } }

.narrow { max-width: var(--narrow); }
.stack > * + * { margin-top: var(--s-5); }
.mono-num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.skip {
  position: absolute;
  left: -9999px;
  top: var(--s-3);
  background: var(--accent);
  color: var(--on-accent);
  padding: 12px 20px;
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
}
.skip:focus { left: var(--s-5); }

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

/* ---- Listas ----------------------------------------------- */
.list { list-style: none; margin: 0 0 var(--s-4); padding: 0; max-width: var(--measure); }
.list li { position: relative; padding-left: 26px; margin-bottom: var(--s-3); }
.list li:last-child { margin-bottom: 0; }
.list li::before {
  content: ""; position: absolute; left: 2px; top: 0.6em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--gradient-brand);
}
.list--muted li::before { background: var(--rule-strong); }

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