/* Prueba de concepto: la web entera con la estética de la terminal del refugio (/books/).
   Se carga después de dist.css (Tailwind) y de github-dark: Tailwind sigue aportando
   `prose` y las clases de las directivas de los artículos; esta hoja pone la paleta,
   la tipografía y los componentes. /books/ la carga también, con books.css detrás. */
:root {
  --fondo: #020402;
  --panel: #040904;
  --relleno: #0b1f0d;
  --fosforo: #46c553;
  --fosforo-vivo: #7cf087;
  --fosforo-tenue: #2a7a33;
  --linea: #1d5a24;
  --linea-viva: #2f8f3a;
  --ambar: #d6a23c;
  --ambar-tenue: #6b5220;
  --ambar-fondo: #17120a;
  --alerta: #e0503f;
  --brillo: 0 0 3px rgba(70, 197, 83, .35);
  --mono: "Cascadia Mono", "JetBrains Mono", "IBM Plex Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  color-scheme: dark;
}

/* Barra de scroll con líneas de barrido. La dibuja el navegador fuera de la capa .crt,
   así que las líneas van en la propia barra. Chrome ignora ::-webkit-scrollbar si hay
   scrollbar-color, por eso el color estándar queda solo para quien no entiende lo otro (Firefox). */
@supports not selector(::-webkit-scrollbar) {
  :root { scrollbar-color: var(--linea-viva) var(--fondo); }
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: repeating-linear-gradient(to bottom, var(--panel) 0 2px, #000 2px 3px); box-shadow: inset 1px 0 0 var(--linea); }
::-webkit-scrollbar-track:horizontal { box-shadow: inset 0 1px 0 var(--linea); }
::-webkit-scrollbar-thumb { background: repeating-linear-gradient(to bottom, var(--linea-viva) 0 2px, #0d2e11 2px 3px); border: 2px solid transparent; background-clip: padding-box; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background-image: repeating-linear-gradient(to bottom, var(--fosforo) 0 2px, #12401a 2px 3px); }
::-webkit-scrollbar-thumb:active { background-image: repeating-linear-gradient(to bottom, var(--fosforo-vivo) 0 2px, #1a5a24 2px 3px); }
::-webkit-scrollbar-corner { background: var(--fondo); }
/* Flechas: con barra propia, Chrome solo las pinta si tienen estilo. Triángulos de píxeles. */
::-webkit-scrollbar-button:single-button { display: block; width: 12px; height: 12px; background: var(--panel) center / 12px 12px no-repeat; }
::-webkit-scrollbar-button:double-button { display: none; }
::-webkit-scrollbar-button:single-button:vertical:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges' fill='%2346c553'%3E%3Crect x='5' y='4' width='2' height='1'/%3E%3Crect x='4' y='5' width='4' height='1'/%3E%3Crect x='3' y='6' width='6' height='1'/%3E%3Crect x='2' y='7' width='8' height='1'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:vertical:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges' fill='%2346c553'%3E%3Crect x='2' y='4' width='8' height='1'/%3E%3Crect x='3' y='5' width='6' height='1'/%3E%3Crect x='4' y='6' width='4' height='1'/%3E%3Crect x='5' y='7' width='2' height='1'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges' fill='%2346c553'%3E%3Crect x='4' y='5' width='1' height='2'/%3E%3Crect x='5' y='4' width='1' height='4'/%3E%3Crect x='6' y='3' width='1' height='6'/%3E%3Crect x='7' y='2' width='1' height='8'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges' fill='%2346c553'%3E%3Crect x='4' y='2' width='1' height='8'/%3E%3Crect x='5' y='3' width='1' height='6'/%3E%3Crect x='6' y='4' width='1' height='4'/%3E%3Crect x='7' y='5' width='1' height='2'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:hover { background-color: var(--relleno); }
::-webkit-scrollbar-button:single-button:active { background-color: var(--linea); }

/* /books/ no carga Tailwind: lo poco del reset que hace falta en todas las páginas. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
html, body { margin: 0; min-height: 100%; background: var(--fondo); }
body { color: var(--fosforo); font: 14px/1.55 var(--mono); text-shadow: var(--brillo); }
a { color: var(--fosforo-vivo); text-decoration: none; }
a:hover { text-decoration: underline; }
/* style.css pinta `main a` en cian; misma especificidad, gana por ir después. */
main a, main a:hover { color: var(--fosforo-vivo); }
:focus-visible { outline: 1px solid var(--fosforo-vivo); outline-offset: 2px; }
::selection { background: var(--fosforo-vivo); color: var(--fondo); text-shadow: none; }

/* Tubo: barrido más suave que la /books/ original (.2), porque aquí se leen textos largos. */
.crt { position: relative; min-height: 100vh; }
.crt::before, .crt::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.crt::before { background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .12) 2px 3px); }
.crt::after { background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, .45) 100%); }

.envoltorio { max-width: 960px; margin: 0 auto; padding: 0 16px 48px; display: flex; flex-direction: column; gap: 16px; }

h1, h2, h3 { margin: 0; font-weight: 600; color: var(--fosforo-vivo); letter-spacing: .04em; }
.prompt { margin: 0; color: var(--fosforo-tenue); }
.prompt::before { content: "> "; }
.pista { font-size: 11px; color: var(--fosforo-tenue); }
.caja { border: 1px solid var(--linea-viva); border-radius: 6px; background: var(--panel); padding: 16px 18px; box-shadow: 0 0 6px rgba(47, 143, 58, .15), inset 0 0 12px rgba(47, 143, 58, .05); min-width: 0; }
.cabecera-caja { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cabecera-caja h2 { font-size: 15px; }

/* ---------------------------------------------------------------- cabecera */
.cabecera { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--linea); }
.marca { display: flex; align-items: center; gap: 10px; color: inherit; }
.marca:hover { text-decoration: none; }
.marca img { width: 40px; height: 40px; border: 1px solid var(--linea-viva); border-radius: 3px; image-rendering: pixelated; box-shadow: 0 0 8px rgba(47, 143, 58, .3); }
.marca span { display: flex; flex-direction: column; line-height: 1.3; }
.marca-nombre { color: var(--fosforo-vivo); font-weight: 600; letter-spacing: .12em; }
.marca-sub { color: var(--fosforo-tenue); font-size: 12px; }
.controles { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.menu { display: flex; gap: 2px; flex-wrap: wrap; }
.menu a { padding: 3px 8px; border: 1px solid transparent; border-radius: 4px; color: var(--fosforo); }
.menu a:hover { color: var(--fosforo-vivo); border-color: var(--linea); text-decoration: none; }
.menu a.activo { background: var(--relleno); border-color: var(--linea); color: var(--fosforo-vivo); }
.buscar { display: flex; align-items: center; border: 1px solid var(--linea); border-radius: 4px; background: var(--panel); }
.buscar:focus-within { border-color: var(--fosforo-vivo); }
.buscar label { padding: 3px 0 3px 8px; color: var(--fosforo-tenue); }
.buscar input { font: inherit; color: var(--fosforo-vivo); text-shadow: inherit; background: none; border: 0; outline: 0; padding: 3px 8px 3px 6px; width: 9em; }
.buscar input::placeholder { color: var(--fosforo-tenue); opacity: 1; }

.estado { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: 12px; color: var(--fosforo-tenue); }
.estado b { color: var(--fosforo); font-weight: 500; }

/* ---------------------------------------------------------------- inicio */
.presentacion { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 22px; align-items: center; }
@media (max-width: 600px) {
  .presentacion { grid-template-columns: 1fr; }
  .presentacion .retrato { max-width: 150px; }
}
.retrato { display: block; width: 100%; height: auto; border: 1px solid var(--linea-viva); border-radius: 3px; box-shadow: 0 0 14px rgba(47, 143, 58, .25); image-rendering: pixelated; }
.presentacion h1 { font-size: clamp(18px, 3.2vw, 26px); line-height: 1.2; text-transform: uppercase; letter-spacing: .06em; text-shadow: 0 0 8px rgba(124, 240, 135, .35); margin: 4px 0 10px; }
.presentacion p { margin: 0 0 8px; max-width: 64ch; }
.presentacion .accesos { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-top: 12px; }

.estanteria { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.estanteria li { display: flex; }
.estanteria a { width: 100%; display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; border: 1px solid var(--linea); border-radius: 5px; padding: 10px; color: inherit; }
.estanteria a:hover { border-color: var(--linea-viva); text-decoration: none; }
.estanteria img { width: 64px; aspect-ratio: 73 / 100; object-fit: cover; border: 1px solid var(--linea); border-radius: 2px; display: block; }
.estanteria .nombre { color: var(--fosforo-vivo); font-weight: 600; display: block; margin-bottom: 4px; }
.estanteria .sub { font-size: 12px; color: var(--fosforo-tenue); }
.estanteria .sello { display: inline-block; margin-bottom: 4px; border: 1px dashed var(--ambar-tenue); border-radius: 3px; padding: 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ambar); text-shadow: none; }

/* ---------------------------------------------------------------- listados de artículos */
.entradas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.entradas > li { border-top: 1px solid var(--linea); }
.entradas > li:first-child { border-top: 0; }
.entrada { overflow-wrap: anywhere; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 12px 4px; }
.entrada.sin-imagen { grid-template-columns: minmax(0, 1fr); }
.entrada time { display: block; font-size: 12px; color: var(--fosforo-tenue); font-variant-numeric: tabular-nums; }
.entrada h2, .entrada h3 { font-size: 15px; line-height: 1.35; margin: 1px 0 4px; }
.entrada h2 a, .entrada h3 a { color: var(--fosforo-vivo); }
.entrada p { margin: 0; color: var(--fosforo); font-size: 13px; }
/* Miniaturas "en el monitor": teñidas de fósforo hasta que pasas por encima. */
.miniatura { width: 96px; height: 96px; display: block; border: 1px solid var(--linea); border-radius: 3px; overflow: hidden; background: var(--relleno); }
.miniatura img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) sepia(1) hue-rotate(65deg) saturate(2.4) brightness(.8) contrast(1.1); transition: filter .2s ease; }
.entrada:hover .miniatura img { filter: none; }
@media (max-width: 600px) { .entrada { grid-template-columns: 72px minmax(0, 1fr); } .miniatura { width: 72px; height: 72px; } }
.ver-mas { display: inline-block; margin-top: 12px; font-size: 13px; }

/* ---------------------------------------------------------------- artículo (prose de Tailwind con la paleta) */
.articulo.prose {
  --tw-prose-body: var(--fosforo);
  --tw-prose-headings: var(--fosforo-vivo);
  --tw-prose-lead: var(--fosforo);
  --tw-prose-links: var(--fosforo-vivo);
  --tw-prose-bold: var(--fosforo-vivo);
  --tw-prose-counters: var(--fosforo-tenue);
  --tw-prose-bullets: var(--fosforo-tenue);
  --tw-prose-hr: var(--linea);
  --tw-prose-quotes: var(--fosforo);
  --tw-prose-quote-borders: var(--linea-viva);
  --tw-prose-captions: var(--fosforo-tenue);
  --tw-prose-kbd: var(--fosforo-vivo);
  --tw-prose-code: var(--fosforo-vivo);
  --tw-prose-pre-code: var(--fosforo);
  --tw-prose-pre-bg: #010301;
  --tw-prose-th-borders: var(--linea-viva);
  --tw-prose-td-borders: var(--linea);
  max-width: none;
  overflow-wrap: break-word;
  font-size: 15px;
  line-height: 1.75;
  padding: 24px 28px;
  text-shadow: 0 0 2px rgba(70, 197, 83, .25);
}
@media (max-width: 600px) { .articulo.prose { padding: 16px; } }
.articulo > * { max-width: 660px; margin-left: auto; margin-right: auto; }
.articulo :is(h1, h2, h3, h4) { font-family: var(--mono); letter-spacing: .03em; }
.articulo h1 { font-size: 24px; line-height: 1.25; margin-block: 4px 6px; text-shadow: 0 0 8px rgba(124, 240, 135, .3); }
.articulo h2 { font-size: 19px; margin-top: 2em; }
.articulo h3 { font-size: 16px; }
.articulo h2::before { content: "## "; color: var(--fosforo-tenue); }
.articulo h3::before { content: "### "; color: var(--fosforo-tenue); }
.articulo .fecha-articulo { margin-block: 0 2em; font-size: 12px; color: var(--fosforo-tenue); }
.articulo .fecha-articulo::before { content: "> publicado: "; }
.articulo a { text-decoration: underline; text-decoration-color: var(--linea-viva); text-underline-offset: 3px; }
.articulo a:hover { text-decoration-color: var(--fosforo-vivo); }
.articulo :not(pre) > code { background: var(--relleno); border: 1px solid var(--linea); border-radius: 3px; padding: .1em .35em; font-weight: 500; }
.articulo pre { border: 1px solid var(--linea); border-radius: 4px; }
.articulo img { border: 1px solid var(--linea); border-radius: 3px; }
/* Las imágenes dentro de tablas son iconos o sprites (los enemigos de 20220124): sin marco. */
.articulo td img { border: 0; border-radius: 0; }
.articulo blockquote { font-style: normal; background: var(--panel); padding: .2em 1em; }
.articulo table { font-size: 13px; }
.articulo input[type="checkbox"] { accent-color: var(--fosforo); }
.articulo th { color: var(--fosforo-vivo); }
/* Cajas de las directivas (📚 PARA SABER MÁS…): mismas clases de Tailwind, piel de terminal. */
.articulo .bg-gray-700 { background: var(--relleno); border: 1px solid var(--linea-viva); border-top: 3px solid var(--fosforo); border-radius: 5px; color: var(--fosforo); }
.articulo .bg-gray-700 strong { color: var(--fosforo-vivo); letter-spacing: .04em; }
/* Caja de bloque (:::div): el título va en un <p> y no debe sumar margen arriba. */
.articulo .bg-gray-700 > p:first-child { margin-top: 0; }
/* Caja ❝ CITA: el texto citado en cursiva y el autor (<cite>) aparte, alineado a la derecha. */
.articulo .bg-gray-700 blockquote { margin: .8em 0 0; padding: 0; border: 0; background: none; font-style: italic; color: var(--fosforo); }
.articulo .bg-gray-700 blockquote p::before, .articulo .bg-gray-700 blockquote p::after { content: none; }
.articulo .bg-gray-700 cite { display: block; margin-top: .6em; text-align: right; font-style: normal; color: var(--fosforo-tenue); }
.articulo .bg-gray-700 cite::before { content: "— "; }
/* Icono de píxeles que el plugin `callouts` pone en lugar del emoji. */
.articulo .icono-pixel { display: inline-block; width: 1.5em; height: 1.5em; vertical-align: -.35em; margin-right: .5em; fill: var(--fosforo-vivo); shape-rendering: crispEdges; filter: drop-shadow(0 0 2px rgba(124, 240, 135, .5)); }

/* highlight.js en fósforo: verde para el código, ámbar para las cadenas. */
.articulo .hljs { background: #010301; color: var(--fosforo); text-shadow: 0 0 2px rgba(70, 197, 83, .3); }
.articulo :is(.hljs-keyword, .hljs-built_in, .hljs-selector-tag, .hljs-type, .hljs-meta .hljs-keyword) { color: var(--fosforo-vivo); font-weight: 600; }
.articulo :is(.hljs-title, .hljs-title.function_, .hljs-title.class_, .hljs-section) { color: #a8f5b0; }
.articulo :is(.hljs-string, .hljs-regexp, .hljs-template-string, .hljs-symbol) { color: var(--ambar); text-shadow: none; }
.articulo :is(.hljs-number, .hljs-literal, .hljs-variable.language_, .hljs-attr, .hljs-attribute, .hljs-property) { color: #9be7a2; }
.articulo :is(.hljs-comment, .hljs-quote, .hljs-meta) { color: var(--fosforo-tenue); font-style: italic; }
.articulo :is(.hljs-params, .hljs-variable, .hljs-name, .hljs-tag, .hljs-punctuation, .hljs-operator) { color: var(--fosforo); }
.articulo :is(.hljs-addition) { color: var(--fosforo-vivo); background: var(--relleno); }
.articulo :is(.hljs-deletion) { color: var(--alerta); background: #1a0806; }

/* ---------------------------------------------------------------- visor de imágenes
   <dialog> nativo con el mismo tubo: portadas de los libros (books.js) e imágenes de los artículos (main.js). */
.visor { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100vh; overflow: auto; display: grid; place-items: center; }
.visor:not([open]) { display: none; }
.visor::backdrop { background: rgba(2, 4, 2, .9); }
.visor-marco { margin: 16px; padding: 14px 16px; border: 1px solid var(--linea-viva); border-radius: 6px; background: var(--panel); box-shadow: 0 0 24px rgba(47, 143, 58, .35), inset 0 0 12px rgba(47, 143, 58, .05); display: flex; flex-direction: column; gap: 8px; max-width: 100%; }
.visor-marco .cabecera-caja { margin-bottom: 0; }
.visor-marco img { display: block; max-width: calc(100vw - 68px); max-height: calc(100vh - 140px); width: auto; height: auto; margin: 0 auto; border: 1px solid var(--linea); }
.visor .pista { text-align: center; margin: 0; }
.visor-pie { max-width: calc(100vw - 68px); margin: 0; font-size: 13px; color: var(--fosforo); text-align: center; }
.visor-pie:empty { display: none; }
.visor-mandos { display: flex; gap: 14px; }
.enlace { font: inherit; font-size: 12px; color: var(--fosforo-tenue); background: none; border: 0; padding: 0; cursor: pointer; text-shadow: inherit; }
.enlace:hover { color: var(--fosforo-vivo); }
.enlace[hidden] { display: none; }
.articulo img.ampliable { cursor: zoom-in; transition: box-shadow .2s ease; }
.articulo img.ampliable:hover, .articulo img.ampliable:focus-visible { box-shadow: 0 0 14px rgba(124, 240, 135, .35); outline: 0; }

/* ---------------------------------------------------------------- búsqueda */
.campo-busqueda { display: flex; align-items: center; gap: 8px; border: 1px solid var(--linea-viva); border-radius: 5px; background: var(--relleno); padding: 10px 12px; margin: 12px 0 8px; }
.campo-busqueda:focus-within { border-color: var(--fosforo-vivo); box-shadow: 0 0 10px rgba(124, 240, 135, .25); }
.campo-busqueda label { color: var(--fosforo-tenue); white-space: nowrap; }
.campo-busqueda input { flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--fosforo-vivo); text-shadow: inherit; background: none; border: 0; outline: 0; }
.campo-busqueda input::placeholder { color: var(--fosforo-tenue); opacity: 1; }
#search-info { color: var(--fosforo-tenue); font-size: 12px; margin: 0 0 12px; }
.paginacion { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.boton { font: inherit; font-size: 13px; color: var(--fosforo); text-shadow: inherit; background: var(--panel); border: 1px solid var(--linea); border-radius: 4px; padding: 4px 10px; cursor: pointer; }
.boton:hover:not(:disabled) { border-color: var(--linea-viva); color: var(--fosforo-vivo); }
.boton:disabled { background: var(--relleno); color: var(--fosforo-vivo); border-color: var(--linea-viva); cursor: default; }

/* ---------------------------------------------------------------- pie */
.pie { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--fosforo-tenue); border-top: 1px solid var(--linea); padding-top: 12px; margin-top: 16px; }
.pie nav { display: flex; gap: 14px; flex-wrap: wrap; }
.pie a { color: var(--fosforo-tenue); }
.pie a:hover { color: var(--fosforo-vivo); text-decoration: none; }
.cursor::after { content: "_"; animation: parpadeo 1s steps(1) infinite; }
@keyframes parpadeo { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .cursor::after { animation: none; }
  .miniatura img, .articulo img.ampliable { transition: none; }
}
