/* ═══════════════════════════════════════════════════════════════════════════
   ARCHIVE — the index. The bottle-green room: a sticky roman rail, masonry of plates.
═══════════════════════════════════════════════════════════════════════════ */

body.archive-body { background: var(--green); color: var(--paper); }

/* ── Head ────────────────────────────────────────────────────────────── */
.ax-head { padding: calc(var(--nav-h) + clamp(56px, 10vh, 120px)) var(--gutter) clamp(48px, 6vw, 96px); display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 32px; align-items: end; }
.ax-head .kicker { grid-column: 1 / -1; display: block; margin-bottom: clamp(20px, 2.4vw, 36px); color: var(--fg-muted); }
.ax-title { grid-column: 1 / span 8; font-size: var(--d1); }
.ax-aside { grid-column: 10 / span 3; display: grid; gap: 24px; }
.ax-lede { color: var(--fg-muted); }
.ax-meta { display: flex; gap: 22px; color: var(--fg-muted); }
.ax-meta b { font-family: var(--serif); font-weight: 400; font-size: 22px; color: var(--fg); margin-right: 8px; }
@media (max-width: 860px) {
  .ax-head { grid-template-columns: 1fr; }
  .ax-title, .ax-aside { grid-column: 1 / -1; }
  .ax-aside { margin-top: 28px; }
}

/* ── Body: rail + stream ─────────────────────────────────────────────── */
.ax-body { display: grid; grid-template-columns: 260px 1fr; column-gap: clamp(24px, 3vw, 56px); padding: 0 var(--gutter); border-top: 1px solid var(--line); }
.ax-rail { position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto; padding: calc(var(--nav-h) + 12px) 0 40px; scrollbar-width: none; }
.ax-rail::-webkit-scrollbar { display: none; }
.ax-rail .label { display: block; margin-bottom: 18px; color: var(--fg-muted); }
.ax-ix { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 7px 0; color: var(--fg-muted); transition: color var(--t-fast); }
.ax-ix .r { font-family: var(--serif); font-style: italic; font-size: 15px; }
.ax-ix .t { font-family: var(--serif); font-size: 19px; line-height: 1.1; }
.ax-ix .c { font-size: 10px; letter-spacing: .12em; }
.ax-ix:hover, .ax-ix.is-active { color: var(--fg); }
.ax-ix.is-active .t { font-style: italic; }
.ax-stream { min-width: 0; }

/* Chapter */
.ax-ch { padding: clamp(56px, 8vw, 120px) 0 clamp(24px, 3vw, 40px); border-bottom: 1px solid var(--line); scroll-margin-top: 24px; }
.ax-ch-head { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: baseline; margin-bottom: clamp(28px, 3.5vw, 56px); }
.ax-ch-roman { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.4vw, 34px); color: var(--paper-2); min-width: 56px; }
.ax-ch-title { font-family: var(--serif); font-size: clamp(36px, 5vw, 80px); line-height: 0.95; letter-spacing: -0.02em; }
.ax-ch-count { color: var(--fg-muted); white-space: nowrap; }
.ax-grid { columns: 4; column-gap: 18px; }
@media (max-width: 1400px) { .ax-grid { columns: 3; } }
@media (max-width: 720px)  { .ax-grid { columns: 2; column-gap: 12px; } }
.ax-tile { display: block; width: 100%; break-inside: avoid; margin: 0 0 18px; position: relative; text-align: left; background: rgba(201,194,176,.07); overflow: hidden; }
/* `aspect-ratio: auto 3 / 4` reserves a ~3:4 box before the lazy image loads
   (so the tinted .ax-tile shows as a skeleton and columns don't reflow), then
   yields to the image's real proportions once it arrives — kills the CLS that
   used to shove the scrollspy/rail as plates streamed in. */
.ax-tile img { width: 100%; height: auto; aspect-ratio: auto 3 / 4; display: block; opacity: 0; transition: opacity .45s var(--ease-out), transform 1.2s var(--ease-out); }
.ax-tile img.is-loaded { opacity: 1; }
.ax-tile:hover img { transform: scale(1.025); }
.ax-tile .n { position: absolute; left: 12px; top: 10px; color: var(--paper); mix-blend-mode: difference; font-size: 10px; letter-spacing: .14em; opacity: 0; transition: opacity var(--t-fast); }
.ax-tile:hover .n, .ax-tile:focus-visible .n { opacity: 1; }
.ax-tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px; color: var(--paper); background: var(--ink); font-family: var(--serif); font-size: 15px; line-height: 1.2; transform: translateY(100%); transition: transform var(--t-mid) var(--ease-out); }
.ax-tile:hover .cap, .ax-tile:focus-visible .cap { transform: translateY(0); }
.ax-ch-foot { display: flex; align-items: center; gap: 18px; margin-top: 12px; color: var(--fg-muted); }
.ax-ch-foot .rule { flex: 1; height: 1px; background: var(--line); }
.ax-more { display: flex; justify-content: center; padding: 24px 0; }
@media (max-width: 1024px) {
  .ax-body { grid-template-columns: 1fr; }
  .ax-rail { display: none; }
}

/* Floating index (all sizes; primary on mobile) */
.ax-fab {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 800;
  display: inline-flex; align-items: center; gap: 12px; padding: 14px 20px;
  background: var(--paper); color: var(--ink); white-space: nowrap;
}
.ax-fab .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
@media (min-width: 1025px) { .ax-fab { display: none; } }
.ax-index {
  position: fixed; inset: 0; z-index: 940; background: var(--ink); color: var(--paper);
  padding: calc(var(--nav-h) + 12px) var(--gutter) 40px; overflow: auto;
  clip-path: inset(100% 0 0 0); visibility: hidden;
  transition: clip-path var(--t-slow) var(--ease-io), visibility 0s linear var(--t-slow);
}
.ax-index.is-open { clip-path: inset(0); visibility: visible; transition: clip-path var(--t-slow) var(--ease-io), visibility 0s; }
.ax-index-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.ax-index .ax-ix { grid-template-columns: 44px 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--grey-2); }
.ax-index .ax-ix .t { font-size: clamp(24px, 5vw, 40px); }
.ax-index .ax-ix.is-active, .ax-index .ax-ix:hover { color: var(--paper); }

/* ── Coda ────────────────────────────────────────────────────────────── */
.ax-coda { padding: clamp(96px, 12vw, 180px) var(--gutter); text-align: center; display: grid; justify-items: center; gap: 20px; }
.ax-coda h2 { font-size: var(--d2); }
.ax-coda p { color: var(--fg-muted); max-width: 420px; }
.ax-coda-actions { display: flex; gap: 40px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

/* ── Lightbox ────────────────────────────────────────────────────────── */
.ax-lb { border: 0; padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; background: var(--ink); color: var(--paper); }
.ax-lb::backdrop { background: rgba(0, 0, 0,.96); }
.ax-lb figure { position: absolute; inset: 0; display: grid; place-items: center; padding: 72px var(--gutter) 84px; }
.ax-lb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ax-lb figcaption { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 28px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; color: var(--grey-2); }
.ax-lb figcaption > span:last-child { white-space: nowrap; }
.ax-lb figcaption .t { font-family: var(--serif); font-size: 18px; color: var(--paper); letter-spacing: 0; text-transform: none; }
.ax-lb-close { position: absolute; right: var(--gutter); top: 24px; z-index: 2; }
.ax-lb-close .x { position: relative; width: 22px; height: 22px; display: block; }
.ax-lb-close .x::before, .ax-lb-close .x::after { content: ''; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: currentColor; }
.ax-lb-close .x::before { transform: rotate(45deg); } .ax-lb-close .x::after { transform: rotate(-45deg); }
.ax-lb-nav { position: absolute; top: 0; bottom: 0; width: 22%; z-index: 1; cursor: pointer; color: transparent; }
.ax-lb-nav.prev { left: 0; cursor: w-resize; } .ax-lb-nav.next { right: 0; cursor: e-resize; }
.ax-lb-nav span { position: absolute; top: 50%; font-family: var(--serif); font-size: 32px; color: var(--paper); opacity: 0; transition: opacity var(--t-fast), transform var(--t-fast); transform: translateY(-50%); }
.ax-lb-nav.prev span { left: var(--gutter); } .ax-lb-nav.next span { right: var(--gutter); }
.ax-lb-nav:hover span { opacity: 1; }
