/* =========================================================
   +ARXIV — SYSTEM
   ---------------------------------------------------------
   Interfaz de archivo institucional realismo ficcionandome incorpus pues ubi est , ego sum.
   Referencias de principio no de estilo:
     cbcnet 2004 / submethod 2000 / mono*crafts 1999

   Dos voces tipográficas:
     — IBM Plex Mono  → voz del sistema (códigos, fechas, nav)
     — IBM Plex Sans  → voz humana (títulos, cuerpo de texto)
========================================================= */

:root {

  /* ---- color ---- */
  --paper:        #f1efe8;   /* blanco crudo */
  --paper-raised: #e7e3d9;   /* zonas de sistema */
  --ink:          #1c1b18;   /* texto principal */
  --ink-soft:     #58554c;   /* texto secundario */
  --ink-faint:    #8a8679;   /* texto terciario / meta */
  --line:         rgba(28,27,24,0.16);
  --line-soft:    rgba(28,27,24,0.09);
  --accent:       #6d8079;   /* único acento: verde-turquesa desaturado */

  /* ---- tipografía ---- */
  --font-system: "IBM Plex Mono", "Consolas", monospace;
  --font-read:   "IBM Plex Sans", "Helvetica Neue", sans-serif;

  /* ---- retícula ---- */
  --rail-width: 220px;
  --unit: 8px;
}


/* =========================================================
   BASE
========================================================= */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-read);
  font-size: 13px;
  line-height: 1.6; /* restaurado — a 1 quedaba ilegible fuera del poema */
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

::selection {
  background: rgba(109,128,121,0.25); /* --accent a 25% */
  color: var(--ink);
}


/* =========================================================
   LAYOUT GENERAL
========================================================= */

.system {
  display: grid;
  grid-template-columns: var(--rail-width) 1fr;
  min-height: 100vh;
}


/* =========================================================
   CABECERA DEL SISTEMA
========================================================= */

.system-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 20px 28px;
  background: var(--paper-raised);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-system);
}

.wordmark {
  font-size: 13px;
  font-weight: 350;
  letter-spacing: 0.30em;
  text-transform: uppercase;
  color: var(--ink);
}

.wordmark a {
  text-decoration: none;
  color: inherit;
}

.wordmark span {
  color: var(--accent);
}

.system-status {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =========================================================
   RAIL — ÍNDICE / NAVEGACIÓN
========================================================= */

.rail {
  border-right: 1px solid var(--line);
  padding: 28px 20px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  font-family: var(--font-system);
}

.rail-block { margin-bottom: 36px; }

.rail-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.rail nav { display: flex; flex-direction: column; gap: 2px; }

.rail nav a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}

.rail nav a::before {
  content: "·";
  color: var(--ink-faint);
}

.rail nav a:hover,
.rail nav a[aria-current="page"] {
  color: var(--ink);
}

.rail nav a[aria-current="page"]::before {
  color: var(--accent);
}

.rail-counter {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}

.rail-counter b { color: var(--accent); font-weight: 600; }

.rail-note {
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink-faint);
  margin: 0 0 10px;
}

.rail-note:last-child { margin-bottom: 0; }


/* =========================================================
   ÍNDICE MÓVIL (usa <details> nativo, sin JS)
========================================================= */

.rail-toggle { display: none; }


/* =========================================================
   CONTENIDO — LISTA DE FICHAS
========================================================= */

.archive {
  padding: 0;
  list-style: none;
  margin: 0;
  counter-reset: registro;
}

.ficha {
  counter-increment: registro;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  padding: 32px 28px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 90px;
}

.ficha:first-child { border-top: 1px solid var(--line); }

.ficha-meta {
  font-family: var(--font-system);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ficha-code {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.ficha-code::before {
  content: counter(registro, decimal-leading-zero) " / ";
  color: var(--ink-faint);
  font-weight: 400;
}

.ficha-type {
  display: inline-block;
  width: fit-content;
  padding: 2px 6px;
  border: 1px solid var(--line);
  text-transform: uppercase;
}

.ficha-body { min-width: 0; }

.ficha-body h1,
.ficha-body h2 {
  font-family: var(--font-read);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: 0 0 20px;
  color: var(--ink);
}

.ficha-body p {
  margin: 0 0 14px;
  color: var(--ink);
  max-width: 62ch;
}

.ficha-body p:last-child { margin-bottom: 0; }

.ficha-tags {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-system);
  font-size: 10px;
}

.ficha-tags span {
  color: var(--ink-soft);
}

.ficha-tags span::before {
  content: "#";
  color: var(--accent);
}


/* =========================================================
   SEPARADOR DE SECCIÓN
   ---------------------------------------------------------
   <li class="archive-divider"><p>— nombre —</p></li>
   Marca un cambio de bloque temático dentro del archive sin
   romper la numeración de fichas ni el grid (no lleva counter).
========================================================= */

.archive-divider {
  padding: 22px 28px 6px;
  border-top: 1px solid var(--line);
}

.archive-divider p {
  margin: 0;
  font-family: var(--font-system);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-faint);
}

.archive-divider p::before,
.archive-divider p::after { color: var(--accent); }


/* =========================================================
   FICHA — VARIANTE POEMA
========================================================= */

.ficha[data-type="poema"] {
  --poem-accent: #415e59;
}

.poema-cuerpo {
  font-family: "Consolas", "IBM Plex Mono", monospace;
  font-size: 14px;
  line-height: 1.05;
  color: var(--ink);
  max-width: 62ch;
}

.poema-titulo {
  color: var(--poem-accent);
}

.estrofa {
  position: relative;
  margin: 0 0 20px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.estrofa::before {
  content: "∷";
  position: absolute;
  left: -1px;
  top: 0;
  transform: translateX(-100%);
  padding-right: 1px;
  font-family: var(--font-system);
  font-size: 9px;
  color: var(--poem-accent);
  opacity: 0.70;
}

.poema-cuerpo { counter-reset: estrofa; }

.estrofa:last-child { margin-bottom: 0; }


/* =========================================================
   BANNER DE IMAGEN — EXPANDIBLE / RETRÁCTIL
========================================================= */

.banner-toggle {
  margin-top: 24px;
  max-width: 62ch;
  border: 1px solid var(--line);
  background: var(--paper-raised);
}

.banner-toggle summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  font-family: var(--font-system);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--poem-accent, var(--ink-soft));
  border-bottom: 1px solid var(--line);
}

.banner-toggle summary::-webkit-details-marker { display: none; }

.banner-toggle summary::after {
  content: "+ expandir";
  color: var(--ink-faint);
  flex-shrink: 0;
}

.banner-toggle[open] summary::after {
  content: "– retraer";
}

.banner-frame {
  overflow: hidden;
  max-height: 110px;
  transition: max-height .4s ease;
}

.banner-toggle[open] .banner-frame {
  max-height: 1400px;
}

.banner-frame img {
  width: 100%;
  display: block;
  height: 110px;
  object-fit: cover;
  object-position: center 20%;
  transition: height .4s ease;
  filter: grayscale(25%) contrast(105%) sepia(6%);
}

.banner-toggle[open] .banner-frame img {
  height: auto;
  object-fit: initial;
}

.banner-caption {
  padding: 8px 10px;
  font-family: var(--font-system);
  font-size: 10px;
  color: var(--poem-accent, var(--ink-faint));
  border-top: 1px solid var(--line);
}


/* =========================================================
   FICHA — VARIANTE IMAGEN
========================================================= */

.ficha[data-type="imagen"] .visor {
  border: 1px solid var(--line);
  background: var(--paper-raised);
}

.ficha[data-type="imagen"] .visor img {
  filter: grayscale(20%) contrast(106%);
  border-bottom: 1px solid var(--line);
}

.visor-caption {
  padding: 8px 10px;
  font-family: var(--font-system);
  font-size: 10px;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}


/* =========================================================
   TEASERS — PÁGINA DE INICIO
========================================================= */

.archive--teaser .teaser {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  padding: 26px 28px;
  border-bottom: 1px solid var(--line);
}

.archive--teaser .teaser:first-child { border-top: 1px solid var(--line); }

.teaser-meta {
  font-family: var(--font-system);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.teaser-meta .ficha-code::before { content: none; }

.teaser-body h2 {
  font-family: var(--font-read);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
}

.teaser-body p {
  margin: 0 0 10px;
  color: var(--ink-soft);
  max-width: 62ch;
}

.teaser-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-system);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.teaser-link:hover { text-decoration: underline; }


/* =========================================================
   COLOFÓN
========================================================= */

.colophon {
  grid-column: 2 / -1;
  padding: 40px 28px 120px;
  font-family: var(--font-system);
  font-size: 10px;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}


/* =========================================================
   REGISTRO DE OPERADOR
========================================================= */

.operator {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 50;
  font-family: var(--font-system);
}

.operator-trigger {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 6px 10px;
  cursor: pointer;
}

.operator-trigger:hover { color: var(--ink); }

.operator-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 220px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
}

.operator:hover .operator-panel,
.operator:focus-within .operator-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.operator-image {
  width: 100%;
  display: block;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  filter: grayscale(40%) contrast(110%);
}

.operator-name {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 6px;
  font-weight: 600;
}

.operator-desc {
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0;
}


/* =========================================================
   RESPONSIVE — TABLET
========================================================= */

@media (max-width: 980px) {

  :root { --rail-width: 180px; }

  .ficha,
  .archive--teaser .teaser {
    grid-template-columns: 120px 1fr;
    gap: 20px;
    padding: 24px 20px;
  }
}


/* =========================================================
   RESPONSIVE — MÓVIL
========================================================= */

@media (max-width: 700px) {

  .system {
    grid-template-columns: 1fr;
  }

  .system-header {
    padding: 16px 18px;
  }

  .rail {
    position: sticky;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 0;
    background: var(--paper-raised);
    z-index: 10;
  }

  .rail-toggle {
    display: block;
    font-family: var(--font-system);
  }

  .rail-toggle summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 18px;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-soft);
    display: flex;
    justify-content: space-between;
  }

  .rail-toggle summary::after {
    content: "+";
    color: var(--accent);
  }

  .rail-toggle[open] summary::after { content: "–"; }

  .rail-toggle summary::-webkit-details-marker { display: none; }

  .rail-toggle-content {
    padding: 4px 18px 20px;
  }

  .ficha,
  .archive--teaser .teaser {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 22px 18px;
  }

  .ficha-meta,
  .teaser-meta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .archive-divider { padding: 18px 18px 4px; }

  .colophon {
    grid-column: 1 / -1;
    flex-direction: column;
    padding: 28px 18px 100px;
  }
}