/* STILLS — animated stills for era opens / month turns. <img> + CSS transform only (no video). Pair with stills.js.
   Everything is transform/opacity animation. prefers-reduced-motion: the still shows, the move is off.
   The host element must be positioned (stills.js sets position:relative if it is static). */
.stills { position: absolute; inset: 0; overflow: hidden; background: #0b0a09; contain: strict; pointer-events: none; }
.stills-plate { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity .6s ease; }
.stills-plate.in { opacity: 1; } .stills-plate.out { opacity: 0; }
.stills-plate img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--fx, 50%) var(--fy, 50%); display: block; user-select: none; -webkit-user-drag: none;
  transform-origin: var(--fx, 50%) var(--fy, 50%); transform: translate3d(var(--x0, 0), var(--y0, 0), 0) scale(var(--s0, 1.2)); will-change: transform; }
.stills-plate.in img { animation: stills-kb var(--dur, 12s) var(--ease, ease) both; }
@keyframes stills-kb { to { transform: translate3d(var(--x1, 0), var(--y1, 0), 0) scale(var(--s1, 1.2)); } }

/* ── period plates (archival): grain + bow-vignette as pseudo-elements, no filter stack — one light sepia/contrast filter only.
   Four print chemistries, set per era (or per scene with a tone override): archive (1922–36) · heavy (1953: dark, grainy, deep vignette) · thaw (1964: near-B&W, crisp, little grain) · late (1984: neutral grey, archive-toned already). ── */
.stills-plate[data-tone="archive"] { --filt: sepia(.28) contrast(1.06) brightness(.97); --grain: .3; --vig: .38; --vig2: .7; }
.stills-plate[data-tone="heavy"]   { --filt: sepia(.55) contrast(1.12) brightness(.9);  --grain: .5; --vig: .5;  --vig2: .85; --sc: .55; --du: .8; --fl: .085; --wv: 1.4px; }
.stills-plate[data-tone="thaw"]    { --filt: sepia(.07) contrast(1.08) brightness(1.02); --grain: .15; --vig: .2; --vig2: .42; --sc: .3; --du: .5; --fl: .04; --wv: .7px; }
.stills-plate[data-tone="late"]    { --filt: sepia(.1) contrast(1.05) brightness(.98);   --grain: .22; --vig: .28; --vig2: .55; }
.stills-plate:is([data-tone="archive"], [data-tone="heavy"], [data-tone="thaw"], [data-tone="late"]) img { filter: var(--filt); }
.stills-plate:is([data-tone="archive"], [data-tone="heavy"], [data-tone="thaw"], [data-tone="late"])::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse 120% 100% at 50% 48%, transparent 48%, rgba(14,10,6,var(--vig)) 82%, rgba(8,5,3,var(--vig2)) 100%); }
.stills-plate:is([data-tone="archive"], [data-tone="heavy"], [data-tone="thaw"], [data-tone="late"])::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: var(--grain); mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.4 -.2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 180px 180px; }
/* ── FILM STOCK (1953 heavy / 1964 thaw): live projector artefacts, stills.js adds <div.stills-film> to those plates. Transform/opacity only, all stepped (film runs in frames). ── */
.stills-plate:is([data-tone="heavy"], [data-tone="thaw"])::after { inset: -24px; animation: stills-grain .42s steps(1) infinite; }
@keyframes stills-grain { 0% { transform: translate(0,0); } 20% { transform: translate(-13px,9px); } 40% { transform: translate(8px,-17px); } 60% { transform: translate(-21px,-6px); } 80% { transform: translate(15px,14px); } }
.stills-film { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.stills-film i { position: absolute; display: block; }
.stills-film .fl { inset: 0; background: #0b0805; opacity: 0; animation: stills-flicker 1.9s steps(1) infinite; }   /* projector brightness flutter */
@keyframes stills-flicker { 0% { opacity: 0; } 7% { opacity: var(--fl); } 9% { opacity: 0; } 23% { opacity: calc(var(--fl) * .5); } 26% { opacity: 0; } 51% { opacity: var(--fl); } 53% { opacity: calc(var(--fl) * .3); } 56% { opacity: 0; } 78% { opacity: calc(var(--fl) * .7); } 80% { opacity: 0; } }
.stills-film .sc { top: 0; bottom: 0; left: -60%; width: 220%; opacity: var(--sc); animation: stills-scratch 1.7s steps(1) infinite;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='400'%3E%3Cg stroke='%23f4eedb' fill='none'%3E%3Cpath d='M82 0V400' stroke-width='1' opacity='.55'/%3E%3Cpath d='M211 40L213 290' stroke-width='.8' opacity='.7'/%3E%3Cpath d='M366 0L364 170' stroke-width='1.2' opacity='.45'/%3E%3Cpath d='M512 120V400' stroke-width='.9' opacity='.6'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 640px 100% repeat-x; }
@keyframes stills-scratch { 0% { transform: translateX(0); opacity: var(--sc); } 18% { transform: translateX(43px); } 31% { transform: translateX(-71px); opacity: 0; } 44% { transform: translateX(120px); opacity: var(--sc); } 70% { transform: translateX(-20px); } 86% { transform: translateX(95px); opacity: 0; } }
.stills-film .du { inset: -30px; opacity: var(--du); animation: stills-dust 2.3s steps(1) infinite;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360'%3E%3Cg%3E%3Ccircle cx='40' cy='60' r='1.6' fill='%23f2ecd8'/%3E%3Ccircle cx='140' cy='210' r='2.1' fill='%23120d08'/%3E%3Ccircle cx='250' cy='40' r='1.2' fill='%23120d08'/%3E%3Ccircle cx='300' cy='300' r='1.8' fill='%23f2ecd8'/%3E%3Ccircle cx='90' cy='320' r='1.1' fill='%23120d08'/%3E%3Cpath d='M200 120q6 8 2 18t4 16' stroke='%23120d08' stroke-width='.8' fill='none'/%3E%3Ccircle cx='330' cy='140' r='1.4' fill='%23f2ecd8'/%3E%3Ccircle cx='180' cy='320' r='1.9' fill='%23120d08'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 360px 360px; }
@keyframes stills-dust { 0% { transform: translate(0,0); } 13% { transform: translate(-90px,40px); } 27% { transform: translate(60px,-120px); } 41% { transform: translate(-30px,-30px); } 57% { transform: translate(110px,70px); } 73% { transform: translate(-140px,-60px); } 88% { transform: translate(20px,130px); } }
/* gate weave: the whole frame shifts a hair, in steps */
.stills-plate:is([data-tone="heavy"], [data-tone="thaw"]).in { animation: stills-weave .5s steps(1) infinite; }
@keyframes stills-weave { 0% { transform: translate(0,0); } 25% { transform: translate(var(--wv), calc(var(--wv) * -.6)); } 50% { transform: translate(calc(var(--wv) * -.5), var(--wv)); } 75% { transform: translate(calc(var(--wv) * .4), calc(var(--wv) * .3)); } }

/* the water-scheme / plan map: pan it like a blueprint */
.stills-plate[data-tone="blueprint"] img { filter: grayscale(.4) contrast(1.1); }
.stills-plate[data-tone="blueprint"]::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; mix-blend-mode: multiply;
  background: linear-gradient(rgba(20,52,110,.0) 0 0), #5d86c4; }
.stills-plate[data-tone="blueprint"]::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: .5;
  background: linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px) 0 0 / 28px 28px, linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px) 0 0 / 28px 28px, radial-gradient(ellipse 120% 100% at 50% 50%, transparent 55%, rgba(5,15,40,.6)); }
/* modern (2027 / dc): clean — no grain, no filter, no vignette. The period is now. */

/* credit: not over the scene — shown on long-press of the host, or read it from Stills.credit() for the dossier */
.stills-credit { position: absolute; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 5; padding: 4px 8px; width: max-content; max-width: calc(100% - 20px);
  font: 500 9px/1.3 ui-monospace, 'Courier New', monospace; letter-spacing: .04em; color: #efe6cf; background: rgba(8,6,4,.72); border-radius: 2px; opacity: 0; transition: opacity .25s ease; pointer-events: none; }
.stills-credit.show { opacity: 1; }
/* an era with no stills yet: nothing is painted */
.stills[data-empty] { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  .stills-plate.in img { animation: none; transform: scale(1.1); }
  .stills-plate:is([data-tone="heavy"], [data-tone="thaw"]).in, .stills-plate:is([data-tone="heavy"], [data-tone="thaw"])::after, .stills-film .fl, .stills-film .sc, .stills-film .du { animation: none; }
  .stills-film .fl { display: none; }
  .stills-plate { transition-duration: .01s; }
}
