/* On phones, keep the full scene readable instead of cropping a wide film to a portrait viewport. */
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) {
  .scene {
    --scene-media-height: 56.25vw;
    height: auto;
    min-height: 0;
    padding-top: var(--scene-media-height);
    background: #0e1c18;
  }
  .scene > .ambient-video,
  .scene > .scene-art,
  .scene > .rotating-art {
    position: absolute;
    inset: 0 0 auto;
    width: 100%;
    height: var(--scene-media-height);
    object-fit: contain;
    object-position: center;
  }
  .scene > .rotating-art img {object-fit: contain; object-position: center;}
  .scene > .shade,
  .scene:has(.right) > .shade,
  .town > .shade,
  .landscape > .shade {
    inset: 0 0 auto;
    height: calc(var(--scene-media-height) + 2px);
    background: linear-gradient(0deg, #0e1c18, transparent 22%);
  }
  .scene .scene-content,
  .scene .scene-content.right,
  .scene#nations .scene-content,
  .landscape .scene-content,
  .town .scene-content {
    position: relative;
    inset: auto;
    transform: none;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 28px 24px 18px;
  }
  .scene .eyebrow {margin-bottom: 17px;}
  .scene h2, html:not([lang=en]) .scene-content h2 {font-size: clamp(31px, 8.5vw, 48px);}
  .scene .scene-copy {max-width: none; margin: 19px 0 22px; font-size: 14px; line-height: 1.75;}
  .scene > .scene-credit {position: relative; inset: auto; display: block; margin: 12px 24px 28px; line-height: 1.6;}
  .scene.art-only {background-size: 100% auto; background-position: top center; background-repeat: no-repeat;}
  .scene#nations {min-height: 0;}
  .nation-selector {position: relative; inset: auto; padding: 0 24px 12px;}
  .nation-buttons {gap: 14px;}
  #nation-description {max-width: none; font-size: 12px; line-height: 1.7;}
  #nations.title-moment .scene-content {opacity: 1; visibility: visible;}
  .world-window {position: relative; inset: auto; width: auto; transform: none; margin: 10px 14px 22px;}
  .world-window video {object-fit: contain; aspect-ratio: 16/9;}
  .landscape-ring {grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; gap: 36px 10px; margin: 29px 0 35px;}
  .landscape-ring button {width: min(52px, 100%); height: auto; aspect-ratio: 1; justify-self: center;}
  #landscape-context {margin-top: 28px; min-height: 48px; line-height: 1.7;}
  .economy-chain {min-height: 112px;}
  .chain-bottom {gap: 8px;}
  .chain-bottom p {font-size: 11px; line-height: 1.7;}
  .chain-bottom button {width: 36px; height: 36px;}
  .chain-more {font-size: 21px;}
  .chain-note {font-size: 11px;}
  .freedom-content {position: relative; inset: auto; padding: 30px 24px;}
  .freedom h2, .freedom h2 em {font-size: clamp(35px, 9vw, 48px);}
  .freedom-rule {margin-top: 28px;}
  .hero {padding-top: calc(var(--scene-media-height) + 62px); min-height: 0;}
  .hero > .ambient-video, .hero > .shade {top: 62px;}
  .hero-title {position: relative; inset: auto; transform: none; width: auto; padding: 18px 16px 12px;}
  .hero h1 {font-size: clamp(45px, 14vw, 85px);}
  .hero h1 em {font-size: 26px;}
  .hero-title > .eyebrow {font-size: 8px; margin-bottom: 20px;}
  .hero-foot {position: relative; inset: auto; display: flex; gap: 23px; padding: 14px 24px 35px;}
  .hero .film-beat {min-height: 105px;}
  .hero .hero-note {display: block; font-size: 9px; line-height: 1.6;}
  .hero.title-moment .hero-title {opacity: 1; visibility: visible;}
  .steam-finale {min-height: 660px;}
  .film-chapters {flex-wrap: wrap;}
  .film-chapters button {min-height: 36px;}
  #cinema {width: 100vw; max-width: 100vw; max-height: 94svh;}
  #cinema video {object-fit: contain; max-height: 66svh;}
}

/* A phone held sideways has width but little height: keep the movie and controls accessible. */
@media (orientation: landscape) and (max-height: 540px) and (max-width: 1100px) {
  .masthead {height: 54px; padding: 0 20px;}
  .scene {height: auto; min-height: 720px;}
  .hero {min-height: 740px;}
  .scene .scene-content, .scene .scene-content.right {width: 46%;}
  .landscape {min-height: 730px;}
  .scene.landscape .scene-content {width: 34%; left: 4%; top:95px; transform:none;}
  .scene.landscape h2 {font-size: 32px;}
  .scene.landscape .landscape-ring {grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 30px 8px;}
  .scene.landscape .landscape-ring button {width: 38px; height: 38px;}
  .world-window {top: 95px; transform:none;}
  dialog {max-height: 94svh;}
  #cinema video {height: 72svh; max-height: 72svh; width: 100%; object-fit: contain;}
  .cinema-caption {padding: 12px 22px;}
}

@media (orientation: landscape) and (max-height: 540px) and (max-width: 760px) {
  .scene {min-height: 0;}
  .hero {min-height: 0;}
  .scene .scene-content, .scene .scene-content.right, .scene.landscape .scene-content {width: auto; left: auto; top:auto;}
  .world-window {top: auto;}
}

/* Keep the closing title inside the same 16:9 media area on phones.
   The section copy and nation controls stay in normal document flow below it. */
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) {
  #nations .nation-finale {
    inset: 0 0 auto;
    width: 100%;
    height: var(--scene-media-height);
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-size: clamp(26px, 7vw, 56px);
  }
  #nations .nation-finale em {margin: 4px 0;}
  #nations .nation-finale small {
    margin-top: 10px;
    font-size: clamp(7px, 1.8vw, 10px);
    letter-spacing: .25em;
  }
  #nations.title-moment #nation-description {visibility: visible;}
}
