/* Scenes page. The shell, type and colour come from /site-shell.css; this file lays out the
   scene strip, the live 3D stage, the film chapters and the film dialog.

   Design language (shared with the homepage, leaderboard and blog): display sans headlines set
   semibold and tight, mono caps labels, hairline rules between sections, 4px controls with a
   inline arrow, 10px media corners, dark glass chips over footage. */

/* ---------- scene strip: one link per scene, the current one underlined ---------- */
.scene-strip { display: flex; gap: 26px; margin: -32px 0 44px; padding: 4px 0 14px; border-bottom: 1px solid var(--hair); overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.scene-strip::-webkit-scrollbar { display: none; }
.scene-strip .caps-link { flex: none; color: var(--faint); transition: color .25s; }
.scene-strip .caps-link:hover, .scene-strip .caps-link[aria-current] { color: var(--ink); }

/* ---------- hero ---------- */
.gallery .hero .lede { max-width: 26em; margin-top: 26px; color: var(--muted); }
.gallery-initial { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 60vh; color: var(--muted); font-size: 16px; }
.page-error { min-height: 56vh; }
.page-error .btn { margin-top: 34px; }

/* ---------- live 3D stage ---------- */
.scene-live, .scene-still { position: relative; margin-top: 44px; aspect-ratio: 16/9; overflow: hidden; border-radius: var(--r); background: var(--mist); isolation: isolate; }
.scene-still > img { width: 100%; height: 100%; object-fit: cover; }
.scene-live-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .4s; }
.scene-live.is-ready .scene-live-poster { opacity: 0; pointer-events: none; }
.scene-viewer-mount { position: absolute; inset: 0; z-index: 1; height: 100%; min-height: 0; }
.scene-live .scene-viewer-instance { height: 100%; min-height: 0; }
.scene-live .unity-recorded-replay { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.scene-live .unity-recorded-replay > .unity-presentation { flex: 1; min-height: 0; }
.scene-live[data-mode=task] { aspect-ratio: 4/3; }
.scene-live .public-unity { font-family: var(--sans); background: transparent; --panel: transparent; }
.scene-live .unity-presentation { background: transparent; border: 0; }
.scene-live .unity-presentation-heading,
.scene-live .unity-presentation > .notice,
.scene-live .unity-presentation > p[role=status] { display: none; }
.scene-live .unity-presentation iframe { opacity: 0; border: 0; width: 100%; height: 100%; min-height: 0; transition: opacity .4s; }
.scene-live.is-ready .unity-presentation iframe { opacity: 1; }

/* notes laid over the stage: dark glass chips, as on the homepage footage */
.scene-live-feedback,
.scene-live .public-unity > .waiting-status,
.scene-live .unity-presentation > .waiting-status,
.scene-unavailable { position: absolute; left: 16px; bottom: 16px; z-index: 3; margin: 0; max-width: calc(100% - 32px); padding: 9px 12px 8px; border-radius: 4px; background: rgba(29,29,31,.72); color: #f5f5f7; font: 14px/1.4 var(--sans); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.scene-live-feedback { z-index: 2; display: flex; align-items: center; gap: 10px; }
.scene-live-feedback.is-error .spinner { display: none; }
.scene-live .public-unity > .waiting-status,
.scene-live .unity-presentation > .waiting-status { width: min(400px, calc(100% - 32px)); }
.scene-live .waiting-status-label { font-family: var(--sans); }
.scene-live .waiting-status-bar { border: 0; height: 3px; border-radius: 3px; accent-color: #f5f5f7; }
.scene-live .public-unity-error,
.scene-live .unity-presentation > [role=alert] { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 4; padding: 14px 16px; border-radius: 4px; background: rgba(29,29,31,.86); color: #f5f5f7; font: 14px/1.6 var(--sans); }
.scene-live .public-unity-error button { margin-top: 10px; padding: 8px 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(245,245,247,.42); font: 500 14px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.scene-unavailable { display: grid; gap: 8px; max-width: min(520px, calc(100% - 32px)); padding: 14px 16px; line-height: 1.6; }
.scene-unavailable .caps-link { justify-self: start; }
.scene-live .scene-loading-caption { font-family: var(--sans); }

/* reload and fullscreen: square glass controls in the stage's top right corner */
.scene-live-controls { position: absolute; z-index: 8; right: 16px; top: 16px; display: flex; gap: 8px; }
.scene-live-controls button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 4px; background: rgba(29,29,31,.72); color: #f5f5f7; font-size: 17px; line-height: 1; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: background .25s; }
.scene-live-controls button:hover { background: #161617; }
.scene-live:fullscreen, .scene-live.is-expanded { aspect-ratio: auto; width: 100%; height: 100dvh; margin: 0; border-radius: 0; }
.scene-live.is-expanded { position: fixed; inset: 0; z-index: 1000; }
body.scene-live-expanded { overflow: hidden; }

/* the five full-town rooms wait for an explicit download choice */
.scene-live[data-presentation=town-room] { width: 100%; min-height: 360px; }
.scene-live .town-room-shell { height: 100%; display: flex; flex-direction: column; background: var(--mist); }
.scene-live .town-room-intro { margin: auto; max-width: 620px; text-align: center; padding: 52px 24px 28px; display: grid; gap: 15px; justify-items: center; }
.scene-live .town-room-intro h3 { font: 600 clamp(21px, 1.7vw, 27px)/1.12 var(--display); letter-spacing: -0.016em; }
.scene-live .town-room-intro p { max-width: 520px; font-size: 16px; line-height: 1.6; }
.scene-live .town-room-download { color: var(--muted); }
.scene-live .town-room-intro button { padding: 13px 14px 12px; border-radius: 4px; background: var(--ink); color: #f5f5f7; font: 500 14px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.scene-live .town-room-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; min-height: 66px; padding: 14px 112px 14px 20px; color: var(--muted); font-size: 14px; }
.scene-live .town-room-toolbar button { flex-shrink: 0; padding: 6px 0; color: var(--ink); font: 500 14px/1.32 var(--mono); letter-spacing: .09em; text-transform: uppercase; box-shadow: inset 0 -1px 0 currentColor; }
.scene-live .town-room-frame { width: 100%; flex: 1; min-height: 0; border: 0; background: var(--night); }
.gallery-room-note { max-width: 62em; margin-top: 18px; }

/* ---------- under the stage: tools on the left, in-page links on the right ---------- */
.hero-bottom { display: flex; align-items: center; justify-content: space-between; gap: 18px 24px; flex-wrap: wrap; margin-top: 22px; }
.hero-tools { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.hero-bottom nav { display: flex; gap: 26px; flex-wrap: wrap; }
.hero-tools .btn[aria-pressed="true"] { background: var(--ink); color: #f5f5f7; box-shadow: none; }
.viewer-replay-note { margin-top: 14px; }

.viewer-options { position: relative; }
.viewer-options > summary { display: inline-flex; align-items: center; gap: 10px; padding: 13px 14px 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--rule); font: 500 14px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; list-style: none; cursor: pointer; transition: box-shadow .25s; }
.viewer-options > summary::-webkit-details-marker { display: none; }
.viewer-options > summary::after { content: "+"; font-family: var(--sans); font-size: 14px; letter-spacing: 0; }
.viewer-options[open] > summary::after { content: "−"; }
.viewer-options > summary:hover, .viewer-options[open] > summary { box-shadow: inset 0 0 0 1px var(--ink); }
.viewer-option-fields { position: absolute; z-index: 12; left: 0; top: calc(100% + 8px); display: grid; gap: 12px; min-width: 270px; padding: 18px; border-radius: 6px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule), 0 18px 44px rgba(0,0,0,.1); }
.viewer-option-fields label { font: 500 13px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.viewer-option-fields select { padding: 9px 10px; border: 0; border-radius: 4px; background: transparent; box-shadow: inset 0 0 0 1px var(--rule); color: var(--ink); font: 16px var(--sans); }
.viewer-option-fields a { color: var(--muted); font-size: 14px; line-height: 1.5; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; transition: color .25s, text-decoration-color .25s; }
.viewer-option-fields a:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- film chapters ---------- */
.gallery .hero + .section, .gallery .hero + .gallery-room-note + .section { margin-top: 64px; }
.gallery-chapter { scroll-margin-top: calc(var(--top) + 12px); }
.chapter-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 40px; flex-wrap: wrap; }
.chapter-head .note { max-width: 30em; }
.mosaic { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 24px; align-items: start; margin-top: 40px; }
.mosaic > .film:first-child, .mosaic > .film:last-child:nth-child(even) { grid-column: 1 / -1; }
.film { position: relative; display: block; width: 100%; min-width: 0; scroll-margin-top: calc(var(--top) + 12px); }
.film-image { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: var(--r); background: var(--mist); isolation: isolate; }
.film-image video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.film-caption { margin-top: 16px; }
.film-caption h3 { font: 600 clamp(17px, 1.35vw, 21px)/1.2 var(--display); letter-spacing: -0.014em; }
.film-caption p { max-width: 58ch; margin-top: 8px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.film-expand { position: absolute; right: 12px; top: 12px; z-index: 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 4px; background: rgba(29,29,31,.72); color: #f5f5f7; font-size: 19px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); opacity: 0; transition: opacity .25s, background .25s; }
.film:hover .film-expand, .film-expand:focus-visible { opacity: 1; }
.film-expand:hover { background: #161617; }
.inline-case-status { position: absolute; left: 12px; top: 12px; z-index: 2; padding: 8px 10px 7px; border-radius: 4px; background: rgba(29,29,31,.72); color: #f5f5f7; font-size: 14px; pointer-events: none; }
.inline-case-status:not([hidden])::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border: 1px solid rgba(245,245,247,.34); border-top-color: #f5f5f7; border-radius: 50%; animation: rle-spin 1s linear infinite; }
.inline-case-retry { position: absolute; left: 12px; bottom: 12px; z-index: 3; padding: 9px 11px 8px; border-radius: 4px; background: rgba(29,29,31,.72); color: #f5f5f7; font: 500 14px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.no-film { margin-top: 64px; }

/* ---------- more scenes ---------- */
.more-scenes .chapter-head { margin-top: 16px; }
.more-scenes .section-title { margin-top: 0; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; }
.more-scene { position: relative; height: clamp(190px, 21vw, 300px); overflow: hidden; border-radius: var(--r); background: var(--mist); }
.more-scene img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.more-scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 38%, rgba(0,0,0,.62)); }
.more-scene > span { position: absolute; left: 22px; right: 22px; bottom: 20px; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #f5f5f7; font: 600 clamp(19px, 1.7vw, 27px)/1.12 var(--display); letter-spacing: -0.016em; }
.more-scene .arr { flex: none; font: 18px/1 var(--sans); }
.more-scene:hover img { transform: scale(1.03); }

/* ---------- film dialog: one on-demand native player ---------- */
.film-dialog { width: min(1180px, calc(100% - 48px)); max-height: 94dvh; padding: 0; overflow: auto; border: 0; border-radius: 8px; background: #161617; color: #f5f5f7; box-shadow: 0 40px 120px rgba(0,0,0,.5); }
.film-dialog::backdrop { background: rgba(0,0,0,.82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 16px 16px 22px; }
.dialog-top h2 { font: 600 17px/1.3 var(--display); letter-spacing: -0.012em; }
.dialog-top button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(245,245,247,.3); color: #f5f5f7; font-size: 18px; line-height: 1; transition: background .25s, color .25s; }
.dialog-top button:hover { background: #f5f5f7; color: #1d1d1f; }
.dialog-video { position: relative; aspect-ratio: 16/9; background: #000000; }
.dialog-video video { display: block; width: 100%; height: 100%; object-fit: contain; }
.video-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(0,0,0,.4); font-size: 14px; pointer-events: none; }
.video-status::before { content: ""; width: 14px; height: 14px; border: 1px solid rgba(245,245,247,.3); border-top-color: #f5f5f7; border-radius: 50%; animation: rle-spin 1s linear infinite; }
.video-error { padding: 14px 22px; background: #1d1d1f; font-size: 14px; line-height: 1.6; }
.video-error button, .video-error a { margin-right: 18px; color: #f5f5f7; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dialog-description { padding: 16px 22px 22px; color: #a1a1a6; font-size: 16px; line-height: 1.6; }
.dialog-description:empty { display: none; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .scene-strip { gap: 20px; margin: -14px 0 32px; }
  .scene-live, .scene-still { margin-top: 30px; }
  .hero-bottom nav { gap: 18px; }
  .gallery .hero + .section, .gallery .hero + .gallery-room-note + .section { margin-top: 44px; }
  .mosaic { gap: 26px 16px; margin-top: 30px; }
  .more-grid { gap: 16px; margin-top: 30px; }
  .viewer-option-fields { left: auto; right: 0; }
}
@media (max-width: 700px) {
  .scene-live, .scene-still { aspect-ratio: 4/3; }
  .scene-live-controls { top: 10px; right: 10px; }
  .mosaic, .more-grid { grid-template-columns: 1fr; }
  .mosaic > .film { grid-column: auto; }
  .film-expand { opacity: 1; }
  .scene-live .town-room-intro { gap: 12px; padding: 54px 18px 24px; }
  .scene-live .town-room-toolbar { align-items: flex-start; flex-direction: column; gap: 4px; padding: 14px 96px 12px 14px; font-size: 14px; }
  .film-dialog { width: calc(100% - 24px); }
}
@media (prefers-reduced-motion: reduce) { .scene-live-poster, .scene-live iframe { transition: none; } }
