:root {
  --bg: #060505;
  --panel: rgba(12, 10, 9, 0.82);
  --text: #f2efe9;
  --text-dim: #9b948a;
  --accent: #c9a96a;
  --accent-soft: rgba(201, 169, 106, 0.16);
  --border: rgba(242, 239, 233, 0.12);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
}

a-scene {
  position: fixed;
  inset: 0;
}

/* ---- 2D mode: flat portrait video (subject on backdrop), no VR180 sphere ---- */
.lm-video { display: none; }
html:has(body.format-2d),
body.format-2d { background: #fff; }  /* white room behind the video — never let the dark theme show as a border */
body.format-2d a-scene { display: none !important; }
body.format-2d .lm-video {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* show the whole standing figure; margins match the room */
  background: #fff;       /* white-backdrop footage: side margins read as the room, not a black border */
  z-index: 1;
  opacity: 0;                        /* two stacked layers crossfade between clips */
  transition: opacity 420ms ease;
}
body.format-2d .lm-video.active-2d { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  body.format-2d .lm-video { transition: opacity 120ms ease; }
}

/* ---- fade layer over the sphere during clip swaps ---- */
#fade-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
  z-index: 4;
}
#fade-overlay.visible { opacity: 1; }
body.format-2d #fade-overlay { background: #fff; }  /* white-room fade, not a dark flash between clips */

/* ---- header ---- */
.lm-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 20px 28px;
  z-index: 6;
  pointer-events: none;
}
.lm-wordmark {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.lm-subject {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* ---- entry gate ---- */
.enter-gate {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at center, rgba(6, 5, 5, 0.38), rgba(6, 5, 5, 0.82) 88%);
  z-index: 8;
  transition: opacity 700ms ease;
}
.enter-gate h1, .enter-gate p {
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
}
.enter-gate.leaving { opacity: 0; pointer-events: none; }
.enter-gate h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 7vw, 64px);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.enter-gate p {
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.04em;
}
.enter-gate button {
  margin-top: 18px;
  padding: 13px 38px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 240ms ease, color 240ms ease;
}
.enter-gate button:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ---- ask panel ---- */
.ask-panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 32px));
  padding: 18px 22px calc(22px + env(safe-area-inset-bottom));
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  z-index: 6;
  transition: opacity 500ms ease, transform 500ms ease;
}
.ask-panel.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(24px);
  pointer-events: none;
}

.lm-status {
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 12px;
  min-height: 22px;
  transition: color 300ms ease;
}
.lm-status.active { color: var(--accent); }

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 48vh;
  overflow-y: auto;
  transition: max-height 340ms ease, opacity 240ms ease, margin 240ms ease;
}
.ask-panel.chips-collapsed .chips {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  overflow: hidden;
}

/* Collapsible handle — lets mobile shrink the panel to a slim bar so the
 * subject stays visible; tap or swipe up to reveal the questions. */
.chips-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0 0 10px;
  background: none;
  border: none;
  cursor: pointer;
}
.chips-toggle-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(242, 239, 233, 0.28);
}
.chips-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.chips-toggle-label::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 300ms ease;
}
.ask-panel.chips-collapsed .chips-toggle-label::after {
  transform: rotate(-135deg) translateY(1px);
}

/* Tighter panel on phones so the subject stays in view. */
@media (max-width: 640px) {
  .ask-panel {
    width: 100%;
    padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }
  .lm-status { font-size: 15px; margin-bottom: 10px; }
  .chips { gap: 7px; }
  .chips button { font-size: 11px; padding: 6px 12px; }
  .chip-group-label { font-size: 9px; margin-top: 2px; }
}
.chips button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 220ms ease, color 220ms ease, background 220ms ease;
}
.chips button svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.chip-group-label {
  flex-basis: 100%;
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.75;
  margin-top: 4px;
}
.chips button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.ask-form {
  display: flex;
  gap: 8px;
}
.ask-form input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(242, 239, 233, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 220ms ease;
}
.ask-form input:focus { border-color: var(--accent); }
.ask-form input::placeholder { color: var(--text-dim); }

.ask-form button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 220ms ease, color 220ms ease;
}
.ask-form button:hover { border-color: var(--accent); color: var(--accent); }
.ask-form button:disabled { opacity: 0.45; cursor: default; }

#mic-btn.listening {
  border-color: var(--accent);
  color: var(--accent);
  animation: mic-pulse 1.4s ease infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 7px transparent; }
}

/* ---- booking CTA ---- */
.booking-link {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 220ms ease;
}
.booking-link::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
.booking-link:hover { color: var(--accent); }
.booking-link.hidden { display: none; }

.booking-prompt {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  max-width: calc(100% - 32px);
  background: linear-gradient(180deg, rgba(26, 20, 14, 0.96), rgba(12, 10, 9, 0.96));
  border: 1px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: booking-rise 500ms ease;
}
.booking-prompt.hidden { display: none; }
@keyframes booking-rise {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.booking-prompt p {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
  margin: 0;
}
.booking-prompt-btn {
  flex-shrink: 0;
  padding: 10px 18px;
  background: var(--accent);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 8px;
  transition: opacity 220ms ease;
}
.booking-prompt-btn:hover { opacity: 0.88; }
.booking-prompt-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.booking-prompt-close:hover { color: var(--text); }
@media (max-width: 520px) {
  .booking-prompt { flex-wrap: wrap; justify-content: center; text-align: center; }
}

/* keep A-Frame's VR/AR buttons clear of the ask panel (top-right corner) */
.a-enter-vr, .a-enter-ar {
  bottom: auto !important;
  top: 16px !important;
  right: 16px !important;
  left: auto !important;
}
.a-enter-ar { right: 78px !important; }

/* On devices with no VR headset (kiosk boxes, desktops), A-Frame's own VR/AR
 * fullscreen switches to headset mode and hides the clean HTML panel — hide
 * those buttons and use our page-fullscreen button instead. */
.no-headset .a-enter-vr,
.no-headset .a-enter-ar { display: none !important; }

.fs-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  background: rgba(12, 10, 9, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}
.fs-btn:hover { border-color: var(--accent); color: var(--accent); }
.fs-btn.hidden { display: none; }

/* ---- kiosk mode (walk-up holobox): right-side controls, tap-to-talk ---- */
.kiosk-controls { display: none; }
.kiosk-tap { display: none; }

/* Transparent full-screen layer so a finger tap registers everywhere (a touch
 * on the WebGL canvas doesn't reliably fire a click; an HTML layer does). Sits
 * above the scene but below the panel and side controls. */
body.kiosk .kiosk-tap {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 3;
  background: transparent;
}

body.kiosk .ask-form { display: none; }          /* no on-screen keyboard */
body.kiosk .booking-link { display: none; }
body.kiosk .fs-btn { display: none; }             /* box runs full-screen already */

body.kiosk .ask-panel {
  width: min(760px, calc(100% - 24px));
  padding: 20px 24px calc(28px + env(safe-area-inset-bottom));
}
body.kiosk .lm-status { font-size: 22px; margin-bottom: 16px; }
body.kiosk .chips { gap: 12px; }
body.kiosk .chips button { font-size: 17px; padding: 13px 22px; }
body.kiosk .chips button svg { width: 17px; height: 17px; }
body.kiosk .chip-group-label { font-size: 12px; margin-top: 8px; }
body.kiosk .chips-toggle-label { font-size: 13px; }
body.kiosk .chips-toggle-grip { width: 56px; height: 5px; }

/* Proto-style control column, vertically centered on the right edge. */
body.kiosk .kiosk-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: fixed;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 7;
}
.kiosk-mic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
  color: var(--accent);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background 200ms ease, transform 150ms ease;
}
.kiosk-mic:active { transform: scale(0.94); }
.kiosk-mic.listening {
  background: var(--accent);
  color: var(--bg);
  animation: kiosk-mic-pulse 1.3s ease infinite;
}
@keyframes kiosk-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 169, 106, 0.5); }
  50% { box-shadow: 0 0 0 22px rgba(201, 169, 106, 0); }
}
.kiosk-hint {
  max-width: 110px;
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--text);
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}
.kiosk-home {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: rgba(12, 10, 9, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  cursor: pointer;
  transition: transform 150ms ease, border-color 200ms ease, color 200ms ease;
}
.kiosk-home:hover { border-color: var(--accent); color: var(--accent); }
.kiosk-home:active { transform: scale(0.94); }

/* ---- 2D "person in the box": keep the feet clear ----
 * On the white 2D kiosks the bottom question panel covers the subject's feet and
 * breaks the standing-in-the-box illusion, so it's hidden until the visitor asks
 * for it with the list button. Voice (the big mic) still works without it. */
.kiosk-questions { display: none; }
body.kiosk.format-2d .kiosk-questions {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(12, 10, 9, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}
body.kiosk.format-2d .kiosk-questions:hover { border-color: var(--accent); color: var(--accent); }
body.kiosk.format-2d .kiosk-questions:active { transform: scale(0.94); }
body.kiosk.format-2d.questions-open .kiosk-questions {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
body.kiosk.format-2d .ask-panel {
  opacity: 0;
  transform: translateX(-50%) translateY(24px);
  pointer-events: none;
}
body.kiosk.format-2d.questions-open .ask-panel {
  opacity: 1;
  transform: translateX(-50%);
  pointer-events: auto;
}
