/*
 * Slider statico della home (sostituisce Slider Revolution).
 *
 * Desktop (>= 1240px): riproduce la griglia originale 1680x700. I testi sono
 * posizionati in coordinate di griglia (--x, --y, --fs) e scalati con la
 * larghezza tramite --u (1 px di griglia). Sopra i 1680px la griglia resta a
 * 1:1 e centrata, come in Revolution ("sliderLayout: auto").
 * Sotto i 1240px i testi vengono impilati in basso a sinistra.
 */

.hs {
  --hs-green: #007632;
  --hs-green-hover: #45b169;
  --hs-ease: cubic-bezier(.645, .045, .355, 1); /* Power3.easeInOut */
  position: relative;
  overflow: hidden;
  background-color: #e5e5e5;
}

.hs__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1680 / 700;
  max-height: 700px;
}

/* ---------- slide e sfondo ---------- */

.hs__slide {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease-in-out, visibility 0s linear .3s;
}

.hs__slide.is-active {
  z-index: 2;
  opacity: 1;
  visibility: visible;
  transition: opacity .3s ease-in-out, visibility 0s;
}

.hs__slide.is-leaving {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  transition: none;
}

.hs__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: var(--bgpos, center center);
}

/* ---------- griglia dei testi (desktop) ---------- */

.hs__grid {
  --u: calc(100cqw / 1680);
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, 1680px);
  transform: translateX(-50%);
  container-type: inline-size;
}

.hs__layer {
  position: absolute;
  left: calc(var(--x, 0) * var(--u));
  top: calc(var(--y, 0) * var(--u));
  margin: 0;
  opacity: 0;
  transition: opacity .3s var(--hs-ease);
}

.hs__line {
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: calc(var(--fs, 56) * var(--u));
  line-height: calc(22 * var(--u));
  letter-spacing: 0;
  white-space: pre;
  color: #fff;
  text-shadow: 0 0 4px rgba(0, 0, 0, .5);
}

.hs__green {
  color: var(--hs-green);
}

.hs__sub {
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-weight: 400;
  font-size: calc(32 * var(--u));
  line-height: calc(39 * var(--u));
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 0 4px rgba(0, 0, 0, .5);
}

.hs__btn {
  box-sizing: border-box;
  width: 301px;
  padding: 15px;
  border-radius: 4px;
  background-color: var(--hs-green);
  font-family: Montserrat, sans-serif;
  font-weight: 500;
  font-size: 17px;
  line-height: 17px;
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
  color: #fff;
  transition: opacity .3s var(--hs-ease), background-color 0s;
}

.hs__btn:hover,
.hs__btn:focus-visible {
  background-color: var(--hs-green-hover);
  color: #fff;
}

.hs__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ---------- entrata e uscita dei testi ---------- */

.is-in .hs__layer {
  opacity: 1;
}

.is-in .hs__line--first {
  transition-delay: .01s;
}

.is-in .hs__line:not(.hs__line--first) {
  transition-duration: .5s;
  transition-delay: .3s;
}

.is-in .hs__sub {
  transition-duration: .5s;
  transition-delay: .58s;
}

.is-in .hs__btn {
  transition: opacity .5s var(--hs-ease) .89s, background-color 0s;
}

.is-out .hs__layer {
  opacity: 0;
  transition-duration: .3s;
  transition-delay: 0s;
}

/* ---------- frecce (stile "uranus") ---------- */

.hs__arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  margin: -25px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: opacity .3s;
}

.hs__arrow--prev { left: 20px; }
.hs__arrow--next { right: 20px; }

.hs__arrow svg {
  width: 21px;
  height: 39px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, .3));
}

.hs__arrow:hover { opacity: .75; }

.hs__arrow:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

/* ---------- tablet e mobile: testi impilati ---------- */

@media (max-width: 1239px) {
  .hs__stage {
    aspect-ratio: 1024 / 700;
  }

  .hs__grid {
    --k: .98px;
    left: 0;
    width: 100%;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    box-sizing: border-box;
    padding: 0 14% 10%;
  }

  .hs__layer {
    position: relative;
    left: auto;
    top: auto;
  }

  .hs__line {
    font-size: calc(var(--fs, 56) * var(--k));
    line-height: 1.12;
    white-space: normal;
  }

  .hs__sub {
    margin-top: .5em;
    font-size: calc(32 * var(--k));
    line-height: 1.22;
    white-space: normal;
  }

  .hs__btn {
    margin-top: 1.4em;
  }
}

@media (max-width: 1023px) {
  .hs__stage {
    aspect-ratio: auto;
    height: 400px;
  }

  .hs__grid {
    --k: .62px;
    padding: 0 9% 7%;
  }

  .hs__btn {
    margin-top: 1.1em;
  }
}

@media (max-width: 777px) {
  .hs__stage {
    height: auto;
    aspect-ratio: 480 / 400;
    max-height: 400px;
  }

  .hs__grid {
    --k: min(.62px, calc(100vw / 750));
    padding: 0 max(8%, 50px) 8%;
  }

  .hs__btn {
    width: auto;
    margin-top: .9em;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 13px;
  }

  .hs__arrow {
    width: 40px;
    height: 40px;
    margin-top: -20px;
  }

  .hs__arrow--prev { left: 6px; }
  .hs__arrow--next { right: 6px; }

  .hs__arrow svg {
    width: 15px;
    height: 28px;
  }
}

@media (max-width: 479px) {
  /* come in Revolution: niente sottotitolo sotto i 480px */
  .hs__sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hs__slide,
  .hs__slide.is-active,
  .hs__layer,
  .is-in .hs__layer,
  .is-out .hs__layer {
    transition: none !important;
  }
}
