/*
  Aerial tour palette (from the brand swatches)
  - White  #FFFFFF  → text on navy (10.6:1)
  - Navy   #1E3C78  → main surface
  - Yellow #F0B400  → accents; always paired with dark text, never white (1.9:1 fails)
*/

/* Layout: navy sidebar on the left, full-bleed panorama on the right with glass overlays. */
:root {
  --navy: #1E3C78;
  --navy-deep: #13284F;
  --ink: #0C1A35;
  --yellow: #F0B400;
  --yellow-soft: #FFD36A;
  --white: #FFFFFF;
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.14);
  --glass: rgba(19, 40, 79, 0.78);
  --scrim: rgba(12, 26, 53, 0.95);

  --font-display: 'Montserrat', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --sidebar-width: 340px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background-color: var(--ink);
  color: var(--white);
}

a { text-decoration: none; color: inherit; }

button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
}

button:focus-visible, a:focus-visible, .scene-item:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* Layout */
.tour-layout {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Sidebar */
/* Client logo sits on a white panel with a yellow diagonal, echoing the brand's print ads. */
.tour-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100%;
  background-color: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: left 0.45s var(--ease);
  overflow-y: auto;
}

.brand-panel {
  position: relative;
  background: var(--white);
  padding: 22px 30px 26px;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 0 100%);
}

.brand-panel::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: var(--yellow);
  clip-path: polygon(0 calc(100% - 7px), 100% calc(72% - 7px), 100% 72%, 0 100%);
}

.brand-logo {
  display: block;
  width: 150px;
  height: auto;
}

.sidebar-header {
  padding: 18px 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.brand-tag {
  padding: 4px 10px;
  background-color: var(--yellow);
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 2px;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-wrap: balance;
}

.brand-location {
  font-size: 14px;
  color: var(--muted);
}

.feature-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.feature-chips li {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--navy-deep);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.feature-chips svg { width: 16px; height: 16px; }
.feature-chips strong { color: var(--yellow); font-weight: 600; }

.scene-nav {
  padding: 8px 30px;
}

.nav-title {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 400;
}

.scenes { list-style: none; }

.scene-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 16px;
  font-weight: 300;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.scene-item:last-child { border-bottom: none; }

.scene-item::before {
  content: '';
  width: 4px;
  height: 0;
  border-radius: 2px;
  background: var(--yellow);
  transition: height 0.35s var(--ease);
}

.scene-item .text { transition: transform 0.35s var(--ease); }

.scene-item:hover { color: var(--yellow-soft); }
.scene-item:hover .text { transform: translateX(4px); }

.scene-item.current {
  color: var(--yellow);
  font-weight: 500;
}

.scene-item.current::before { height: 22px; }

/* Nearby */
.nearby {
  padding: 8px 30px 12px;
}

.nearby-list {
  display: grid;
  grid-template-columns: 1fr auto;
}

.nearby-list dt,
.nearby-list dd {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.nearby-list dt {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 300;
}

.nearby-list dt svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--yellow);
}

.nearby-list dd {
  padding-left: 16px;
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.nearby-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-footer {
  margin-top: auto;
  padding: 24px 30px 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cta-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background-color: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  border-radius: 4px;
  transition: background-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.cta-button:hover {
  background-color: var(--yellow-soft);
  transform: translateY(-2px);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.contact-grid a { color: var(--muted); transition: color 0.3s var(--ease); }
.contact-grid a:hover { color: var(--yellow); }

.trust-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.trust-line span {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--yellow);
  letter-spacing: 0;
}

/* Viewer */
.tour-viewer {
  flex: 1;
  position: relative;
  min-width: 0;
  background-color: var(--ink);
}

#pano {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.viewer-header {
  position: absolute;
  top: calc(30px + env(safe-area-inset-top, 0px));
  left: 30px;
  right: calc(30px + env(safe-area-inset-right, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.current-scene-info {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 14px 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--yellow);
  pointer-events: auto;
  min-width: 0;
}

.scene-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--yellow);
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.sceneName {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.action-btn {
  width: 44px;
  height: 44px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.action-btn:hover {
  background: var(--yellow);
  color: var(--ink);
}

.action-btn .icon { width: 20px; height: 20px; }
.action-btn .icon.on { display: none; }
.action-btn.enabled .icon.on { display: block; }
.action-btn.enabled .icon.off { display: none; }

.viewer-controls {
  position: absolute;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  pointer-events: none;
}

.control-group {
  display: flex;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 30px;
  padding: 6px;
  border: 1px solid var(--line);
  pointer-events: auto;
}

.control-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.control-btn svg { width: 18px; height: 18px; }

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.control-btn:active {
  background: var(--yellow);
  color: var(--ink);
}

/* Info hotspots */
.info-hotspot {
  position: relative;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  margin-top: -20px;
  z-index: 10;
}

.info-hotspot-pin {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s var(--ease);
}

.info-hotspot-pin svg { width: 22px; height: 22px; }
.info-hotspot-pin:hover { transform: scale(1.1); }

.info-hotspot.featured .info-hotspot-pin {
  background: var(--yellow);
  color: var(--ink);
  border: 3px solid var(--white);
}

.info-hotspot.featured .info-hotspot-pin::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--yellow);
  z-index: -1;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2); opacity: 0; }
}

.info-hotspot-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
}

/* Pin moved beside the plot in "Completed": label and card open to the left. */
.info-hotspot.side .info-hotspot-label {
  left: auto;
  right: calc(100% + 10px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

.info-hotspot.side .info-hotspot-card {
  left: auto;
  right: calc(100% + 12px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

.info-hotspot.featured .info-hotspot-label {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
}

.info-hotspot-card {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: 260px;
  max-width: 70vw;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-top: 3px solid var(--yellow);
  border-radius: 6px;
  padding: 16px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: none;
  cursor: default;
}

.info-hotspot.visible { z-index: 100; }
.info-hotspot.visible .info-hotspot-card { display: block; }

.info-hotspot-card h4 {
  font-family: var(--font-display);
  font-size: 16px;
  margin-bottom: 6px;
  padding-right: 24px;
}

.info-hotspot-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.info-hotspot-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.info-hotspot-close:hover { color: var(--white); background: rgba(255, 255, 255, 0.1); }
.info-hotspot-close svg { width: 14px; height: 14px; }

/* Renders gallery */
.gallery {
  padding: 4px 30px 8px;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.gallery-thumbs button {
  aspect-ratio: 4 / 3;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  line-height: 0;
}

.gallery-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.gallery-thumbs button:hover img { transform: scale(1.08); }

/* Today / Completed */
.phase-toggle {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 30px;
  pointer-events: auto;
}

.phase-btn {
  padding: 8px 16px;
  border-radius: 26px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--muted);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.phase-btn:hover { color: var(--white); }

.phase-btn.active {
  background: var(--yellow);
  color: var(--ink);
}

.concept-note {
  position: absolute;
  top: calc(98px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--glass);
  color: var(--yellow);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  pointer-events: none;
}

/* Play tour */
.tour-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 14px;
  border-radius: 22px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: background-color 0.3s var(--ease);
}

.tour-btn svg { width: 18px; height: 18px; }
.tour-btn:hover { background: var(--yellow-soft); }
.tour-btn.playing svg { display: none; }

/* Guided tour is the main call to action: larger, with a running-time tag, and a soft
   pulse until it has been played once. */
.tour-btn {
  position: relative;
  height: 48px;
  padding: 0 16px 0 16px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
}

.tour-btn .tour-length {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 10px;
  background: rgba(12, 26, 53, 0.14);
}

.tour-btn.playing .tour-length { display: none; }

.tour-btn.invite::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(240, 180, 0, 0.7);
  animation: tour-invite 2.2s ease-out infinite;
  pointer-events: none;
}

@keyframes tour-invite {
  0% { box-shadow: 0 0 0 0 rgba(240, 180, 0, 0.7); }
  70%, 100% { box-shadow: 0 0 0 14px rgba(240, 180, 0, 0); }
}

.viewer-actions { position: relative; }

.tour-nudge {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 8px;
  border-radius: 12px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--yellow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  white-space: nowrap;
  z-index: 5;
}

.tour-nudge.in { opacity: 1; transform: none; }

.tour-nudge::before {
  content: '';
  position: absolute;
  top: -7px;
  left: var(--arrow-x, 40px);
  width: 12px;
  height: 12px;
  background: inherit;
  border-left: 1px solid var(--yellow);
  border-top: 1px solid var(--yellow);
  transform: rotate(45deg);
}

.tour-nudge-play {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
}

.tour-nudge-play svg { width: 16px; height: 16px; color: var(--yellow); }
.tour-nudge-play:hover { background: rgba(255, 255, 255, 0.08); }

.tour-nudge-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.tour-nudge-close svg { width: 14px; height: 14px; }
.tour-nudge-close:hover { color: var(--white); background: rgba(255, 255, 255, 0.1); }

.action-btn.enabled {
  color: var(--yellow);
  border-color: var(--yellow);
}

.action-btn.enabled:hover { color: var(--ink); }

.tour-caption {
  position: absolute;
  left: 50%;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(580px, calc(100% - 32px));
  padding: 14px 84px 16px 20px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-left: 3px solid var(--yellow);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tour-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.tour-progress span {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  transition: background-color 0.4s var(--ease);
}

.tour-progress span.done,
.tour-progress span.current { background: var(--yellow); }

.tour-caption p {
  font-size: 17px;
  line-height: 1.45;
  text-wrap: balance;
}

.tour-caption p.enter { animation: caption-in 0.6s var(--ease); }

@keyframes caption-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.tour-stop {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.tour-stop:hover { color: var(--white); background: rgba(255, 255, 255, 0.1); }
.tour-stop svg { width: 14px; height: 14px; }

.tour-mute {
  position: absolute;
  top: 12px;
  right: 44px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.tour-mute:hover { color: var(--white); background: rgba(255, 255, 255, 0.1); }
.tour-mute svg { width: 16px; height: 16px; }
.tour-mute .icon.off { display: none; }
.tour-mute.muted .icon.on { display: none; }
.tour-mute.muted .icon.off { display: block; }

.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 6px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

/* Plot outline */
.plot-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.plot-overlay polygon { stroke-linejoin: round; }

.plot-overlay .plot-fill {
  fill: var(--yellow);
  fill-opacity: 0.18;
  transition: fill-opacity 0.6s var(--ease);
}

.plot-overlay .plot-glow {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 7;
  stroke-opacity: 0.55;
}

.plot-overlay .plot-line {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 2.5;
  stroke-dasharray: 10 6;
  animation: plot-march 1.2s linear infinite;
}

.plot-overlay.completed .plot-fill { fill-opacity: 0; }
.plot-overlay.completed .plot-glow { stroke-opacity: 0.3; }

@keyframes plot-march {
  to { stroke-dashoffset: -16; }
}

.plot-label {
  position: absolute;
  transform: translate(-50%, calc(-100% - 8px));
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

/* Horizon labels */
.horizon-label {
  position: relative;
  width: 0;
  height: 0;
  pointer-events: none;
}

.horizon-label .stem {
  position: absolute;
  left: -0.5px;
  bottom: 0;
  width: 1px;
  height: var(--stem);
  background: var(--white);
  opacity: 0.85;
}

.horizon-label .dot {
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid var(--white);
}

.horizon-label .tag {
  position: absolute;
  left: 0;
  bottom: var(--stem);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.horizon-label .tag b {
  color: var(--yellow);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.horizon-label.pulse .dot { animation: spot-pulse 1.4s ease-out infinite; }
.horizon-label.pulse .tag { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.horizon-label.pulse .tag b { color: var(--ink); }

/* Guided tour: place markers, feature labels and the render overlay */
.touring .info-hotspot { opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0.4s; }
#pano { transform-origin: 50% 50%; will-change: transform; }

.tour-spot,
.tour-feature {
  position: relative;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tour-spot .dot,
.tour-feature .dot {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid var(--white);
  box-shadow: 0 0 12px rgba(240, 180, 0, 0.8);
}

.tour-spot .ring {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--yellow);
  animation: spot-ring 1.8s ease-out infinite;
}

.tour-spot .name {
  position: absolute;
  left: 0;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 14px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: mark-in 0.7s var(--ease) both;
}

.tour-feature .line {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2px;
  height: 64px;
  margin-left: -1px;
  background: linear-gradient(to top, var(--yellow), rgba(240, 180, 0, 0.2));
  transform-origin: bottom;
  animation: line-in 0.6s var(--ease) both;
}

.tour-feature .text {
  position: absolute;
  left: 0;
  bottom: 64px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--yellow);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: mark-in 0.7s 0.25s var(--ease) both;
}

.tour-feature.with-image .text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 10px;
}

.tour-feature.with-image .text img {
  display: block;
  width: 230px;
  height: 130px;
  object-fit: cover;
  object-position: 50% 60%;
  border-radius: 4px;
}

/* Spots near the right edge of the photo: the name opens to the left of the dot. */
.tour-spot.align-left .name {
  left: auto;
  right: -14px;
  transform: none;
  animation-name: mark-in-left;
}

@keyframes mark-in-left {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Marks fade out between steps; earlier villa callouts step back as new ones appear. */
.tour-spot,
.tour-feature { transition: opacity 0.6s ease; }
.tour-spot.leaving,
.tour-feature.leaving { opacity: 0; }
.tour-feature.settled { opacity: 0.72; }
.tour-feature.settled .text { border-color: var(--line); }
.tour-feature.settled.with-image .text { padding: 8px 16px; }
.tour-feature.settled.with-image .text img { display: none; }

/* A touch during the tour points to the Stop button. */
.tour-btn.attention,
.tour-stop.attention { animation: stop-attention 0.7s ease-in-out 4; }
.tour-btn.attention { box-shadow: 0 0 0 4px rgba(240, 180, 0, 0.55), 0 0 24px rgba(240, 180, 0, 0.8); }
.tour-stop.attention { color: var(--ink); background: var(--yellow); }

@keyframes stop-attention {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.16); }
}

@keyframes spot-ring {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(3.6); opacity: 0; }
}

@keyframes spot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(240, 180, 0, 0.8); }
  100% { box-shadow: 0 0 0 16px rgba(240, 180, 0, 0); }
}

@keyframes mark-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes line-in {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.tour-render {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}

.tour-render.on { opacity: 1; }

.tour-render img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.tour-render .backdrop {
  position: absolute;
  inset: -40px;
  background: center / cover no-repeat;
  filter: blur(26px) brightness(0.65);
  display: none;
}

/* Portrait screens: show the whole render, framed by its blurred backdrop. */
@media (max-aspect-ratio: 1/1) {
  .tour-render .backdrop { display: block; }
  .tour-render img { object-fit: contain; }
}

.tour-render::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45));
}

/* Road point: dark pin with a road icon, and a facts list in its card */
.info-hotspot.road .info-hotspot-pin {
  background: var(--ink);
  color: var(--yellow);
  border: 2px solid var(--yellow);
}

.info-hotspot.road .info-hotspot-card { width: 290px; }

.card-facts {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.card-facts dt { color: var(--muted); }

.card-facts dd {
  color: var(--yellow);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.card-action {
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 4px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.card-action:hover { background: var(--yellow-soft); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--scrim);
}

.lightbox figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lightbox img {
  max-width: min(1200px, 100%);
  max-height: 80vh;
  border-radius: 4px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.lightbox figcaption {
  font-size: 14px;
  color: var(--muted);
  white-space: pre;
}

.lightbox-nav,
.lightbox-close {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--white);
}

.lightbox-nav:hover,
.lightbox-close:hover { background: var(--yellow); color: var(--ink); }
.lightbox-nav svg, .lightbox-close svg { width: 20px; height: 20px; }

.lightbox-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
}

/* Coordinates helper (#coords) */
.coords-readout {
  position: absolute;
  left: 30px;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  background: var(--yellow);
  color: var(--ink);
  font: 600 13px/1.4 ui-monospace, Menlo, Consolas, monospace;
  padding: 8px 12px;
  border-radius: 4px;
  user-select: all;
}

/* Mobile toggle */
.mobile-menu-toggle {
  display: none;
  position: absolute;
  top: calc(18px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  width: 50px;
  height: 50px;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 50%;
  z-index: 1200;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle .icon { width: 24px; height: 24px; }
.mobile-menu-toggle .icon.on { display: none; }
.mobile-menu-toggle.active .icon.on { display: block; }
.mobile-menu-toggle.active .icon.off { display: none; }

/* Responsive */
@media (max-width: 992px) {
  .tour-sidebar {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    z-index: 1100;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .tour-sidebar.active { left: 0; }

  .brand-panel { padding: 18px 80px 22px 24px; }
  .brand-logo { width: 120px; }
  .sidebar-header, .scene-nav, .nearby, .sidebar-footer { padding-left: 24px; padding-right: 24px; }

  .mobile-menu-toggle { display: flex; }

  .viewer-header {
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: 16px;
    right: calc(78px + env(safe-area-inset-right, 0px));
  }

  .viewer-actions {
    position: absolute;
    top: 62px;
    right: -62px;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }

  .viewer-header { flex-wrap: wrap; }

  .phase-toggle {
    position: absolute;
    top: 66px;
    left: 0;
  }

  .phase-btn { padding: 7px 13px; }

  #fullscreenToggle { display: none; }

  .tour-btn { height: 42px; padding: 0 14px 0 12px; font-size: 13px; }

  .concept-note {
    top: calc(126px + env(safe-area-inset-top, 0px));
    left: 16px;
    transform: none;
  }

  .tour-caption {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    padding: 12px 80px 14px 16px;
  }

  .tour-caption p { font-size: 15px; }

  .gallery { padding-left: 24px; padding-right: 24px; }

  .lightbox { gap: 8px; }
  .lightbox-nav { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .lightbox-nav.prev { left: calc(50% - 56px); }
  .lightbox-nav.next { left: calc(50% + 10px); }

  .current-scene-info { padding: 10px 16px; }
  .sceneName { font-size: 17px; }

  .viewer-controls {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .control-group { padding: 4px; }
  .control-btn { width: 38px; height: 38px; }

  .brand-title { font-size: 26px; }

  .coords-readout { left: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* Narrow phones: no room for a side label next to the moved pin. */
@media (max-width: 600px) {
  .info-hotspot.side .info-hotspot-label { display: none; }

  .tour-nudge { top: 6px; right: calc(100% + 12px); }
  .tour-nudge::before { top: 50%; left: auto; right: -7px; margin-top: -6px; border-left: none; border-top: 1px solid var(--yellow); border-right: 1px solid var(--yellow); }
  .tour-nudge-play { font-size: 13px; }
  .tour-feature .line { height: 40px; }
  .tour-feature .text { bottom: 40px; padding: 6px 12px; font-size: 13px; }
  .tour-feature.with-image .text img { width: 170px; height: 96px; }
  .tour-spot .name { bottom: 14px; padding: 4px 10px; font-size: 11px; }
  .horizon-label .tag { font-size: 11px; padding: 4px 10px; }
  .info-hotspot.road .info-hotspot-card { width: 250px; }
  .card-facts { font-size: 12px; gap: 5px 10px; }

  .info-hotspot.side .info-hotspot-card {
    right: auto;
    left: -10px;
    top: auto;
    bottom: calc(100% + 12px);
    transform: none;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .sidebar-header { padding-top: 20px; padding-bottom: 12px; }
  .brand-title { font-size: 22px; }
  .brand-logo { width: 100px; }
  .scene-item { padding: 10px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .info-hotspot.featured .info-hotspot-pin::before { animation: none; }
  .plot-overlay .plot-line { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* Languages (i18n.js) */
html[lang="ru"] { --font-body: 'Rubik', 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif; }
html[lang="he"] {
  --font-body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Rubik', 'Arial Black', system-ui, sans-serif;
}

/* Hebrew reads right to left: the text blocks flip, the layout stays. */
.rtl .tour-sidebar,
.rtl .current-scene-info,
.rtl .tour-caption p,
.rtl .info-hotspot-card,
.rtl .info-hotspot-label,
.rtl .lightbox figcaption,
.rtl .toast,
.rtl .tour-nudge { direction: rtl; }
.rtl .tour-sidebar .contact-grid a { direction: ltr; unicode-bidi: isolate; }

/* First-visit language picker */
.lang-picker {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(12, 26, 53, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: lang-fade 0.4s var(--ease);
  transition: opacity 0.35s var(--ease);
}

.lang-picker.out { opacity: 0; pointer-events: none; }

@keyframes lang-fade { from { opacity: 0; } to { opacity: 1; } }

.lang-card {
  width: min(560px, 100%);
  padding: 30px 30px 32px;
  border-radius: 14px;
  background: var(--navy);
  border: 1px solid var(--line);
  border-top: 4px solid var(--yellow);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  color: var(--white);
}

.lang-logo {
  width: 120px;
  padding: 10px 14px 8px;
  border-radius: 6px;
  background: var(--white);
}

.lang-project {
  margin-top: 16px;
  font-family: 'Montserrat', 'Arial Black', system-ui, sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--yellow);
}

.lang-question {
  margin-top: 6px;
  font-family: 'Montserrat', 'Arial Black', system-ui, sans-serif;
  font-weight: 800;
  font-size: 28px;
  line-height: 1.2;
  text-wrap: balance;
}

.lang-question-alt {
  margin-top: 6px;
  font-family: 'Rubik', system-ui, sans-serif;
  font-size: 15px;
  color: var(--muted);
}

.lang-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.lang-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--navy-deep);
  color: var(--white);
  font-family: 'Rubik', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 500;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.lang-option:hover,
.lang-option:focus-visible {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
  transform: translateY(-2px);
}

.lang-option .flag {
  width: 54px;
  height: 36px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Language switch, bottom left of the viewer */
.lang-switch {
  position: absolute;
  left: 24px;
  bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
}

.lang-current {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px 0 10px;
  border-radius: 22px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  color: var(--white);
  font-family: 'Rubik', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
}

.lang-current:hover { border-color: var(--yellow); }

.lang-current .flag,
.lang-item .flag {
  width: 26px;
  height: 18px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.lang-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  min-width: 170px;
  padding: 6px;
  border-radius: 10px;
  background: var(--scrim);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--white);
  font-family: 'Rubik', system-ui, sans-serif;
  font-size: 15px;
  text-align: start;
}

.lang-item:hover,
.lang-item:focus-visible { background: rgba(255, 255, 255, 0.1); }
.lang-item.current { color: var(--yellow); font-weight: 600; }

@media (max-width: 992px) {
  .lang-switch { left: 12px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .lang-current { height: 40px; padding: 0 8px; }
  .lang-current span { display: none; }
}

@media (max-width: 520px) {
  .lang-card { padding: 24px 18px 22px; }
  .lang-question { font-size: 23px; }
  .lang-options { grid-template-columns: 1fr; gap: 10px; }
  .lang-option { flex-direction: row; justify-content: center; padding: 14px; }
  .lang-option .flag { width: 36px; height: 24px; }
}
