/* Estilos de todo el blog. La CSP solo permite estilos de este dominio (style-src 'self'). */

/* Open Sans (licencia SIL OFL 1.1, ver /fuentes/OFL.txt), alojada en el propio blog. */
@font-face {
  font-family: "Open Sans";
  src: url("/fuentes/open-sans.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("/fuentes/open-sans-italic.woff2") format("woff2");
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #000000;
  --card: #0e1116;
  --borde: #262c36;
  --text: #e6edf3;
  --muted: #9aa4b0;
  --accent: #60a5fa;
  --accent-suave: rgba(96, 165, 250, .14);
  --accent-medio: rgba(96, 165, 250, .22);
  --accent-borde: rgba(96, 165, 250, .3);
  --code-bg: #0a0d12;
  --code-text: #d7e0ea;
  --prompt: #4ade80;
  --titulo: #ffffff;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "Fira Code", Menlo, Consolas, monospace;
  --sans: "Open Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 var(--sans);
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Encabezado y pie */
header.sitio, main, footer.sitio { max-width: 760px; margin: 0 auto; padding: 0 20px; }
header.sitio {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 24px; padding-top: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--borde);
}
/* Título del blog */
.marca {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--titulo);
  text-decoration: none;
}
.marca .prompt { color: var(--accent); font-family: var(--sans); }
.marca .acento { color: inherit; }
/* Menú y pie en letra monoespaciada, estilo terminal */
header.sitio nav { display: flex; flex-wrap: wrap; gap: 4px 1.25rem; font-family: var(--mono); font-size: .88rem; }
header.sitio nav a { color: var(--muted); text-decoration: none; transition: color .2s; }
header.sitio nav a:hover, header.sitio nav a[aria-current="page"] { color: var(--accent); }
footer.sitio {
  color: var(--muted); font-family: var(--mono); font-size: .8rem; line-height: 1.8;
  margin-top: 3rem; padding-top: 24px; padding-bottom: 48px; border-top: 1px solid var(--borde);
}
footer.sitio a { color: var(--muted); }

/* Portada */
.intro { padding: 40px 0 8px; }
.intro h1 {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--titulo);
}
.intro p { color: var(--muted); margin: 0 0 12px; max-width: 60ch; }
.seccion {
  font-family: var(--sans); font-size: .85rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin: 36px 0 12px;
}
.tarjetas { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.tarjeta {
  background: var(--card); border: 1px solid var(--borde); border-radius: 8px;
  padding: 18px 22px; transition: border-color .15s;
}
.tarjeta:hover { border-color: var(--accent); }
.tarjeta h2 { margin: 2px 0 6px; font-size: 1.18rem; line-height: 1.35; }
.tarjeta h2 a { color: var(--text); text-decoration: none; }
.tarjeta h2 a:hover { color: var(--accent); }
.tarjeta p { margin: 0 0 10px; color: var(--muted); }
.tarjeta.pronto { border-style: dashed; }
.boton {
  display: inline-block; padding: 8px 16px; border-radius: 8px; background: var(--accent-suave);
  border: 1px solid var(--accent); color: var(--accent); font-weight: 600; text-decoration: none; font-size: .95rem;
}
.boton:hover { background: var(--accent); color: var(--bg); }

/* Fechas y etiquetas */
.fecha { color: var(--muted); font-size: .85rem; margin: 0; font-family: var(--sans); }
.tags, .post .tags { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { margin: 0; }
.tags a {
  display: inline-block; font-size: .75rem; font-family: var(--mono); padding: .2rem .6rem; border-radius: 4px;
  background: var(--accent-suave); color: var(--accent); border: 1px solid var(--accent-borde); text-decoration: none;
  transition: background .2s;
}
.tags a:hover { background: var(--accent-medio); }
.tags.grandes a { font-size: .82rem; padding: .3rem .75rem; }

/* Posts */
.post { padding: 32px 0 8px; counter-reset: fig; }
.post > header { margin-bottom: 24px; }
.post h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 4.5vw, 2.1rem); line-height: 1.25; }
/* Formato nuevo de post (<article class="post formato">): fecha y tiempo de lectura arriba,
   luego título y etiquetas. Los posts sin "formato" (como Bienvenido) se quedan como estaban. */
.formato > header { margin-bottom: 2rem; }
.formato > header .fecha { font-family: var(--mono); font-size: .85rem; margin: 0 0 .5rem; }
.formato > header .tags { margin-top: 0; }
.formato h1 { margin: 0 0 .75rem; font-size: clamp(1.6rem, 4.5vw, 1.85rem); }
.post h2 { font-size: 1.25rem; margin: 32px 0 8px; }
.post h3 {
  margin: 32px 0 8px; font-size: 1.12rem; color: var(--accent);
}
.post p, .post li { max-width: 68ch; }
.post ul { padding-left: 22px; margin: 8px 0; }
.post li { margin: 5px 0; }
.post li::marker { color: var(--accent); }
.bitacora > header { border-left: 3px solid var(--accent); padding-left: 14px; }

code {
  font-family: var(--mono); background: var(--accent-suave); padding: 1px 6px;
  border-radius: 4px; font-size: .88em; overflow-wrap: anywhere;
}
pre {
  position: relative; background: var(--code-bg); color: var(--code-text); border: 1px solid #222a35;
  border-radius: 6px; padding: 38px 16px 14px; overflow-x: auto; font: .84rem/1.55 var(--mono); margin: 14px 0;
}
pre::before {
  /* barra de "terminal" con tres puntos */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 26px;
  border-bottom: 1px solid #222a35; border-radius: 6px 6px 0 0; background:
    radial-gradient(circle at 16px 13px, #ff5f57 5px, transparent 5.5px),
    radial-gradient(circle at 34px 13px, #febc2e 5px, transparent 5.5px),
    radial-gradient(circle at 52px 13px, #28c840 5px, transparent 5.5px),
    #151b23;
}
pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }

/* Navegación entre posts (formato original: dos tarjetas con el título del post vecino) */
.vecinos {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 40px 0 0;
  padding-top: 24px; border-top: 1px solid var(--borde);
}
.vecinos a {
  display: block; background: var(--card); border: 1px solid var(--borde); border-radius: 8px;
  padding: 12px 16px; color: var(--text); text-decoration: none; font-size: .95rem; line-height: 1.4;
}
.vecinos a:hover { border-color: var(--accent); }
.vecinos a span { display: block; color: var(--muted); font-size: .8rem; font-family: var(--sans); margin-bottom: 4px; }
.vecinos .sig { text-align: right; }
@media (max-width: 560px) { .vecinos { grid-template-columns: 1fr; } .vecinos .sig { text-align: left; } }
/* Formato nuevo, justo después del artículo: ← Anterior · Volver al índice · Siguiente → */
.formato + .vecinos {
  grid-template-columns: 1fr auto 1fr; align-items: center; margin: 3rem 0 0; padding-top: 1.5rem;
  font-family: var(--mono); font-size: .85rem;
}
.formato + .vecinos a {
  display: inline; background: none; border: 0; border-radius: 0; padding: .4rem 0;
  color: var(--accent); font-size: inherit; line-height: inherit;
}
.formato + .vecinos a:hover { text-decoration: underline; }
.formato + .vecinos .indice { color: var(--muted); text-align: center; }
.formato + .vecinos .indice:hover { color: var(--accent); }
.formato + .vecinos .sig { justify-self: end; text-align: right; }

/* Página de etiquetas: barra de etiquetas fija arriba y una fila horizontal deslizable por etiqueta */
.post .tags.nube {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  gap: .5rem; margin: 0 0 1.75rem; padding: .75rem 0; border-bottom: 1px solid var(--borde);
}
.post .tags.nube::-webkit-scrollbar { display: none; }
.post .tags.nube a { white-space: nowrap; }
.etiqueta { margin: 0 0 1.75rem; scroll-margin-top: 80px; }
.etiqueta h2 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  font-family: var(--sans); font-size: 1.15rem; color: var(--accent); margin: 0 0 .75rem;
}
.etiqueta .cuenta { font-size: .8rem; font-weight: 400; color: var(--muted); }
.etiqueta .carrusel {
  list-style: none; margin: 0; padding: 0 0 12px;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, calc((100% - 24px) / 3));
  gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--borde) transparent;
}
.etiqueta .carrusel li { scroll-snap-align: start; max-width: none; margin: 0; }
.etiqueta .carrusel a {
  display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 112px;
  background: var(--card); border: 1px solid var(--borde); border-radius: 8px; padding: 14px 16px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .98rem; line-height: 1.4;
  transition: border-color .15s;
}
.etiqueta .carrusel a:hover { border-color: var(--accent); }
.etiqueta .carrusel time { font-size: .8rem; font-weight: 400; color: var(--muted); }
@media (min-width: 700px) {
  .post .tags.nube { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  /* En el celular la fila llega al borde de la pantalla y se asoma la siguiente tarjeta */
  .etiqueta .carrusel { grid-auto-columns: 78%; margin: 0 -20px; padding: 0 20px 12px; scroll-padding: 0 20px; }
  .post .tags.nube { margin: 0 -20px 1.75rem; padding: .75rem 20px; }
}

/* Pestañas sin JavaScript: solo se ve la etiqueta de la URL (#kali...), o la primera si no hay ninguna.
   Si el navegador no entiende :has(), se ven todas las etiquetas como antes. */
@supports selector(:has(a)) {
  .post:has(.etiqueta:target) .etiqueta:not(:target),
  .post:not(:has(.etiqueta:target)) .etiqueta:not(:first-of-type) { display: none; }
  /* Al tocar una etiqueta la página no salta hacia abajo: se queda arriba con la barra a la vista */
  .etiqueta { scroll-margin-top: 100vh; }
  /* Etiqueta elegida, resaltada en la barra. Para una etiqueta nueva, agrega su línea aquí. */
  .post:not(:has(.etiqueta:target)) .nube li:first-child a,
  .post:has(#dns:target) .nube a[href="#dns"],
  .post:has(#kali:target) .nube a[href="#kali"],
  .post:has(#cloudflare:target) .nube a[href="#cloudflare"],
  .post:has(#defensa:target) .nube a[href="#defensa"],
  .post:has(#web:target) .nube a[href="#web"],
  .post:has(#reconocimiento:target) .nube a[href="#reconocimiento"],
  .post:has(#ofensiva:target) .nube a[href="#ofensiva"],
  .post:has(#defensa-soc:target) .nube a[href="#defensa-soc"],
  .post:has(#osint:target) .nube a[href="#osint"],
  .post:has(#redes-dns:target) .nube a[href="#redes-dns"],
  .post:has(#seguridad-web:target) .nube a[href="#seguridad-web"],
  .post:has(#sobre-el-blog:target) .nube a[href="#sobre-el-blog"],
  .post:has(#linux:target) .nube a[href="#linux"],
  .post:has(#pentesting:target) .nube a[href="#pentesting"],
  .post:has(#blog:target) .nube a[href="#blog"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
}

/* Botón para volver */
.volver { margin: 24px 0 -8px; font-size: .9rem; }
.volver a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--borde); background: var(--card); color: var(--muted);
  text-decoration: none; font-family: var(--sans);
}
.volver a:hover { border-color: var(--accent); color: var(--accent); }
/* Comentarios (giscus) */
.comentarios { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--borde); }
.comentarios h2 { font-size: 1.25rem; margin: 0 0 12px; }
.giscus, .giscus-frame { width: 100%; min-height: 150px; }
.giscus-frame { border: none; color-scheme: dark; }
.giscus-frame--loading { opacity: 0; }

/* Imágenes y figuras dentro de los posts */
.post img { max-width: 100%; height: auto; display: block; border: 1px solid var(--borde); border-radius: 8px; margin: 16px 0 6px; }
/* Capturas con el pie de foto en una barra, como una ventana */
.post figure { margin: 1.75rem 0; background: var(--card); border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.post figure img { width: 100%; border: 0; border-radius: 0; margin: 0; }
.post figure { counter-increment: fig; }
.post figcaption { color: var(--muted); font-size: .85rem; line-height: 1.5; padding: .65rem 1rem; border-top: 1px solid var(--borde); }
/* Numeración automática de capturas: "fig 1.0 — ", "fig 2.0 — "... */
.post figcaption::before { content: "fig " counter(fig) ".0 — "; font-family: var(--mono); }

/* Tablas dentro de los posts */
.post table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .95rem; }
.post th, .post td { border: 1px solid var(--borde); padding: 8px 12px; text-align: left; vertical-align: top; }
.post th { background: var(--card); }
.post thead th { color: var(--accent); }

/* Panel tipo Wireshark para la portada de un post (<figure class="wireshark">).
   Solo CSS: se puede copiar a cualquier post. En el celular la tabla se desliza de lado. */
.post figure.wireshark { font-family: var(--mono); font-size: .74rem; line-height: 1.5; }
.wireshark .ws-barra {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: #151b23; border-bottom: 1px solid var(--borde);
}
.wireshark .ws-puntos {
  flex: none; width: 46px; height: 10px; background:
    radial-gradient(circle at 5px 5px, #ff5f57 4.5px, transparent 5px),
    radial-gradient(circle at 23px 5px, #febc2e 4.5px, transparent 5px),
    radial-gradient(circle at 41px 5px, #28c840 4.5px, transparent 5px);
}
.wireshark .ws-filtro {
  flex: 1; min-width: 0; padding: 3px 10px; border-radius: 4px; font-size: inherit;
  background: rgba(74, 222, 128, .08); border: 1px solid rgba(74, 222, 128, .45); color: var(--prompt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wireshark .ws-info { flex: none; color: var(--muted); }
.wireshark .ws-tabla { overflow-x: auto; }
.post .wireshark table { margin: 0; font-size: inherit; }
.post .wireshark td.largo { white-space: normal; min-width: 16em; }
.post .wireshark th, .post .wireshark td { border: 0; padding: 4px 10px; white-space: nowrap; }
.post .wireshark thead th { background: var(--card); color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--borde); }
.wireshark tbody td:nth-child(2), .wireshark tbody td:nth-child(3) { color: var(--text); }
.wireshark tbody td:first-child { color: var(--muted); }
.wireshark tbody td { color: var(--code-text); }
.wireshark .ws-sel td { background: var(--accent-suave); }
.wireshark .ws-dns { color: var(--prompt); }
.wireshark .ws-tls { color: var(--accent); }
.wireshark mark { background: rgba(74, 222, 128, .15); color: var(--prompt); padding: 0 3px; border-radius: 3px; }
.wireshark .ws-nota { color: var(--muted); }
.post .wireshark .ws-detalle {
  list-style: none; margin: 0; padding: 10px 12px; border-top: 1px solid var(--borde); background: var(--code-bg); color: var(--muted);
}
.post .wireshark .ws-detalle li { margin: 0; max-width: none; }
.post .wireshark .ws-detalle .n2 { padding-left: 1.2em; color: var(--code-text); }
.post .wireshark .ws-detalle .n3 { padding-left: 2.4em; }
.post .wireshark .ws-detalle .clave { color: var(--prompt); }
.post .wireshark figcaption { font-family: var(--sans); }

:root { --rojo: #ff5f57; --amarillo: #febc2e; }
/* Diagramas de cajas y flechas (<figure class="diagrama">), solo CSS.
   En el celular las cajas se apilan y las flechas apuntan hacia abajo. */
.post figure.diagrama { font-family: var(--mono); font-size: .72rem; line-height: 1.45; }
.post figure.diagrama figcaption { font-family: var(--sans); }
.dg {
  display: flex; align-items: center; justify-content: center; padding: 26px 16px;
  background: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(38, 44, 54, .55) 27px 28px);
}
.dg-nodo {
  flex: none; min-width: 112px; padding: 9px 12px; border: 1.5px solid var(--borde); border-radius: 6px;
  background: var(--code-bg); text-align: center;
}
.dg-nodo strong { display: block; color: var(--text); font-size: .78rem; }
.dg-nodo span { display: block; color: var(--muted); }
.dg-nodo.n-verde { border-color: var(--prompt); }
.dg-nodo.n-verde span:first-of-type { color: var(--prompt); }
.dg-nodo.n-azul { border-color: var(--accent); }
.dg-nodo.n-azul span:first-of-type { color: var(--accent); }
.dg-nodo.n-claro { border-color: var(--text); }
.dg-nodo.n-rojo { border-color: var(--rojo); }
.dg-nodo.n-rojo span:first-of-type { color: var(--rojo); }
.dg-flecha { flex: 1 1 0; min-width: 64px; max-width: 170px; padding: 0 6px; text-align: center; color: var(--muted); }
.dg-flecha .abajo { display: block; color: var(--amarillo); }
.dg-linea {
  display: block; position: relative; height: 2px; margin: 6px 8px 6px 0;
  background: repeating-linear-gradient(90deg, var(--prompt) 0 6px, transparent 6px 10px);
}
.dg-linea::after {
  content: ""; position: absolute; right: -8px; top: -4px;
  border-left: 8px solid var(--prompt); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.dg-flecha.gris .dg-linea { background: var(--muted); }
.dg-flecha.gris .dg-linea::after { border-left-color: var(--muted); }
.dg-grupo { flex: none; border: 1px dashed var(--borde); border-radius: 8px; padding: 8px 10px 10px; background: rgba(0, 0, 0, .35); }
.dg-grupo-titulo { margin: 0 0 6px; color: var(--muted); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; }
.dg-grupo .dg-nodos { display: flex; gap: 8px; }
@media (max-width: 560px) {
  .dg { flex-direction: column; padding: 18px 12px; }
  .dg-flecha { max-width: none; width: 100%; padding: 4px 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
  .dg-flecha .arriba { text-align: right; }
  .dg-flecha .abajo { text-align: left; }
  .dg-linea {
    grid-column: 2; grid-row: 1; width: 2px; height: 30px; margin: 0 0 8px;
    background: repeating-linear-gradient(180deg, var(--prompt) 0 6px, transparent 6px 10px);
  }
  .dg-flecha .arriba { grid-column: 1; grid-row: 1; }
  .dg-flecha .abajo { grid-column: 3; grid-row: 1; }
  .dg-linea::after { right: -4px; top: auto; bottom: -8px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid var(--prompt); border-bottom: 0; }
  .dg-flecha.gris .dg-linea::after { border-left-color: transparent; border-top-color: var(--muted); }
  .dg-nodo, .dg-grupo { width: 100%; }
  .dg-grupo .dg-nodos > .dg-nodo { flex: 1; min-width: 0; }
}

/* Recuadros de nota (<aside class="nota">) y subtítulos de los posts en letra de terminal */
.formato > h3 { font-family: var(--mono); font-size: 1.05rem; }
.nota {
  margin: 1.5rem 0; padding: 14px 18px; background: var(--card); border: 1px solid var(--borde);
  border-left: 3px solid var(--prompt); border-radius: 8px;
}
.nota .nota-titulo { font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--prompt); margin: 0 0 4px; }
.nota p:last-child { margin: 0; color: var(--code-text); font-size: .95rem; }

/* Inicio: bienvenida, "¿Qué vas a encontrar aquí?" y recuadro para empezar */
.bienvenida { padding: 40px 0 0; }
.bienvenida h1 { margin: 0 0 .75rem; font-family: var(--sans); font-weight: 700; font-size: 1.75rem; line-height: 1.25; color: var(--text); }
.bienvenida p { margin: 0 0 2.25rem; font-size: 1.05rem; color: var(--muted); max-width: 60ch; }
.que-hay h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.lista-simple { list-style: none; padding: 0; margin: 1.25rem 0 2rem; }
.lista-simple li { padding: .85rem 0; border-bottom: 1px solid var(--borde); }
.lista-simple li:last-child { border-bottom: 0; }
.lista-simple strong { display: block; color: var(--text); margin-bottom: .2rem; }
.lista-simple span { display: block; font-size: .92rem; color: var(--muted); }
.cta { margin: 2rem 0 0; padding: 1.25rem; text-align: center; background: var(--card); border: 1px solid var(--borde); border-radius: 8px; }
.cta p { margin: 0; font-size: .95rem; color: var(--muted); }
.cta-btn {
  display: inline-block; margin-top: .75rem; padding: .5rem 1.1rem; border-radius: 6px;
  background: var(--accent-suave); color: var(--accent); border: 1px solid var(--accent-borde);
  font-family: var(--mono); font-size: .85rem; text-decoration: none; transition: background .2s;
}
.cta-btn:hover { background: var(--accent-medio); }

/* Bitácora formal: cabecera de documento, indicadores y tabla de registros */
.doc-header { border-bottom: 1px solid var(--borde); padding-bottom: 1.25rem; margin-bottom: 1.75rem; }
.doc-header .doc-meta { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0 0 .6rem; max-width: none; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.doc-meta strong { color: var(--text); }
.doc-header h1 { margin: 0 0 .4rem; font-size: 1.65rem; line-height: 1.25; }
.doc-header p { margin: 0; color: var(--muted); font-size: .95rem; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .85rem; margin: 0 0 2rem; }
.kpi > div { background: var(--card); border: 1px solid var(--borde); border-radius: 6px; padding: .9rem 1rem; }
.kpi-etiqueta { display: block; font-family: var(--mono); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kpi-dato { display: block; margin-top: .25rem; font-family: var(--mono); font-size: 1.25rem; font-weight: 700; color: var(--text); }
.kpi-dato.ok { color: var(--prompt); }
.kpi-dato.aviso { color: var(--amarillo); font-size: 1rem; margin-top: .4rem; }
.registro { overflow-x: auto; margin: 0 0 2rem; background: var(--card); border: 1px solid var(--borde); border-radius: 8px; }
.post .registro table { margin: 0; min-width: 620px; font-size: .88rem; }
.post .registro th, .post .registro td { border: 0; border-bottom: 1px solid var(--borde); }
.post .registro thead th {
  padding: .85rem .95rem; background: var(--code-bg); color: var(--muted); white-space: nowrap;
  font-family: var(--mono); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase;
}
.post .registro td { padding: .95rem; vertical-align: top; }
.post .registro tr:last-child td { border-bottom: 0; }
.post .registro tbody tr:hover td { background: rgba(255, 255, 255, .018); }
.id-registro { display: block; font-family: var(--mono); font-size: .82rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.dato-registro { display: block; margin-top: .28rem; font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.registro td strong a { color: var(--text); text-decoration: none; }
.registro td strong a:hover { color: var(--accent); }
.registro td.accion { color: var(--muted); }
.estado { display: inline-block; padding: .2rem .55rem; border-radius: 4px; font-family: var(--mono); font-size: .72rem; font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.e-ok { color: var(--prompt); background: rgba(74, 222, 128, .12); border: 1px solid rgba(74, 222, 128, .3); }
.e-observacion { color: var(--amarillo); background: rgba(254, 188, 46, .12); border: 1px solid rgba(254, 188, 46, .3); }
.e-bloqueado { color: var(--rojo); background: rgba(255, 95, 87, .12); border: 1px solid rgba(255, 95, 87, .3); }
@media (max-width: 560px) {
  /* En el celular cada registro es una tarjeta: ID, fecha y estado arriba; evento y acción debajo */
  .post .registro table { min-width: 0; }
  .registro thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .registro tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem; padding: .95rem; border-bottom: 1px solid var(--borde); }
  .registro tbody tr:last-child { border-bottom: 0; }
  .post .registro td { display: block; padding: 0; border: 0; }
  .post .registro td:nth-child(3), .post .registro td:nth-child(4) { flex-basis: 100%; }
  .registro td:first-child .id-registro, .registro td:first-child .dato-registro { display: inline; margin: 0 .5rem 0 0; }
}

/* Resúmenes de libros (<article class="post formato libro">): ficha del libro y secciones fijas */
.ficha-libro {
  margin: 0 0 2rem; padding: 1rem 1.2rem; background: var(--card); border: 1px solid var(--borde);
  border-left: 3px solid var(--accent); border-radius: 8px;
}
.ficha-libro > p { margin: 0 0 .35rem; font-family: var(--mono); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ficha-libro > p strong { font-weight: 600; }
.post .ficha-libro ul { margin: 0; }
.ficha-libro em { color: var(--muted); }
.libro > h2 { font-family: var(--mono); font-size: 1.05rem; color: var(--accent); margin: 2rem 0 .5rem; }
.post ol { padding-left: 30px; margin: 8px 0; }
.post ol li::marker { color: var(--accent); font-family: var(--mono); }
/* Tarjetas de la página /libros/: autor debajo del título */
.tarjeta .autor { margin: 0 0 8px; font-family: var(--mono); font-size: .82rem; color: var(--accent); }
.formato + .vecinos span:empty { display: block; }

/* Buscador (/buscar/) */
.buscador { margin: 0 0 1rem; }
.buscador label { display: block; margin: 0 0 .5rem; }
.buscador input {
  width: 100%; padding: .75rem 1rem; border-radius: 8px; border: 1px solid var(--borde);
  background: var(--card); color: var(--text); font: 1rem var(--mono); caret-color: var(--prompt);
}
.buscador input::placeholder { color: var(--muted); }
.buscador input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-suave); }
.estado-busqueda { color: var(--muted); font-family: var(--mono); font-size: .82rem; margin: 0 0 1rem; }
.tarjeta .tipo {
  display: inline-block; margin-right: .4rem; padding: .05rem .45rem; border-radius: 4px; font-family: var(--mono);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-suave); border: 1px solid var(--accent-borde);
}
.tarjeta .tipo-libro { color: var(--prompt); background: rgba(74, 222, 128, .1); border-color: rgba(74, 222, 128, .3); }

/* Categoría del post: una sola por post, encima del título (portada y posts) */
.categoria { margin: 0 0 4px; font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.categoria a { color: var(--prompt); text-decoration: none; }
.categoria a::before { content: "~/"; color: var(--muted); }
.categoria a:hover { text-decoration: underline; }
.post > header .categoria { margin: 0 0 .35rem; }
/* Página /categorias/ */
.cat-intro { color: var(--muted); margin: 0 0 1rem; }
.cat-desc { color: var(--muted); font-size: .92rem; margin: -.25rem 0 .75rem; }

/* ---------- Modo claro (botón ☀/☾ del encabezado, ver /js/tema.js) ---------- */
:root[data-tema="claro"] {
  --bg: #ffffff;
  --card: #f6f8fa;
  --borde: #d0d7de;
  --text: #1f2328;
  --muted: #59636e;
  --accent: #1d4ed8;
  --accent-suave: rgba(29, 78, 216, .08);
  --accent-medio: rgba(29, 78, 216, .16);
  --accent-borde: rgba(29, 78, 216, .3);
  --prompt: #15803d;
  --titulo: #0b0f14;
  color-scheme: light;
}
/* La terminal, los paneles tipo Wireshark, los diagramas y las notas se quedan oscuros en los dos modos */
:root[data-tema="claro"] :is(pre, .wireshark, .diagrama, .nota) {
  --bg: #000000; --card: #0e1116; --borde: #262c36; --text: #e6edf3; --muted: #9aa4b0;
  --accent: #60a5fa; --accent-suave: rgba(96, 165, 250, .14); --prompt: #4ade80;
  color-scheme: dark;
}
:root[data-tema="claro"] :is(.diagrama, .nota) { background-color: #0e1116; color: #e6edf3; }
:root[data-tema="claro"] :not(pre) > code { background: #eff2f5; color: #1f2328; }
:root[data-tema="claro"] .tarjeta .tipo-libro { background: rgba(21, 128, 61, .08); border-color: rgba(21, 128, 61, .3); }

/* Botón de tema, en el encabezado */
.boton-tema {
  font: .8rem var(--mono); color: var(--muted); background: transparent; cursor: pointer;
  border: 1px solid var(--borde); border-radius: 999px; padding: .25rem .75rem; line-height: 1.4;
}
.boton-tema:hover { color: var(--accent); border-color: var(--accent); }

/* Paginación de la portada: 5 posts por página, índice solo con números */
[hidden] { display: none !important; }
#posts { scroll-margin-top: 16px; }
.paginacion ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 24px 0 0; }
.paginacion a {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.5rem; height: 2.5rem; padding: 0 .5rem;
  font: 600 .9rem var(--mono); color: var(--muted); text-decoration: none;
  border: 1px solid var(--borde); border-radius: 8px; background: var(--card);
}
.paginacion a:hover { color: var(--accent); border-color: var(--accent); }
.paginacion a[aria-current="page"] { color: var(--bg); background: var(--accent); border-color: var(--accent); }

/* ---------- Escala para ordenador (pantallas ≥ 1024px). En celular no cambia nada ---------- */
@media (min-width: 1024px) {
  html { font-size: 17px; }
  body { font-size: 18px; line-height: 1.75; }
  header.sitio, main, footer.sitio { max-width: 1080px; padding-left: 40px; padding-right: 40px; }

  /* Encabezado */
  .marca { font-size: 1.85rem; }
  header.sitio nav { font-size: .95rem; }

  /* Portada */
  .bienvenida { padding-top: 64px; }
  .bienvenida h1 { font-size: 2.8rem; line-height: 1.15; }
  .bienvenida p { font-size: 1.15rem; max-width: 62ch; }
  .que-hay h2 { font-size: 1.5rem; }
  .lista-simple { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .lista-simple li { padding: 1.1rem 1.2rem; border: 1px solid var(--borde); border-radius: 8px; background: var(--card); }
  .lista-simple li:last-child { border-bottom: 1px solid var(--borde); }
  .lista-simple strong { font-size: 1.05rem; }
  .cta p { font-size: 1.05rem; }
  .seccion { font-size: .95rem; }
  .tarjetas { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .tarjeta h2 { font-size: 1.35rem; }

  /* Posts */
  .post h1, .formato h1, .doc-header h1 { font-size: 2.6rem; line-height: 1.2; }
  .post h2 { font-size: 1.6rem; margin-top: 2.4rem; }
  .post h3 { font-size: 1.3rem; }
  .post p, .post li { max-width: 75ch; }
  pre { font-size: .88rem; }

  /* Otras páginas */
  .etiqueta h2, .comentarios h2 { font-size: 1.45rem; }
  footer.sitio { font-size: .85rem; }
}
