/* Screen modes (see screen-mode.js): a full-screen stage for the scene and
   the words, and a reading stage that keeps only the narration words.
   The stage is the page's <main>: native fullscreen when the platform
   grants it, a fixed viewport stage everywhere else (phone browsers that
   refuse element fullscreen included). Colours are brand tokens. */

/* Fallback stage: when native fullscreen is not in play, an active mode
   still fills the viewport and sits above the page chrome. */
body.screen-active:not(:has(main:fullscreen)) main {
  position: fixed;
  inset: 0;
  z-index: 70;
  height: 100dvh;
  overflow: hidden;
  background: var(--es-ground);
}

main:fullscreen {
  background: var(--es-ground);
  overflow: hidden;
}

/* Words only: the scene, the room furniture and every narrative element
   except the live caption line step aside. The player bar stays: play,
   pause and leaving the mode remain one tap away. */
body.screen-words-only #scene,
body.screen-words-only #connector,
body.screen-words-only #overview,
body.screen-words-only #frontier-intro,
body.screen-words-only #detail-panel,
body.screen-words-only #hero-callout,
body.screen-words-only #narration-controls,
body.screen-words-only #text-view,
body.screen-words-only #end-card {
  display: none !important;
}

body.screen-words-only #narrative:not([hidden]),
body.screen-words-only #room-caption:not([hidden]) {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1rem 6.5rem;
  background: transparent;
}

body.screen-words-only #narrative > :not(.narrative-main),
body.screen-words-only .narrative-main > :not(#narrative-caption-slot),
body.screen-words-only #room-caption > :not(#room-caption-slot) {
  display: none !important;
}

body.screen-words-only #narrative-caption-slot,
body.screen-words-only #room-caption-slot {
  width: min(34em, 100%);
}

body.screen-words-only #main-narration-captions {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
}

body.screen-words-only #main-narration-captions .narration-captions__line {
  max-block-size: 62dvh;
  font-size: clamp(1.7rem, 6.5vw, 2.9rem);
  line-height: 1.35;
  text-align: center;
}

/* The reading stage still honours an enlarged-text preference. */
@media (max-width: 700px) {
  body.screen-words-only #main-narration-captions .narration-captions__line {
    font-size: clamp(1.55rem, 8vw, 2.6rem);
  }
}
