/* ---- fonts ---- */
@font-face {
  font-family: 'ByteBounce';
  src: url('assets/ByteBounce.ttf') format('truetype');
  font-display: swap;
}

/* ---- page ---- */
html, body {
  margin: 0;
  height: 100%;
  background: #000;        /* never shows — gif fills the viewport */
  overflow: hidden;
  font-family: system-ui, sans-serif;
  cursor: url('assets/cursor-arrow.png') 0 0, auto;
}
body { display: grid; place-items: center; }

/* ---- stage: fills the whole viewport, gif stretches to match ---- */
.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
}

/* bg + overlays all stack at 100% of the stage so pixel positions stay aligned */
.bg, .overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;       /* clicks pass through to the hotspots */
}
.bg { pointer-events: auto; } /* but the bg itself is fine to receive */
.overlay[hidden] { display: none; } /* beat .overlay's display:block specificity */

/* ---- clickable hotspots ----
   coords are % of the 384x192 stage. tweak in devtools with ?debug.
   transparent by default, but tint on hover/active for tactile feel. */
.hotspot {
  position: absolute;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: url('assets/cursor-hand.png') 9 0, pointer;
}
.hotspot:focus { outline: none; }
.hotspot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* tuned to the actual gif:
   - transport buttons sit inside the cloud (~y=46%)
   - mute toggle is the speaker icon at top right (~x=96%, y=4%) */
.hotspot.prev  { left: 83%;   top: 45%;  width: 4.5%; height: 12%; }
.hotspot.play  { left: 87.5%; top: 44%;  width: 4%;   height: 14%; }
.hotspot.next  { left: 91%;   top: 45%;  width: 4.5%; height: 12%; }
.hotspot.mute  { left: 95.5%; top: 1.5%; width: 4%;   height: 8%;  }
/* ---- nav row under the Hollows title ---- */
/* font-size + gap are fixed px (not vw) so they don't grow on window resize.
   --zoom-inv counter-scales browser zoom (set by JS), so ctrl+plus won't
   inflate the nav either. transform-origin keeps it anchored to top-center. */
.nav {
  position: absolute;
  top: 28%;                /* sits just below the baked-in title */
  left: 50%;
  transform: translateX(-50%) scale(var(--zoom-inv, 1));
  transform-origin: 50% 0%;
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: 'ByteBounce', ui-monospace, Menlo, Consolas, monospace;
  font-size: 35px;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 0 #1a2742, 0 0 8px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  pointer-events: none;    /* only the active item is clickable (see below) */
}
.nav-item,
.nav-sep {
  text-shadow:
    0 1px 0 #9776ca,
    0 2px 0 #9776ca,
    0 3px 4px rgba(0, 0, 0, 0.35);
}
.nav-sep {
  text-shadow:
    0 1px 0 #9776ca,
    0 2px 3px rgba(0, 0, 0, 0.3);
}
.nav-item {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.nav-item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
/* ---- pixel speech bubble under Opensea ----
   persistent (no flash, no JS) so status is known before any click.
   chunky 2px border + offset purple drop-shadow to match the pixel-art vibe. */
.nav-item.is-soon { position: relative; }
/* don't dim Opensea on hover — keeps the bubble at full opacity */
.nav-item.is-active.is-soon:hover { opacity: 1; }
.nav-bubble {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  margin-top: 4px;
  padding: 6px 12px;
  background: #fff;
  color: #1a2742;
  border: 2px solid #1a2742;
  box-shadow: 0 2px 0 #9776ca;
  font-size: 0.5em;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  white-space: nowrap;
  text-shadow: none;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.nav-item.is-soon:hover .nav-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* tail pointing up, stacked border + fill triangles */
.nav-bubble::before,
.nav-bubble::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}
.nav-bubble::before {
  transform: translateX(-50%);
  border-bottom: 6px solid #1a2742;
}
.nav-bubble::after {
  transform: translate(-50%, 2px);
  border-bottom: 6px solid #fff;
}
.nav-item.is-active {
  pointer-events: auto;
  cursor: url('assets/cursor-hand.png') 9 0, pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.nav-item.is-active:hover  { opacity: 0.85; transform: translateY(-1px); }
.nav-item.is-active:active { transform: translateY(0); }
.nav-sep {
  opacity: 0.7;
  font-weight: bold;            /* synthesizes a thicker glyph from ByteBounce */
  /* compress width, stretch height, nudge up to optical center of the text */
  transform: scaleX(0.35) scaleY(1.6) translateY(-0.05em);
  display: inline-block;
  letter-spacing: 0;            /* don't add nav's letter-spacing after the dash glyph */
}

/* debug: append ?debug to the url to see the hitboxes */
body.debug .hotspot { background: rgba(255, 0, 0, 0.35); outline: 1px solid red; }
body.debug .wl-input,
body.debug .wl-check { outline: 1px solid red; }

/* ---- whitelist checker overlay ----
   the PNG is 768x192 but only the LEFT 384x192 has content (matches bg.gif).
   we use background-size: 200% 100% to stretch the PNG to 2x width so the
   left half exactly fills the viewport. coords below are % of viewport. */
.wl-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;        /* clip the overflowing right half of the overlay */
}
.wl-modal[hidden] { display: none; }

/* render PNG as an <img> like the other overlays. PNG is 768x192 but only
   the left 384x192 has content, so stretch to 200% width and let the
   transparent right half flow off-screen (clipped by .wl-modal overflow). */
.wl-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: url('assets/cursor-hand.png') 9 0, pointer;
}

/* matches the cloud panel art bbox (PNG x=73-306, y=29-162 of the 384x192 half).
   absorbs clicks so users can interact inside the panel without the modal closing. */
.wl-panel-zone {
  position: absolute;
  left: 19%;
  top: 15%;
  width: 61%;
  height: 69%;
  cursor: url('assets/cursor-arrow.png') 0 0, default;
}

/* input slot interior is at PNG x=135-248, y=88-98 (left half = 384x192).
   button at PNG x=178-204, y=112-122. expressed as % of viewport. */
/* the input is a contenteditable <div> — zero intrinsic browser styling. */
.wl-input {
  position: absolute;
  left: 35%;
  top: calc(48% - 2vh);     /* split the difference between math-center and optical-center */
  width: 30%;
  height: 4.5vh;
  line-height: 4.5vh;
  box-sizing: border-box;
  padding: 0 8px;
  margin: 0;
  font-family: 'ByteBounce', ui-monospace, Menlo, Consolas, monospace;
  /* baseline size for non-JS fallback. JS will auto-fit the actual size to the box. */
  font-size: clamp(11px, 2.3vw, 36px);
  color: #1a2742;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  cursor: text;
  caret-color: #1a2742;     /* dark blue blinking caret so users see typing position */
}
.wl-input:focus { outline: 0; }

.wl-check {
  position: absolute;
  left: 46.4%;
  top: 58%;
  width: 7%;
  height: 6%;
  background: transparent;
  border: 0;
  cursor: url('assets/cursor-hand.png') 9 0, pointer;
}
.wl-check:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.wl-result {
  position: absolute;
  /* horizontal-center on the panel, vertical-center between button bottom and panel bottom */
  left: 50%;
  top: 72%;
  transform: translate(-50%, -50%);
  width: 60%;
  margin: 0;
  text-align: center;
  font-family: 'ByteBounce', ui-monospace, Menlo, Consolas, monospace;
  font-size: clamp(24px, 2.8vw, 42px);
  line-height: 1;          /* tight so the box's center aligns with the text's center */
  color: #fff;
  text-shadow: 0 1px 0 #1a2742, 0 0 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.wl-result.is-good { color: #8de89a; }
.wl-result.is-bad  { color: #e88d8d; }

/* ---- mobile gate ----
   pixel art + hotspot UI doesn't scale well on phones, so show the scene
   as a hero with a "desktop only" notice underneath. */
.mobile-block { display: none; }

/* trigger the mobile screen whenever the desktop scene would look bad:
   - viewport too narrow (≤1000px)
   - portrait orientation (taller than wide)
   - aspect-ratio too far from the gif's native 2:1 (catches near-square windows)
   - any touch-primary device up to 1024px */
@media (max-width: 1000px),
       (orientation: portrait),
       (max-aspect-ratio: 5 / 4),
       (pointer: coarse) and (max-width: 1024px) {
  .stage { display: none; }
  .mobile-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100vw;
    min-height: 100vh;
    text-align: center;
    color: #fff;
    /* sky gradient sampled from the gif so the art blends in */
    background: linear-gradient(180deg, #8fd3ff 0%, #b9e5ff 55%, #d9f0ff 100%);
    padding: 32px 20px;
    box-sizing: border-box;
  }
  .mobile-art {
    width: min(92vw, 480px);
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border-radius: 12px;
    box-shadow:
      0 0 0 4px rgba(255, 255, 255, 0.7),
      0 18px 40px rgba(20, 40, 80, 0.35);
  }
  .mobile-block p { margin: 0; color: #1a2742; }
  .mobile-block .title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: lowercase;
  }
  .mobile-block .sub {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.65;
    max-width: 280px;
  }
}
