/* ==========================================================================
   FICHERO — sistema visual
   Terminal de catálogo de biblioteca sobre fósforo verde P1.
   Paleta cerrada: #040704 suelo · #33ff33 fósforo · #1f9c48 apagado · #8dffab claro
   ========================================================================== */

@font-face {
  font-family: 'Departure Mono';
  src: url('/fonts/departure-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Courier Prime';
  src: url('/fonts/courier-prime-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Courier Prime';
  src: url('/fonts/courier-prime-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ground: #040704;
  --well: #071009;
  --phosphor: #33ff33;
  --dim: #1f9c48;
  --pale: #8dffab;

  --line: rgba(51, 255, 51, 0.22);
  --line-strong: rgba(51, 255, 51, 0.55);
  --wash: rgba(10, 32, 16, 0.55);

  --font-display: 'Departure Mono', 'Courier Prime', 'Courier New', monospace;
  --font-text: 'Courier Prime', 'Courier New', Courier, monospace;

  --bar-h: 58px;
  --fn-h: 46px;
  --gutter: clamp(16px, 3.4vw, 56px);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

iframe {
  border: 0;
}

html {
  min-height: 100%;
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: calc(var(--bar-h) + 1px) 0 calc(var(--fn-h) + 1px);
  background: var(--ground);
  color: var(--phosphor);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* El barrido del monitor: una banda de fósforo que baja sin parar.
   Va por debajo de las scanlines y de la barra fija, así que no emborrona texto. */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 14vh;
  z-index: 59;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(51, 255, 51, 0) 0%,
    rgba(51, 255, 51, 0.02) 45%,
    rgba(141, 255, 171, 0.07) 50%,
    rgba(51, 255, 51, 0.02) 55%,
    rgba(51, 255, 51, 0) 100%
  );
  animation: sweep 11s linear infinite;
}

@keyframes sweep {
  from {
    transform: translateY(-14vh);
  }
  to {
    transform: translateY(100vh);
  }
}

/* El cristal: viñeta + líneas de barrido, sin bisel redondeado de juguete. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.5) 100%);
}

/* --------------------------------------------------------------- superficies
   El navegador también es parte del diseño. */

::selection {
  background: var(--phosphor);
  color: var(--ground);
}

:focus-visible {
  outline: 2px solid var(--phosphor);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--pale);
  outline-offset: 3px;
  background: var(--phosphor);
  color: var(--ground);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--dim) var(--ground);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--ground);
  border-left: 1px solid var(--line);
}

::-webkit-scrollbar-thumb {
  background: var(--dim);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--phosphor);
}

/* ------------------------------------------------------------------- chrome */

.crt-wrapper {
  min-height: calc(100vh - var(--bar-h) - var(--fn-h));
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: clamp(22px, 3.2vw, 40px) var(--gutter) 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--phosphor);
  color: var(--ground);
  padding: 10px 16px;
  font-weight: 700;
  text-decoration: none;
}

.skip:focus {
  left: 8px;
  top: calc(var(--bar-h) + 8px);
}

/* Barra de estado: la cabecera de la terminal. */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--bar-h);
  background: var(--ground);
  border-bottom: 1px solid var(--dim);
}

.navbar {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--phosphor);
  text-decoration: none;
  font-family: var(--font-text);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand b {
  display: inline-block;
  padding: 3px 8px 2px;
  background: var(--phosphor);
  color: var(--ground);
  font-weight: 700;
  letter-spacing: 0.16em;
  transition:
    background-color 0.15s linear,
    color 0.15s linear,
    box-shadow 0.15s linear;
}

.brand span {
  color: var(--dim);
  font-size: 14px;
  letter-spacing: 0.1em;
}

/* El hover no pinta la barra entera: solo el chip, que pasa a contorno. */
.brand:hover,
.brand:focus-visible {
  background: none;
  color: var(--phosphor);
}

.brand:hover span,
.brand:focus-visible span {
  color: var(--phosphor);
}

.brand:hover b,
.brand:focus-visible b {
  background: transparent;
  color: var(--phosphor);
  box-shadow: inset 0 0 0 1px var(--phosphor);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.nav-menu a {
  display: inline-block;
  padding: 6px 10px;
  color: var(--phosphor);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s linear,
    color 0.15s linear,
    box-shadow 0.15s linear;
}

/* Un solo bloque encendido en el menú: lo lleva la sección actual hasta que
   el ratón o el foco se van a otra; entonces el bloque se muda allí y la
   actual se queda en contorno, el mismo lenguaje que el hover de la marca. */
.nav-menu a:hover,
.nav-menu a:focus-visible,
.nav-menu a[aria-current='page'] {
  background: var(--phosphor);
  color: var(--ground);
}

.nav-menu a:focus-visible {
  outline: 2px solid var(--phosphor);
  outline-offset: 2px;
}

.nav-menu a[aria-current='page'] {
  font-weight: 700;
}

.nav-menu:has(a:hover, a:focus-visible) a[aria-current='page']:not(:hover, :focus-visible) {
  background: transparent;
  color: var(--phosphor);
  box-shadow: inset 0 0 0 1px var(--phosphor);
}

/* Con JS y menú en línea, el relleno deja de pintarse en cada enlace: lo
   lleva un único bloque (`.nav-glow`, en Header.astro) que se desliza entre
   ellos. Invierte lo que tiene debajo, así que a mitad de recorrido las
   letras quedan medio encendidas, como un cursor barriendo la línea. */
.nav-glow {
  display: none;
}

@media (min-width: 1025px) {
  .nav-menu.is-gliding {
    position: relative;
  }

  .nav-menu.is-gliding a:hover,
  .nav-menu.is-gliding a:focus-visible,
  .nav-menu.is-gliding a[aria-current='page'] {
    background: transparent;
    color: var(--phosphor);
  }

  .nav-menu.is-gliding .nav-glow {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: var(--w, 0);
    height: var(--h, 0);
    background: var(--phosphor);
    mix-blend-mode: difference;
    pointer-events: none;
    opacity: 0;
    transform: translate(var(--x, 0), var(--y, 0));
    transition:
      transform 0.32s var(--ease-out),
      width 0.32s var(--ease-out),
      opacity 0.15s linear;
  }

  .nav-menu.is-gliding .nav-glow.is-instant {
    transition: none;
  }
}

@media (min-width: 1025px) and (prefers-reduced-motion: reduce) {
  .nav-menu.is-gliding .nav-glow {
    transition: opacity 0.15s linear;
  }
}

.menu-toggle {
  display: none;
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.menu-icon {
  display: none;
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--dim);
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.14em;
  user-select: none;
}

.menu-icon:hover {
  background: var(--phosphor);
  color: var(--ground);
}

/* El interruptor real es la casilla: el anillo de foco va sobre la etiqueta. */
.menu-toggle:focus-visible + .menu-icon {
  outline: 2px solid var(--phosphor);
  outline-offset: 2px;
}

/* Barra de teclas de función: el pie. */

.site-footer {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 100;
  height: var(--fn-h);
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 var(--gutter);
  background: var(--ground);
  border-top: 1px solid var(--dim);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-transform: uppercase;
}

.site-footer .fn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
}

.site-footer .fn kbd {
  padding: 2px 6px 1px;
  border: 1px solid var(--line-strong);
  color: var(--phosphor);
  font: inherit;
  font-weight: 700;
}

.site-footer .fn:hover,
.site-footer .fn:focus-visible {
  background: none;
  color: var(--phosphor);
}

.site-footer .fn:hover kbd {
  background: var(--phosphor);
  color: var(--ground);
}

.site-footer .right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.copy-left {
  display: inline-block;
  transform: scaleX(-1);
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 15px;
  background: var(--phosphor);
  animation: blink 1.1s steps(1) infinite;
}

/* --------------------------------------------------------------- tipografía */

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.98;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-family: var(--font-text);
  font-weight: 700;
  font-size: clamp(34px, 4.2vw, 52px);
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(24px, 2.6vw, 34px);
}

h3 {
  font-size: 20px;
  letter-spacing: 0.02em;
}

p,
li {
  max-width: 68ch;
  text-wrap: pretty;
}

p {
  margin: 0 0 1.05em;
}

a {
  color: var(--phosphor);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

a:hover {
  background: var(--phosphor);
  color: var(--ground);
  text-decoration: none;
}

strong,
b {
  font-weight: 700;
}

.blink,
.cursor-blink {
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.highlight {
  color: var(--pale);
  font-weight: 700;
}

/* Etiqueta de sección: numerada porque el orden es el índice del fichero. */
.label {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 14px;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.label span {
  color: var(--phosphor);
}

/* -------------------------------------------------------------------- ficha */

.home {
  position: relative;
  max-width: 1360px;
  margin: 0 auto;
}

.ficha-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}

.ficha {
  position: relative;
  z-index: 1;
  border: 2px solid var(--phosphor);
  background: #061007;
  padding: clamp(20px, 3vw, 32px) clamp(20px, 3vw, 34px) clamp(22px, 3vw, 30px);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.7);
  animation: settle 0.55s var(--ease-out) both;
}

@keyframes settle {
  from {
    transform: translateY(12px);
  }
}

.ficha h1 {
  margin: 0 0 12px;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 0.94;
  letter-spacing: -0.035em;
}

.ficha__sub {
  font-size: clamp(16px, 1.5vw, 19px);
  color: var(--pale);
  letter-spacing: 0.02em;
  margin-bottom: 22px;
}

.ficha__rule {
  height: 1px;
  background: var(--line-strong);
  margin: 0 0 18px;
}

.fields {
  display: grid;
  grid-template-columns: minmax(88px, 132px) minmax(0, 1fr);
  gap: 10px 22px;
  margin: 0;
  font-size: 16px;
}

.fields dt {
  color: var(--dim);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding-top: 4px;
}

.fields dd {
  margin: 0;
  color: var(--phosphor);
}

.ficha__action {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding: 12px 16px;
  background: var(--phosphor);
  color: var(--ground);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease-out);
}

.ficha__action .arrow {
  margin-left: auto;
  flex: none;
  transition: transform 0.25s var(--spring);
}

.ficha__action:hover,
.ficha__action:focus-visible {
  background: var(--ground);
  color: var(--phosphor);
  outline: 2px solid var(--phosphor);
  outline-offset: 0;
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
}

.ficha__action:hover .arrow {
  transform: translateX(4px);
}

.stamp {
  position: absolute;
  right: -14px;
  bottom: 106px;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 16px;
  transform: rotate(-7deg);
  border: 2px solid var(--phosphor);
  background: rgba(4, 7, 4, 0.9);
  color: var(--phosphor);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    background-color 0.15s linear,
    color 0.15s linear;
  animation: press 0.5s var(--spring) 0.4s both;
}

/* El sello es la puerta al registro: se rellena, no se subraya. */
.stamp:hover,
.stamp:focus-visible {
  background: var(--phosphor);
  color: var(--ground);
}

@keyframes press {
  from {
    transform: rotate(-13deg) scale(1.14);
    opacity: 0.2;
  }
}

/* ------------------------------------------------------------- expedientes */

.drawers {
  position: relative;
  z-index: 1;
  animation: settle 0.55s var(--ease-out) 0.08s both;
}

/* El raíl del expediente: una sola línea que sostiene el índice entero. */
.drawers::before {
  content: '';
  position: absolute;
  left: -13px;
  top: -16px;
  bottom: -18px;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--line-strong) 9%,
    var(--line-strong) 91%,
    transparent
  );
  transform-origin: top;
  animation: rail 0.9s var(--ease-out) 0.2s both;
}

.drawers::after {
  content: '';
  position: absolute;
  left: -16px;
  bottom: -18px;
  width: 7px;
  height: 1px;
  background: var(--line-strong);
}

@keyframes rail {
  from {
    transform: scaleY(0);
  }
}

.drawers .label {
  margin-bottom: 18px;
}

.drawer {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 0 18px;
  align-items: start;
  padding: 15px 18px 15px 20px;
  margin-bottom: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 16, 9, 0.96);
  color: var(--phosphor);
  text-decoration: none;
  transition:
    transform 0.32s var(--spring),
    border-color 0.2s linear,
    box-shadow 0.32s var(--ease-out),
    background-color 0.2s linear;
}

.drawer::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  width: 11px;
  height: 1px;
  background: var(--line-strong);
}

.drawer__n {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--dim);
  padding-top: 6px;
  letter-spacing: 0.06em;
}

.drawer__t {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 32px);
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.drawer__k {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.drawer:hover,
.drawer:focus-visible,
.drawer[aria-current='page'] {
  transform: translateX(-24px);
  border-color: var(--phosphor);
  background: var(--well);
  box-shadow:
    -16px 0 44px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px var(--phosphor);
  outline: none;
}

.drawer:hover .drawer__t,
.drawer:focus-visible .drawer__t,
.drawer[aria-current='page'] .drawer__t {
  color: var(--phosphor);
}

.drawer:hover .drawer__k,
.drawer:focus-visible .drawer__k {
  color: var(--pale);
}

.drawers__hint {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--dim);
  letter-spacing: 0.04em;
}

/* El único cajón que soy yo: el puesto que se perdió. Número y estado en
   fósforo pleno; el resto de la lucha queda en tenue. */
.drawer--own {
  border-color: var(--phosphor);
}

.drawer--own .drawer__n,
.drawer--own .drawer__k {
  color: var(--phosphor);
}

/* Caja lateral de los expedientes: la misma lucha, en pequeño. */
.case-index a {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  color: var(--phosphor);
  text-decoration: none;
}

.case-index__n {
  color: var(--dim);
  font-family: var(--font-display);
}

.case-index a:hover span:last-child,
.case-index a:focus-visible span:last-child {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.case-index .is-current a {
  font-weight: 700;
}

.case-index .is-current .case-index__n {
  color: var(--phosphor);
}

/* --------------------------------------------------------- cuerpo de página */

.boards {
  max-width: 1360px;
  margin: clamp(44px, 5.6vw, 76px) auto 0;
  padding-bottom: 72px;
  display: grid;
  gap: clamp(38px, 4.6vw, 62px);
}

.board {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.board h2 {
  margin-bottom: 16px;
}

.board p {
  font-size: 17px;
}

.board p:last-child {
  margin-bottom: 0;
}

.board__body {
  display: grid;
  gap: 18px;
}

@media (min-width: 900px) {
  .board__body,
  .board__body.split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
    gap: clamp(32px, 4vw, 64px);
    align-items: start;
  }
}

.board__meta {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 0 0 0;
  font-size: 15px;
}

.board__meta div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.board__meta dt {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.board__meta dd {
  margin: 0;
  color: var(--phosphor);
}

.rival {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 15px;
  max-width: none;
}

.rivals {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Cabecera de la tabla de puestos: dice qué es cada columna. */
.rivals__head {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rivals__head span:last-child,
.rival span:last-child {
  text-align: right;
}

.rivals__note {
  margin: 12px 0 0;
  max-width: 44ch;
  color: var(--dim);
  font-size: 13px;
}

.rival b {
  color: var(--dim);
  font-weight: 400;
}

.rival span:last-child {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.rival--own {
  color: var(--phosphor);
}

.rival--own b {
  color: var(--phosphor);
}

.rival--own span:last-child {
  color: var(--pale);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border: 1px solid var(--phosphor);
  color: var(--phosphor);
  font-family: var(--font-text);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.06em;
  transition:
    background-color 0.18s linear,
    color 0.18s linear,
    transform 0.25s var(--spring);
}

.btn:hover,
.btn:focus-visible {
  background: var(--phosphor);
  color: var(--ground);
  transform: translateY(-2px);
}

.btn--solid {
  background: var(--phosphor);
  color: var(--ground);
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
}

.btn--solid:hover,
.btn--solid:focus-visible {
  background: var(--ground);
  color: var(--phosphor);
  outline: 2px solid var(--phosphor);
  outline-offset: 0;
}

.note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--dim);
}

/* -------------------------------------------------------------------- prosa */

section {
  max-width: 100%;
}

section > ul {
  max-width: 66ch;
}

h1 + .prompt {
  margin-top: 14px;
}

ul {
  padding-left: 20px;
}

li {
  margin: 6px 0;
}

blockquote {
  margin: 20px 0;
  padding-left: 16px;
  border-left: 1px solid var(--dim);
  color: var(--pale);
}

/* ------------------------------------------------------------------ móvil */

@media (max-width: 1080px) {
  .ficha-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .drawers::before,
  .drawers::after {
    display: none;
  }

  .drawers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .drawers .label,
  .drawers__hint {
    grid-column: 1 / -1;
  }

  .drawer {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 0;
  }

  .drawer::before {
    display: none;
  }

  .drawer:hover,
  .drawer:focus-visible,
  .drawer[aria-current='page'] {
    transform: translateY(-4px);
  }
}

/* El chip lleva el nombre completo: con siete textos no cabe a la vez que el
   subtítulo, así que primero cae él, no el menú. Medido: a 1100 px quedan 49 px
   de aire; por debajo de 1060 el `scrollWidth` empieza a desbordar la barra. */
@media (max-width: 1100px) {
  .brand span {
    display: none;
  }
}

/* Por debajo de 1024 el menú pasa a desplegable. */
@media (max-width: 1024px) {
  .menu-icon {
    display: inline-block;
  }

  .menu-toggle {
    display: block;
  }

  .nav-menu {
    position: fixed;
    top: var(--bar-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px var(--gutter) 14px;
    background: var(--ground);
    border-bottom: 1px solid var(--phosphor);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
    display: none;
  }

  .menu-toggle:checked ~ .nav-menu {
    display: flex;
  }

  .nav-menu a {
    padding: 12px 6px;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
  }
}

@media (max-width: 760px) {
  :root {
    --bar-h: 56px;
    --fn-h: 44px;
  }

  body {
    font-size: 16px;
  }

  /* La etiqueta de sección es una sola línea: si aprieta, se cierra el tracking. */
  .label {
    gap: 8px;
    letter-spacing: 0.1em;
  }

  .drawers {
    grid-template-columns: minmax(0, 1fr);
  }

  .drawer {
    grid-template-columns: 38px 1fr;
    gap: 0 14px;
  }

  .fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .fields dd {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .ficha__head {
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    letter-spacing: 0.14em;
  }

  .ficha h1 {
    margin: 16px 0 10px;
  }

  .stamp {
    right: 8px;
    bottom: 96px;
    top: auto;
    font-size: 11px;
    letter-spacing: 0.18em;
  }

  .site-footer .right .copy-left,
  .site-footer .right .years {
    display: none;
  }
}

/* Entre 760 y 900 no caben cuatro teclas y el copyright: se quedan las dos
   primeras, y el resto de páginas viven en el menú. */
@media (max-width: 900px) {
  .site-footer .fn:nth-child(3),
  .site-footer .fn:nth-child(4) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  body::before {
    display: none;
  }
}

/* ============================================================ páginas internas
   Misma ficha, otra signatura: cabeza + relato a la izquierda y registro a la
   derecha. */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding-bottom: 72px;
}

.page__head {
  max-width: 74ch;
  padding-bottom: 26px;
  margin-bottom: clamp(28px, 3.4vw, 40px);
  border-bottom: 1px solid var(--line);
}

.page__head h1 {
  margin: 12px 0 16px;
  font-size: clamp(32px, 3.4vw, 48px);
  line-height: 1.02;
}

.page__lede {
  margin: 0;
  max-width: 62ch;
  font-size: clamp(17px, 1.4vw, 19px);
  color: var(--pale);
}

/* Línea de terminal: decorativa, fuera del árbol de lectura. */
.prompt {
  margin: 0 0 18px;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.page__cols {
  display: grid;
  gap: clamp(30px, 4vw, 56px);
}

.page__flow {
  display: block;
}

.page__main {
  min-width: 0;
}

.page__aside {
  display: grid;
  gap: 24px;
  align-content: start;
}

.page__aside .list-rows li {
  padding: 9px 0 8px;
  font-size: 15px;
}

@media (min-width: 900px) {
  .page__cols {
    grid-template-columns: minmax(0, 1fr) minmax(0, 356px);
    align-items: start;
  }
}

.sec {
  margin: 0 0 clamp(34px, 4vw, 52px);
}

/* Sección a todo el ancho que sigue a un bloque de dos columnas. */
.sec--after-cols {
  margin-top: clamp(38px, 4.6vw, 58px);
}

.sec:last-child {
  margin-bottom: 0;
}

.sec h2 {
  margin-bottom: 14px;
  font-size: clamp(22px, 2vw, 28px);
}

.prose {
  max-width: 68ch;
}

/* Sinopsis larga: dos columnas de lectura, como una ficha impresa. */
.cols-2 {
  max-width: none;
  columns: 2;
  column-gap: clamp(26px, 3.4vw, 48px);
}

.cols-2 p {
  margin: 0 0 1em;
  break-inside: avoid;
  max-width: none;
}

.cols-2 p:last-child {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .cols-2 {
    columns: 1;
  }
}

.prose > :last-child {
  margin-bottom: 0;
}

/* Registro: pares etiqueta/valor, igual que la ficha de la home. */

.record {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.record > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0 9px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.record dt {
  padding-top: 3px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.record dd {
  margin: 0;
  color: var(--phosphor);
  text-wrap: pretty;
}

/* Variante horizontal: el registro de la ficha, en una tira. */

.record--row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin: clamp(24px, 3vw, 34px) 0 clamp(30px, 4vw, 44px);
  border-top: 1px solid var(--line);
}

.record--row > div {
  display: block;
  padding: 12px 20px 12px 0;
  border-bottom: 1px solid var(--line);
}

.record--row dt {
  padding: 0;
  margin-bottom: 7px;
}

.record--row dd {
  font-size: 15px;
  line-height: 1.45;
}

/* Registro de cambios: cada versión, su fecha y lo que movió. */

.log {
  max-width: 74ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* El `li` global se limita a 68ch: aquí manda el ancho de la ficha. */
.log__item {
  max-width: none;
}

.log__item + .log__item {
  margin-top: clamp(30px, 4vw, 44px);
  padding-top: clamp(24px, 3vw, 32px);
  border-top: 1px solid var(--line);
}

.log__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
}

.log__version {
  font-family: var(--font-display);
  font-size: clamp(26px, 2.6vw, 34px);
  letter-spacing: 0.02em;
}

.log__now {
  padding: 3px 8px 2px;
  background: var(--phosphor);
  color: var(--ground);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.log__date {
  margin-left: auto;
  color: var(--dim);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.log__note {
  margin: 8px 0 0;
  max-width: 66ch;
  color: var(--pale);
  font-size: 15px;
}

.log .record {
  margin-top: 16px;
}

.log__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.log__list li {
  position: relative;
  padding-left: 16px;
}

.log__list li + li {
  margin-top: 3px;
}

.log__list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--dim);
}

/* Prehistoria: los commits anteriores al registro, plegados por año. */

.hist {
  margin-top: clamp(40px, 5vw, 64px);
}

.hist__years {
  max-width: 96ch;
  margin-top: clamp(18px, 2.4vw, 26px);
  border-top: 1px solid var(--line);
}

.hist__year {
  border-bottom: 1px solid var(--line);
}

.hist__year summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 13px 0 12px;
  color: var(--phosphor);
  cursor: pointer;
  list-style: none;
}

.hist__year summary::-webkit-details-marker {
  display: none;
}

.hist__year summary::before {
  content: '+';
  width: 12px;
  color: var(--dim);
  font-family: var(--font-display);
  font-size: 15px;
}

.hist__year[open] summary::before {
  content: '−';
}

.hist__year summary:hover {
  background: rgba(125, 255, 138, 0.07);
}

.hist__year summary:focus-visible {
  outline: 2px solid var(--phosphor);
  outline-offset: 2px;
}

.hist__year-n {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.04em;
}

.hist__year-c {
  margin-left: auto;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hist__list {
  margin: 0 0 14px;
  padding: 0 0 0 24px;
  list-style: none;
}

.hist__commit {
  display: grid;
  grid-template-columns: 46px 58px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
  color: var(--pale);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
}

.hist__commit time,
.hist__commit code {
  color: var(--dim);
  font-size: 12px;
}

.hist__commit:hover span,
.hist__commit:focus-visible span {
  color: var(--phosphor);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Opciones numeradas: regalos y compra. */

.opts {
  display: grid;
  gap: 10px;
  max-width: 78ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.opt {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px 13px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 16, 9, 0.62);
  color: var(--phosphor);
  text-decoration: none;
  transition:
    background-color 0.16s linear,
    color 0.16s linear,
    transform 0.24s var(--spring),
    box-shadow 0.24s var(--ease-out);
}

.opt__n {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--dim);
}

.opt__t {
  display: block;
  font-size: 17px;
}

.opt__k {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: right;
}

/* Dos opciones en paralelo (comprar / buscar). */
.opts--pair {
  max-width: none;
}

@media (min-width: 760px) {
  .opts--pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 1.6vw, 20px);
  }
}

.opt:hover,
.opt:focus-visible {
  transform: translateX(4px);
  background: var(--phosphor);
  color: var(--ground);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
}

.opt:hover .opt__n,
.opt:focus-visible .opt__n,
.opt:hover .opt__k,
.opt:focus-visible .opt__k {
  color: #0a3a12;
}

.hint {
  margin-top: 14px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.hint--end {
  margin-top: 36px;
}

.actions--end {
  margin-top: 32px;
}

/* Formulario. */

/* Confirmación de envío: el mismo contorno de fósforo que la sección actual del menú. */
.form__status {
  max-width: 560px;
  margin: 0 0 18px;
  padding: 12px 16px;
  box-shadow: inset 0 0 0 1px var(--phosphor);
  color: var(--phosphor);
}

.form {
  display: grid;
  gap: 18px;
  max-width: 560px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--dim);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 13px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #061007;
  color: var(--phosphor);
  font-family: var(--font-text);
  font-size: 16px;
}

.field textarea {
  min-height: 148px;
  resize: vertical;
}

.field input:hover,
.field textarea:hover {
  border-color: var(--phosphor);
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--phosphor);
  outline-offset: 1px;
  border-color: var(--phosphor);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--dim);
}

.form button[type='submit'] {
  justify-self: start;
  margin-top: 4px;
  padding: 12px 26px 11px;
  border: 1px solid var(--phosphor);
  background: var(--phosphor);
  color: var(--ground);
  font-family: var(--font-text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition:
    background-color 0.18s linear,
    color 0.18s linear,
    transform 0.22s var(--spring);
}

.form button[type='submit']:hover,
.form button[type='submit']:focus-visible {
  background: var(--ground);
  color: var(--phosphor);
  transform: translateY(-2px);
}

/* Disparador de vídeo dentro del texto. */

/* El disparador y su coma son una sola unidad: la coma no abre línea. */
.nowrap {
  white-space: nowrap;
}

.link-btn {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--phosphor);
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.link-btn:hover,
.link-btn:focus-visible {
  background: var(--phosphor);
  color: var(--ground);
  text-decoration: none;
}

/* Modal de vídeo. */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  padding: 24px;
  align-items: center;
  justify-content: center;
  background: rgba(4, 7, 4, 0.95);
}

.modal[data-open='true'] {
  display: flex;
}

.modal__frame {
  position: relative;
  width: min(880px, 100%);
  padding: 12px;
  border: 2px solid var(--phosphor);
  background: #061007;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85);
}

.modal__close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 38px;
  height: 38px;
  border: 0;
  background: var(--phosphor);
  color: var(--ground);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover {
  background: var(--pale);
}

.modal__video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.modal__video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Lista de obras y motivos: filas con regla, sin tarjetas. */

.list-rows {
  max-width: 78ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-rows li {
  max-width: none;
  padding: 11px 0 10px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

.list-rows li:first-child {
  border-top: 1px solid var(--line);
}

.list-rows .sub {
  color: var(--dim);
}

@media (max-width: 760px) {
  .page {
    padding-bottom: 56px;
  }

  .opt {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px 12px;
  }

  .opt__k {
    grid-column: 2;
    text-align: left;
  }

  .record > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .record dt {
    padding-top: 0;
  }

  .log__date {
    margin-left: 0;
  }

  .hist__commit {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
  }

  /* En el móvil el hash sobra: el asunto ya identifica el commit. */
  .hist__commit code {
    display: none;
  }
}
