/* ============================================================
   SO/ARCHIVO · línea de tiempo 3D, cierre y responsive
   ============================================================ */

.archive {
  padding: clamp(5rem, 11vw, 9rem) var(--pad) 0;
  border-top: 3px solid var(--paper);
  scroll-margin-top: var(--topbar);
}
.archive-head,
.timeline,
.demo-banner { max-width: 1320px; margin-inline: auto; }

.archive-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  align-items: end;
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
  border-bottom: 3px solid var(--paper);
}

.archive-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3rem, 8.6vw, 8rem);
  line-height: .82;
  letter-spacing: -.055em;
  text-transform: uppercase;
}
.archive-title .outline {
  color: transparent;
  -webkit-text-stroke: clamp(1.5px, .16vw, 2.5px) var(--paper);
}
.archive-title .dot { color: var(--flare); }

.archive-meta {
  padding-left: clamp(1rem, 2vw, 1.6rem);
  border-left: 3px solid var(--acid);
}
#estado {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--paper);
}
#estado::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 4px;
  background: var(--paper);
  animation: blink 1.2s steps(2, jump-none) infinite;
}
#estado[data-state="ok"]::before { background: var(--acid); animation: none; }
#estado[data-state="demo"]::before { background: var(--flare); animation: none; }
#estado[data-state="error"] { color: var(--flare); }
#estado[data-state="error"]::before { background: var(--flare); animation: none; }
.archive-hint {
  margin-top: .8rem;
  font-size: 8px;
  letter-spacing: .18em;
  color: var(--muted);
}
.archive-count {
  margin-top: 1.1rem;
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: -.02em;
  color: var(--acid);
  text-transform: uppercase;
}

.demo-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .8rem 1.2rem;
  margin-top: 1.5rem;
  padding: .9rem 1.1rem;
  background: var(--flare);
  color: var(--ink);
  border: 3px solid var(--ink);
  font-size: 9px;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
}
.demo-banner[hidden] { display: none; }
.demo-banner strong {
  padding: .25rem .45rem;
  background: var(--ink);
  color: var(--flare);
  letter-spacing: .16em;
}

/* ---------- pila de fichas ---------- */

.timeline {
  position: relative;
  margin-top: clamp(3rem, 8vh, 5rem);
  padding-bottom: 10vh;
}

.entry {
  position: sticky;
  top: calc(var(--topbar) + 2.5rem + var(--i, 0) * 10px);
  margin-bottom: clamp(3.5rem, 11vh, 7rem);
  perspective: 1500px;
  scroll-margin-top: calc(var(--topbar) + 1rem);
}

.entry-card {
  position: relative;
  padding: clamp(1.2rem, 2.6vw, 2.2rem);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 31px,
    rgba(11, 11, 10, .045) 31px 32px
  );
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow:
    12px 12px 0 var(--accent, var(--acid)),
    24px 24px 0 rgba(242, 238, 227, .12);
  transform-style: preserve-3d;
  transition:
    transform 1s cubic-bezier(.16, 1, .3, 1),
    opacity .6s ease,
    box-shadow .25s ease;
}
.entry-card::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 0;
  width: clamp(52px, 8vw, 92px);
  height: 9px;
  background: var(--accent, var(--acid));
  z-index: 2;
}
.entry-card::after {
  content: attr(data-index);
  position: absolute;
  right: 1.4rem;
  bottom: 2.2rem;
  z-index: 0;
  font-family: var(--display);
  font-size: clamp(6rem, 13vw, 11rem);
  line-height: .65;
  color: rgba(11, 11, 10, .05);
  pointer-events: none;
}
.entry-card > * { position: relative; z-index: 1; }

.js .entry-card {
  opacity: 0;
  transform:
    perspective(1500px)
    rotateX(16deg)
    translate3d(0, 80px, -60px)
    rotateZ(var(--tilt, 0deg));
}
.js .entry.is-in .entry-card {
  opacity: 1;
  transform:
    perspective(1500px)
    rotateX(0deg)
    translate3d(0, 0, 0)
    rotateZ(var(--tilt, 0deg));
}
.js .entry.is-in .entry-card:hover,
.js .entry.is-in .entry-card:focus-within {
  transform:
    perspective(1500px)
    rotateX(0deg)
    translate3d(-5px, -5px, 0)
    rotateZ(0deg);
  box-shadow:
    18px 18px 0 var(--accent, var(--acid)),
    30px 30px 0 rgba(242, 238, 227, .14);
}

/* cada dato entra escalonado cuando la ficha queda a la vista */
.js .entry-card .entry-year,
.js .entry-card .entry-name,
.js .entry-card .entry-note,
.js .entry-card .entry-stamp,
.js .entry-card .entry-tags,
.js .entry-card .entry-bottom {
  opacity: 0;
  translate: 0 16px;
  transition:
    opacity .55s ease,
    translate .7s cubic-bezier(.16, 1, .3, 1);
}
.js .entry.is-in .entry-card .entry-year { opacity: 1; translate: 0 0; transition-delay: .1s; }
.js .entry.is-in .entry-card .entry-name { opacity: 1; translate: 0 0; transition-delay: .18s; }
.js .entry.is-in .entry-card .entry-note { opacity: 1; translate: 0 0; transition-delay: .26s; }
.js .entry.is-in .entry-card .entry-stamp { opacity: 1; translate: 0 0; transition-delay: .34s; }
.js .entry.is-in .entry-card .entry-tags { opacity: 1; translate: 0 0; transition-delay: .42s; }
.js .entry.is-in .entry-card .entry-bottom { opacity: 1; translate: 0 0; transition-delay: .5s; }

.entry-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem 1.2rem;
  padding-bottom: .8rem;
  border-bottom: 2px solid var(--ink);
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.entry-num {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: -.01em;
  line-height: 1;
}
.entry-num span { font-family: var(--mono); font-size: 9px; font-weight: 700; opacity: .5; }
.entry-decade { color: rgba(11, 11, 10, .55); font-weight: 700; }
.entry-flag {
  margin-left: auto;
  padding: .3rem .5rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .14em;
}

.entry-main {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding-block: clamp(1.2rem, 3vw, 2rem);
}

.entry-year {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.8rem, 9.5vw, 8.2rem);
  line-height: .76;
  letter-spacing: -.065em;
  color: transparent;
  -webkit-text-stroke: clamp(1.5px, .22vw, 3px) var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translate3d(0, var(--year-y, 0px), 0);
  will-change: transform;
}
.entry-year-label {
  display: block;
  margin-top: .9rem;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .2em;
  color: rgba(11, 11, 10, .5);
}

.entry-name {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5.4vw, 4.6rem);
  line-height: .88;
  letter-spacing: -.04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.entry-note {
  max-width: 48ch;
  margin-top: 1rem;
  padding-left: .9rem;
  border-left: 4px solid var(--accent, var(--acid));
  font-size: clamp(.78rem, .9vw, .88rem);
  line-height: 1.7;
}
.entry-stamp {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  max-width: 100%;
  margin-top: 1.2rem;
  padding: .55rem .75rem;
  background: var(--accent, var(--acid));
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(-1.4deg);
}
.stamp-label {
  padding-right: .7rem;
  border-right: 2px solid var(--ink);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .18em;
}
.stamp-value {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}
.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: 1.1rem;
  padding: 0;
  list-style: none;
}
.tag {
  padding: .35rem .5rem;
  border: 2px solid var(--ink);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.tag--fill { background: var(--ink); color: var(--paper); }

.entry-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem 1.2rem;
  margin-top: .4rem;
  padding-top: .85rem;
  border-top: 2px solid var(--ink);
}
.barcode {
  width: 110px;
  height: 20px;
  flex: 0 0 auto;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 2px,
    transparent 2px 4px,
    var(--ink) 4px 7px,
    transparent 7px 9px,
    var(--ink) 9px 10px,
    transparent 10px 15px
  );
}
.entry-src {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .16em;
  color: rgba(11, 11, 10, .55);
}
.entry-code {
  margin-left: auto;
  padding: .3rem .45rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .14em;
}
.entry-side {
  position: absolute;
  top: 50%;
  right: .45rem;
  writing-mode: vertical-rl;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .3em;
  color: rgba(11, 11, 10, .35);
  pointer-events: none;
}

/* ---------- estados de carga y error ---------- */

.skeleton {
  position: relative;
  height: clamp(280px, 38vh, 380px);
  margin-bottom: clamp(2rem, 5vh, 3rem);
  border: 3px solid var(--line-strong);
  background:
    repeating-linear-gradient(
      -45deg,
      transparent 0 14px,
      rgba(242, 238, 227, .045) 14px 28px
    );
  background-size: 200% 200%;
  animation: skeleton-shift 1.6s linear infinite;
}
.skeleton::after {
  content: "LEYENDO REGISTROS…";
  position: absolute;
  left: 1.2rem;
  bottom: 1rem;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--muted);
}
.skeleton:nth-child(2) { opacity: .6; }
.skeleton:nth-child(3) { opacity: .3; }

.error-panel {
  padding: clamp(1.4rem, 3vw, 2.4rem);
  border: 3px solid var(--flare);
  background: var(--ink-2);
  box-shadow: 12px 12px 0 rgba(255, 61, 31, .22);
}
.error-code {
  display: inline-block;
  padding: .35rem .55rem;
  background: var(--flare);
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
}
.error-title {
  margin-top: 1.2rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: .9;
  letter-spacing: -.03em;
  text-transform: uppercase;
}
.error-msg {
  max-width: 70ch;
  margin-top: 1rem;
  font-size: .86rem;
  line-height: 1.7;
  color: var(--paper-2);
  overflow-wrap: anywhere;
}
.error-list {
  margin: 1.2rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.8;
}
.error-list strong { color: var(--paper); }
.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.8rem;
}
.error-actions .btn--ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--paper);
  box-shadow: 6px 6px 0 var(--flare);
}
.error-actions .btn--ghost:hover { box-shadow: 2px 2px 0 var(--flare); }
.nojs {
  padding: 1.2rem;
  border: 3px solid var(--flare);
  color: var(--paper);
  font-size: .9rem;
}

@keyframes skeleton-shift {
  from { background-position: 0 0; }
  to { background-position: 120px 120px; }
}

/* ---------- cierre ---------- */

.outro {
  position: relative;
  overflow: hidden;
  padding: clamp(5rem, 13vw, 11rem) var(--pad);
  background: var(--acid);
  color: var(--ink);
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
}
.outro-inner { position: relative; z-index: 1; max-width: 1320px; margin-inline: auto; }
.outro-title {
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.2rem, 12vw, 11rem);
  line-height: .8;
  letter-spacing: -.06em;
  text-transform: uppercase;
}
.outline-ink {
  color: transparent;
  -webkit-text-stroke: clamp(2px, .25vw, 3.5px) var(--ink);
}
.outro-lead {
  max-width: 56ch;
  margin-top: clamp(1.6rem, 4vw, 2.5rem);
  font-size: clamp(.86rem, 1vw, .98rem);
  line-height: 1.75;
}
.outro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: clamp(1.8rem, 4vw, 2.8rem);
}
.outro-mark {
  position: absolute;
  top: -6%;
  right: -2%;
  font-family: var(--display);
  font-size: clamp(16rem, 34vw, 34rem);
  line-height: .7;
  color: transparent;
  -webkit-text-stroke: 2px rgba(11, 11, 10, .16);
  transform-origin: center;
  animation: outro-spin 44s linear infinite;
  pointer-events: none;
}

@keyframes outro-spin { to { transform: rotate(360deg); } }

/* ---------- pie ---------- */

.footer {
  padding: clamp(2.5rem, 6vw, 4rem) var(--pad) 1.5rem;
  background: var(--ink);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr .6fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  max-width: 1320px;
  margin-inline: auto;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.footer-mark {
  display: inline-block;
  margin-bottom: .6rem;
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: -.02em;
}
.footer-grid p {
  font-size: 9px;
  letter-spacing: .08em;
  line-height: 1.8;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.footer-label {
  display: block;
  margin-bottom: .7rem;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--acid);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  max-width: 1320px;
  margin: 1.2rem auto 0;
  font-size: 8px;
  letter-spacing: .18em;
  color: var(--muted);
}
.footer-bottom a { color: var(--paper); text-decoration: none; }
.footer-bottom a:hover { color: var(--acid); }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .hero-main { grid-template-columns: minmax(0, 1.4fr) minmax(200px, .6fr); }
  .entry-side { display: none; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
  .footer-grid > :last-child { display: none; }
}

@media (max-width: 900px) {
  .hero-main {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 3rem;
    padding-block: 3rem;
  }
  .hero-title { font-size: clamp(2.6rem, 12.5vw, 6.5rem); }
  .hero-stage {
    justify-self: center;
    width: 100%;
    padding-top: 2rem;
    gap: 2rem;
  }
  .stage-frame { left: 25%; right: 25%; }
  .hero-foot { grid-template-columns: 1fr auto; }
  .hero-foot .scroll-cue { display: none; }
  .manifesto-inner { grid-template-columns: 1fr; }
  .layer-stack { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 3px solid var(--paper); }
  .archive-title-row { grid-template-columns: 1fr; align-items: start; }
  .archive-meta { max-width: 520px; }
  .entry-main { grid-template-columns: 1fr; gap: 1.2rem; }
  .entry-year { font-size: clamp(3.4rem, 14vw, 6rem); }
  .entry-year-label { margin-top: .5rem; }
}

@media (max-width: 860px) {
  .entry {
    position: relative;
    top: auto;
    margin-bottom: clamp(2.5rem, 7vh, 4rem);
  }
  .js .entry-card,
  .js .entry.is-in .entry-card {
    transform:
      perspective(1200px)
      rotateX(0deg)
      translate3d(0, 0, 0)
      rotateZ(var(--tilt, 0deg));
  }
  .js .entry-card { opacity: 0; transform: translate3d(0, 50px, 0); }
  .js .entry.is-in .entry-card { opacity: 1; transform: rotateZ(var(--tilt, 0deg)); }
  .js .entry.is-in .entry-card:hover { transform: rotateZ(0deg); }
}

@media (max-height: 680px) and (min-width: 861px) {
  .entry { position: relative; top: auto; }
}

@media (max-width: 600px) {
  :root { --topbar: 56px; --cube: 168px; --cube-half: 84px; }
  .topbar-meta { gap: .8rem; }
  .clock { display: none; }
  .status { font-size: 8px; }
  .hero-title { font-size: clamp(2.4rem, 12vw, 4.4rem); }
  .hero-lead { font-size: .82rem; }
  .hero-actions { gap: 1rem; }
  .hero-api { width: 100%; justify-content: space-between; }
  .stage-frame { display: none; }
  .hero-foot { font-size: 8px; letter-spacing: .1em; }
  .manifesto, .stats { padding-block: 4rem; }
  .statement { font-size: clamp(1.55rem, 7vw, 2.4rem); }
  .stats-grid { grid-template-columns: 1fr; }
  .stat { min-height: 0; border-right: 0; border-bottom: 3px solid var(--paper); }
  .stat:last-child { border-bottom: 0; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 3px solid var(--paper); }
  .entry-card { box-shadow: 8px 8px 0 var(--accent, var(--acid)); }
  .entry-card::after { display: none; }
  .entry-flag { margin-left: 0; }
  .entry-bottom { gap: .6rem .8rem; }
  .barcode { width: 80px; }
  .entry-code { margin-left: 0; }
  .outro-mark { opacity: .5; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .footer-grid > :last-child { display: block; }
}

/* ---------- accesibilidad de movimiento ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }
  .js .reveal,
  .js .entry-card,
  .js .entry.is-in .entry-card,
  .statement .word {
    opacity: 1 !important;
    transform: none !important;
  }
  .js .entry-card .entry-year,
  .js .entry-card .entry-name,
  .js .entry-card .entry-note,
  .js .entry-card .entry-stamp,
  .js .entry-card .entry-tags,
  .js .entry-card .entry-bottom {
    opacity: 1 !important;
    translate: none !important;
  }
  .entry { position: relative; top: auto; }
  .entry-year { transform: none !important; }
  .ticker-track { animation: none; }
  .cube, .cube-scene, .layer-stack-inner, .outro-mark { animation: none; }
}
