/* Local exhibit interface. The quality selector changes rendering, the interface stays on paper. */
:root {
  color-scheme: light;
  --paper: #f4f2ea;
  --background: #f6f7f3;
  --surface: #fff;
  --ink: #17191c;
  --muted: #535955;
  --line: #d9dbd3;
  --border: #8b9389;
  --accent: #ff6b3d;
  --focus: #5162d6;
  --gallery: #e9e6db;
  --sans: "Space Grotesk","Noto Sans SC","PingFang SC","Microsoft YaHei","Segoe UI",sans-serif;
  --serif: "Noto Serif CJK SC","Songti SC","SimSun",serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); font: 400 16px/1.55 var(--sans); }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; font: inherit; touch-action: manipulation; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.frame { width: min(1616px,100%); margin: auto; padding-inline: clamp(16px,3.3vw,56px); }
.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead .frame, .intro-brand { display: flex; align-items: center; gap: 11px; min-height: 54px; font-weight: 700; font-size: 15px; }
.door-mark { position: relative; flex: none; width: 18px; height: 20px; border: 2px solid currentColor; border-bottom: 0; }
.door-mark::before { content: ""; position: absolute; inset: 4px 3px 0; border: 1px solid currentColor; border-bottom: 0; }
main.frame { padding-block: clamp(19px,2.2vw,32px) 24px; }
main > header { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 8px 32px; margin-bottom: 20px; }
main h1 { margin: 0; font: 700 clamp(32px,3.65vw,50px)/1.16 var(--serif); }
main > header p { max-width: 36em; margin: 0 0 2px; color: var(--muted); font-size: 15px; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
nav button, nav a, .panel button, #gate-hotspot, .intro-enter {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: 600 14px/1.45 var(--sans); text-decoration: none;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}
nav svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.nav-tools { margin-inline-start: auto; display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; }
nav a, #show-moisture { background: transparent; }
nav button:hover, nav a:hover, .panel button:hover { background: var(--paper); border-color: var(--ink); }
nav button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.layout {
  display: grid; grid-template-columns: minmax(0,1fr) clamp(250px,22vw,304px);
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: clip;
}
.viewport { min-width: 0; background: var(--gallery); }
.viewport-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 18px; background: var(--paper); border-bottom: 1px solid var(--line); }
.viewport-head strong { font-size: 16px; }
.viewport-type { color: var(--muted); font-size: 13px; }
.mode-walk, body.walk .mode-gallery, body.walk .gallery-strip, body.walk .gallery-actions, body.walk #building-quality-guide, #move { display: none; }
body.walk .mode-walk { display: inline; }
body.walk #move { display: flex; }
#stage { position: relative; height: clamp(435px,calc(100dvh - 284px),780px); overflow: hidden; background: var(--gallery); }
body.walk #stage { background: #384956; }
#stage canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: grab; }
#stage canvas:active { cursor: grabbing; }
#caption, #gate-hotspot { position: absolute; z-index: 2; }
#caption { left: 12px; bottom: 12px; max-width: calc(100% - 24px); padding: 4px 9px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 5px; font-size: 12px; pointer-events: none; }
#gate-hotspot { transform: translate(-50%,-50%); gap: 8px; white-space: nowrap; background: var(--paper); border-color: var(--ink); }
#gate-hotspot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 1px solid var(--ink); }
#gate-hotspot:hover { background: #fff; }
#error { position: relative; z-index: 3; margin: 0; padding: 16px; background: var(--paper); }
aside { min-width: 0; border-inline-start: 1px solid var(--line); }
.panel { padding: 20px; }
.panel + .panel { border-top: 1px solid var(--line); }
.panel h3 { margin: 0 0 13px; font-size: 17px; line-height: 1.4; }
.panel p { margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
#quality { min-height: 3.3em; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.panel button { font-weight: 500; }
.panel button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--background); }
.grade button { position: relative; border: 0; border-radius: 6px; background: transparent; min-height: 37px; }
.grade button[aria-pressed="true"] { background: var(--accent); color: var(--ink); }
.grade button[aria-pressed="true"]::before { content: ""; width: 6px; height: 10px; border: solid currentColor; border-width: 0 1.7px 1.7px 0; transform: translateY(-1px) rotate(45deg); }
#gate-action { margin-top: 16px; background: var(--paper); font-weight: 650; }
#explode { font-weight: 650; }
html.intro-open { overflow: hidden; }
#intro {
  position: fixed; inset: 0; z-index: 10; overflow: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: minmax(0,.82fr) minmax(0,1.18fr); grid-template-rows: auto minmax(0,1fr) auto;
  gap: 12px clamp(24px,4vw,70px); padding: clamp(24px,4vw,66px);
  color: var(--ink); background: var(--paper); transition: opacity 240ms ease;
}
#intro[data-leaving] { opacity: 0; pointer-events: none; }
.intro-brand { grid-column: 1; grid-row: 1; padding-block: 6px; border-top: 1px solid var(--ink); }
.intro-copy { grid-column: 1; grid-row: 2; align-self: center; padding-block: 24px; }
.intro-title { margin: 0; font: 700 clamp(52px,6.2vw,106px)/1.12 var(--serif); }
.intro-lead { max-width: 25em; margin: clamp(16px,1.8vw,28px) 0 0; color: var(--muted); font-size: clamp(16px,1.3vw,20px); line-height: 1.75; }
.intro-enter { gap: 18px; margin-top: 32px; min-height: 48px; padding-inline: 20px; background: var(--accent); border-color: var(--ink); }
.intro-enter:hover { background: #ff825b; }
.intro-enter span { font-size: 20px; line-height: 1; }
.intro-image { grid-column: 2; grid-row: 1/3; display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; object-position: 75% center; border-radius: 5px; }
.intro-credit { grid-column: 2; grid-row: 3; margin: 0; color: var(--muted); font-size: 12px; }
@media(max-width:900px) {
  .layout { grid-template-columns: 1fr; }
  main > header { align-items: start; margin-bottom: 14px; }
  .panel { padding: 16px; }
  aside { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); border-inline-start: 0; border-top: 1px solid var(--line); }
  .panel + .panel { border-top: 0; border-inline-start: 1px solid var(--line); }
  #stage { height: clamp(330px,54svh,565px); }
  .nav-tools { margin-inline-start: 0; }
}
@media(max-width:650px) {
  #intro { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(175px,1fr) auto auto; padding: 20px; gap: 8px; }
  .intro-brand, .intro-copy, .intro-image, .intro-credit { grid-column: 1; }
  .intro-brand { min-height: 36px; }
  .intro-image { grid-row: 2; object-position: 72% 52%; }
  .intro-credit { grid-row: 3; }
  .intro-copy { grid-row: 4; padding: 12px 0 4px; }
  .intro-title { font-size: clamp(42px,10vw,60px); }
  .intro-lead { margin-top: 10px; font-size: 16px; line-height: 1.55; }
  .intro-enter { margin-top: 16px; }
}
@media(max-width:600px) {
  main.frame { padding-top: 16px; }
  .masthead .frame { min-height: 44px; }
  main > header p { font-size: 14px; }
  nav { gap: 6px; }
  .nav-tools {
    display: grid; width: 100%; gap: 6px;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.15fr) auto;
  }
  .nav-tools a { text-align: center; text-wrap: balance; }
  nav button, nav a { min-height: 40px; gap: 4px; padding-inline: 8px; }
  nav svg { width: 15px; height: 15px; }
  #stage { height: clamp(310px,48svh,460px); }
  .viewport-head { padding-inline: 12px; min-height: 40px; }
  aside { display: block; }
  .panel + .panel { border-inline-start: 0; border-top: 1px solid var(--line); }
  .panel { padding: 14px; }
  #quality { min-height: 0; }
  #gate-hotspot { font-size: 13px; padding-inline: 8px; }
}
@media(max-height:490px) and (min-width:651px) {
  #intro { padding: 16px 24px; }
  .intro-copy { padding: 0; }
  .intro-title { font-size: clamp(36px,5.5vw,62px); }
  .intro-lead { margin-top: 8px; font-size: 15px; }
  .intro-enter { margin-top: 12px; }
}
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

.sample-return { margin-left: auto; color: var(--ink); font-size: 14px; font-weight: 500; text-underline-offset: 3px; white-space: nowrap; }

.viewport-tools { display: flex; align-items: center; gap: 14px; }
.viewport-tools button, .stage-actions button, .view-list button {
  border: 1px solid var(--border); color: var(--ink); background: var(--surface);
  border-radius: 7px; font: 550 14px/1.4 var(--sans);
}
.viewport-tools button { padding: 5px 12px; min-height: 32px; }
.walk-steps, #walk-quality-guide { display: none; }
#caption {
  bottom: auto; top: 12px; padding: 5px 10px;
  background: rgba(249,248,243,.95);
}
body.walk .walk-steps, body:not(.walk) .gallery-actions {
  display: flex; gap: 2px; position: absolute; z-index: 2; right: 12px; bottom: 12px;
  padding: 3px; background: rgba(249,248,243,.96); border: 1px solid var(--line); border-radius: 9px;
}
.stage-actions button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 6px 13px; border-color: transparent; background: transparent;
}
.stage-actions button + button { border-inline-start-color: var(--line); }
.stage-actions button span { font-size: 17px; line-height: 1; }
body.walk #move, body:not(.walk) .gallery-strip {
  display: flex; align-items: center; gap: clamp(12px,2vw,25px); margin: 0;
  padding: 12px 16px; border-top: 1px solid var(--line); background: var(--paper);
}
.gallery-actions button[aria-pressed="true"] { background: var(--ink); color: white; }
.strip-label { flex: none; font-size: 14px; font-weight: 650; }
.view-list { flex: 1; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.view-list button {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; min-width: 0; min-height: 48px; text-align: start;
  border-color: var(--line);
}
.view-list img {
  flex: none; display: block; width: clamp(42px,4.3vw,76px); height: auto;
  aspect-ratio: 2 / 1; object-fit: cover; border-radius: 3px;
}
.view-list button[aria-current="location"], .view-list button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 -2px var(--accent); }
.viewport-tools button:hover, .stage-actions button:hover, .view-list button:hover { background: var(--paper); border-color: var(--ink); }
body.walk #walk-quality-guide { display: block; }
#quality {
  position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.quality-guide dl, .quality-guide dd { margin: 0; }
.quality-guide dl > div { padding-inline-start: 12px; border-inline-start: 2px solid var(--line); }
.quality-guide dl > div + div { margin-top: 21px; }
body.stylized .quality-guide .grade-low, body:not(.stylized) .quality-guide .grade-high { border-inline-start-color: var(--accent); }
.quality-guide dt { font-weight: 700; font-size: 15px; }
.quality-guide dd { margin-top: 5px; font-size: 14px; line-height: 1.65; }
.quality-guide .device-note { color: var(--muted); }
@media(min-width:901px) {
  #stage { height: clamp(385px,calc(100dvh - 357px),740px); }
}
@media(min-width:901px) and (max-width:1170px) {
  body.walk #move, body:not(.walk) .gallery-strip { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 12px; }
  .view-list button { gap: 5px; font-size: 13px; }
}
@media(min-width:601px) and (max-width:900px) {
  aside { grid-template-columns: minmax(0,1fr) minmax(0,1.25fr); align-items: start; }
  .quality-guide { grid-column: 2; grid-row: 1 / 3; border-bottom: 0; }
  .scene-notes { grid-column: 1; border-inline-start: 0; border-top: 1px solid var(--line); }
  .browse-strip .view-list { gap: 5px; }
  .view-list button { gap: 5px; }
}
@media(max-width:600px) {
  body.walk #move, body:not(.walk) .gallery-strip { display: block; padding: 10px 12px 12px; }
  .strip-label { display: block; margin-bottom: 6px; }
  .view-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .view-list img { width: 49px; }
  .view-list button { min-height: 44px; font-size: 13px; }
  .stage-actions button { min-height: 44px; }
  .viewport-tools button { min-height: 36px; }
  #caption { top: 8px; left: 8px; }
  body.walk .walk-steps, body:not(.walk) .gallery-actions { right: 8px; bottom: 8px; }
}
