/* ITERAC — estilos del sitio. Tokens en diseno/ESPECIFICACION.md */

:root {
  --ground: #0a0a0a;
  --ink: #e8e8e4;
  --muted: #9a9a95;
  --rule: #6e6e69;
  --hair: #2a2a28;
  --flag: #ff6a5c;
  --slab: 'Roboto Slab', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --logo: 'Space Mono', 'IBM Plex Mono', monospace;
  --gutter: 24px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --ground: #f2f2ef;
  --ink: #0a0a0a;
  --muted: #55554f;
  --rule: #77776f;
  --hair: #cfcfc9;
  --flag: #b3201a;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--slab);
  font-size: 16px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
input:focus-visible { outline-color: var(--ink); }
img { max-width: 100%; height: auto; display: block; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: 8px; top: -60px; padding: 10px 14px; border: 1px solid var(--rule); background: var(--ground); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; z-index: 10; }
.saltar:focus { top: 8px; }
[hidden] { display: none !important; }
html:not(.js) .solo-js { display: none !important; }

.contenedor { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter) 48px; }
.columna { max-width: 800px; margin: 0 auto; }

/* ---------- Texto ---------- */
.etq { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.id { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--muted); }
.dato { font-family: var(--mono); font-size: 14px; line-height: 1.5; }
.texto { font-family: var(--mono); font-weight: 300; font-size: 15px; line-height: 1.75; }
.texto p { margin: 12px 0 0; }
.texto p:first-child { margin-top: 0; }
h1 { margin: 8px 0 0; font-family: var(--slab); font-weight: 400; font-size: 48px; line-height: 1.05; }
.h1-inicio { font-size: 28px; line-height: 1.2; margin: 8px 0 12px; }

/* ---------- Botones ---------- */
.btn {
  min-height: 44px; padding: 0 12px;
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 2px;
  font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .08em;
}
.btn[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.btn-texto {
  min-height: 44px; padding: 0; background: transparent; border: 0;
  font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .08em;
}
.enlace-flecha { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .08em; }

/* ---------- Cabecera ---------- */
.cab {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; border-bottom: 1px solid var(--hair);
}
.logo {
  display: inline-flex; align-items: center; gap: 4px; min-height: 64px;
  font-family: var(--logo); font-weight: 400; font-size: 20px;
}
.logo:hover { text-decoration: none; }
.logo-bloque { display: inline-block; width: 11px; height: 20px; background: var(--ink); }
.cab-panel { display: contents; }
.cab-nav { display: flex; flex-wrap: wrap; gap: 0 20px; font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .08em; }
.cab-nav a { padding: 12px 0 14px; border-bottom: 2px solid transparent; }
.cab-nav a[aria-current="page"] { border-bottom-color: var(--ink); }
.cab-nav a:hover { text-decoration: none; border-bottom-color: var(--rule); }
.cab-nav a[aria-current="page"]:hover { border-bottom-color: var(--ink); }
.cab-menu { display: none; }

.ruta {
  display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 14px 0;
  font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .08em; color: var(--muted);
}
.ruta [aria-current] { color: var(--ink); }

/* ---------- Pie ---------- */
.pie { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--rule); }
.pie-lema { margin: 8px 0 32px; max-width: 40ch; font-family: var(--slab); font-weight: 400; font-size: 22px; line-height: 1.25; }
.pie-cols { display: flex; flex-wrap: wrap; gap: 24px 48px; margin-top: 24px; }
.pie-col { flex: 1 1 140px; min-width: 0; }
.pie-col .etq { margin-bottom: 8px; }
.pie-col a, .pie-col span.pie-item { display: block; padding: 6px 0; font-size: 14px; line-height: 1.55; }
.pie-col span.pie-item { color: var(--muted); }
.pie-final {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--hair);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.pie-corto {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px;
  padding-top: 16px; border-top: 1px solid var(--hair);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.pie-corto nav { display: flex; flex-wrap: wrap; gap: 0 20px; letter-spacing: .08em; }
.pie-corto nav a { padding: 10px 0; }

/* ---------- Censura ---------- */
.censura { display: inline-block; background: var(--ink); vertical-align: middle; height: 22px; width: 220px; max-width: 100%; }

/* ---------- Inicio ---------- */
.inicio { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 40px 64px; padding: 56px 0 40px; }
.inicio-texto { flex: 1 1 340px; min-width: 0; }
.inicio-texto > p { margin: 0 0 40px; max-width: 46ch; }
.inicio-fig { flex: 0 1 502px; min-width: 0; margin: 0; }
.indice { border-top: 1px solid var(--rule); margin-top: 8px; }
.indice-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.indice-fila:hover { text-decoration: none; }
.indice-fila:hover .ttl { text-decoration: underline; }
.indice-fila .id { flex: 0 0 150px; }
.indice-fila .ttl-c { flex: 1 1 180px; min-width: 0; }
.indice-fila .ttl { font-family: var(--slab); font-size: 16px; line-height: 1.35; }
.indice-fila .censura { width: 150px; height: 18px; }
.indice-fila .est { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; }

/* ---------- Figuras ASCII ---------- */
.ascii-scroll { overflow-x: auto; }
.ascii-lienzo { position: relative; }
.ascii {
  position: absolute; left: 0; top: 0; margin: 0;
  font-family: var(--mono); font-size: 11px; line-height: 12px; letter-spacing: 0; white-space: pre;
  color: var(--ink);
}
.ascii-tenue { opacity: .35; }
.ascii-medio { opacity: .65; }
.ascii-muted { color: var(--muted); }
.ascii-hair { color: var(--hair); }
.ascii-orbita { color: var(--rule); opacity: .6; }
.ascii-rojo { color: var(--flag); font-weight: 500; }
.ascii-etq { position: absolute; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); }
figcaption, .pie-fig { padding-top: 8px; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--muted); }

/* ---------- Archivo ---------- */
.intro { padding: 16px 0 24px; }
.intro h1 { margin: 0 0 12px; }
.intro p { margin: 0; max-width: 60ch; }
.vista { display: flex; gap: 20px; border-bottom: 1px solid var(--hair); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; }
.vista a, .vista span { min-height: 44px; display: inline-flex; align-items: center; padding: 0 0 2px; }
.vista a { color: var(--muted); }
.vista [aria-current] { margin-bottom: -1px; border-bottom: 2px solid var(--ink); color: var(--ink); }
.filtros { padding: 20px 0 0; }
.filtros label { display: block; }
.buscar {
  display: block; width: 100%; margin-top: 6px; min-height: 48px; padding: 8px 14px;
  background: transparent; color: var(--ink); border: 1px solid var(--rule); border-radius: 2px;
  font-family: var(--mono); font-size: 14px; font-weight: 400;
}
.buscar::placeholder { color: var(--rule); }
.pestanas { display: flex; flex-wrap: wrap; gap: 0 4px; margin-top: 20px; border-bottom: 1px solid var(--hair); }
.pestana {
  min-height: 44px; padding: 10px 20px 8px 0; margin-bottom: -1px;
  background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .08em;
}
.pestana[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.pestana .n { color: var(--muted); }
.etiquetas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.etiquetas .etq { margin-right: 6px; }
.chip { min-height: 44px; padding: 0 10px; }
.barra-res {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px;
  padding: 14px 0 10px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted);
}
.barra-res .acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
.barra-res .limpiar { color: var(--ink); text-decoration: underline; }
.barra-res .orden { color: var(--muted); }
.barra-res .azar { color: var(--ink); }
.tabla { border-top: 1px solid var(--rule); }
.tabla-cab, .fila { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; }
.tabla-cab { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.fila { padding: 18px 0; border-bottom: 1px solid var(--hair); }
.fila:hover { text-decoration: none; }
a.fila:hover .ttl { text-decoration: underline; }
.c-id { flex: 0 0 170px; }
.c-ttl { flex: 1 1 220px; min-width: 0; }
.c-it { flex: 0 0 150px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; }
.c-est { flex: 0 0 120px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; }
.c-fl { flex: 0 0 20px; text-align: right; font-family: var(--mono); }
.tabla-cab span { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); }
.fila .ttl { font-family: var(--slab); font-size: 18px; line-height: 1.3; }
.fila .flecha { display: inline-block; transition: transform .15s; }
a.fila:hover .flecha, a.boton-fl:hover .flecha { transform: translateX(4px); }
.vacio { padding: 32px 0; border-bottom: 1px solid var(--hair); }
.vacio button { min-height: 0; color: var(--ink); text-decoration: underline; }

/* ---------- Mapa ---------- */
.mapa-zona { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; margin-top: 20px; }
.mapa-caja { flex: 0 1 auto; min-width: 0; max-width: 100%; border: 1px solid var(--rule); border-radius: 2px; padding: 12px; overflow-x: auto; }
.mapa { position: relative; margin: 0 auto; }
.mapa-puntos { color: var(--hair); }
.mapa-marco { color: var(--rule); }
.mapa-etq { position: absolute; padding: 0 4px; background: var(--ground); font-family: var(--mono); font-size: 11px; line-height: 16px; letter-spacing: .04em; color: var(--muted); pointer-events: none; }
.mapa-etq.on { color: var(--ink); }
.mapa-pt {
  position: absolute; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  padding: 0; background: transparent; border: 0; color: var(--ink); font-family: var(--mono); font-weight: 500;
}
.mapa-pt.on { color: var(--flag); }
.mapa-glifo { background: var(--ground); }
.mapa-barra { display: block; width: 8px; height: 14px; background: var(--ink); }
.ficha-lat { flex: 1 1 220px; min-width: 0; border: 1px solid var(--rule); border-radius: 2px; }
.ficha-lat .cab-caja { padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.ficha-lat .cuerpo { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.ficha-lat .ttl { font-family: var(--slab); font-size: 20px; line-height: 1.25; }
.ficha-lat .censura { display: block; width: 70%; height: 24px; }
.boton-fl {
  display: inline-flex; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 8px;
  padding: 0 14px; border: 1px solid var(--rule); border-radius: 2px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
}
.boton-fl:hover { text-decoration: none; }
.aviso-restr { margin-top: 8px; padding: 12px 14px; border: 1px solid var(--hair); border-radius: 2px; }
.leyenda { padding: 12px 16px; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 6px; }
.leyenda .i { color: var(--ink); }
.leyenda .r { color: var(--flag); }
.leyenda .b { display: inline-block; width: 7px; height: 12px; background: var(--ink); vertical-align: -2px; }
.ficha-lat .azar-c { padding: 0 16px 16px; }
.ficha-lat .azar-c .btn { width: 100%; }

/* ---------- Expediente ---------- */
.exp-cab { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 16px 0 24px; }
.exp-cab > div:first-child { flex: 1 1 380px; min-width: 0; }
.estado { padding: 10px 16px; border: 2px solid var(--ink); font-family: var(--mono); text-align: center; }
.estado .v { font-size: 16px; font-weight: 500; letter-spacing: .08em; }
.ficha { display: flex; flex-wrap: wrap; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.ficha > div { flex: 1 1 220px; padding: 10px 16px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.ficha .censura { width: 120px; height: 20px; margin-top: 4px; }
.seccion { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--hair); }
.seccion h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--slab); font-weight: 400; font-size: 20px; line-height: 1.2; }
.seccion h2 svg { display: block; flex: none; }
.seccion .texto { margin-top: 12px; }
.seccion ol, .seccion ul { margin: 12px 0 0; padding-left: 28px; }
.fig-marco { margin: 24px 0 0; border: 1px solid var(--rule); border-radius: 2px; }
.fig-marco .ecuacion { padding: 10px 16px; border-bottom: 1px solid var(--hair); font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--muted); }
.fig-marco .ascii-scroll { padding: 12px 16px; }
.fig-marco .ascii-lienzo { margin: 0 auto; }
.controles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; border-top: 1px solid var(--hair); }
.controles .btn { padding: 0 14px; }
.controles .vel { min-width: 52px; padding: 0 8px; }
.fig-marco figcaption { padding: 10px 16px; border-top: 1px solid var(--hair); }
.figuras { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.par { display: flex; flex-wrap: wrap; gap: 16px; }
.par > figure { flex: 1 1 240px; min-width: 0; }
.fig { margin: 0; }
.fig-img { border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; }
.fig-img img { width: 100%; }
.fig-pend { position: relative; height: 320px; border: 1px solid var(--rule); border-radius: 2px; }
.par .fig-pend { height: 220px; }
.fig-pend svg { display: block; width: 100%; height: 100%; }
.fig-pend svg line { stroke: var(--hair); stroke-width: 1; }
.fig-pend .marca {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 6px 12px;
  background: var(--ground); border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); white-space: nowrap;
}
.fig-obra { margin: 24px 0 0; }
.fig-obra .fig-img, .fig-obra .fig-pend { width: 384px; max-width: 100%; margin: 0 auto; }
.fig-obra .fig-pend { height: auto; aspect-ratio: 4 / 5; }
.fig-obra figcaption { text-align: center; }
.relacionados { max-width: 800px; margin: 48px auto 0; }
.tarjetas { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.tarjeta { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--rule); border-radius: 2px; }
.tarjeta:hover { text-decoration: none; }
a.tarjeta:hover .ttl { text-decoration: underline; }
.tarjeta .top { display: flex; justify-content: space-between; gap: 12px; }
.tarjeta .ttl { font-family: var(--slab); font-size: 16px; line-height: 1.35; }
.tarjeta .censura { display: block; width: 70%; height: 22px; }
.navexp { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--hair); }

/* ---------- Instituto ---------- */
.inst-sec { margin-top: 40px; padding-top: 12px; border-top: 1px solid var(--hair); }
.metodo { margin-top: 16px; border-top: 1px solid var(--rule); }
.metodo-fila { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.metodo-fila > div { flex: 0 0 150px; }
.metodo-fila .id, .temas .id { letter-spacing: .08em; }
.metodo-fila h2, .temas h2 { margin: 2px 0 0; font-family: var(--slab); font-weight: 400; font-size: 22px; line-height: 1.25; }
.metodo-fila p { flex: 1 1 320px; margin: 0; }
.temas { display: flex; flex-wrap: wrap; margin-top: 16px; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.temas > div { flex: 1 1 220px; padding: 20px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.temas h2 { margin-bottom: 8px; }
.temas p { margin: 0; font-size: 14px; }
.contacto { margin-top: 12px; border-top: 1px solid var(--rule); }
.contacto > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }

/* ---------- Móvil (referencia 390 px) ---------- */
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .contenedor { padding-bottom: 24px; }
  h1 { font-size: 36px; }
  .h1-inicio { font-size: 26px; margin: 8px 0 10px; }
  .texto { font-size: 14px; }
  .seccion h2 { font-size: 18px; }
  .fila .ttl { font-size: 16px; }
  .cab { min-height: 56px; gap: 0; }
  .logo { min-height: 44px; }
  .cab-menu { display: inline-flex; align-items: center; padding: 0 14px; }
  .cab-panel { display: flex; flex-direction: column; flex: 1 0 100%; border-top: 1px solid var(--hair); }
  html.js .cab-panel:not(.abierta) { display: none; }
  .cab-nav { flex-direction: column; gap: 0; }
  .cab-nav a { padding: 14px 0; border-bottom: 1px solid var(--hair); }
  .cab-nav a[aria-current="page"] { border-bottom: 1px solid var(--hair); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
  .cab-panel .js-tema { min-height: 48px; padding: 0; border: 0; text-align: left; }
  .inicio { padding: 32px 0 20px; gap: 32px; }
  .inicio-texto > p { margin-bottom: 28px; }
  .indice-fila .id { flex-basis: 100%; }
  .tabla-cab { display: none; }
  .fila { padding: 14px 0; gap: 4px 12px; }
  .c-id { flex-basis: 100%; }
  .c-ttl { flex: 1 1 100%; }
  .c-it, .c-est { flex: 0 0 auto; color: var(--muted); }
  .c-fl { display: none; }
  .mapa-caja { padding: 8px; }
  .fig-marco .ascii-scroll { padding: 12px 8px; }
  .fig-pend { height: 220px; }
  .par .fig-pend { height: 160px; }
  .pie-lema { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
