/* ═══════════════════════════════════════════════════════════════════════════
   THE ARCHIVE, A FILM — one horizontal strip on a fixed stage. The page's
   own vertical scroll (wheel, trackpad, touch, keys) moves it sideways, so a
   single gesture carries you through every chapter. Each chapter is a room
   of the palette; the stage's colour dissolves between rooms as you travel.
═══════════════════════════════════════════════════════════════════════════ */
.film-body { background: #000; color: var(--paper); }
.film-body .nav { color: var(--paper); }

.film {
  --fm-top: calc(var(--nav-h) + clamp(18px, 3vh, 40px));
  --fm-bot: clamp(86px, 12vh, 118px);
  position: fixed; inset: 0; overflow: hidden; z-index: 1;
  background: var(--film-bg, #000); color: var(--paper);
  --fg: var(--paper); --fg-muted: var(--grey-2); --line: rgba(201,194,176,.18); --line-strong: rgba(201,194,176,.55);
}
.film-track { position: absolute; top: 0; left: 0; height: 100%; display: flex; align-items: stretch; will-change: transform; }
.film-spacer { width: 1px; pointer-events: none; }

/* ── Opening card ───────────────────────────────────────────────────── */
.fm-intro { flex: none; width: 100vw; height: 100%; padding: var(--fm-top) var(--gutter) var(--fm-bot); display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 32px; align-content: end; }
.fm-intro .kicker { grid-column: 1 / -1; color: var(--grey-2); margin-bottom: clamp(20px, 3vh, 36px); }
.fm-intro-title { grid-column: 1 / span 9; font-family: var(--serif); font-weight: 400; font-size: clamp(54px, 9.4vw, 156px); line-height: .9; letter-spacing: -0.02em; }
.fm-intro-title em { font-style: italic; color: var(--paper-2); }
.fm-intro-lede { grid-column: 9 / span 4; align-self: end; max-width: 380px; color: var(--grey-2); margin-top: 28px; }
.fm-intro-hint { grid-column: 1 / -1; margin-top: clamp(32px, 6vh, 64px); display: inline-flex; align-items: center; gap: 12px; }
.fm-intro-hint .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--paper); animation: fmpulse 2.4s var(--ease-io) infinite; }
@keyframes fmpulse { 0%, 100% { opacity: .25; transform: scale(.7) } 50% { opacity: 1; transform: scale(1) } }
@media (max-width: 860px) {
  .fm-intro { grid-template-columns: 1fr; }
  .fm-intro-title, .fm-intro-lede { grid-column: 1 / -1; }
}

/* ── A chapter: its card, then its plates ───────────────────────────── */
.fm-ch { flex: none; display: flex; height: 100%; padding-right: clamp(80px, 12vw, 220px); }
.fm-card { flex: none; width: clamp(300px, 40vw, 640px); height: 100%; padding: var(--fm-top) clamp(28px, 4vw, 72px) var(--fm-bot) clamp(28px, 5vw, 88px); border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; }
.fm-roman { font-family: var(--serif); font-style: italic; font-size: clamp(90px, 15vw, 260px); line-height: .8; letter-spacing: -0.03em; color: var(--paper-2); opacity: .88; }
.fm-card-foot { display: grid; gap: clamp(16px, 2.4vh, 26px); }
.fm-title { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5.2vw, 88px); line-height: .92; letter-spacing: -0.015em; text-wrap: balance; }
.fm-meta { display: flex; gap: 22px; color: var(--grey-2); }
.fm-card .rule-link { justify-self: start; }

.fm-pl { flex: none; height: 100%; padding: var(--fm-top) 0 var(--fm-bot); margin-left: clamp(28px, 3.4vw, 64px); display: flex; flex-direction: column; }
.fm-pl[data-v="top"] { justify-content: flex-start; }
.fm-pl[data-v="mid"] { justify-content: center; }
.fm-pl[data-v="bot"] { justify-content: flex-end; }
.fm-frame { position: relative; display: block; overflow: hidden; background: rgba(201,194,176,.05); padding: 0; border: 0; cursor: zoom-in; }
.fm-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.08); opacity: 0; transition: opacity 1.1s var(--ease-out); will-change: transform; }
.fm-frame img.is-loaded { opacity: 1; }
.fm-frame::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(201,194,176,0); transition: box-shadow .5s var(--ease-out); pointer-events: none; }
.fm-frame:hover::after, .fm-frame:focus-visible::after { box-shadow: inset 0 0 0 1px rgba(201,194,176,.6); }
.fm-frame:focus-visible { outline: 1px solid var(--paper); outline-offset: 6px; }
.fm-cap { display: flex; gap: 14px; margin-top: 14px; color: var(--grey-2); overflow: hidden; }
.fm-cap .n { color: var(--paper); flex: none; }
.fm-cap .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: .02em; font-weight: 400; font-size: 12px; }
.fm-pl[data-v="bot"] .fm-cap { order: -1; margin: 0 0 14px; }

.fm-more { flex: none; height: 100%; padding: var(--fm-top) 0 var(--fm-bot); margin-left: clamp(40px, 5vw, 96px); display: flex; flex-direction: column; justify-content: center; gap: 18px; width: clamp(200px, 18vw, 300px); }
.fm-more .n { font-family: var(--serif); font-style: italic; font-size: clamp(44px, 5vw, 80px); line-height: .9; color: var(--paper-2); }
.fm-more p { color: var(--grey-2); font-size: 14px; line-height: 1.5; }

/* ── Closing card ───────────────────────────────────────────────────── */
.fm-end { flex: none; width: 100vw; height: 100%; padding: var(--fm-top) var(--gutter) var(--fm-bot); display: grid; place-items: center; text-align: center; border-left: 1px solid var(--line); }
.fm-end-inner { display: grid; justify-items: center; gap: 26px; }
.fm-end .fin { font-family: var(--serif); font-style: italic; font-size: clamp(64px, 10vw, 170px); line-height: .85; letter-spacing: -0.02em; }
.fm-end .sig { display: block; width: min(52vw, 300px); opacity: .7; }
.fm-end-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 40px; }
.fm-end-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; color: var(--grey-2); }
.fm-end-legal a:hover { color: var(--paper); }

/* ── HUD: where you are in the reel ─────────────────────────────────── */
.fm-hud { --line: rgba(201,194,176,.2); --line-strong: rgba(201,194,176,.55); --fg-muted: var(--grey-2);
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 64px; padding: 0 var(--gutter); display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2.2fr) minmax(80px, 1fr); align-items: center; gap: 28px; color: var(--paper); pointer-events: none; }
.fm-hud > * { pointer-events: auto; }
.fm-hud-now { display: flex; gap: 14px; min-width: 0; }
.fm-hud-now .r { color: var(--paper-2); flex: none; min-width: 2.4em; }
.fm-hud-now .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-reel { position: relative; height: 24px; display: flex; align-items: center; }
.fm-reel::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.fm-reel-bar { position: absolute; left: 0; top: 50%; height: 1px; width: 100%; background: var(--paper); transform-origin: left; transform: scaleX(0); }
.fm-tick { position: absolute; top: 0; width: 22px; height: 24px; margin-left: -11px; display: grid; place-items: center; padding: 0; }
.fm-tick::after { content: ''; width: 1px; height: 9px; background: var(--line-strong); transition: height .4s var(--ease-out), background .4s; }
.fm-tick.is-on::after, .fm-tick:hover::after { height: 17px; background: var(--paper); }
.fm-tick .tip { position: absolute; bottom: 30px; left: 50%; transform: translate(-50%, 6px); white-space: nowrap; opacity: 0; transition: opacity .3s, transform .3s var(--ease-out); pointer-events: none; font-size: 10px; }
.fm-tick:hover .tip, .fm-tick:focus-visible .tip { opacity: 1; transform: translate(-50%, 0); }
.fm-hud-index { justify-self: end; }
@media (max-width: 760px) {
  .fm-hud { grid-template-columns: 1fr auto; row-gap: 0; height: 74px; align-content: center; }
  .fm-reel { grid-column: 1 / -1; grid-row: 2; height: 16px; }
  .fm-tick .tip { display: none; }
  .fm-tick::after { height: 6px; }
  .fm-tick.is-on::after { height: 12px; }
}

/* ── Plate viewer ───────────────────────────────────────────────────── */
.fm-view { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.97); color: var(--paper); display: grid; place-items: center; opacity: 0; visibility: hidden; transition: opacity .5s var(--ease-out), visibility 0s linear .5s; }
.fm-view.is-open { opacity: 1; visibility: visible; transition: opacity .5s var(--ease-out); }
.fm-view-fig { display: grid; justify-items: center; gap: 18px; max-width: 88vw; }
.fm-view-fig img { max-width: 88vw; max-height: 78svh; object-fit: contain; }
.fm-view-fig figcaption { display: flex; gap: 22px; color: var(--grey-2); }
.fm-view-close { position: absolute; top: 20px; right: var(--gutter); color: var(--paper); }
.fm-view-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 64px; height: 64px; font-family: var(--serif); font-size: 32px; color: var(--paper); opacity: .7; transition: opacity .3s; }
.fm-view-nav:hover { opacity: 1; }
.fm-view-nav.prev { left: max(8px, calc(var(--gutter) - 20px)); } .fm-view-nav.next { right: max(8px, calc(var(--gutter) - 20px)); }
@media (max-width: 760px) { .fm-view-nav { top: auto; bottom: 18px; transform: none; } }

/* ── Arrival from the desk: the drawing, then it settles into the reel ─ */
.fm-arrive { position: fixed; inset: 0; z-index: 1300; background: #000; display: grid; place-items: center; padding: 6vh 6vw; pointer-events: none; }
.fm-arrive img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); transform-origin: 0 0; }

/* ── Reduced motion: no parallax, instant fades ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .fm-frame img { transform: none; transition: none; opacity: 1; }
  .fm-intro-hint .dot { animation: none; }
  .fm-view { transition: none; }
}

/* the information notice sits above the reel here */
.film-body .notice { bottom: 84px; }
@media (max-width: 760px) { .film-body .notice { bottom: 90px; } }
