/* ==========================================================================
   Stile hotspot — condiviso fra frontend e configuratore.
   Stile 1: BOTTONE sopra, asta, puntino in basso (ancora).
   Stile 2: puntino in alto (ancora), asta, BOTTONE sotto.
   ========================================================================== */

.hs-stage {
  position: relative;
  overflow: hidden;
  background: #111;
}

.hs-stage__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* punto di messa a fuoco dell'immagine, impostato via JS dalla config */
  object-position: var(--hs-focus-x, 50%) var(--hs-focus-y, 50%);
  /* lo zoom deve avere origine ESATTAMENTE sul punto di focus: è la condizione
     che fa coincidere il risultato con il calcolo di fitRect() in JS */
  transform-origin: var(--hs-focus-x, 50%) var(--hs-focus-y, 50%);
  transform: scale(var(--hs-zoom, 1));
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.hs-stage[data-fit='contain'] .hs-stage__img {
  object-fit: contain;
}

.hs-stage__idle-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hs-focus-x, 50%) var(--hs-focus-y, 50%);
  transform-origin: var(--hs-focus-x, 50%) var(--hs-focus-y, 50%);
  transform: scale(var(--hs-zoom, 1));
  display: block;
  user-select: none;
}

.hs-stage__idle-video[hidden] {
  display: none;
}

.hs-stage[data-fit='contain'] .hs-stage__idle-video {
  object-fit: contain;
}

/* livello immagine usato per la dissolvenza verso la sezione successiva */
.hs-stage__img--next {
  opacity: 0;
  transition: opacity 700ms ease;
  will-change: opacity;
}

.hs-stage__img--next.is-visible {
  opacity: 1;
}

/* livello video delle transizioni */
.hs-stage__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hs-focus-x, 50%) var(--hs-focus-y, 50%);
  transform-origin: var(--hs-focus-x, 50%) var(--hs-focus-y, 50%);
  transform: scale(var(--hs-zoom, 1));
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.hs-stage__video.is-visible {
  opacity: 1;
}

.hs-stage__video.is-idle {
  opacity: 1;
}

.hs-stage__layer {
  position: absolute;
  inset: 0;
  transition: opacity 180ms ease;
}

/* durante una transizione gli hotspot scompaiono */
.hs-stage__layer.is-out {
  opacity: 0;
  pointer-events: none;
}

/* --- singolo hotspot ------------------------------------------------------ */

.hs {
  --hs-dot: 20px;
  --hs-stem: 46px;
  --hs-green-1: #7cbb45;
  --hs-green-2: #4d8a26;
  --hs-line: #ffffff;

  position: absolute;
  width: 0;
  height: 0;
  /* left/top vengono impostati via JS: coincidono con il centro del puntino */
}

.hs.is-hidden {
  display: none;
}

/* scale() PRIMA di translateX(-50%): così lo spostamento percentuale viene
   scalato anch'esso e il puntino resta incollato all'ancora a qualsiasi scala. */
.hs__inner {
  position: absolute;
  left: 0;
  transform: scale(var(--hs-scale, 1)) translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.hs--s1 .hs__inner {
  bottom: 0;
  transform-origin: 0 100%;
}

.hs--s2 .hs__inner {
  top: 0;
  flex-direction: column-reverse;
  transform-origin: 0 0;
}

.hs__btn {
  pointer-events: auto;
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  padding: 14px 30px 15px;
  border-radius: 999px;
  border: 4px solid #fff;
  background: linear-gradient(180deg, var(--hs-green-1) 0%, var(--hs-green-2) 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.hs__btn:hover,
.hs__btn:focus-visible {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.08);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.38);
  outline: none;
}

.hs__btn:active {
  transform: translateY(0) scale(0.98);
}

.hs__stem {
  width: 4px;
  height: var(--hs-stem);
  background: var(--hs-line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  flex: 0 0 auto;
}

.hs__dot {
  pointer-events: auto;
  width: var(--hs-dot);
  height: var(--hs-dot);
  border-radius: 50%;
  border: 4px solid var(--hs-line);
  background: linear-gradient(180deg, var(--hs-green-1) 0%, var(--hs-green-2) 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  flex: 0 0 auto;
  box-sizing: content-box;
}

/* il puntino deve essere centrato ESATTAMENTE sull'ancora */
.hs--s1 .hs__dot {
  margin-bottom: calc((var(--hs-dot) + 8px) / -2);
}

.hs--s2 .hs__dot {
  margin-top: calc((var(--hs-dot) + 8px) / -2);
}

/* pulsazione discreta per richiamare l'attenzione */
@media (prefers-reduced-motion: no-preference) {
  .hs__dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    animation: hs-pulse 2.6s ease-out infinite;
  }
  .hs__dot {
    position: relative;
  }
}

@keyframes hs-pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.85;
  }
  70%,
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}
