/* Hotspots — chip (icon + label) always visible; drag moves whole chip.
 * Accent follows TourBranding (--brand), never Orbe platform chrome.
 *
 * Posición (yaw/pitch) = dato de Convex aplicado por Marzipano en el wrapper.
 * Este archivo solo define apariencia, tamaño y animación: nunca desplaza el ancla.
 * Movimiento vía tokens de css/design-tokens.css (reduced-motion global). */
.hotspot {
  --hotspot-ink: #ffffff;
  --hotspot-accent: var(--brand, #4b5563);
  /* Halo derivado del acento: sirve para cualquier branding de cliente. */
  --hotspot-halo: color-mix(in srgb, var(--hotspot-accent) 55%, transparent);
  position: relative;
  width: auto;
  height: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overflow: visible;
  color: var(--hotspot-accent);
}

.hotspot__chip {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: min(220px, 42vw);
  padding: 0.28rem 0.55rem 0.28rem 0.32rem;
  border-radius: 999px;
  background: rgba(6, 12, 10, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 4px 14px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  transition:
    transform var(--orbe-dur-fast, 0.15s) var(--orbe-ease-out, ease),
    box-shadow var(--orbe-dur-fast, 0.15s) var(--orbe-ease-in-out, ease),
    border-color var(--orbe-dur-fast, 0.15s) var(--orbe-ease-in-out, ease);
  pointer-events: none;
}

.hotspot__icon {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--hotspot-accent);
  box-shadow: 0 0 0 2px var(--hotspot-accent);
}

.hotspot__svg {
  display: block;
}

.hotspot__label {
  display: block;
  color: var(--hotspot-ink);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

/* Scene preview — framed like main 360 viewport (not a flat strip card) */
.hotspot-preview {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(6px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--orbe-dur-fast, 0.15s) var(--orbe-ease-out, ease),
    transform var(--orbe-dur-base, 0.2s) var(--orbe-ease-out, ease);
  z-index: 20;
  width: 168px;
  padding: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #0a1210;
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 14px 32px rgba(0, 0, 0, 0.55);
}

.hotspot-preview__viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0a1210;
}

.hotspot-preview__viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, transparent 28%, transparent 72%, rgba(0, 0, 0, 0.35) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.hotspot-preview__thumb {
  position: absolute;
  inset: -8% -35%;
  width: 170%;
  height: 116%;
  object-fit: cover;
  object-position: var(--preview-yaw, 50%) 46%;
  transform: perspective(420px) rotateX(4deg) scale(1.02);
  transform-origin: center center;
  filter: saturate(1.05) contrast(1.04);
  background: #122;
}

.hotspot-preview__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 0.35rem 0.45rem;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  background: linear-gradient(transparent, rgba(6, 12, 10, 0.92));
}

.hotspot:hover .hotspot-preview,
.hotspot:focus-visible .hotspot-preview,
.hotspot.hotspot--preview-open .hotspot-preview {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hotspot:hover .hotspot__chip,
.hotspot:focus-visible .hotspot__chip {
  transform: scale(1.04);
  /* Antes: rgba(0,155,58,.55) — verde Orbe retirado filtrándose al viewer
     white-label. Ahora deriva del branding del cliente (doc 39/42). */
  border-color: var(--hotspot-halo, rgba(255, 255, 255, 0.6));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  outline: none;
}

/* Foco visible sobre cualquier panorama: anillo blanco + anillo de marca.
 * El wrapper de Marzipano no se toca, así que el ancla no se mueve. */
.hotspot:focus-visible {
  outline: none;
}

.hotspot:focus-visible .hotspot__icon {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 5px var(--hotspot-accent),
    0 0 0 7px rgba(0, 0, 0, 0.45);
}

.hotspot--active .hotspot__icon,
.hotspot--selected .hotspot__icon {
  background: var(--hotspot-accent);
  color: var(--hotspot-icon-ink, #ffffff);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--hotspot-accent);
}

.hotspot--nav {
  --hotspot-accent: var(--brand, #4b5563);
}

.hotspot--nav .hotspot__icon {
  width: 30px;
  height: 30px;
}

.hotspot--info .hotspot__icon {
  width: 26px;
  height: 26px;
}

.hotspot-inline-empty {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
}

.hotspot-inline-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  backdrop-filter: blur(8px);
  font-size: 0.8rem;
  font-weight: 500;
}

.hotspot-inline-button:hover,
.hotspot-inline-button:focus-visible {
  background: var(--brand-soft, rgba(75, 85, 99, 0.88));
  color: var(--brand-ink, #ffffff);
  border-color: rgba(255, 255, 255, 0.5);
  outline: none;
  transform: translateY(-1px);
}

body.theme-high-contrast .hotspot__chip {
  background: #000;
  border-color: #fff;
}

body.theme-high-contrast .hotspot__icon {
  background: #fff;
  color: #000;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--brand, #4b5563);
}

body.hotspot-edit-mode .hotspot__chip {
  outline: 2px dashed rgba(250, 204, 21, 0.95);
  outline-offset: 3px;
}

body.hotspot-edit-mode .hotspot {
  cursor: grab;
}

/* P1 — pulse de atención. El anillo deriva del acento del hotspot
 * (categoría o branding del cliente), nunca de un color de plataforma. */
.hotspot--anim-pulse .hotspot__icon {
  animation: hotspot-pulse 1.9s var(--orbe-ease-in-out, ease-in-out) infinite;
}

@keyframes hotspot-pulse {
  0% {
    box-shadow:
      0 0 0 2px var(--hotspot-accent),
      0 0 0 0 var(--hotspot-halo, rgba(255, 255, 255, 0.5));
    transform: scale(1);
  }
  60% {
    box-shadow:
      0 0 0 2px var(--hotspot-accent),
      0 0 0 11px rgba(255, 255, 255, 0);
    transform: scale(1.05);
  }
  100% {
    box-shadow:
      0 0 0 2px var(--hotspot-accent),
      0 0 0 11px rgba(255, 255, 255, 0);
    transform: scale(1);
  }
}

/* Categoría legible sin depender solo del color del icono: hairline del acento
 * en el borde del chip. `:where()` mantiene especificidad 0 para que hover/foco
 * sigan ganando. */
:where(.hotspot[data-category]) .hotspot__chip {
  border-color: color-mix(in srgb, var(--hotspot-accent) 32%, rgba(255, 255, 255, 0.2));
}

@media (prefers-reduced-motion: reduce) {
  .hotspot-preview,
  .hotspot__chip {
    transition: none;
  }

  .hotspot-preview__thumb {
    transform: none;
  }

  .hotspot--anim-pulse .hotspot__icon {
    animation: none;
  }
}
