/* Onboarding, the display popover and the reserved narration slot.
   Behaviour lives in exploration.js. Tokens come from /style.css. */

/* Display popover (daylight, labels, orbit, interior, reset) -------------- */
.display-panel {
  position: absolute; top: calc(100% + 10px); right: 0; width: min(340px, calc(100vw - 2 * var(--gutter)));
  padding: 14px 16px 12px; background: var(--ink-veil); color: var(--paper-text); border: 1px solid var(--line-paper);
  border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  z-index: var(--z-panel); text-align: left; max-height: calc(100dvh - var(--header-h) - 50px);
  overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
header:has(#explore-panel:not([hidden])) { z-index: calc(var(--z-panel) + 1); }
.light-control { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 2px 0 12px; border-bottom: 1px solid var(--line-paper); }
.control-caption { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--bronze-2); }
.light-control input { width: 100%; height: 24px; margin: 0; accent-color: var(--bronze-2); cursor: pointer; }
.light-control output { min-width: 98px; font-size: 12.5px; color: var(--paper-text-2); text-align: right; }
.toggles { display: flex; flex-direction: column; gap: 1px; padding: 8px 0 2px; }
.toggles button { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 8px; border-radius: var(--radius-s); font-size: 13.5px; font-weight: 500; text-align: left; }
.toggles button:hover { background: rgb(246 241 231 / .08); }
.toggle-dot { flex: none; position: relative; width: 30px; height: 17px; border-radius: 9px; background: rgb(246 241 231 / .16); border: 1px solid rgb(246 241 231 / .22); transition: background-color .18s, border-color .18s; }
.toggle-dot::after { content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper-text-2); transition: transform .18s, background-color .18s; }
button[aria-pressed=true] .toggle-dot { background: var(--bronze-2); border-color: var(--bronze-2); }
button[aria-pressed=true] .toggle-dot::after { transform: translateX(13px); background: var(--ink); }
.reset-button { margin-top: 6px; color: var(--bronze-3); font-weight: 600; }
.display-panel .hints { margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--line-paper); font-size: 12px; line-height: 1.55; color: var(--paper-text-2); }
.display-panel footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-top: 10px; }
.display-panel footer button { padding: 4px 0; font-size: 12px; color: var(--paper-text-2); text-align: left; }
.display-panel footer button:hover { color: var(--paper-text); text-decoration: underline; text-underline-offset: 3px; }
.display-panel footer button span { color: var(--bronze-2); }

/* Welcome card (first visit) ------------------------------------------------ */
/* The welcome takes the interpretive label's place on first visit so the
   model itself stays uncovered; the label appears once exploring begins. */
.welcome {
  position: absolute; left: var(--gutter); top: calc(18px + var(--header-h) + 14px);
  width: min(400px, calc(100% - 2 * var(--gutter))); max-height: calc(100dvh - 18px - var(--header-h) - 14px - var(--strip-h) - 40px); overflow: auto;
  padding: 22px 26px 20px; background: var(--paper-veil); color: var(--ink);
  border: 1px solid rgb(29 36 39 / .1); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); z-index: var(--z-welcome);
}
#experience:has(#welcome.welcome-manual:not([hidden])) .detail-card { display: none; }
@media (min-height: 521px) { #experience:not(.exploring):has(#welcome:not([hidden])) .detail-card { display: none; } }
.welcome .eyebrow { color: var(--bronze); }
.welcome h2 { font-family: var(--font-display); font-weight: 500; font-size: 28px; line-height: 1.08; letter-spacing: -.01em; margin: 8px 0 10px; }
.welcome p { font-size: 14px; line-height: 1.65; color: var(--ink-2); margin: 0; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.welcome-actions button { min-height: 40px; padding: 0 15px; border-radius: var(--radius-s); border: 1px solid var(--line-ink); background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 600; }
.welcome-actions button:hover { background: var(--paper-2); }
.welcome-actions .primary { background: var(--ink); color: var(--paper-text); border-color: var(--ink); }
.welcome-actions .primary:hover { background: var(--ink-2); }
.welcome .welcome-hint { margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.exploring .welcome { display: none; }
.welcome-brief { display: none; }
@media (max-width: 760px) {
  /* A short sheet: one line of copy and one row of actions, so the Temple
     front stays visible behind it on a phone. */
  .welcome { top: auto; bottom: calc(12px + var(--strip-h) + 14px); left: var(--gutter); right: var(--gutter); width: auto; max-height: calc(100dvh - 160px); padding: 14px 16px 14px; }
  .welcome h2 { font-size: 21px; margin: 5px 0 6px; }
  .welcome p { font-size: 13px; line-height: 1.5; }
  .welcome-long, .welcome .welcome-hint { display: none; }
  .welcome-brief { display: block; }
  .welcome-actions { margin-top: 10px; gap: 5px; flex-wrap: nowrap; }
  .welcome-actions button { flex: 1 1 0; padding: 0 6px; min-height: 40px; font-size: 12.5px; white-space: nowrap; }
}
@media (max-height: 520px) { .welcome { display: none; } }

/* An explicit request stays available in every orbit view, including short
   windows. Only its own contents scroll; the header and route remain clear. */
.welcome.welcome-manual {
  display: block; top: calc(18px + var(--header-h) + 14px); bottom: auto;
  max-height: calc(100dvh - 18px - var(--header-h) - 14px - var(--strip-h) - 40px - var(--narration-h));
  overflow: auto; overscroll-behavior: contain;
}
@media (max-height: 520px) {
  .welcome.welcome-manual {
    top: calc(8px + var(--header-h) + 8px);
    max-height: calc(100dvh - 8px - var(--header-h) - 8px - var(--strip-h) - 28px - var(--narration-h));
    padding: 14px 16px;
  }
  .welcome.welcome-manual h2 { font-size: 21px; margin: 5px 0 6px; }
  .welcome.welcome-manual .welcome-long, .welcome.welcome-manual .welcome-hint { display: none; }
  .welcome.welcome-manual .welcome-brief { display: block; font-size: 13px; line-height: 1.5; }
  .welcome.welcome-manual .welcome-actions { margin-top: 10px; gap: 5px; flex-wrap: nowrap; }
  .welcome.welcome-manual .welcome-actions button { flex: 1 1 0; padding: 0 6px; min-height: 40px; font-size: 12.5px; white-space: nowrap; }
}

/* Reserved narration slot: the narration team unhides #listen and fills
   #narration-player. Both inherit the ink tool surface so they sit with the
   existing controls without further styling. --------------------------------- */
#experience:has(#narration-player:not([hidden])) { --narration-h: 56px; }
.narration-player {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--strip-h) + 10px); z-index: var(--z-ui);
  display: flex; align-items: center; gap: 10px; width: min(560px, calc(100% - 2 * var(--gutter))); min-height: 44px; max-height: 56px; padding: 6px 10px 6px 14px;
  background: var(--ink-veil); color: var(--paper-text); border: 1px solid var(--line-paper); border-radius: var(--radius);
  box-shadow: var(--shadow-soft); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-size: 13px;
}
.narration-player button { min-height: 36px; padding: 0 12px; border-radius: var(--radius-s); background: rgb(246 241 231 / .1); font-weight: 600; }
.narration-player button:hover { background: rgb(246 241 231 / .18); }
.narration-player .primary, .narration-player button[aria-pressed=true] { background: var(--paper); color: var(--ink); }
.narration-player progress, .narration-player input[type=range] { flex: 1; min-width: 60px; accent-color: var(--bronze-2); }
.narration-player .narration-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listen-button[aria-pressed=true] { background: var(--paper); color: var(--ink); }
@media (max-width: 760px) { .narration-player { bottom: calc(12px + var(--strip-h) + 8px); } }
@media (max-height: 520px) { .narration-player { bottom: calc(8px + var(--strip-h) + 8px); } }
