/* Universal viewer interface: entrance screen, visitor controls, help, joystick, full screen.
   Layout only. Colours, typeface and translucencies come from the active brand package
   (brands/<id>/brand.css, CSS variables --ui-*), so a client brand restyles the whole
   interface without touching this file. Room plaques are styled per room (plaques.css). */

:root {
  /* neutral fallbacks, used only if no brand package is loaded; every brand.css overrides them */
  --ui-font: system-ui, sans-serif; --ui-ground: #1a1a1a; --ui-fg: #f4f4f4; --ui-muted: #b9b9b9; --ui-accent: #f4f4f4; --ui-view-bg: #0d0d0d;
  --ui-panel: rgba(26, 26, 26, .86); --ui-panel-strong: rgba(26, 26, 26, .9); --ui-panel-soft: rgba(26, 26, 26, .55); --ui-panel-faint: rgba(26, 26, 26, .35);
  --ui-hairline: rgba(185, 185, 185, .28); --ui-track: rgba(185, 185, 185, .25); --ui-line: rgba(244, 244, 244, .55); --ui-line-strong: rgba(244, 244, 244, .7); --ui-knob: rgba(244, 244, 244, .75);
}

/* ---- type roles (BRAND.md) ---- */
.st-overline { font: 500 11px/1.4 var(--ui-font); letter-spacing: .16em; text-transform: uppercase; }
.st-display { font: 500 36px/1.15 var(--ui-font); letter-spacing: .02em; text-transform: uppercase; }
.st-body { font: 400 15px/1.55 var(--ui-font); }
.st-ui { font: 500 13px/1.3 var(--ui-font); letter-spacing: .04em; }
.st-caption { font: 400 12px/1.45 var(--ui-font); letter-spacing: .02em; color: var(--ui-muted); }

/* ---- buttons ---- */
.st-button { font: 500 13px/1 var(--ui-font); letter-spacing: .04em; color: var(--ui-fg);
  background: var(--ui-panel); border: 1px solid var(--ui-hairline); border-radius: 0; padding: 11px 16px; cursor: pointer; white-space: nowrap;
  transition: border-color .2s, background-color .2s, color .2s; -webkit-tap-highlight-color: transparent; }
.st-button:hover { border-color: var(--ui-line-strong); }
.st-button:focus-visible { outline: 1px solid var(--ui-accent); outline-offset: 3px; }

/* ================= entrance screen ================= */
#entrance { position: fixed; inset: 0; z-index: 20; background: var(--ui-ground); color: var(--ui-fg);
  font-family: var(--ui-font); display: grid; grid-template-columns: minmax(380px, 38%) 1fr;
  transition: opacity .7s ease; }
#entrance.leaving { opacity: 0; pointer-events: none; }
#entrance .en-view { position: relative; overflow: hidden; background: var(--ui-view-bg); }
#entrance .en-view img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%;
  opacity: 0; transition: opacity 1.2s ease; }
#entrance .en-view img.loaded { opacity: 1; }
#entrance .en-panel { display: flex; flex-direction: column; padding: 56px 56px 48px; min-height: 0; min-width: 0; overflow: auto; }
#entrance .en-logo { width: 232px; max-width: 70%; height: auto; display: block; }
#entrance .en-logo-text { margin: 0; width: auto; color: var(--ui-fg); }   /* brand without a logo file: its name */
#entrance .en-main { margin-top: auto; padding-top: 48px; }
#entrance .en-over { color: var(--ui-muted); margin: 0 0 14px; }
#entrance h1 { margin: 0 0 18px; }
#entrance .en-tagline { color: var(--ui-muted); margin: 0 0 40px; }
#entrance .en-help { list-style: none; margin: 0 0 32px; padding: 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; }
#entrance .en-help dt { color: var(--ui-muted); font: 500 11px/1.4 var(--ui-font); letter-spacing: .04em; }
#entrance .en-help dd { margin: 0; color: var(--ui-muted); font: 400 11px/1.4 var(--ui-font); letter-spacing: .02em; opacity: .85; }
#entrance .en-foot { display: flex; align-items: center; gap: 24px; min-height: 44px; }
#entrance .en-progress { flex: 1; max-width: 260px; }
#entrance .en-track { height: 1px; background: var(--ui-track); position: relative; overflow: hidden; }
#entrance .en-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ui-fg); transition: width .35s ease; }
#entrance .en-fill::after { content: ''; position: absolute; right: 0; top: -1px; width: 3px; height: 3px; background: var(--ui-accent); }
#entrance .en-status { margin-top: 10px; font-variant-numeric: tabular-nums; }
#entrance .en-enter { display: inline-flex; align-items: center; gap: 14px; padding: 13px 18px 13px 20px; background: transparent;
  border-color: var(--ui-line); opacity: 0; pointer-events: none; transition: opacity .6s ease, background-color .2s, color .2s, border-color .2s; }
#entrance.ready .en-enter { opacity: 1; pointer-events: auto; }
#entrance.ready .en-progress { display: none; }
#entrance.idle .en-enter { opacity: 1; pointer-events: auto; }   /* on demand: Enter starts loading */
#entrance.idle .en-progress { display: none; }
#entrance .en-enter:hover { background: var(--ui-fg); color: var(--ui-ground); border-color: var(--ui-fg); }
#entrance .en-enter .arrow { display: inline-block; width: 22px; height: 1px; background: currentColor; position: relative; }
#entrance .en-enter .arrow::after { content: ''; position: absolute; right: 0; top: -3px; width: 6px; height: 6px;
  border-top: 1px solid currentColor; border-right: 1px solid currentColor; transform: rotate(45deg); transform-origin: 100% 0; }
#entrance .en-error { color: var(--ui-fg); }
#entrance .en-desktop { display: contents; } #entrance .en-touch { display: none; }
@media (pointer: coarse) { #entrance .en-desktop { display: none; } #entrance .en-touch { display: contents; } }
/* narrow / portrait: view on top, panel below */
@media (max-width: 860px), (max-aspect-ratio: 4/5) {
  #entrance { grid-template-columns: minmax(0, 1fr); grid-template-rows: 40vh minmax(0, 1fr); }
  #entrance .en-view { order: -1; }
  #entrance .en-panel { padding: 28px 24px 28px; }
  #entrance .en-logo { width: 176px; }
  #entrance .en-main { padding-top: 28px; }
  #entrance .st-display { font-size: 28px; }
  #entrance .en-tagline { margin-bottom: 24px; }
  #entrance .en-help { margin-bottom: 24px; }
}
@media (max-height: 620px) and (min-width: 861px) { #entrance .en-panel { padding: 32px 40px; } #entrance .en-help { margin-bottom: 24px; } #entrance .en-tagline { margin-bottom: 24px; } }

/* ================= walkthrough: small brand mark ================= */
#studio-badge { position: fixed; left: 14px; top: 14px; z-index: 3; display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 8px; background: var(--ui-panel-soft); color: var(--ui-fg); pointer-events: none;
  font: 500 10.5px/1 var(--ui-font); letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }
#studio-badge img { width: 20px; height: 20px; display: block; }
#studio-badge span { opacity: .85; }
@media (max-width: 560px) { #studio-badge span { display: none; } #studio-badge { padding: 6px; } #studio-badge.no-mark { display: none; }   /* no brandmark: nothing small enough to show beside the bar */ }

/* ================= walkthrough: controls ================= */
#visitor-bar { position: fixed; right: 14px; bottom: 14px; display: flex; gap: 6px; z-index: 3; }
#visitor-help { position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%); width: max-content; max-width: min(520px, calc(100% - 28px));
  box-sizing: border-box; background: var(--ui-panel-strong); border: 1px solid var(--ui-hairline); padding: 18px 22px 16px; z-index: 3;
  color: var(--ui-fg); font-family: var(--ui-font); transition: opacity .5s; }
#visitor-help.hidden { opacity: 0; pointer-events: none; }
#visitor-help h2 { margin: 0 0 12px; color: var(--ui-muted); }
#visitor-help dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
#visitor-help dt { font: 500 13px/1.45 var(--ui-font); letter-spacing: .04em; white-space: nowrap; }
#visitor-help dd { margin: 0; font: 400 13px/1.45 var(--ui-font); color: var(--ui-muted); }
#visitor-help p { margin: 12px 0 0; }
#visitor-help .row { text-align: right; margin-top: 14px; }
#visitor-help .row .st-button { padding: 9px 16px; }
/* touch: controls at the top right, help below them, the bottom left stays free for the joystick */
@media (pointer: coarse) { #visitor-bar { bottom: auto; top: 14px; } #visitor-help { bottom: auto; top: 64px; } }

/* touch joystick (created by walkControls.js) */
#joystick { border: 1px solid var(--ui-line); background: var(--ui-panel-faint); }
#joystick .knob { background: var(--ui-knob); }

/* ================= full screen / open in new tab (src/ui/fullscreen.js) ================= */
.st-icon { display: inline-flex; align-items: center; gap: 9px; }
.st-icon svg { width: 14px; height: 14px; display: block; flex: none; }
#visitor-bar .st-icon[aria-pressed] { min-width: 0; }
@media (max-width: 560px) { #visitor-bar { gap: 4px; } #visitor-bar .st-button { padding-left: 12px; padding-right: 12px; } #visitor-bar .fs-label { display: none; } #visitor-bar .st-icon { padding-left: 11px; padding-right: 11px; } }
#entrance .en-fs { position: absolute; right: 16px; top: 16px; z-index: 2; padding: 10px; background: var(--ui-panel-soft); }
#entrance .en-fs svg { width: 16px; height: 16px; }

/* ================= artwork viewing panel (src/interaction/artworkViewer.js) =================
   The original image(s) centred at true proportions (a group such as a triptych as one
   composition), with a quiet caption beside or below; the close button sits in the margin, never
   over the picture. Click a picture: full size (scroll / drag to look around; caption steps aside).
   Sizes and position of the figure are set by the script so picture + caption always fit. */
#art-viewer { position: fixed; inset: 0; z-index: 30; background: var(--ui-viewer-bg, rgba(13, 13, 13, .96));
  opacity: 0; transition: opacity .26s ease; touch-action: none; }
#art-viewer.open { opacity: 1; }
#art-viewer .av-stage { position: absolute; inset: 0; overflow: hidden; }
#art-viewer .av-figure { position: absolute; display: flex; opacity: 0; transition: opacity .45s ease; }
#art-viewer.shown .av-figure { opacity: 1; }
#art-viewer .av-figure.side { flex-direction: row; align-items: flex-end; gap: 40px; }
#art-viewer .av-figure.below { flex-direction: column; align-items: flex-start; gap: 22px; }
#art-viewer .av-row { display: flex; flex: none; }
#art-viewer .av-img { display: block; flex: none; user-select: none; -webkit-user-drag: none; box-shadow: 0 18px 60px rgba(0, 0, 0, .45); }
#art-viewer.can-zoom .av-img { cursor: zoom-in; }
/* caption: title, medium, dimensions (brand typeface and palette) */
#art-viewer .av-caption { color: var(--ui-fg); font-family: var(--ui-font); flex: none; }
#art-viewer .av-caption[hidden] { display: none; }
#art-viewer .av-title { font: 500 17px/1.3 var(--ui-font); letter-spacing: .01em; margin-bottom: 10px; }
#art-viewer .av-medium, #art-viewer .av-dims { font: 400 13px/1.55 var(--ui-font); letter-spacing: .02em; color: var(--ui-muted); }
/* full size */
#art-viewer.zoomed .av-stage { overflow: auto; touch-action: pan-x pan-y; scrollbar-width: thin; }
#art-viewer.zoomed .av-figure { position: static; display: block; width: max-content; min-width: 100%; }
#art-viewer.zoomed .av-row { margin: 0 auto; width: max-content; }
#art-viewer.zoomed .av-caption { display: none; }
#art-viewer.zoomed .av-img { cursor: zoom-out; box-shadow: none; }
#art-viewer.zoomed .av-close { background: var(--ui-panel); }
#art-viewer .av-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  background: transparent; border-color: var(--ui-hairline); z-index: 2; }
#art-viewer .av-close svg { width: 18px; height: 18px; }
#art-viewer .av-close:hover { border-color: var(--ui-line-strong); }
#art-viewer .av-loading { position: absolute; left: 50%; top: 50%; width: 160px; transform: translate(-50%, -50%); display: none; }
#art-viewer.loading .av-loading { display: block; }
#art-viewer .av-track { display: block; height: 1px; background: var(--ui-track); position: relative; overflow: hidden; }
#art-viewer .av-fill { position: absolute; top: 0; bottom: 0; width: 30%; background: var(--ui-fg); animation: av-slide 1.1s ease-in-out infinite; }
@keyframes av-slide { from { left: -30%; } to { left: 100%; } }
@media (max-width: 860px), (pointer: coarse) {
  #art-viewer .av-close { top: 12px; right: 12px; }
  #art-viewer .av-title { font-size: 15px; margin-bottom: 6px; }
  #art-viewer .av-medium, #art-viewer .av-dims { font-size: 12px; }
}
/* artworks that open in the panel: a quiet zoom cursor over them (set by artworkLabels.js) */
canvas.art-zoom { cursor: zoom-in !important; }   /* walkControls sets an inline cursor */
