/* ATM · AIM TO MISBEHAVE — the floor. One room, seen from above: his pieces, his camcorder, his press.
   The colours are his: the asphalt + the grey laminate he shoots on, the bee girl's yellow, the KNIEVEL pink, the red ink.
   Every label is a strip of white tape (his screen's tape, the tape on the frame). Sizes come from --u (set by app.js:
   one floor unit, so a tee is a tee next to a bomber on any screen). */

/* arriving from the hall: the house's pages crossfade (same-origin view transition) */
@view-transition { navigation: auto; }


:root {
  color-scheme: dark;
  --ink: #141413;
  --tape: #ece6d6;
  --tape-edge: #d7cfbb;
  --bee: #f4d63a;
  --pink: #f2759d;
  --red: #b3162f;
  --u: 100px;
  --mono: 'Space Mono', ui-monospace, Menlo, monospace;
  --big: 'Anton', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
html { overflow-x: clip; }
body {
  background: #2a2a28;
  color: var(--tape);
  font-family: var(--mono);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
button { font: inherit; color: inherit; }
img { -webkit-user-drag: none; }

/* ── the floor ── */
.floor {
  position: fixed; inset: 0; overflow: hidden;
  background-color: #3b3b38;
  background-image: url('img/floor-asphalt.jpg');
  background-size: calc(var(--u) * 5.6);
  transition: filter .5s;
}
body.floor--wood .floor { background-color: #77746f; background-image: url('img/floor-wood.jpg'); background-size: calc(var(--u) * 7.5); }
body.floor--asphalt .floor { filter: brightness(1.18) contrast(.95); }
/* the light: a slow patch of sun (asphalt) / the window (wood) drifting over the floor, the corners fall off */
.floor-light {
  position: absolute; inset: -20%; pointer-events: none; z-index: 900;
  background:
    radial-gradient(60% 50% at var(--lx, 40%) var(--ly, 35%), rgba(255, 246, 225, .16), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, .45));
  mix-blend-mode: soft-light;
  animation: sun 38s ease-in-out infinite alternate;
}
@keyframes sun { 0% { --lx: 30%; --ly: 30%; transform: translate(-4%, -3%); } 100% { transform: translate(5%, 4%); } }

/* a thing on the floor (a piece, the camcorder, the press, the bee, the coaster) */
.thing {
  position: absolute; left: 0; top: 0;
  width: var(--w); height: var(--h);
  margin: calc(var(--h) / -2) 0 0 calc(var(--w) / -2);
  transform: translate3d(var(--x), var(--y), 0) rotate(var(--r)) scale(var(--s, 1));
  cursor: grab; touch-action: none;
  border: 0; padding: 0; background: none;
  will-change: transform;
}
.thing img { display: block; width: 100%; height: 100%; pointer-events: none;
  filter: drop-shadow(0 calc(var(--u) * .03) calc(var(--u) * .03) rgba(0, 0, 0, .5)); transition: filter .18s; }
.thing.held { cursor: grabbing; }
.thing.held img { filter: drop-shadow(0 calc(var(--u) * .14) calc(var(--u) * .16) rgba(0, 0, 0, .45)); }
.thing:focus-visible { outline: 2px dashed var(--bee); outline-offset: 4px; }
.thing.drop { animation: drop .55s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes drop { 0% { opacity: 0; --s: 1.35; } 60% { opacity: 1; } 100% { --s: 1; } }
@property --s { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --lx { syntax: '<percentage>'; inherits: false; initial-value: 40%; }
@property --ly { syntax: '<percentage>'; inherits: false; initial-value: 35%; }

/* the camcorder: its little REC light */
.thing--cam .led { position: absolute; left: 57%; top: 8.5%; width: 4%; aspect-ratio: 1; border-radius: 50%; background: #ff2a1a;
  box-shadow: 0 0 6px 2px rgba(255, 42, 26, .7); animation: led 1.6s steps(1) infinite; }
@keyframes led { 50% { opacity: .15; box-shadow: none; } }
/* the press on the floor: the squeegee lies across the screen */
.thing--press .sq { position: absolute; left: -6%; top: 58%; width: 112%; height: auto; transform: rotate(-7deg); }
/* the box: a tap rocks it as it tips */
.thing--box.tip img { animation: tip .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tip { 30% { transform: rotate(-9deg) scale(1.06); } 60% { transform: rotate(6deg); } }
/* ── the toys ── */
/* a sticker stuck on a thing rides it (placed in % of its host, so it survives a resize) */
.thing img.stuck { position: absolute; height: auto; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.thing--sticker img { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); }
.thing--block img { filter: drop-shadow(0 calc(var(--u) * .02) calc(var(--u) * .02) rgba(0, 0, 0, .55)); }
.thing--bag.tip img { animation: tip .45s cubic-bezier(.3, 1.6, .5, 1); }
/* the can, picked up: it glows its colour and shakes */
.thing--spray.armed { filter: drop-shadow(0 0 12px var(--paint, #f2759d)); animation: rattle .35s steps(2) infinite; }
@keyframes rattle { 50% { translate: 1px -1px; } }
body.spraying .floor { cursor: crosshair; }
body.spraying .thing:not(.thing--spray) { pointer-events: none; }
.paint { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; transition: opacity .8s ease-out; }
.paint.washing { opacity: 0; }
/* his feet in the frame */
.feet { position: fixed; left: 50%; bottom: 0; width: min(72vw, 50vh); height: auto; transform: translate(-50%, 36%); z-index: 950; pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .45)); }
.feet[hidden] { display: none; }
/* the spell box (phones: it brings up the keyboard; desktops can just type) */
.spell { position: fixed; z-index: 1001; left: 50%; bottom: max(96px, calc(env(safe-area-inset-bottom) + 90px)); transform: translateX(-50%) rotate(-1deg);
  width: min(78vw, 360px); padding: 9px 12px 8px; border: 0; outline: none; background: var(--tape); color: var(--ink);
  font: 700 15px var(--mono); letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.spell::placeholder { color: rgba(20, 20, 19, .45); letter-spacing: .04em; text-transform: lowercase; font-weight: 400; }
.spell[hidden] { display: none; }

/* a strip of tape on the toys that do something: what it is + "tap" (koma: "the bag isnt clear enuf") */
.thing .tag { position: absolute; left: 50%; bottom: -2%; transform: translate(-50%, 40%) rotate(-3deg); z-index: 2; pointer-events: none;
  padding: .28em .7em .22em; background: var(--tape); color: var(--ink); white-space: nowrap;
  font: 700 clamp(9px, calc(var(--u) * .1), 12px) var(--mono); letter-spacing: .02em; text-transform: lowercase;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35); opacity: .95; }
.thing--spray .tag { bottom: -10%; }
.thing--box .tag { bottom: 8%; }
.thing--cam .tag { bottom: -14%; }
/* the bag hops until someone taps it */
.thing--bag:not(.used) img { animation: hop 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes hop { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(-7%) rotate(-4deg) scale(1.04); } 86% { transform: none; } 92% { transform: translateY(-3%) rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .thing--bag:not(.used) img { animation: none; } }


/* ── the bar: the mark + strips of tape ── */
.bar { position: fixed; z-index: 1000; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); pointer-events: none; }
.bar > * { pointer-events: auto; }
.mark { display: block; width: min(260px, 44vw); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55)); }
.mark img { display: block; width: 100%; height: auto; }
.tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 60vw; }

.tool {
  position: relative; display: inline-flex; align-items: baseline; gap: 6px;
  padding: 7px 12px 6px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--tape); color: var(--ink);
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: lowercase;
  clip-path: polygon(0 6%, 4% 0, 9% 7%, 15% 1%, 22% 5%, 30% 0, 39% 6%, 47% 1%, 56% 6%, 64% 0, 72% 5%, 81% 1%, 89% 6%, 95% 0, 100% 5%,
                     99% 50%, 100% 96%, 94% 100%, 87% 94%, 79% 100%, 70% 95%, 62% 100%, 53% 95%, 44% 100%, 36% 94%, 27% 100%, 19% 95%, 11% 100%, 5% 94%, 0 98%, 1% 50%);
  box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0);
  transform: rotate(var(--tilt, -1deg));
  transition: transform .15s, background .15s;
}
.tool:nth-child(2n) { --tilt: 1.2deg; }
.tool:nth-child(3n) { --tilt: -.4deg; }
.tool b { font-weight: 400; color: var(--red); }
.tool:hover { background: #fff8e6; transform: rotate(var(--tilt, -1deg)) translateY(-1px); }
.tool:active { transform: rotate(var(--tilt, -1deg)) translateY(1px) scale(.97); }
.tool:focus-visible { outline: 2px dashed var(--bee); outline-offset: 3px; }
.tool[aria-pressed="true"]:not(.tool--snd) { background: var(--bee); }
.tool[disabled] { opacity: .45; cursor: default; }
.tool[hidden] { display: none; }
.tool--flash i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); align-self: center; }
.tool--x { background: var(--ink); color: var(--tape); }
.tool--x:hover { background: #2b2b29; }

.hint { position: fixed; z-index: 1000; left: 50%; bottom: max(54px, calc(env(safe-area-inset-bottom) + 46px)); transform: translateX(-50%) rotate(-1deg);
  margin: 0; padding: 5px 10px; background: rgba(20, 20, 19, .72); color: var(--tape); font-size: 11px; letter-spacing: .04em; white-space: nowrap;
  pointer-events: none; transition: opacity .8s; }
.hint.gone { opacity: 0; }
.hint-phone { display: none; }
@media (hover: none) { .hint-desk { display: none; } .hint-phone { display: inline; } }

.foot { position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  font-size: 11px; letter-spacing: .03em; color: rgba(236, 230, 214, .92); text-shadow: 0 1px 2px rgba(0, 0, 0, .9); pointer-events: none;
  background: linear-gradient(0deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0)); padding-top: 28px; }   /* legible on the asphalt (2026-11-04 audit) */
.foot a { padding: 6px 0; }
.foot a { color: inherit; pointer-events: auto; }
.back { font-weight: 700; text-decoration: none; color: var(--tape) !important; }
.credit { text-align: right; }

/* ── the overlays: picked up, the camcorder, the press, the photo ── */
.lift, .cam, .press, .snap {
  position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: max(60px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background: rgba(12, 12, 11, .78); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fade .25s ease-out;
}
.lift[hidden], .cam[hidden], .press[hidden], .snap[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.lift-ctl, .cam-ctl, .press-ctl, .snap-ctl { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* picked up */
.lift-stage { position: relative; width: min(86vw, 62vh, 760px); aspect-ratio: 1; perspective: 1400px; overflow: hidden; touch-action: none; cursor: zoom-in; }
.lift-stage.zoomed { cursor: grab; }
.lift-card { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, 1.2, .4, 1); animation: pickup .45s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes pickup { from { transform: scale(.55) rotate(var(--from-r, 0deg)); opacity: .3; } }
.lift-card.flipped { transform: rotateY(180deg); }
.lift-face { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transform-origin: var(--zx, 50%) var(--zy, 50%); transition: transform .35s ease-out;
  filter: drop-shadow(0 26px 30px rgba(0, 0, 0, .55)); }
.lift-back { transform: rotateY(180deg); }
.lift-stage.zoomed .lift-front { transform: scale(var(--z, 2.6)) translate(var(--px, 0), var(--py, 0)); transition: none; }
.lift-stage.zoomed .lift-back { transform: rotateY(180deg) scale(var(--z, 2.6)) translate(var(--px, 0), var(--py, 0)); transition: none; }
.lift-tag { display: flex; gap: 10px; align-items: baseline; padding: 6px 12px 5px; background: var(--tape); color: var(--ink); font-size: 12px; transform: rotate(-1.5deg); }
.lift-tag b { color: var(--red); }

/* the camcorder: the hole in its LCD (props.py measured it) shows the tape */
.cam-body { position: relative; width: min(94vw, 110vh, 980px); aspect-ratio: 1400 / 761; }
.cam-img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 30px 36px rgba(0, 0, 0, .6)); }
.cam-screen { position: absolute; left: 6.98%; top: 41.1%; width: 31.92%; height: 47.01%; background: #0a2bd6; overflow: hidden; cursor: ew-resize; touch-action: none; }
.cam-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-osd { position: absolute; inset: 0; padding: 5% 6%; font-family: var(--mono); font-size: clamp(8px, 1.5vw, 14px); color: #fff; text-shadow: 1px 1px 0 #000;
  display: grid; grid-template: auto 1fr auto / 1fr 1fr; pointer-events: none; z-index: 2; }
.osd-rec { color: #ff3b2a; display: flex; align-items: center; gap: .4em; }
.osd-rec i { width: .7em; height: .7em; border-radius: 50%; background: #ff3b2a; animation: led 1s steps(1) infinite; }
.cam.paused .osd-rec { color: #fff; } .cam.paused .osd-rec i { animation: none; background: #fff; border-radius: 0; width: .3em; box-shadow: .45em 0 0 #fff; }
.osd-tape { text-align: right; }
.osd-tc { grid-row: 3; align-self: end; }
.osd-date { grid-row: 3; grid-column: 2; text-align: right; align-self: end; color: #ffb21e; }
.cam-notape { position: absolute; inset: 0; display: grid; place-content: center; gap: .5em; text-align: center; color: #fff; font-family: var(--mono);
  font-size: clamp(9px, 1.7vw, 16px); z-index: 1; }
.cam-notape b { font-size: 1.6em; letter-spacing: .12em; animation: led 1.4s steps(1) infinite; }
.cam.has-tape .cam-notape { display: none; }
.cam:not(.has-tape) .osd-rec { visibility: hidden; }
.cam-scrub { position: absolute; left: 6%; right: 6%; bottom: 3%; height: 3px; background: rgba(255, 255, 255, .25); z-index: 3; opacity: 0; transition: opacity .3s; }
.cam-scrub i { display: block; height: 100%; width: 0; background: #ffb21e; }
.cam-screen.scrubbing .cam-scrub, .cam-screen:hover .cam-scrub { opacity: 1; }
.cam-screen::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .14) 0 1px, transparent 1px 3px), radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, .12), transparent 50%); }

/* the press: the tee on the floor, the screen over its chest, the mesh, the squeegee */
.press { background: rgba(12, 12, 11, .55); }
.press-bed { position: relative; width: min(84vw, 58vh, 640px); aspect-ratio: 1200 / 1073; touch-action: none; }
.press-tee { position: absolute; inset: 0; }
.press-tee img, .press-ink img { position: absolute; display: block; }
.press-blank { inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .45)); }
.press-ink { position: absolute; inset: 0; clip-path: inset(0 0 calc(100% - var(--pulled, 0%)) 0); mix-blend-mode: multiply; }
.press-ink.wet img { filter: saturate(1.25) contrast(1.05) brightness(.96); }
.press-ink.dry img { transition: filter 2.4s; filter: none; }
.press-screen { position: absolute; transition: transform .7s cubic-bezier(.5, 0, .3, 1), opacity .7s; }
.press-screen.up { transform: translateY(-38%) rotateX(55deg) scale(.92); opacity: 0; pointer-events: none; }
.press-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .5)); }
.press-mesh { position: absolute; left: 8.7%; top: 11.2%; right: 9.2%; bottom: 10.5%;
  background:
    repeating-linear-gradient(90deg, rgba(240, 214, 70, .16) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(240, 214, 70, .16) 0 1px, transparent 1px 3px),
    rgba(232, 205, 70, .22);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .25); }
.press-squeegee { position: absolute; left: -4%; width: 108%; height: auto; top: calc(var(--sq, 6%) - 4%); cursor: grab; touch-action: none;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, .55)); transition: top .25s; }
.press-squeegee.held { cursor: grabbing; transition: none; }
.press-hint { margin: 0; font-size: 12px; background: var(--tape); color: var(--ink); padding: 5px 10px 4px; transform: rotate(1deg); }

/* the photo */
.snap-print { background: #f6f2e8; padding: 10px 10px 34px; box-shadow: 0 30px 50px rgba(0, 0, 0, .6); transform: rotate(-2deg); animation: develop .9s ease-out; }
.snap-print img { display: block; max-width: min(84vw, 900px); max-height: 64vh; width: auto; height: auto; }
@keyframes develop { from { transform: rotate(-9deg) translateY(30px) scale(.9); opacity: 0; } }
.flashbulb { position: fixed; inset: 0; z-index: 3000; background: #fff; opacity: 0; pointer-events: none; }
.flashbulb.pop { animation: pop .7s ease-out; }
@keyframes pop { 0% { opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 640px) {
  .tools { gap: 6px; max-width: 54vw; }
  .tool { font-size: 11px; padding: 6px 9px 5px; }
  .credit { max-width: 62vw; }
  .mark { width: 40vw; }
}

@media (prefers-reduced-motion: reduce) {
  .floor-light, .thing--cam .led, .cam-notape b { animation: none; }
  .thing.drop { animation: none; }
  .lift-card { transition: none; animation: none; }
}

