/* The front door (weberplex.app): a fork in the road. Left leads to the cinema
   (movie night) past a crowd of movie characters, right to the arcade (game
   night) past a crowd of game characters. The scene is inline SVG fan art; the
   idle motion is CSS, the walk down a path is GSAP (landing.js). The two halves
   are real links, so it works without the script and by keyboard. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: #0d0a12; color: #fff; font: 400 16px/1.45 'Archivo', system-ui, sans-serif; }
:focus-visible { outline: 3px solid #ffd34d; outline-offset: -4px; }

.door {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.door-head { text-align: center; }
/* the name is 6.64 em wide, so under about 223 px (200% text on a phone) it shrinks to fit between the page's edges */
.door-head h1 { margin: 0; font: 400 min(clamp(30px, 7vw, 46px), calc((100vw - 24px) / 6.9))/1 'Limelight', Georgia, serif; letter-spacing: 0.06em; text-transform: uppercase; color: #fbf3e2; }
.door-head p { margin: 4px 0 0; color: #cfc4dc; font-size: 16px; }

/* the stage keeps the scene's 800x700 shape and fits the screen */
.stage {
  position: relative; overflow: hidden; border-radius: 18px; border: 2px solid #3b2b50; background: #0d0a12;
  --rw: 800; --rh: 700;
  width: min(100%, calc((100vh - 110px) * var(--rw) / var(--rh))); width: min(100%, calc((100dvh - 110px) * var(--rw) / var(--rh)));
  aspect-ratio: var(--rw) / var(--rh);
}
.scene {
  display: block; width: 100%; height: 100%;
  background:
    linear-gradient(to bottom, rgb(6 3 14 / 0.7), transparent 62%),
    linear-gradient(90deg, #3a1630 0%, #22123c 48%, #101a66 100%);
}
/* a portrait screen gets a taller picture, cropped at the sides (the doors stay in) */
@media (max-aspect-ratio: 1/1) {
  .stage { --rw: 5; --rh: 6; }
  .door { justify-content: center; }
  /* signposts hug the outer edges so the middle of the road stays clear for the traveller */
  .way { padding: 0 8px 10px; }
  .way-movie { justify-content: flex-start; }
  .way-game { justify-content: flex-end; }
  .way-label { max-width: 86%; }
}

/* the two halves are the links; the label is the signpost */
.way {
  position: absolute; top: 0; bottom: 0; width: 50%; display: flex; align-items: flex-end; justify-content: center;
  padding: 0 8px 12px; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.way-movie { left: 0; }
.way-game { right: 0; }
.way-label {
  display: block; max-width: 100%; padding: 7px 12px 8px; text-align: center; border: 2px solid; border-radius: 10px;
  background: rgb(10 6 16 / 0.82); transition: transform 140ms ease, background-color 140ms ease;
}
.way-label b { display: block; font-weight: 400; line-height: 1.05; font-size: clamp(19px, 4.6vw, 30px); }
.way-label small { display: none; margin-top: 2px; font-size: clamp(11px, 2.4vw, 13px); line-height: 1.3; color: #e8dff0; }
@media (min-width: 560px) { .way-label small { display: block; } }
.way-movie .way-label { border-color: #ffc76e; }
.way-movie .way-label b { font-family: 'Limelight', Georgia, serif; color: #fbf3e2; letter-spacing: 0.02em; }
.way-game .way-label { border-color: #59d8ff; }
.way-game .way-label b { font-family: 'Jersey 10', ui-monospace, monospace; color: #ffd34d; letter-spacing: 0.06em; text-transform: uppercase; font-size: clamp(19px, 5.2vw, 38px); text-shadow: 2px 2px 0 #0b0f2e; }
.way:is(:hover, :focus-visible) .way-label { transform: translateY(-4px); background: rgb(10 6 16 / 0.94); }
/* Game night wraps when the room runs out (it stays on one line from about 290 px), and on a phone set to 200% text
   (about 200 to 260 px wide) both signposts give up some padding and size their words to the room, so "Movie" and
   "NIGHT" each read whole inside the frame. The room is half the stage, less 4 px on the outer side and 8 on the inner
   (the road), less the frame and its padding; the longest word is about 3.3 em wide. */
@media (max-width: 259px) {
  .way-movie { padding-left: 4px; }
  .way-game { padding-right: 4px; }
  .way-label { padding: 5px 5px 6px; overflow-wrap: break-word; }
  .way .way-label b { font-size: clamp(12px, calc(((100vw - 28px) / 2 - 26px) / 3.4), 19px); }
}

/* leaning toward a side: that side lights up, the other settles back */
.side { transition: filter 300ms ease; }
.halo { opacity: 0.55; transition: opacity 300ms ease; transform-box: fill-box; transform-origin: 50% 50%; }
.stage[data-lean="movie"] .side-game, .stage[data-lean="game"] .side-movie { filter: brightness(0.45) saturate(0.6); }
.stage[data-lean="movie"] .side-movie .halo, .stage[data-lean="game"] .side-game .halo { opacity: 1; }

/* the signs and the little lines the characters say */
.sign-movie { font: 400 30px 'Limelight', Georgia, serif; fill: #fbf3e2; }
.sign-game { font: 400 46px 'Jersey 10', ui-monospace, monospace; fill: #ffd34d; letter-spacing: 2px; filter: drop-shadow(0 0 5px #ffd34d); }
.sign-sub { font: 400 9px 'Silkscreen', ui-monospace, monospace; fill: #ffc76e; letter-spacing: 0.15em; }
.sign-coin { fill: #9cff3c; }
.bates { font: 700 13px 'Archivo', system-ui, sans-serif; fill: #f4efe6; stroke: none; letter-spacing: 0.06em; }
.vacancy { font: 700 10px 'Archivo', system-ui, sans-serif; fill: #ff3b4a; stroke: none; letter-spacing: 0.2em; filter: drop-shadow(0 0 3px #ff3b4a); }
.quip { font: 400 13px 'Jersey 10', ui-monospace, monospace; fill: #ffd34d; stroke: none; letter-spacing: 0.08em; }
.whisper { font: italic 400 10px Georgia, serif; fill: #cfe8e0; stroke: none; }
.price { font: 400 11px 'Silkscreen', ui-monospace, monospace; fill: #9cff3c; stroke: none; }
.qmark { font: 700 20px 'Archivo', system-ui, sans-serif; fill: #fff; stroke: #7a4a08; stroke-width: 1; }
.m { font: 700 6px 'Archivo', system-ui, sans-serif; fill: #e0242f; stroke: none; }
.bulb { fill: #ffe9b0; }
.beam { transform-origin: 0 0; opacity: 0.8; }
.blade { filter: drop-shadow(0 0 3px #ff2a2a) drop-shadow(0 0 8px #ff2a2a); }
.quip, .whisper { opacity: 0; }
.coin { opacity: 0; }

/* pointing at a character: it lights up, and a tag says who it is and what it says */
.ch.on { filter: brightness(1.12) drop-shadow(0 0 5px rgb(255 247 218 / 0.55)); }
.side-game .ch.on { filter: brightness(1.12) drop-shadow(0 0 5px rgb(89 216 255 / 0.6)); }
.who {
  position: absolute; left: 0; top: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px;
  max-width: min(280px, 80%); pointer-events: none; opacity: 0; transition: opacity 140ms ease;
}
.who.show { opacity: 1; }
.who q {
  position: relative; display: block; padding: 6px 12px 7px; border: 2px solid #1b0f0c; border-radius: 14px; background: #fff7e8; color: #1b0f0c;
  font: 700 14px/1.25 'Archivo', system-ui, sans-serif; text-align: center; quotes: none;
}
.who q::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; margin-left: -6px; background: #fff7e8; border: 2px solid #1b0f0c; border-top: 0; border-left: 0; transform: rotate(45deg); }
.who span { display: block; padding: 4px 10px 5px; border: 2px solid #ffc76e; border-radius: 8px; background: rgb(10 6 16 / 0.9); text-align: center; box-shadow: 0 0 12px rgb(255 199 110 / 0.35); }
.who.game span { border-color: #59d8ff; box-shadow: 0 0 12px rgb(89 216 255 / 0.35); }
.who b { display: block; font: 400 17px/1.1 'Limelight', Georgia, serif; color: #fbf3e2; white-space: nowrap; }
.who.game b { font: 400 22px/1 'Jersey 10', ui-monospace, monospace; color: #ffd34d; letter-spacing: 0.04em; }
.who small { display: block; font-size: 11px; color: #cfc4dc; white-space: nowrap; }

/* the flash that covers the cut to the next page */
.flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(circle, #fff7da 0%, #ffc76e 55%, #3a1424 100%); }
.stage[data-lean="game"] .flash { background: radial-gradient(circle, #effff0 0%, #59d8ff 55%, #0b0f2e 100%); }

/* reduced motion: the picture sits still, and the lines are simply shown */
@media (prefers-reduced-motion: reduce) { .quip, .whisper { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .star { animation: twinkle 2.6s ease-in-out infinite alternate; }
  @keyframes twinkle { from { opacity: 0.25; } to { opacity: 1; } }
  .dash { animation: march 1.2s linear infinite; }
  @keyframes march { to { stroke-dashoffset: calc(var(--p) * -1px); } }
  .halo { animation: breathe 3.6s ease-in-out infinite alternate; }
  @keyframes breathe { from { transform: scale(0.96); } to { transform: scale(1.04); } }
  @keyframes frame { 0% { opacity: 1; } 50% { opacity: 0; } }
  @keyframes blink { to { visibility: hidden; } }

  /* the cinema */
  .bulb.a { animation: chase 1.2s steps(1) infinite; }
  .bulb.b { animation: chase 1.2s steps(1) infinite -0.6s; }
  @keyframes chase { 0% { opacity: 1; } 50% { opacity: 0.2; } }
  .beam.b1 { animation: sweep 4.2s ease-in-out infinite alternate; }
  .beam.b2 { animation: sweep 3.6s ease-in-out infinite alternate-reverse; }
  .stage[data-lean="movie"] .beam { animation-duration: 1.4s; }
  @keyframes sweep { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }
  .door-glow { animation: glow 2.2s ease-in-out infinite alternate; }
  @keyframes glow { from { opacity: 0.65; } to { opacity: 1; } }

  /* E.T. across the moon */
  .et-bike { animation: ride 9s ease-in-out infinite alternate; }
  @keyframes ride { from { transform: translate(-34px, 8px); } to { transform: translate(30px, -10px); } }
  /* Mother, in the window */
  .mom { animation: mom 7s steps(1) infinite; }
  @keyframes mom { 0%, 55% { opacity: 0; } 60%, 92% { opacity: 1; } }
  .vacancy { animation: neon 2.8s steps(1) infinite; }
  .tilt { animation: tilt 6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
  @keyframes tilt { 0%, 60%, 100% { transform: rotate(0); } 70%, 90% { transform: rotate(-9deg); } }
  /* Vader's saber hums and sways; his helmet rises a hair with each breath */
  .saber { animation: sway 2.8s ease-in-out infinite alternate; transform-origin: 0 0; }
  @keyframes sway { from { transform: rotate(-5deg); } to { transform: rotate(7deg); } }
  .blade { animation: hum 0.14s steps(2) infinite; }
  @keyframes hum { 50% { opacity: 0.86; } }
  .breathe { animation: breath 3.2s ease-in-out infinite; }
  @keyframes breath { 50% { transform: translateY(-1.2px); } }
  /* Pennywise: the balloon never leaves; he does */
  .balloon { animation: bob 3s ease-in-out infinite alternate; }
  @keyframes bob { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-8px) rotate(4deg); } }
  .peek { animation: peek 8s ease-in-out infinite; }
  @keyframes peek { 0%, 18% { transform: translateY(92px); } 32%, 72% { transform: translateY(0); } 86%, 100% { transform: translateY(92px); } }
  /* Ash: the chainsaw idles, the one-liner lands */
  .saw { animation: idle 0.09s steps(2) infinite; }
  @keyframes idle { 50% { transform: translate(0.8px, -0.6px); } }
  .puff { animation: puff 1.4s ease-out infinite; }
  @keyframes puff { from { transform: translate(0, 0); opacity: 0.8; } to { transform: translate(6px, -14px); opacity: 0; } }
  .quip { animation: line 7s ease-in-out infinite 2s; }
  @keyframes line { 0%, 70%, 100% { opacity: 0; } 76%, 94% { opacity: 1; } }
  /* Spider-Man on his web */
  .swing { animation: swing 3.2s ease-in-out infinite alternate; transform-origin: 0 0; }
  @keyframes swing { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
  /* Gollum and the ring */
  .g-eyes { animation: lids 4.6s steps(1) infinite; transform-box: fill-box; transform-origin: 50% 50%; }
  @keyframes lids { 0%, 94% { transform: scaleY(1); } 95%, 98% { transform: scaleY(0.12); } }
  .glint { animation: frame 1.6s steps(1) infinite; }
  .whisper { animation: line 6s ease-in-out infinite; }

  /* the arcade */
  .sign-game { animation: neon 3.4s steps(1) infinite; }
  @keyframes neon { 0%, 91%, 95%, 100% { opacity: 1; } 93%, 97% { opacity: 0.45; } }
  .sign-coin { animation: blink 1.1s steps(2, start) infinite; }
  .screen { animation: screen 2.4s steps(1) infinite; }
  @keyframes screen { 0% { fill: #59d8ff; } 33% { fill: #ff5d73; } 66% { fill: #9cff3c; } }
  .px { animation: frame 1.2s steps(1) infinite; }
  .halo-glint { animation: frame 2.2s steps(1) infinite; }
  .visor-glint { animation: frame 3s steps(1) infinite; }
  /* Mario bumps the block; a coin pops out */
  .jump { animation: jump 2.4s ease-in-out infinite; }
  @keyframes jump { 0%, 30%, 100% { transform: translateY(0); } 42% { transform: translateY(-24px); } 54% { transform: translateY(0); } }
  .qblock { animation: bump 2.4s ease-in-out infinite; }
  @keyframes bump { 0%, 40%, 50%, 100% { transform: translateY(0); } 44% { transform: translateY(-5px); } }
  .coin { animation: coin 2.4s ease-out infinite; }
  @keyframes coin { 0%, 41% { transform: translateY(0); opacity: 0; } 43% { opacity: 1; } 60% { transform: translateY(-34px); opacity: 1; } 66%, 100% { transform: translateY(-40px); opacity: 0; } }
  /* Zagreus's feet are on fire, as ever */
  .flames path { animation: flame 0.22s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
  @keyframes flame { from { transform: scaleY(0.82); } to { transform: scaleY(1.15); } }
  /* Cuphead and Mugman bounce like rubber hose */
  .hose { animation: hose 0.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
  @keyframes hose { from { transform: scale(1.04, 0.95); } to { transform: scale(0.97, 1.04); } }
  /* the crewmates waddle; the creeper hisses */
  .crew { animation: waddle 0.9s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
  @keyframes waddle { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
  .hiss { animation: hiss 5s steps(1) infinite; }
  @keyframes hiss { 0%, 80%, 84%, 88%, 100% { filter: none; } 82%, 86% { filter: brightness(2.4); } }
  /* R.E.P.O.: two bots, one vase, no plan */
  .repo-bot { animation: bot 0.5s ease-in-out infinite alternate; }
  @keyframes bot { to { transform: translateY(-3px); } }
  .vase { animation: vase 1.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 50%; }
  @keyframes vase { from { transform: translateY(0) rotate(-9deg); } to { transform: translateY(-5px) rotate(9deg); } }
  .beam-grab { animation: grab 0.6s linear infinite; }
  @keyframes grab { to { stroke-dashoffset: -14; } }

  /* what pointing at someone sets off, beyond the tweens in landing.js */
  .ch.on .quip, .ch.on .whisper { animation: none; opacity: 0; } /* the tag says it instead */
  .vader.on .blade { filter: drop-shadow(0 0 4px #ff2a2a) drop-shadow(0 0 14px #ff2a2a); }
  .ash.on .saw { animation-duration: 0.045s; }
  .ash.on .puff { animation-duration: 0.5s; }
  .gollum.on .glint { animation-duration: 0.4s; }
  .stage:is([data-act="norman"], [data-act="bates"], [data-act="house"]) .mom { animation: none; opacity: 1; }
  .stage[data-act="bates"] .vacancy { animation: neon 0.5s steps(1) infinite; }
  .creeper.on .hiss { animation: hiss 0.5s steps(1) infinite; }
  .stage[data-act="mario"] :is(.jump, .qblock, .coin) { animation-duration: 0.9s; }
  .zag.on .flames path { animation-duration: 0.09s; }
  .cup.on .hose { animation-duration: 0.18s; }
  .crewbox.on .crew { animation-duration: 0.25s; }
  .repo.on .repo-bot { animation-duration: 0.18s; }
  .repo.on .vase { animation-duration: 0.35s; }
  .chief.on { animation: shield 0.7s ease-in-out infinite alternate; }
  @keyframes shield { from { filter: brightness(1.1) drop-shadow(0 0 3px #7ff3ff); } to { filter: brightness(1.2) drop-shadow(0 0 10px #7ff3ff); } }
  .chief.on .visor-glint { animation-duration: 0.5s; }

  /* the traveller */
  .bob { animation: travel-bob 1.7s ease-in-out infinite; }
  @keyframes travel-bob { 50% { transform: translateY(-3px); } }
  .leg { transform-box: fill-box; transform-origin: 50% 0; }
  .walking .bob { animation-duration: 0.3s; }
  .walking .leg.l1 { animation: step 0.3s ease-in-out infinite alternate; }
  .walking .leg.l2 { animation: step 0.3s ease-in-out infinite alternate-reverse; }
  @keyframes step { from { transform: rotate(-28deg); } to { transform: rotate(28deg); } }
}
