@font-face { font-family: "Bowlby One"; src: url("fonts/bowlby-one.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Rubik"; font-weight: 300 900; src: url("fonts/rubik.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Permanent Marker"; src: url("fonts/permanent-marker.woff2") format("woff2"); font-display: swap; }

:root {
  --velvet: #9a112a;
  --velvet-dark: #5c0a19;
  --maroon: #3a1422;       /* the logo's own dark */
  --night: #1b0810;
  --paper: #efe7cd;        /* the logo's own light */
  --gold: #e9bd55;
  --gold-dark: #9a6f1c;
  --wood: #94592c;

  --fat: "Bowlby One", Impact, "Arial Black", sans-serif;
  --text: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Permanent Marker", "Comic Sans MS", cursive;

  --pad: clamp(16px, 3vw, 40px);
  --valance-h: clamp(62px, 12vh, 116px);
  --floor-h: clamp(56px, 12vh, 122px);
  --apron-h: clamp(14px, 3vh, 30px);
  --fold: clamp(58px, 7.6vw, 128px);
  --beam: clamp(150px, 21vw, 320px);
  --boing: cubic-bezier(.2, 1.8, .4, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--night); }

body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font: 500 16px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── the stage ──────────────────────────────────────────── */

.screen {
  --mx: 50%;
  --my: 38%;
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: var(--valance-h) 1fr var(--floor-h) auto;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.hero { grid-area: 2 / 1; }
.floor { grid-area: 3 / 1; }
.apron { grid-area: 4 / 1; }

/* velvet: two halves meeting in the middle, folds fanning out from the seam */
.curtain {
  position: absolute;
  inset: 0;
  z-index: -4;
  background:
    linear-gradient(90deg, transparent calc(50% - 30px), rgba(0, 0, 0, .26) calc(50% - 3px), rgba(0, 0, 0, .6) 50%, rgba(255, 170, 150, .16) calc(50% + 4px), transparent calc(50% + 34px)),
    linear-gradient(90deg, rgba(0, 0, 0, .36) 0, rgba(0, 0, 0, 0) 22%, rgba(255, 160, 140, .15) 42%, rgba(255, 160, 140, .04) 56%, rgba(0, 0, 0, .13) 78%, rgba(0, 0, 0, .36) 100%) center / var(--fold) 100%,
    linear-gradient(90deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, .15) 50%, rgba(255, 190, 170, .07) 75%, rgba(0, 0, 0, 0) 100%) center / calc(var(--fold) * .618) 100%,
    linear-gradient(180deg, #ab142c 0%, var(--velvet) 45%, #6d0b1d 100%);
  transform-origin: 50% 0;
}

.curtain.ruffle { animation: ruffle .6s ease-out; }

/* follow spot + the dark corners of the house */
.spot {
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(circle var(--beam) at var(--mx) var(--my), rgba(255, 232, 190, .27) 0, rgba(255, 232, 190, .21) 76%, rgba(255, 232, 190, 0) 100%),
    radial-gradient(ellipse 95% 85% at 50% 40%, rgba(20, 2, 8, 0) 32%, rgba(20, 2, 8, .62) 100%);
}

/* swags with a gold fringe; one swag per background tile */
.valance {
  position: absolute;
  inset: 0 0 auto;
  height: var(--valance-h);
  z-index: -2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 100' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='0' y1='0' y2='1'%3E%3Cstop offset='0' stop-color='%23470712'/%3E%3Cstop offset='1' stop-color='%23850f24'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 0H200V40Q100 124 0 40Z' fill='url(%23g)'/%3E%3Cpath d='M0 14Q100 62 200 14M0 27Q100 94 200 27' fill='none' stroke='%23000' stroke-opacity='.2' stroke-width='3'/%3E%3Cpath d='M0 40Q100 124 200 40' fill='none' stroke='%23e9bd55' stroke-width='5'/%3E%3Cpath d='M0 40Q100 124 200 40' fill='none' stroke='%239a6f1c' stroke-width='1.5' stroke-dasharray='2 5' transform='translate(0 5)'/%3E%3Ccircle cx='0' cy='41' r='7' fill='%23e9bd55'/%3E%3Ccircle cx='200' cy='41' r='7' fill='%23e9bd55'/%3E%3Cpath d='M-5 46H5L3 70H-3ZM195 46H205L203 70H197Z' fill='%23c99a35'/%3E%3C/svg%3E") center top / 16.667% 100% repeat-x;
  filter: drop-shadow(0 8px 9px rgba(20, 2, 8, .5));
}

/* ── sound switch (on the valance) ──────────────────────── */

.sound {
  all: unset;
  position: absolute;
  top: clamp(4px, 1.1vh, 12px);
  right: calc(var(--pad) - 8px);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(239, 231, 205, .78);
  cursor: pointer;
  transition: color .12s, scale .18s var(--boing);
}

.sound:hover, .sound:focus-visible { color: var(--gold); scale: 1.12; }
.sound:focus-visible { outline: 3px dashed var(--gold); outline-offset: 1px; }
.sound svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound .cone { fill: currentColor; }
.sound[aria-pressed="true"] .off, .sound[aria-pressed="false"] .on { display: none; }

/* ── logo + sign ────────────────────────────────────────── */

.hero {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: clamp(14px, 3vh, 34px);
  padding: clamp(18px, 4vh, 44px) 16px clamp(10px, 2vh, 24px);
}

.marquee { position: relative; width: min(100%, 1060px, 34vh * 2.53); }

.logo { margin: 0; aspect-ratio: 901 / 356; }
.logo img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 6px 8px rgba(20, 2, 8, .45)); }

/* once the paper letters exist, the flat logo stays behind as their shadow on the velvet */
.phys .logo img { opacity: .2; filter: brightness(0) blur(2px); }

.hint {
  display: none;
  position: absolute;
  right: 0;
  bottom: 100%;
  margin: 0 0 .15em;
  align-items: flex-end;
  gap: .25em;
  font: 400 clamp(.85rem, 1.6vw, 1.25rem)/1 var(--hand);
  white-space: nowrap;
  opacity: .85;
  rotate: 4deg;
  text-shadow: 0 1px 3px rgba(20, 2, 8, .6);
  pointer-events: none;
  transition: opacity .6s;
}

.phys .hint { display: flex; }
.hint.gone { opacity: 0; }
.hint svg { width: 2em; height: 2em; overflow: visible; fill: none; stroke: currentColor; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; translate: 0 .7em; }

.soon { margin: 0; display: grid; justify-items: center; gap: 1.1em; }

/* a paper sign, cut from the same sheet as the logo */
.soon strong {
  display: inline-block;
  padding: .62em 1.1em .5em;
  border-radius: .2em;
  background: var(--paper) var(--paper-tex, none) center / 512px;
  color: var(--maroon);
  font: 400 clamp(1rem, min(2.3vw, 3.8vh), 1.7rem)/1 var(--fat);
  text-transform: uppercase;
  letter-spacing: .07em;
  box-shadow: inset 0 0 0 2px rgba(255, 252, 238, .55), 0 .32em .55em rgba(20, 2, 8, .5);
  rotate: -2.5deg;
  transform-origin: 50% -60%;
  animation: sway 3.8s ease-in-out infinite;
}

.soon span { max-width: 46ch; font: 500 clamp(.84rem, 1.3vw, 1.08rem)/1.4 var(--text); color: rgba(239, 231, 205, .86); text-shadow: 0 1px 3px rgba(20, 2, 8, .55); text-wrap: balance; }

/* ── boards and stage front ─────────────────────────────── */

.floor {
  position: relative;
  overflow: hidden;
  perspective: 260px;
  background: var(--wood);
}

.floor::before {
  content: "";
  position: absolute;
  inset: 0 -60% -140%;
  transform-origin: 50% 0;
  transform: rotateX(52deg);
  background:
    linear-gradient(90deg, rgba(40, 16, 6, .55) 0 2px, rgba(255, 222, 170, .08) 2px 4px, transparent 4px) center / clamp(40px, 5.2vw, 84px) 100%,
    linear-gradient(180deg, #7b4824, #a9692f 70%);
}

/* the curtain's shadow, and the light dying towards the wings */
.floor::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 2, 8, .82) 0, rgba(20, 2, 8, .28) 20%, rgba(20, 2, 8, 0) 46%),
    radial-gradient(ellipse 70% 160% at 50% 100%, rgba(20, 2, 8, 0) 40%, rgba(20, 2, 8, .5) 100%);
}

.apron {
  height: calc(var(--apron-h) + env(safe-area-inset-bottom));
  border-top: 4px solid var(--gold);
  background: linear-gradient(180deg, #33101d, var(--night));
  box-shadow: inset 0 2px 0 var(--gold-dark);
}

/* ── paper letters ──────────────────────────────────────── */

.stage { position: absolute; inset: 0; z-index: 5; overflow: hidden; pointer-events: none; }

.chunk {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  will-change: transform;
  transition: opacity .2s, filter .15s;
}

.chunk.loose { z-index: 1; }
.chunk.held { z-index: 2; cursor: grabbing; filter: brightness(1.06); }
.chunk.homing { pointer-events: none; opacity: .5; }
.chunk.pop { animation: pop .4s ease-out; }

/* ── motion ─────────────────────────────────────────────── */

@keyframes pop { from { filter: brightness(1.45); } }
@keyframes sway { 50% { rotate: 1.5deg; } }
@keyframes ruffle { 25% { transform: skewX(.7deg) scaleX(1.006); } 55% { transform: skewX(-.45deg); } 80% { transform: skewX(.2deg); } }

/* ── other screens ──────────────────────────────────────── */

@media (max-width: 1100px) { .valance { background-size: 25% 100%; } }

@media (max-width: 700px) { .valance { background-size: 33.334% 100%; } }

@media (max-height: 520px) {
  :root { --valance-h: 48px; --floor-h: 44px; }
  .hero { gap: 10px; padding-block: 8px 6px; }
  .hint { display: none !important; }
  .sound { top: 0; }
  .valance { background-size: 16.667% 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .soon strong, .chunk.pop, .curtain.ruffle { animation: none; }
}
