/* DIGITAL ARCHIVE (/archive/ y /archive/fruit-stickers/) · negro liso con texto crema, como el álbum de Pokémon de The room.
   Referencia: nicolo-lombardi.com/archive/la-barra. El índice lista las colecciones; cada colección es un muro infinito de piezas
   (js/archive-wall.js, que usa el mismo motor que el álbum: js/room/infinite-card-grid.js). Sin textos de ayuda: las piezas no llevan pie.
   Orden: base · barra · índice · muro · estados · movimiento. */
:root { --bg: #0c0c0b; --ink: var(--cream); --hair: rgba(244, 239, 230, .18); --gutter: clamp(16px, 1.2vw, 24px); }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body { min-height: 100vh; min-height: 100svh; color: var(--ink); background: var(--bg); font-family: var(--font-ui); font-size: var(--fs-read); font-weight: var(--fw-regular); line-height: var(--lh-body); overflow-x: clip; }
a { color: inherit; text-underline-offset: 4px; }
img { display: block; max-width: 100%; height: auto; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.archive-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Barra: la misma que en el resto de la web (logo y enlaces), sin fondo y mezclada con «difference» (css/nav-links.css) ---------- */
.nav { position: fixed; inset: 0 0 auto; z-index: 9; height: var(--nav-h); display: flex; align-items: center; padding: 0 var(--bar-gutter); }
.nav-logo { flex: none; display: block; width: 44px; height: 47px; transition: transform .3s var(--ease-out); }
.nav-logo:hover { transform: rotate(-8deg) scale(1.06); }

/* ---------- Índice: el título y, debajo, una fila por colección ---------- */
.archive-index { padding: calc(var(--nav-h) + clamp(32px, 6vw, 96px)) var(--gutter) clamp(48px, 8vw, 120px); }
.archive-heading { max-width: 11ch; font-family: var(--font-display); font-size: var(--fs-h1); font-weight: var(--fw-title); letter-spacing: -.055em; line-height: .95; }
.archive-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px 48px; }
.archive-sub { flex: none; max-width: 34ch; margin: 0; font-size: var(--fs-l); line-height: 1.3; text-wrap: balance; }
.archive-head { align-items: last baseline; }   /* la última línea del subtítulo sobre la misma línea de base que el título */
.archive-sub a { color: inherit; text-underline-offset: 4px; }
.archive-list { margin-top: clamp(48px, 9vw, 140px); list-style: none; border-bottom: 1px solid var(--hair); }
.archive-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: clamp(20px, 2.4vw, 36px) 0; color: inherit; text-decoration: none; border-top: 1px solid var(--hair); }
.archive-name { font-family: var(--font-display); font-size: clamp(32px, 4.4vw, 72px); font-weight: var(--fw-title); letter-spacing: -.04em; line-height: 1; }
.archive-name sup { margin-left: .12em; font-family: var(--font-ui); font-size: .3em; font-weight: var(--fw-regular); letter-spacing: 0; vertical-align: top; position: relative; top: .1em; }

/* ---------- Muro: ocupa toda la pantalla; las piezas pasan por debajo de la barra ---------- */
.archive-wall { height: 100vh; height: 100svh; overflow: hidden; overscroll-behavior: none; }
.archive-surface { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.archive-surface.is-dragging { cursor: grabbing; }
.archive-cards { position: absolute; inset: 0; list-style: none; }
.archive-item { position: absolute; left: 0; top: 0; width: var(--card-width); will-change: transform; }
.archive-card { display: block; margin: 0; perspective: 800px; outline: none; -webkit-tap-highlight-color: transparent; }
.archive-turn { display: block; aspect-ratio: 1; }
.archive-turn img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.archive-card:focus-visible .archive-turn { outline: 2px solid var(--ink); outline-offset: 6px; border-radius: 50%; }

/* ---------- Estados ---------- */
.archive-status { position: absolute; z-index: 2; left: var(--bar-gutter); top: calc(var(--nav-h) + 40px); font-size: var(--fs-read); }
.archive-retry { position: absolute; z-index: 2; top: calc(var(--nav-h) + 88px); left: var(--bar-gutter); min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.archive-status[hidden], .archive-retry[hidden] { display: none; }

/* ---------- Movimiento: al abrir, las piezas suben a su sitio del centro hacia fuera ---------- */
.archive-card { opacity: 0; translate: 0 28px; transition: opacity .6s var(--ease-out), translate .8s var(--ease-out); }
.archive-card.is-in { opacity: 1; translate: 0 0; }
@media (prefers-reduced-motion: reduce) {
  .archive-card { translate: none; transition: opacity .3s ease; }
}

/* ---------- Visor de una pieza (referencia: la pieza abierta en nicolo-lombardi.com/archive/la-barra) ----------
   Pantalla negra: título enorme arriba, la pieza al centro y sus datos abajo. La pieza se inclina hacia el ratón por toda la pantalla
   (no solo encima de ella) y un brillo la sigue; con el dedo, al arrastrar. La entrada: el título sube desde su máscara, la pieza llega con un destello
   que se apaga y los datos aparecen uno a uno. */
.archive-viewer { position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; justify-items: center; padding: clamp(40px, 6vh, 72px) var(--gutter) 0; background: var(--bg); color: var(--ink); perspective: 1100px; opacity: 0; visibility: hidden; transition: opacity .5s var(--ease-out), visibility 0s linear .5s; touch-action: none; }
.archive-viewer[hidden] { display: none; }
.archive-viewer:focus { outline: none; }
.archive-viewer.is-open { opacity: 1; visibility: visible; transition: opacity .5s var(--ease-out), visibility 0s; }
.archive-viewer-close { position: absolute; top: 0; right: var(--bar-gutter); z-index: 2; min-height: var(--nav-h); padding: 0 4px; border: 0; background: none; color: inherit; font: inherit; font-size: var(--fs-s); cursor: pointer; }
.archive-viewer-close:hover { text-decoration: underline; text-underline-offset: 6px; }
.archive-viewer-name { max-width: 100%; text-align: center; font-family: var(--font-display); font-size: clamp(44px, 9.5vw, 137px); font-weight: var(--fw-title); letter-spacing: -.045em; line-height: 1; text-wrap: balance; }
.archive-viewer-name .mask { display: inline-block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; vertical-align: top; }
.archive-viewer-name .mask > span { display: inline-block; translate: 0 112%; transition: translate .8s var(--ease-out) calc(.15s + var(--i, 0) * 80ms); }
.archive-viewer.is-open .archive-viewer-name .mask > span { translate: 0 0; }

.archive-stage { display: grid; place-items: center; width: 100%; min-height: 0; transform-style: preserve-3d; }
.archive-piece { position: relative; --h: min(46vh, 60vw); height: var(--h); width: calc(var(--h) * var(--ratio, 1)); max-width: 88vw; aspect-ratio: var(--ratio, 1); transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); will-change: transform; filter: brightness(2.4) saturate(.4); opacity: 0; scale: .94; transition: filter 1.1s var(--ease-out) .25s, opacity .6s ease .2s, scale .9s var(--ease-out) .2s; }
.archive-viewer.is-open .archive-piece { filter: none; opacity: 1; scale: 1; }
.archive-piece img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.archive-gloss { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 255, 255, .6), transparent 55%); mix-blend-mode: soft-light; opacity: var(--gloss, 0); -webkit-mask: var(--piece) center / contain no-repeat; mask: var(--piece) center / contain no-repeat; }

.archive-facts { align-self: end; width: calc(100% + 2 * var(--gutter)); margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) max(12px, env(safe-area-inset-bottom)); }
.archive-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--ink); opacity: 0; translate: 0 10px; transition: opacity .6s ease calc(.45s + var(--i, 0) * 70ms), translate .6s var(--ease-out) calc(.45s + var(--i, 0) * 70ms); }
.archive-viewer.is-open .archive-facts > div { opacity: 1; translate: 0 0; }
.archive-facts dt { font-size: var(--fs-s); letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.archive-facts dd { font-size: clamp(18px, 1.6vw, 24px); }
body.archive-viewing { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .archive-viewer, .archive-viewer.is-open { transition: opacity .2s ease, visibility 0s; }
  .archive-viewer-name .mask > span, .archive-piece, .archive-facts > div { transition: none; translate: none; scale: 1; filter: none; opacity: 1; }
  .archive-gloss { display: none; }
}

@media (max-width: 900px) { .archive-head { flex-direction: column; align-items: flex-start; } .archive-sub { max-width: 36ch; } }
@media (max-width: 700px) { .archive-sub { font-size: var(--fs-s); } }   /* en el móvil, más pequeño */
