/* Audio guide: start screen and persistent audio bar. Both are installed by
   JavaScript only, so a failed script never hides or blocks the exhibition. */

/* ---------- Start screen ---------- */
dialog.guide-welcome {
  position: fixed;
  inset: 0;
  z-index: 3000;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  color: var(--ink, #242620);
  background: var(--paper, #e9e5dc);
  font: 400 15px/1.7 var(--sans, 'DM Sans', Arial, sans-serif);
}
dialog.guide-welcome:not([open]) { display: none; }
.guide-welcome::backdrop { background: var(--paper, #e9e5dc); }
.guide-welcome-open .guide-listening { visibility: hidden; }
.gw-inner {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  box-sizing: border-box;
  overflow: clip;
  padding: max(32px, env(safe-area-inset-top)) 4.5vw max(26px, env(safe-area-inset-bottom));
}
.gw-circle {
  position: absolute;
  z-index: -1;
  right: 9vw;
  top: 50%;
  width: clamp(150px, 24vw, 380px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--red, #b63824);
  transform: translateY(-50%);
  animation: gw-circle 1.6s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes gw-circle { from { opacity: 0; transform: translateY(-50%) scale(.86); } }
.gw-mark { font-family: var(--display, Manrope, Arial, sans-serif); font-size: 22px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.gw-mark span { display: block; margin-top: 7px; font: 9px var(--sans, 'DM Sans', Arial, sans-serif); letter-spacing: 3.7px; }
.gw-content { width: min(700px, 100%); margin: auto 0; padding: clamp(40px, 8vh, 96px) 0 clamp(32px, 6vh, 70px); }
.gw-eyebrow { margin: 0 0 26px; font-size: 9px; font-weight: 500; letter-spacing: 1.5px; line-height: 1.7; }
.gw-content h1 {
  margin: 0 0 32px;
  font: 500 clamp(64px, 9.5vw, 150px)/.9 var(--display, Manrope, Arial, sans-serif);
  letter-spacing: -.075em;
  outline: none;
}
.gw-content h1 i { font-family: var(--serif, 'Instrument Serif', Georgia, serif); font-weight: 400; font-size: 1.12em; letter-spacing: -.045em; }
.gw-description { max-width: 460px; }
.gw-description p { margin: 0; color: var(--muted, #696b62); font-size: 14px; line-height: 1.8; }
.gw-description p + p { margin-top: 10px; }
.gw-audio { display: flex; align-items: center; gap: 18px; max-width: 460px; margin: 30px 0 26px; padding-top: 24px; border-top: 1px solid var(--line, #c9c7bd); }
.gw-audio-mark { flex: 0 0 40px; display: grid; place-items: center; height: 40px; border: 1px solid var(--ink, #242620); border-radius: 50%; }
.gw-audio-mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.gw-audio strong { font-size: 13px; font-weight: 500; }
.gw-audio p { margin: 2px 0 0; color: var(--muted, #696b62); font-size: 12px; }
.gw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.gw-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  min-height: 52px;
  padding: 0 24px;
  border: 1px solid var(--ink, #242620);
  border-radius: 0;
  background: transparent;
  color: var(--ink, #242620);
  font: 500 12px/1.4 var(--sans, 'DM Sans', Arial, sans-serif);
  cursor: pointer;
  touch-action: manipulation;
  transition: background .3s, color .3s;
}
.gw-actions .gw-allow { min-width: 180px; background: var(--ink, #242620); color: var(--paper, #e9e5dc); }
.gw-actions .gw-allow .icon { width: 16px; height: 16px; margin: 0; }
.gw-actions .gw-allow:hover { background: var(--red, #b63824); border-color: var(--red, #b63824); }
.gw-actions .gw-quiet:hover { background: var(--ink, #242620); color: var(--paper, #e9e5dc); }
.gw-actions button:focus-visible { outline: 2px solid var(--red, #b63824); outline-offset: 5px; }
.gw-note { margin: 14px 0 0; color: var(--muted, #696b62); font-size: 10px; }
.gw-bottom { display: flex; justify-content: space-between; gap: 20px; padding-top: 18px; border-top: 1px solid var(--line, #c9c7bd); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; }
@media (max-width: 800px) {
  .gw-inner { padding-left: 6vw; padding-right: 6vw; }
  .gw-mark { font-size: 18px; }
  .gw-mark span { font-size: 7px; letter-spacing: 3px; }
  .gw-circle { right: -10vw; top: 21%; width: 42vw; }
  .gw-eyebrow { font-size: 8px; margin-bottom: 20px; max-width: 70%; }
  .gw-content h1 { font-size: clamp(56px, 17vw, 86px); margin-bottom: 26px; }
  .gw-description p { font-size: 13px; }
  .gw-audio { gap: 14px; margin: 26px 0 22px; padding-top: 20px; }
  .gw-actions button { min-height: 50px; padding: 0 18px; font-size: 12px; }
  .gw-actions .gw-allow { gap: 22px; min-width: 150px; }
  .gw-bottom { font-size: 7px; }
}
@media (max-width: 380px) {
  .gw-actions { display: grid; grid-template-columns: 1fr; }
  .gw-actions button { width: 100%; }
}
@media (max-height: 640px) and (min-width: 801px) {
  .gw-content { padding: 28px 0; }
  .gw-content h1 { font-size: 72px; }
}
@media (prefers-reduced-motion: reduce) { .gw-circle { animation: none; } }

/* ---------- Persistent audio bar ---------- */
.guide-listening {
  position: fixed;
  z-index: 2100;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100vw - 36px);
  color: var(--paper, #e9e5dc);
  font: 400 12px/1.5 var(--sans, 'DM Sans', Arial, sans-serif);
  pointer-events: none;
}
.guide-listening[hidden] { display: none !important; }
.guide-bar {
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 3px 5px 3px 6px;
  border-radius: 30px;
  background: #242620f0;
  box-shadow: 0 6px 24px #24262033;
  backdrop-filter: blur(12px);
  pointer-events: auto;
}
.guide-listening button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0 11px;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.guide-listening button:hover { background: #e9e5dc1a; }
.guide-listening button:focus-visible { outline: 2px solid var(--red, #b63824); outline-offset: 2px; }
.guide-listening button:disabled { color: #e9e5dc59; cursor: default; background: transparent; }
.guide-listening .icon { width: 18px; height: 18px; margin: 0; vertical-align: middle; }
.guide-listening svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.guide-icon { display: inline-flex; color: #e9e5dcb3; }
.guide-toggle[aria-pressed="true"] .guide-icon { color: #e05b43; }
.guide-listening[data-state="narrating"] .guide-toggle .guide-icon { animation: guide-pulse 1.8s ease-in-out infinite; }
@keyframes guide-pulse { 50% { opacity: .45; } }
.guide-divider { width: 1px; height: 18px; margin: 0 3px; background: #e9e5dc40; }
.guide-status {
  max-width: 260px;
  margin: 5px 0 0 14px;
  overflow: hidden;
  color: var(--ink, #242620);
  font-size: 9px;
  letter-spacing: .4px;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: max-content;
  padding: 1px 8px;
  border-radius: 10px;
  background: #e9e5dcd9;
}
.guide-status:empty { display: none; }
dialog .guide-status { color: var(--paper, #e9e5dc); background: #1b1e19cc; }
.guide-transcript {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  width: min(440px, calc(100vw - 36px));
  max-height: min(65svh, 580px);
  box-sizing: border-box;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 22px;
  border: 1px solid var(--line, #c9c7bd);
  background: var(--paper, #e9e5dc);
  color: var(--ink, #242620);
  box-shadow: 0 16px 50px #24262040;
  pointer-events: auto;
}
.guide-transcript[hidden] { display: none !important; }
.guide-transcript-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.guide-transcript h2 { margin: 0; font: 500 24px/1.1 var(--display, Manrope, Arial, sans-serif); letter-spacing: -.04em; }
.guide-transcript .guide-transcript-close { min-height: 36px; padding: 0 10px; font-size: 11px; }
.guide-transcript .guide-transcript-close:hover { background: #2426200f; }
.guide-transcript .guide-transcript-close .icon { width: 14px; height: 14px; }
.guide-transcript-intro { margin: 10px 0 0; color: var(--muted, #696b62); font-size: 12px; }
.guide-transcript article { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line, #c9c7bd); }
.guide-transcript h3 { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 6px; font-size: 9px; font-weight: 500; letter-spacing: 1.5px; text-transform: uppercase; }
.guide-voice { color: var(--muted, #696b62); font-weight: 400; letter-spacing: 1px; }
.guide-transcript article p { margin: 0; font-size: 13px; line-height: 1.75; }
.guide-credit { margin: 20px 0 0; color: var(--muted, #696b62); font-size: 10px; }
.guide-transcript a { text-decoration: underline; text-underline-offset: 3px; }
.guide-ready footer { padding-bottom: max(120px, calc(105px + env(safe-area-inset-bottom))); }
.guide-ready .hero-bottom p { transform: translateY(-70px); }
.guide-static-link { display: inline-block; margin-top: 10px; text-decoration: underline; text-underline-offset: 3px; }
/* Reserve a separate row below the viewer controls so every control can be used. */
#art-dialog:has(.guide-listening) { padding-bottom: max(110px, calc(94px + env(safe-area-inset-bottom))); }
@media (max-width: 800px) {
  .guide-ready .hero-side-note { bottom: 162px; }
  .guide-listening { left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .guide-listening button { min-width: 44px; min-height: 44px; padding: 0 10px; }
  .guide-status { max-width: 210px; font-size: 8px; }
  .guide-transcript { width: min(400px, calc(100vw - 24px)); max-height: 62svh; padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { .guide-listening[data-state="narrating"] .guide-toggle .guide-icon { animation: none; } }
@media (prefers-reduced-motion: reduce) { .guide-welcome *, .guide-listening * { animation: none !important; transition: none !important; } }
@media print { dialog.guide-welcome, .guide-listening { display: none !important; } }

/* A sound-first arrival, with a compact control after the first scroll. */
.gw-content{width:min(720px,100%)}
.gw-audio{background:#ddd6c9;padding:20px 22px;border:0;border-left:3px solid var(--red);margin-top:24px}
.gw-audio strong{font-size:16px}.gw-actions .gw-allow{background:var(--red);border-color:var(--red);min-height:58px;font-size:14px;min-width:225px}
.gw-actions .gw-quiet{border-color:transparent;text-decoration:underline;text-underline-offset:5px;font-size:12px}
.gw-circle{opacity:.1;width:clamp(250px,42vw,650px);right:-9vw}
.gw-content h1{font-size:clamp(62px,8.5vw,132px)}
.guide-invitation{display:none;position:relative;pointer-events:auto;padding:20px 22px 16px;background:var(--paper);color:var(--ink);border:1px solid var(--line);border-top:3px solid var(--red);width:min(355px,calc(100vw - 24px));margin-bottom:12px;box-shadow:0 10px 35px #0001}
.guide-expanded .guide-invitation{display:block}.guide-invitation strong{font:400 27px/1.1 var(--serif)}.guide-invitation p{font-size:12px;line-height:1.6;margin:9px 0}.guide-invitation button{font-size:10px;text-decoration:underline;padding:0;min-height:28px;color:var(--muted)}
@media(max-width:800px){.gw-inner{padding-top:25px;padding-bottom:20px}.gw-content{padding:35px 0 28px}.gw-content h1{font-size:clamp(55px,14vw,86px);margin-bottom:22px}.gw-eyebrow{max-width:100%;margin-bottom:18px}.gw-description p{font-size:13px}.gw-audio{padding:16px;margin:20px 0 18px}.gw-audio strong{font-size:15px}.gw-actions{display:grid;grid-template-columns:1fr}.gw-actions button{width:100%;min-height:48px}.gw-actions .gw-allow{min-height:58px}.gw-note{margin-top:8px}.gw-bottom{padding-top:12px}.guide-invitation{padding:15px 18px 10px}.guide-invitation strong{font-size:25px}}

@media(max-width:800px) and (max-height:740px){.gw-inner{padding-top:20px;padding-bottom:16px}.gw-content{padding:20px 0}.gw-content h1{font-size:54px;margin-bottom:16px}.gw-eyebrow{margin-bottom:14px;font-size:7px}.gw-description p{font-size:12px;line-height:1.5}.gw-audio{margin:16px 0 12px;padding:13px}.gw-audio p{font-size:11px}.gw-audio-mark{flex-basis:32px;height:32px}.gw-actions{gap:3px}.gw-note{font-size:9px}.gw-bottom{display:none}}
