/* gray.cafe
   A dark room with a camcorder running: black, grain, a REC / STBY readout up top, a cover image dim
   behind the home and the code screen with the odd tracking glitch. Plain and quiet; the only mess is the
   pictures on a project page (bare, tilted, overlapping, drifting as you scroll).
   Each project can dress the room further: its `theme.mood` lands on <html data-mood> ("night" is the
   house), and its `theme.accent` on --accent.
   Type: Poppins Bold for display, DejaVu Sans Mono Bold for small labels and readouts (both straight
   from the Halloween film's titles), the system face for reading. */

@font-face { font-family: "Cafe Display"; src: url("fonts/poppins-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cafe Mono"; src: url("fonts/mono-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #030303;
  --bg2: #0d0b0a;
  --ink: #f2ece4;
  --soft: #8a8379;
  --line: rgba(242, 236, 228, .13);
  --paper: #ece5d6;
  --paper-ink: #141210;
  --accent: #ff5a1f;
  --rec: #ff3b2f;
  --display: "Cafe Display", "Poppins", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cafe Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(16px, 4vw, 56px);
  --top: 56px;
  --ease: cubic-bezier(.2, .75, .1, 1);
  --spring: cubic-bezier(.34, 1.5, .5, 1);
  --shadow: 0 16px 32px -12px rgba(0, 0, 0, .9), 0 2px 5px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-mood="halloween"] { --bg: #000; --bg2: #0c0a08; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: var(--top); background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--body); -webkit-font-smoothing: antialiased;
  transition: background-color .6s var(--ease);
  overflow-x: hidden;
}
h1, h2, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
img, video { max-width: 100%; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #000; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.mono { font-family: var(--mono); font-size: 12px; line-height: 1.4; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; }
.soft { color: var(--soft); }
.sep { font-style: normal; margin: 0 .55em; opacity: .55; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 60; background: var(--ink); color: var(--bg); padding: 8px 12px; text-decoration: none; }
.skip:focus { top: 10px; }

/* ---------- top strip ---------- */
.top {
  position: sticky; top: 0; z-index: 35; height: var(--top);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 var(--pad);
  background: linear-gradient(rgba(0, 0, 0, .78), rgba(0, 0, 0, .35));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background .5s var(--ease), -webkit-backdrop-filter .5s, backdrop-filter .5s;
}
.on-hero .top { background: linear-gradient(rgba(0, 0, 0, .5), transparent); -webkit-backdrop-filter: none; backdrop-filter: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; justify-self: start; }
.b-word { font: 700 17px/1 var(--display); letter-spacing: -.01em; color: #ff5a1f; transition: opacity .2s; }
.brand:hover .b-word { opacity: .75; }
.hud { display: flex; justify-content: center; align-items: center; gap: 18px; min-width: 0; }
.hud > * { animation: fadeIn .6s var(--ease) both; }
.rec { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); opacity: .45; transition: opacity .3s; }
.rec.on .rec-dot { opacity: 1; animation: blink 1.1s steps(1) infinite; box-shadow: 0 0 10px var(--rec); }
.rec.stby .rec-dot { background: #3fd16b; opacity: .9; animation: blink 2.4s steps(1) infinite; box-shadow: 0 0 8px rgba(63, 209, 107, .6); }
.tc { font-variant-numeric: tabular-nums; color: var(--soft); }

/* ---------- page in, lights out ---------- */
.boot { padding: 30vh var(--pad); text-align: center; color: var(--soft); }
html.booting .boot { animation: pulse 1.4s ease-in-out infinite; }
#app { outline: none; }
#app.enter > * { animation: rise .7s var(--ease) backwards; }   /* backwards: no lasting stacking context */

.fx { position: fixed; inset: 0; z-index: 45; pointer-events: none; opacity: 0; background: #000; transition: opacity .55s var(--ease); }
.fx.on { opacity: 1; pointer-events: auto; }
.fx.on.fade { transition: opacity .24s ease; }
.fx.on.quick { transition: opacity .14s linear; }
.fx.on.flicker { transition: none; animation: lightsOut .56s steps(1) both; }

.grain {
  position: fixed; inset: -50%; z-index: 30; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.4 -.25'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .8s steps(5) infinite; transition: opacity .8s;
}
.is-watching .grain { opacity: 0; }

/* a project's cover, dim and full-bleed behind the index and the gate */
.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: #000; }
.backdrop img { width: 100%; height: 100%; object-fit: cover; object-position: 62% 40%; opacity: .4; transform: scale(1.04); filter: saturate(1.05);
  transition: opacity .9s var(--ease), transform 6s var(--ease); }
.backdrop::after { content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(ellipse at 60% 45%, transparent 20%, rgba(0, 0, 0, .78) 85%), linear-gradient(transparent 55%, rgba(0, 0, 0, .85)), repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .22) 2px 4px); }
.backdrop.lit img { opacity: .78; transform: scale(1.0); animation: flickIn .5s steps(1) both; }
.backdrop.lit-soft img { opacity: .2; filter: blur(2px) saturate(1.1); }
/* the tape slips now and then: the picture jumps sideways and a tracking band rolls down */
.backdrop.glitchy img { animation: slip 7.3s steps(1) 2s infinite; }
.backdrop.glitchy.lit img { animation: flickIn .5s steps(1) both; }
.backdrop.glitchy::before { content: ""; position: absolute; z-index: 1; left: 0; right: 0; top: 0; height: 9%;
  background: linear-gradient(transparent, rgba(255, 255, 255, .07) 40%, rgba(255, 255, 255, .02) 60%, transparent);
  transform: translateY(-120%); animation: band 11s linear 3s infinite; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- home: the projects, over the newest one's cover ---------- */
.home { position: relative; min-height: calc(100svh - var(--top)); display: grid; align-content: end; padding: 0 var(--pad) calc(28px + env(safe-area-inset-bottom)); }
.home > :not(.backdrop) { position: relative; z-index: 1; }
.tapes { border-top: 1px solid var(--line); }
.tape-li { animation: rise .8s var(--ease) backwards; animation-delay: calc(var(--k) * 90ms + 200ms); }
.tape {
  --row-accent: var(--accent);
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: clamp(14px, 3vw, 40px); align-items: baseline;
  padding: clamp(16px, 2.4vw, 26px) 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.t-num, .t-meta { color: var(--soft); }
.t-title {
  font: 700 clamp(34px, 6vw, 92px)/.92 var(--display); letter-spacing: -.035em; text-transform: uppercase;
  transition: color .35s var(--ease), -webkit-text-stroke-color .35s;
  -webkit-text-stroke: 1.5px transparent;
}
.tape:hover .t-title, .tape:focus-visible .t-title { color: transparent; -webkit-text-stroke-color: var(--row-accent); }
.t-state { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.tape:hover .t-state { color: var(--row-accent); }
.arr { display: inline-block; transition: transform .45s var(--ease); }
.lock { position: relative; display: inline-block; width: 10px; height: 8px; margin-top: 4px; border-radius: 1.5px; background: currentColor; }
.lock::before { content: ""; position: absolute; left: 1.5px; bottom: 6px; width: 7px; height: 6px; border: 1.6px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; box-sizing: border-box; }
.empty { padding: 24px 0; color: var(--soft); }

/* ---------- the PIN gate ---------- */
.gate { position: relative; min-height: calc(100svh - var(--top)); display: grid; grid-template-rows: auto 1fr; padding: clamp(24px, 4vw, 56px) var(--pad) 40px; }
.gate > :not(.backdrop) { position: relative; z-index: 1; }
.g-box { align-self: center; justify-self: center; width: min(100%, 420px); display: grid; justify-items: center; text-align: center; gap: 14px; padding: 24px 0; }
.g-k { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); }
.g-title { font: 700 clamp(44px, 9vw, 84px)/.84 var(--display); letter-spacing: -.045em; text-transform: uppercase; margin-top: 6px; }
.g-meta { color: var(--soft); }
.g-field { position: relative; margin-top: 18px; }
.slots { display: flex; gap: 12px; cursor: text; }
.slot {
  width: 58px; height: 72px; display: grid; place-items: center; border: 1.5px solid rgba(242, 236, 228, .28); border-radius: 10px;
  background: rgba(0, 0, 0, .45); font: 700 34px/1 var(--mono); color: var(--ink);
  transition: border-color .2s, background-color .2s;
}
.slot.full { border-color: rgba(242, 236, 228, .6); }
.slot.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.slot.on::after { content: ""; width: 2px; height: 30px; background: var(--accent); animation: blink 1s steps(1) infinite; }
.pin-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; background: transparent; caret-color: transparent; }
.g-msg { min-height: 1.4em; color: var(--soft); }
.g-box.checking .slot { animation: pulse .9s ease-in-out infinite; }
.g-box.wrong .slots { animation: shake .42s var(--ease); }
.g-box.wrong .slot { border-color: var(--rec); }
.g-box.wrong .g-msg { color: var(--rec); }
.g-box.right .slot { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.g-box.right .g-msg { color: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; margin-top: 8px; }
.key {
  height: 56px; border-radius: 12px; border: 1px solid rgba(242, 236, 228, .14); background: rgba(255, 255, 255, .04);
  font: 700 22px/1 var(--display); cursor: pointer; transition: background-color .15s, border-color .15s, transform .12s;
}
.key:hover { background: rgba(255, 255, 255, .1); border-color: rgba(242, 236, 228, .3); }
.key:active { transform: scale(.95); background: var(--accent); color: #000; }
.key-fn { font-size: 12px; color: var(--soft); }
.back { display: inline-flex; align-items: center; gap: .6em; text-decoration: none; color: var(--soft); transition: color .25s; }
.back:hover { color: var(--accent); }

/* titles: the word solid, the year in outline */
.pt-main, .pt-year { display: block; }
.pt-year { color: transparent; -webkit-text-stroke: max(1.5px, .011em) var(--accent); }
[data-mood="halloween"] .pt-year { animation: neon 2.6s steps(1) .5s both; }

/* ---------- a project: the film fills the screen ---------- */
.hero { position: relative; height: 100vh; height: 100svh; margin-top: calc(-1 * var(--top)); background: #000; overflow: hidden; }
.hero .stage { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage { position: relative; background: #000; outline: none; overflow: hidden; }
.stage video { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; background: transparent; cursor: pointer; }
.stage.is-fs { width: 100vw; height: 100vh; }
.ambient {   /* the film's own light spilling onto the walls */
  position: absolute; z-index: 0; left: -10%; top: -10%; width: 120%; height: 120%;
  filter: blur(44px) saturate(1.45) brightness(.6); opacity: 0; transition: opacity 1.4s var(--ease);
}
.ambient.on { opacity: 1; }

.big-play {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: end center; justify-items: center; gap: 16px;
  border: 0; padding: 0 0 clamp(90px, 16vh, 170px); background: linear-gradient(transparent 45%, rgba(0, 0, 0, .55));
  color: #fff; cursor: pointer; transition: opacity .45s var(--ease), visibility .45s;
}
.bp-icon {
  width: clamp(72px, 10vw, 108px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .25);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .45s var(--spring), background-color .3s, border-color .3s;
}
.bp-icon > span { width: 0; height: 0; margin-left: 12%; border-style: solid; border-width: 13px 0 13px 22px; border-color: transparent transparent transparent currentColor; }
.big-play:hover .bp-icon, .big-play:focus-visible .bp-icon { transform: scale(1.08) rotate(-4deg); background: var(--accent); border-color: var(--accent); }
.big-play:hover .bp-icon > span, .big-play:focus-visible .bp-icon > span { border-left-color: #000; }
.bp-label { display: flex; gap: 14px; text-shadow: 0 1px 12px rgba(0, 0, 0, .8); }
.bp-len { color: var(--accent); }
.stage:not(.is-fresh):not(.is-ended) .bp-label { display: none; }
.stage.is-playing .big-play, .stage.needs-sound .big-play { opacity: 0; visibility: hidden; pointer-events: none; }

.sound-on {   /* the browser refused sound: one tap (anywhere) turns it on */
  position: absolute; z-index: 5; left: 50%; bottom: calc(clamp(40px, 9vh, 90px) + env(safe-area-inset-bottom)); translate: -50% 0;
  display: none; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.stage.needs-sound .sound-on { display: inline-flex; }
.sound-on:hover { border-color: var(--accent); color: var(--accent); }

.controls {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px;
  padding: 48px max(var(--pad), env(safe-area-inset-left)) calc(clamp(10px, 1.6vw, 18px) + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .7));
  color: #fff; transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.stage.is-fresh .controls { opacity: 0; pointer-events: none; transform: translateY(8px); }
.stage:not(.is-ui) .controls { opacity: 0; pointer-events: none; transform: translateY(8px); }   /* hidden until the picture is clicked */
.c-btn { flex: none; width: 38px; height: 38px; border: 0; padding: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; transition: background-color .2s; }
.c-btn:hover { background: rgba(255, 255, 255, .12); }
a.c-btn { color: inherit; text-decoration: none; }
.c-time { flex: none; min-width: 7.4em; font-variant-numeric: tabular-nums; opacity: .9; }
.c-bar { position: relative; flex: 1; height: 30px; cursor: pointer; touch-action: none; outline: none; }
.c-track { position: absolute; left: 0; right: 0; top: 50%; height: 3px; transform: translateY(-50%); background: rgba(255, 255, 255, .22); overflow: hidden; border-radius: 2px; transition: height .2s; }
.c-buf, .c-fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); }
.c-buf { background: rgba(255, 255, 255, .26); }
.c-fill { background: var(--accent); }
.c-knob { position: absolute; top: 50%; left: 0; width: 13px; height: 13px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%) scale(0); transition: transform .2s var(--ease); }
.c-bar:hover .c-track, .stage.is-scrubbing .c-track, .c-bar:focus-visible .c-track { height: 5px; }
.c-bar:hover .c-knob, .stage.is-scrubbing .c-knob, .c-bar:focus-visible .c-knob { transform: translate(-50%, -50%) scale(1); }
.c-bar:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: 4px; }
.c-tip { position: absolute; bottom: 30px; left: 0; transform: translateX(-50%); padding: 4px 7px; background: #000; color: #fff; border-radius: 3px; opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; }
.c-bar:hover .c-tip, .stage.is-scrubbing .c-tip { opacity: 1; }
@media (hover: none) { .c-tip { display: none; } }

/* control icons, drawn in CSS */
.i-play { width: 0; height: 0; margin-left: 3px; border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent currentColor; }
.stage.is-playing .i-play { width: 12px; height: 14px; margin: 0; border: 0; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }
.i-sound { position: relative; display: inline-block; width: 16px; height: 14px; }
.i-sound::before { content: ""; position: absolute; left: 0; top: 2px; width: 9px; height: 10px; background: currentColor; clip-path: polygon(0 30%, 40% 30%, 100% 0, 100% 100%, 40% 70%, 0 70%); }
.i-sound::after { content: ""; position: absolute; right: 0; top: 2px; width: 6px; height: 10px; border: 2px solid currentColor; border-left: 0; border-radius: 0 10px 10px 0; }
.stage.is-muted .i-sound::after { border: 0; border-radius: 0; width: 7px; height: 2px; top: 6px; background: currentColor; transform: rotate(45deg); }
.i-fs { width: 14px; height: 14px;
  background:
    linear-gradient(currentColor, currentColor) left top / 5px 2px no-repeat, linear-gradient(currentColor, currentColor) left top / 2px 5px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 5px 2px no-repeat, linear-gradient(currentColor, currentColor) right top / 2px 5px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 5px 2px no-repeat, linear-gradient(currentColor, currentColor) left bottom / 2px 5px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 5px 2px no-repeat, linear-gradient(currentColor, currentColor) right bottom / 2px 5px no-repeat; }
.i-save { position: relative; width: 14px; height: 14px; border-bottom: 2px solid currentColor; }
.i-save::before { content: ""; position: absolute; left: 6px; top: 0; width: 2px; height: 9px; background: currentColor; }
.i-save::after { content: ""; position: absolute; left: 3.5px; top: 3px; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.stage.is-waiting::after { content: ""; position: absolute; z-index: 3; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.cue {   /* "scroll", bottom right of the film */
  position: absolute; z-index: 4; right: var(--pad); bottom: calc(clamp(70px, 11vh, 110px) + env(safe-area-inset-bottom));
  display: grid; justify-items: center; gap: 4px; padding: 8px; border: 0; background: none; color: #fff; cursor: pointer;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .9); opacity: .6; transition: opacity .4s, color .2s;
}
.cue:hover { color: var(--accent); opacity: 1; }
.cue-arr { display: block; font: 700 20px/1 var(--body); animation: bob 1.3s ease-in-out infinite; }
.past-hero .cue { opacity: 0; }

/* ---------- the collage ---------- */
.p-head { position: relative; z-index: 2; padding: clamp(56px, 9vw, 120px) var(--pad) 0; max-width: 1672px; margin: 0 auto; }
.p-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; }
.p-kicker { color: var(--soft); margin: 0; }
.p-save { color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .3); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.p-save:hover { color: var(--accent); border-color: var(--accent); }
.p-title { font: 700 clamp(44px, 13vw, 200px)/.8 var(--display); letter-spacing: -.05em; text-transform: uppercase; margin: .14em 0 0 -.04em; }

/* z-index makes the board its own layer: a hovered or dragged piece rises above its neighbours and the title,
   never above the top strip or the opened picture. */
.board-wrap { position: relative; z-index: 3; overflow: hidden; padding: 70px var(--pad) 90px; margin: -40px 0 0; }
@supports (overflow: clip) { .board-wrap { overflow-x: clip; overflow-y: visible; } }
.board { position: relative; max-width: 1560px; margin: 0 auto; min-height: 60vh; }

.bit { position: absolute; left: 0; top: 0; will-change: transform; }
.bit:hover { z-index: 900 !important; }
.bit-in {
  position: relative; opacity: 0;
  transform: translateY(-56px) rotate(calc(var(--r, 0deg) + var(--er, 10deg))) scale(1.18);
  transition: transform .85s var(--spring) var(--delay, 0ms), opacity .3s ease var(--delay, 0ms);
}
.bit.in .bit-in { opacity: 1; transform: rotate(var(--r, 0deg)); }
.bit.in:hover .bit-in { transform: rotate(calc(var(--r, 0deg) * .25)) scale(1.045); transition-duration: .5s, .3s; transition-delay: 0ms; }
.bit.lifted .bit-in { transform: rotate(calc(var(--r, 0deg) * -.4)) scale(1.08); transition-duration: .5s, .3s; transition-delay: 0ms; }
.bit.lifted .snap { cursor: grabbing; }

.snap { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.snap img, .snap video { display: block; width: 100%; height: auto; object-fit: cover; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; transition: filter .4s var(--ease); }
.bit-photo .snap, .bit-clip .snap, .bit-booth .snap { box-shadow: 0 24px 44px -16px rgba(0, 0, 0, .95), 0 2px 6px rgba(0, 0, 0, .5); }
.bit-sticker .snap img, .bit-film .snap img { filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .7)); }
.bit-sticker .snap { cursor: grab; }
.bob .snap { animation: float 5.5s ease-in-out infinite alternate; }
.bit-in:hover .snap img, .bit-in:hover .snap video { filter: brightness(1.06) saturate(1.1); }
.bit-sticker .bit-in:hover .snap img, .bit-film .bit-in:hover .snap img { filter: drop-shadow(0 16px 18px rgba(0, 0, 0, .75)) saturate(1.1); }
.snap:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.p-foot { padding: clamp(30px, 6vw, 80px) var(--pad) clamp(70px, 10vw, 130px); max-width: 1560px; margin: 0 auto; }
.back-big { display: inline-grid; gap: 6px; text-decoration: none; }
.bb-t { font: 700 clamp(28px, 4vw, 52px)/1 var(--display); letter-spacing: -.02em; text-transform: uppercase; transition: color .25s; }
.back-big:hover .bb-t { color: var(--accent); }
.back-big:hover .arr { transform: translateX(-8px); }

.note { padding: 18vh var(--pad); display: grid; gap: 18px; justify-items: start; }
.note h1 { font: 700 clamp(40px, 7vw, 88px)/.95 var(--display); letter-spacing: -.035em; max-width: 14ch; }
.btn { border: 1px solid var(--ink); background: transparent; padding: 10px 16px; border-radius: 999px; cursor: pointer; }
.btn:hover { background: var(--ink); color: var(--bg); }
.nojs { padding: 40px var(--pad); }

/* ---------- lightbox ---------- */
html.lb-open { overflow: hidden; }
.lb {
  position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(0, 0, 0, .95); color: #fff; animation: fadeIn .3s var(--ease) both;
  padding-bottom: env(safe-area-inset-bottom);
}
.lb.lb-out { animation: fadeOut .26s ease both; }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: 12px var(--pad); }
.lb-count { color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
.lb-frame { display: grid; place-items: center; min-height: 0; padding: 0 clamp(8px, 7vw, 110px) 24px; touch-action: pan-y; }
.lb-img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100svh - 120px); object-fit: contain; transition: opacity .3s; user-select: none; -webkit-user-drag: none; }
.lb-img.lb-loading { opacity: .3; }
.lb-swap-r .lb-img { animation: inRight .45s var(--ease) both; }
.lb-swap-l .lb-img { animation: inLeft .45s var(--ease) both; }
.lb-card { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 14px var(--pad) 22px; }
.lb-card[hidden], .lb-frame [hidden] { display: none !important; }
.lb-title { font: 700 clamp(18px, 2.2vw, 26px)/1.1 var(--display); text-transform: uppercase; }
.lb-cap { color: var(--accent); text-transform: none; letter-spacing: .02em; }
.lb-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06); color: #fff; font: 400 20px/1 var(--body); cursor: pointer; display: grid; place-items: center; transition: background-color .2s, border-color .2s; }
.lb-btn:hover { background: var(--accent); border-color: var(--accent); color: #000; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-prev { left: clamp(8px, 2vw, 28px); }
.lb-next { right: clamp(8px, 2vw, 28px); }
@media (max-width: 640px) {
  .lb-prev, .lb-next { top: auto; bottom: calc(18px + env(safe-area-inset-bottom)); transform: none; width: 42px; height: 42px; }
  .lb-frame { padding-bottom: 76px; }
}

/* ---------- narrow screens ---------- */
@media (max-width: 760px) {
  :root { --top: 52px; }
  .top { gap: 10px; }
  .cam-date { display: none; }
  .hud { gap: 12px; }
  .backdrop img { object-position: 64% 40%; }
  .c-time { min-width: 0; font-size: 11px; }
  .c-btn { width: 34px; height: 34px; }
  .tape { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .t-num { display: none; }
  .t-meta { grid-row: 2; }
  .t-state { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
  .cue { right: 10px; }
}
@media (max-width: 420px) {
  .top { grid-template-columns: auto 1fr; }
  .top-end { display: none; }
  .hud { justify-content: flex-end; }
  .slot { width: 52px; height: 64px; }
  .keypad { grid-template-columns: repeat(3, 66px); }
}

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-60px) rotate(14deg) scale(1.2); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes blink { 0% { opacity: 1; } 50% { opacity: .15; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes float { from { transform: translateY(0) rotate(0deg); } to { transform: translateY(-10px) rotate(2.5deg); } }
@keyframes neon { 0% { opacity: .15; } 8% { opacity: 1; } 12% { opacity: .3; } 20% { opacity: 1; } 24% { opacity: .5; } 30%, 100% { opacity: 1; } }
@keyframes slip { 0%, 100% { transform: scale(1.04); filter: saturate(1.05); } 62% { transform: scale(1.04) translate(-1.6%, .3%); filter: saturate(1.6) brightness(1.3); } 63% { transform: scale(1.04) translate(1.1%, -.2%); } 64.5% { transform: scale(1.04); filter: saturate(1.05); } 91% { transform: scale(1.04) translate(.8%, 0); filter: brightness(.6); } 92% { transform: scale(1.04); filter: saturate(1.05); } }
@keyframes band { 0% { transform: translateY(-120%); } 30%, 100% { transform: translateY(1250%); } }
@keyframes shake { 15% { transform: translateX(-10px); } 35% { transform: translateX(9px); } 55% { transform: translateX(-6px); } 75% { transform: translateX(4px); } 100% { transform: none; } }
@keyframes flickIn { 0% { opacity: .4; } 20% { opacity: .85; } 30% { opacity: .25; } 45%, 100% { opacity: .78; } }
@keyframes lightsOut { 0% { opacity: 0; } 14% { opacity: .85; } 22% { opacity: .1; } 36% { opacity: 1; } 48% { opacity: .3; } 62%, 100% { opacity: 1; } }
@keyframes grain { 0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); } 60% { transform: translate(-1%, 3%); } 80% { transform: translate(4%, 1%); } }
@keyframes inRight { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes inLeft { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .grain { animation: none; }
  .bit-in { opacity: 1; transform: rotate(var(--r, 0deg)); }
}
