/* ---------- Entry + Intro overlay ----------
   Self-contained, prepended before the site. Remove by deleting:
     - this file
     - intro.js
     - the <div id="intro-root"> block in index.html
     - the two <link>/<script> lines that reference intro.css and intro.js
   Nothing else touches the site's layout or CSS. */

#intro-root {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* --- Phase 1: Entry screen --- */
.intro-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* NPC sits tight beneath ENTER as a visually attached sub-element */
  gap: clamp(2px, 0.4vw, 8px);
  cursor: pointer;
  padding: 32px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}
.intro-entry:focus-visible {
  outline: 2px solid #ff2ea3;
  outline-offset: 8px;
  border-radius: 8px;
}
.intro-entry-enter {
  display: block;
  width: clamp(260px, 48vw, 560px);
  height: auto;
  transition: transform 120ms ease;
}
.intro-entry:hover .intro-entry-enter,
.intro-entry:active .intro-entry-enter {
  transform: scale(1.02);
}
.intro-entry-npc {
  display: block;
  /* half the previous size — quieter sub-element under ENTER */
  width: clamp(32px, 4.5vw, 65px);
  height: auto;
  opacity: 0.9;
}

/* --- Phase 2: Intro video plays centered at native aspect (16:9),
   on the same white background as the site (no black surround) --- */
.intro-stage {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #ffffff;   /* matches site background */
  overflow: hidden;
}
.intro-stage.is-active { display: flex; }

.intro-video {
  /* desktop max ≈ +25 % vs previous 720 px; mobile: fills full viewport width */
  width: min(900px, 100vw);
  height: auto;
  aspect-ratio: 16 / 9;
  /* Prefer svh (small viewport height = with browser chrome visible) so
     the video does not resize when iOS Safari toggles its UI mid-play. */
  max-height: 90vh;
  max-height: 90svh;
  object-fit: contain;
  /* NO opaque background on the video element itself — on iOS 17 Chrome
     the element background can render OVER the video frames, leaving only
     a white surface. The .intro-stage behind is already white. */
  background: transparent;
  display: block;
}

/* Body scroll lock while intro is active */
body.intro-active {
  overflow: hidden;
  touch-action: none;
}

/* Very small screens: keep entry compact but hold φ³ ENTER:NPC ratio */
@media (max-width: 400px) {
  .intro-entry-enter { width: 78vw; }
  .intro-entry-npc   { width: 12vw; }   /* mobile: slightly larger for legibility */
  .intro-entry       { gap: 4px; }
}
