/* forja.sesinit.com — una sola hoja para la portada y las tres páginas legales.
 *
 * La sirve forja_api.py como /web/forja.css?v=<sello>, con el sello sacado del
 * contenido al arrancar: al cambiarla hay que reiniciar com.nsesin.forja-api, y
 * entonces el navegador y Cloudflare piden la nueva sin esperar a la caché.
 *
 * Los colores son los de la app (ios/Forja/DesignSystem/Tema.swift): oscuro
 * casi negro y la brasa naranja. En claro, la brasa de la app (#FF6B2C) da
 * 2,9:1 sobre blanco y no se puede leer como texto: los enlaces van en
 * --acento (brasa oscura) y el naranja vivo queda para el botón, con texto
 * casi negro encima. Las cabeceras usan la redondeada del sistema, como la app
 * (`design: .rounded`): nada se descarga de fuera, la CSP lo prohíbe. */

:root {
  color-scheme: light dark;
  --fondo: #faf7f4;
  --superficie: #ffffff;
  --borde: rgb(22 24 29 / .10);
  --texto: #16181d;
  --suave: #444b58;
  --tenue: #626a78;
  --acento: #b93d0b;
  --brasa: #ff6b2c;
  --tinta-boton: #1b0d05;
  --halo: rgb(255 107 44 / .16);
  --redondo: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  --texto-base: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --curva: cubic-bezier(.16, 1, .3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #08090c;
    --superficie: #101318;
    --borde: rgb(255 255 255 / .09);
    --texto: #f5f7fa;
    --suave: #a3abb9;
    --tenue: #8a93a3;
    --acento: #ff8a52;
    --halo: rgb(255 107 44 / .22);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--suave);
  font: 17px/1.65 var(--texto-base);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgb(255 107 44 / .32); color: var(--texto); }

a {
  color: var(--acento);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, var(--acento) 45%, transparent);
  transition: text-decoration-color .2s, color .2s;
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible, .boton:focus-visible {
  outline: 2px solid var(--brasa);
  outline-offset: 3px;
  border-radius: 6px;
}

h1, h2, h3 { color: var(--texto); font-family: var(--redondo); text-wrap: balance; }
h1 { font-size: 2.25rem; line-height: 1.1; font-weight: 800; letter-spacing: -.025em; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; line-height: 1.3; font-weight: 750; letter-spacing: -.01em; margin: 2.6rem 0 .6rem; }
h3 { font-size: 1.06rem; line-height: 1.35; font-weight: 700; margin: 1.9rem 0 .35rem; }
p, ul { margin: 0 0 1rem; }
ul { padding-left: 1.2rem; }
li { margin: .35rem 0; }
li::marker { color: var(--tenue); }
strong { color: var(--texto); font-weight: 650; }
em { font-style: normal; color: var(--texto); }
code { font: .92em ui-monospace, "SF Mono", Menlo, monospace; color: var(--texto); }
p, li { text-wrap: pretty; }

/* ---------- armazón común ---------- */
.marco { max-width: 46rem; margin: 0 auto; padding: 0 16px; }
.cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 20px; padding-bottom: 20px;
}
.marca {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--texto); text-decoration: none;
  font: 800 1.15rem/1 var(--redondo); letter-spacing: -.01em;
}
.marca img { width: 34px; height: 34px; border-radius: 22.5%; }

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 1.4rem;
  border-radius: 16px;
  background: var(--brasa);
  color: var(--tinta-boton);
  font: 700 1rem/1 var(--redondo);
  text-decoration: none;
  transition: transform .16s var(--curva), background-color .2s;
}
.boton:hover { background: #ff7d45; }
.boton:active { transform: scale(.97); }
.boton svg { width: 1.1em; height: 1.1em; flex: none; }
.boton-chico { min-height: 40px; padding: 0 1rem; border-radius: 12px; font-size: .9rem; }

.pie {
  margin-top: 5rem;
  padding-top: 0; padding-bottom: 3rem;
  font-size: .9rem; color: var(--tenue);
}
.pie nav ul { list-style: none; padding: 0; margin: 0 0 .8rem; display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.pie nav li { margin: 0; }
.pie nav a { color: var(--suave); text-decoration: none; }
.pie nav a:hover, .pie nav a[aria-current] { color: var(--texto); }
.pie p { margin: 0; }
.pie p a { color: var(--suave); }

/* ---------- páginas de lectura ---------- */
.lectura { padding-top: 1.5rem; }
.lectura > :first-child { margin-top: 0; }
.lectura p, .lectura ul { max-width: 35rem; }
.fecha { color: var(--tenue); font-size: .9rem; margin-bottom: 2rem; }
.entrada { font-size: 1.12rem; color: var(--suave); }

/* Índice de las páginas largas: tarjeta arriba en el móvil, columna fija al
 * lado en escritorio (rejilla 1fr + 15rem, el índice `sticky`). */
.indice {
  background: var(--superficie);
  border-radius: 16px;
  padding: 1rem 1.15rem;
  margin: 0 0 2rem;
  font-size: .93rem;
}
.indice p { margin: 0 0 .5rem; font: 700 13px/1.2 var(--redondo); color: var(--tenue); letter-spacing: .02em; }
.indice ol { list-style: none; margin: 0; padding: 0; columns: 1; }
.indice li { margin: 0; break-inside: avoid; }
.indice a { display: block; padding: .3rem 0; color: var(--suave); text-decoration: none; line-height: 1.35; }
.indice a:hover { color: var(--texto); }
@media (min-width: 560px) { .indice ol { columns: 2; column-gap: 1.5rem; } }
h2[id] { scroll-margin-top: 1.5rem; }
.indice-lado { display: none; }

@media (min-width: 1040px) {
  .marco.ancho { max-width: 66rem; }
  .con-indice { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 4rem; align-items: start; }
  .con-indice .indice-movil { display: none; }
  .con-indice .indice-lado { display: block; }
  .con-indice .indice { position: sticky; top: 1.5rem; margin: 0; background: none; border: 0; padding: 0; }
  .con-indice .indice ol { columns: 1; }
  .con-indice .indice a { padding: .32rem 0; transition: color .2s, translate .2s var(--curva); }
  .con-indice .indice a:hover { color: var(--acento); translate: 3px 0; }
}

/* ---------- portada ---------- */
.portada { padding-top: 3.5rem; text-align: center; }
.portada .icono {
  width: 112px; height: 112px; border-radius: 22.5%;
  margin: 0 auto 1.4rem; display: block;
}
.portada h1 { font-size: clamp(3.25rem, 11vw, 6rem); line-height: 1; margin-bottom: .9rem; letter-spacing: -.04em; }
.lema { font: 650 clamp(1.2rem, 4.6vw, 1.5rem)/1.3 var(--redondo); color: var(--texto); margin: 0 auto .8rem; max-width: 24ch; text-wrap: balance; }
.portada .cifras { margin: 0 auto 1.8rem; max-width: 34ch; text-wrap: balance; }

.telefonos {
  position: relative;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 3vw, 28px);
  max-width: 44rem; margin: 4.6rem auto 0; padding: 0 2px;
  align-items: start;
}
.telefonos::before {
  content: ""; position: absolute; inset: 12% 8% -4%;
  background: radial-gradient(closest-side, var(--halo), transparent);
  filter: blur(30px); z-index: -1;
}
.telefonos figure { margin: 0; }
.telefonos img {
  display: block; width: 100%; height: auto; aspect-ratio: 900 / 1956;
  border-radius: clamp(14px, 4vw, 34px);
  background: #08090c;
}
.telefonos figure:nth-child(2) { margin-top: -2.2rem; }
.telefonos figure:nth-child(1), .telefonos figure:nth-child(3) { margin-top: 1.2rem; }
.telefonos figcaption { margin-top: .8rem; font-size: .85rem; line-height: 1.35; color: var(--tenue); }

.enlaces { margin: 4rem auto 0; max-width: 30rem; text-align: left; }
.enlaces h2 { margin-top: 0; }
.enlaces ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.enlaces li { margin: 0; }
.enlaces a {
  display: flex; justify-content: space-between; align-items: center;
  padding: .95rem 1.1rem; background: var(--superficie); border-radius: 14px;
  transition: background-color .2s; color: var(--texto); text-decoration: none; font-weight: 500;
}
.enlaces a::after { content: "→"; color: var(--tenue); transition: translate .2s var(--curva), color .2s; }
.enlaces a:hover { background: color-mix(in srgb, var(--superficie) 88%, var(--brasa)); }
.enlaces a:hover::after { translate: 4px 0; color: var(--brasa); }

@media (max-width: 420px) {
  .portada { padding-top: 1.6rem; }
  .portada .icono { width: 72px; height: 72px; margin-bottom: 1rem; }
  .portada .cifras { margin-bottom: 1.3rem; }
  .telefonos { margin-top: 3.6rem; }
  .telefonos figcaption { font-size: 13px; }
  .enlaces { margin-top: 2.4rem; }
  .telefonos figure:nth-child(2) { margin-top: -1.2rem; }
  .telefonos figure:nth-child(1), .telefonos figure:nth-child(3) { margin-top: .6rem; }
}

/* Un solo momento de movimiento: la portada entra al cargar (icono, título y
 * los tres teléfonos escalonados). Sin preferencia de movimiento reducido;
 * el estado de partida es el visible, así que sin animación todo está ahí. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes forja-sube { from { opacity: 0; translate: 0 18px; } }
  @keyframes forja-enciende { from { opacity: 0; scale: .9; filter: brightness(.4); } }
  .portada .icono { animation: forja-enciende .9s var(--curva) both; }
  .portada h1, .portada .lema, .portada .cifras, .portada .boton { animation: forja-sube .8s var(--curva) both; }
  .portada h1 { animation-delay: .08s; }
  .portada .lema { animation-delay: .14s; }
  .portada .cifras { animation-delay: .2s; }
  .portada .boton { animation-delay: .26s; }
  .telefonos figure { animation: forja-sube 1s var(--curva) both; }
  .telefonos figure:nth-child(1) { animation-delay: .34s; }
  .telefonos figure:nth-child(2) { animation-delay: .42s; }
  .telefonos figure:nth-child(3) { animation-delay: .5s; }
}

/* En la portada todo va centrado: el pie también. */
.portada + .pie { text-align: center; }
.portada + .pie nav ul { justify-content: center; }
