/* Concept tour. Temporary utility styling: no brand colours, logo or typeface. */

:root {
  --ink: #fff;
  --panel: rgba(18, 20, 22, 0.72);
  --panel-solid: rgba(18, 20, 22, 0.9);
  --line: rgba(255, 255, 255, 0.28);
  --line-strong: rgba(255, 255, 255, 0.9);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

.tour-page {
  margin: 0;
  background: #111;
}

.tour {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #111;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* ---------- Exterior ---------- */

.media-box {
  position: absolute; /* size and offset set in tour.js so the 16:9 media covers the stage */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#approach {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s linear;
  background: transparent;
}

.tour[data-stage="approach"] #approach,
.tour[data-stage="interior"] #approach { opacity: 1; }

/* Door click target: percentages of the overview image, measured on the approved render. */
.door {
  position: absolute;
  left: 43.95%;
  top: 39.6%;
  width: 12.1%;
  height: 24.3%;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0);
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s, opacity 0.3s;
  animation: door-pulse 2.6s ease-in-out infinite;
}

.door:hover,
.door:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--line-strong);
  outline: none;
  animation: none;
}

.door:focus-visible { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5); }

.door-tag {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

@keyframes door-pulse {
  0%, 100% { border-color: rgba(255, 255, 255, 0.4); }
  50% { border-color: rgba(255, 255, 255, 0.95); }
}

.tour:not([data-stage="exterior"]) .door,
.tour:not([data-stage="exterior"]) .hint-door {
  opacity: 0;
  pointer-events: none;
}

.hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.4s;
}

.hint-door { bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }

.skip {
  position: absolute;
  right: calc(14px + env(safe-area-inset-right, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.tour[data-stage="approach"] .skip {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Interior ---------- */

.stage-interior {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

.tour[data-stage="interior"] .stage-interior {
  opacity: 1;
  pointer-events: auto;
}

#pano {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  outline: none;
}

#pano.dragging { cursor: grabbing; }
#pano:focus-visible { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.6); }

.labels {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none; /* only the label buttons take input, so dragging works everywhere else */
}

.spot {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  will-change: transform;
}

.spot[hidden] { display: none; }

.spot-btn {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-13px, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
}

.spot-dot {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(18, 20, 22, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
}

.spot-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.spot-text {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

/* Label above or below its dot, used where zones sit close together. */
.spot[data-place="above"] .spot-btn,
.spot[data-place="below"] .spot-btn {
  flex-direction: column;
  gap: 4px;
  transform: translate(-50%, -13px);
}

.spot[data-place="above"] .spot-btn {
  flex-direction: column-reverse;
  transform: translate(-50%, calc(-100% + 13px));
}

.spot-btn:focus-visible .spot-text,
.spot[data-active="true"] .spot-text {
  background: #fff;
  color: #111;
  border-color: #fff;
}

@media (hover: hover) {
  .spot-btn:hover .spot-text {
    background: #fff;
    color: #111;
    border-color: #fff;
  }
}

.spot-btn:focus-visible { outline: none; }
.spot-btn:focus-visible .spot-dot { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6); }

.hint-drag {
  top: 24%; /* clear of the labels that sit around the middle of the opening view */
  transform: translate(-50%, -50%);
}

.hint-drag.gone { opacity: 0; }

/* Zone description */
.card {
  position: absolute;
  left: calc(14px + env(safe-area-inset-left, 0px));
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100% - 28px));
  padding: 14px 40px 14px 16px;
  border-radius: 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  user-select: text;
  -webkit-user-select: text;
}

.tour[data-card="open"] .card {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 650;
}

.card p {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
}

.card-close {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}

.card-close:hover,
.card-close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

/* Bottom strip: zone list. View controls sit top right (bottom right on small screens). */
.bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.zones {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px calc(22px + env(safe-area-inset-right, 0px)) 3px calc(22px + env(safe-area-inset-left, 0px));
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
}

.zones::-webkit-scrollbar { display: none; }

/* Centre the chips when they fit; scroll from the left edge when they do not. */
.zones > :first-child { margin-left: auto; }
.zones > :last-child { margin-right: auto; }

.ctls {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  display: flex;
  gap: 8px;
}

.ctl,
.zone {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ctl-icon {
  width: 44px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

@media (hover: hover) {
  .ctl:hover,
  .zone:hover {
    background: rgba(60, 64, 68, 0.85);
    border-color: rgba(255, 255, 255, 0.6);
  }
}

.ctl:focus-visible,
.zone:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.6);
  outline-offset: 1px;
}

.zone[aria-pressed="true"],
.zone[aria-pressed="true"]:hover {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.ctl:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------- Badge ---------- */

.badge {
  position: absolute;
  left: calc(14px + env(safe-area-inset-left, 0px));
  top: calc(14px + env(safe-area-inset-top, 0px));
  max-width: min(420px, calc(100% - 28px));
  padding: 9px 13px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  pointer-events: none;
}

.badge strong {
  display: block;
  font-size: 15px;
  font-weight: 650;
}

.badge span {
  display: block;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.86);
}

/* ---------- Loading and error ---------- */

.status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 12, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.tour[data-status="loading"] .status,
.tour[data-status="error"] .status {
  opacity: 1;
  pointer-events: auto;
}

.tour[data-stage="loading"] .status { background: #111; }

.status-box {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 320px;
  padding: 20px;
  text-align: center;
}

.status-box p { margin: 0; }

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}

.tour[data-status="error"] .spinner { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
  .ctls {
    top: auto;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* Keep hotspot labels from drawing under the view controls and the zone strip. */
  .labels { bottom: calc(124px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 739px) {
  .tour { font-size: 14px; }

  .card { bottom: calc(128px + env(safe-area-inset-bottom, 0px)); }

  .spot-text {
    font-size: 13px;
    padding: 5px 9px;
  }

  .badge strong { font-size: 14px; }
  .badge span { font-size: 12px; }
}

@media (max-height: 480px) {
  .badge span { display: none; }
}

/* Phone held sideways: the badge is one line, so the controls fit beside it at the top. */
@media (max-height: 480px) and (min-width: 640px) {
  .ctls {
    top: calc(10px + env(safe-area-inset-top, 0px));
    bottom: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .door { animation: none; }
  .stage-interior { transition-duration: 0.2s; }
}
