/* Card hero nel phone-wrapper: posizioni più “sparse” + translateY da variabili parallax dedicate */

.phone-stage {
  position: relative;
}

.hero-float-layer {
  position: absolute;
  inset: 0;
  z-index: 30; /* sopra al telefono */
}

.hero-float-layer > a.hero-live-card.parallax-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.hero-float-layer > a.hero-live-card.parallax-card:hover {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

/*
 * Stesso piano 3D dello schermo nel telefono (global.css → .screen-content-mask):
 * perspective/rotate/skew da --screen-*; solo translateY parallax per slot (--card-scroll-y-*).
 */
/* Piano prospettico unico per TUTTE le card (parallele tra loro). */
.hero-float-layer {
  /* Prospettiva unica (come nello sviluppo precedente “buono”):
     tutte le card condividono lo stesso piano e risultano parallele tra loro.
     Evitiamo però profondità 3D (translateZ) per non creare incroci tra piani. */
  perspective: var(--screen-perspective);
  perspective-origin: 50% 50%;
  /*
   * Importante: in presenza di prospettiva + rotateX/rotateY, alcuni browser su mobile
   * riordinano i layer in base alla profondità 3D durante lo scroll, ignorando lo z-index.
   * Forziamo il compositing "flat" così la gerarchia torna deterministica via z-index.
   */
  transform-style: flat;
}

/* Ripristino layering “classico” come in global.css:
   z-index gestisce schermo sotto, cornice sopra. */
.hero-float-layer > a.hero-live-card.bottom {
  /* Stesso piano dello schermo (rotateX/Y/Z + skew), con prospettiva ereditata dal wrapper */
  transform: rotateX(var(--screen-rotate-x)) rotateY(var(--screen-rotate-y))
    rotateZ(var(--screen-rotate-z)) skewY(var(--screen-skew-y))
    translateY(var(--card-scroll-y-local, 0px));
  will-change: transform;
  transition: transform 0.1s ease-out;
}

.hero-float-layer > a.hero-live-card.hero-fc--offer.bottom {
  --card-scroll-y-local: var(--card-scroll-y-offer, 0px);
  z-index: 30;
}

.hero-float-layer > a.hero-live-card.hero-fc--community.bottom {
  --card-scroll-y-local: var(--card-scroll-y-community, 0px);
  z-index: 20;
}

.hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom {
  --card-scroll-y-local: var(--card-scroll-y-spotlight, 0px);
  z-index: 45;
}

.hero-float-layer > a.hero-live-card.hero-fc--bando.bottom {
  --card-scroll-y-local: var(--card-scroll-y-bando, 0px);
  /* sopra al planning, sotto allo spotlight */
  z-index: 26;
}

/*
 * Entrata "popup/bounce" scaglionata SENZA toccare il transform della card:
 * animiamo solo .card-glass-content, così prospettiva + scrolling restano identici.
 * Spotlight: sempre visibile subito (nessuna animazione).
 */
.hero-float-layer > a.hero-live-card:not(.hero-fc--spotlight) {
  opacity: 0; /* evita card “vuote” visibili prima del reveal */
  animation: heroCardFadeIn 240ms ease-out forwards;
}

@keyframes heroCardFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hero-float-layer > a.hero-live-card:not(.hero-fc--spotlight) .card-glass-content {
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  transform-origin: 50% 60%;
  will-change: transform, opacity;
  animation: heroCardPopup 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes heroCardPopup {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  62% {
    opacity: 1;
    transform: translateY(-2px) scale(1.045);
  }
  100% {
    opacity: 1;
    transform: translateY(0px) scale(1);
  }
}

/*
  Sequenza richiesta: community → bando → offerta → planning
  Totale 2s, start a 1s dal load (l'ultima finisce ~3.00s).
*/
.hero-float-layer > a.hero-live-card.hero-fc--community { animation-delay: 1s; }
.hero-float-layer > a.hero-live-card.hero-fc--community .card-glass-content { animation-delay: 1s; }

.hero-float-layer > a.hero-live-card.hero-fc--bando { animation-delay: 1.55s; }
.hero-float-layer > a.hero-live-card.hero-fc--bando .card-glass-content { animation-delay: 1.55s; }

.hero-float-layer > a.hero-live-card.hero-fc--offer { animation-delay: 2.05s; }
.hero-float-layer > a.hero-live-card.hero-fc--offer .card-glass-content { animation-delay: 2.05s; }

.hero-float-layer > a.hero-live-card.hero-fc--shift { animation-delay: 2.3s; }
.hero-float-layer > a.hero-live-card.hero-fc--shift .card-glass-content { animation-delay: 2.3s; }

@media (prefers-reduced-motion: reduce) {
  .hero-float-layer > a.hero-live-card:not(.hero-fc--spotlight) .card-glass-content {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom {
  --card-scroll-y-local: var(--card-scroll-y-shift, 0px);
  z-index: 24;
}

/* Desktop: card più distanziate tra loro attorno al telefono */
.hero-float-layer > a.hero-live-card.hero-fc--offer {
  top: 6%;
  right: -10%;
  left: auto;
  width: 200px;
}

.hero-float-layer > a.hero-live-card.hero-fc--community {
  top: 14%;
  left: -10%;
  right: auto;
  width: 250px;
}

.hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom {
  top: 34%;
  left: 25%;
  right: auto;
  width: 292px;
}

.hero-float-layer > a.hero-live-card.hero-fc--bando.bottom {
  top: 56%;
  right: -22%;
  left: auto;
  width: 248px;
}

.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom {
  top: 69%;
  left: 25%;
  right: auto;
  width: 190px;
}

.hero-float-layer .hero-live-card .hero-fc-eyebrow {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
  margin: 0 0 4px;
}
.hero-float-layer > a.hero-live-card.hero-fc--offer .hero-fc-eyebrow {
  color: var(--meedico-offer-ink, #0369a1);
}
.hero-float-layer > a.hero-live-card.hero-fc--community .hero-fc-eyebrow {
  color: var(--meedico-community, #7c3aed);
}
.hero-float-layer > a.hero-live-card.hero-fc--bando .hero-fc-eyebrow {
  color: var(--meedico-bando, #047857);
}

.hero-float-layer .hero-live-card .t-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.hero-float-layer .hero-live-card .t-date {
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-float-layer .hero-live-card .t-wish.hero-fc-line3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
}

/* Planning: niente blu primario — resta sullo sfondo rispetto alla spotlight */
.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-wish,
.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-title,
.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-date {
  color: #4b5563;
}

.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .hero-fc-eyebrow {
  color: #6b7280;
}

/*
 * Gerarchia titoli (decrescente): centrale > community > offerte > bandi > planning.
 * Date e wish seguono la stessa scala tra le card.
 */
.hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom .t-title {
  font-size: 1.14rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom .t-date {
  font-size: 0.93rem;
  color: #6b7280;
}

.hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom .t-wish {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color-darker);
}

.hero-float-layer > a.hero-live-card.hero-fc--community.bottom .t-title {
  font-size: 0.98rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--community.bottom .t-date {
  font-size: 0.84rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--offer.bottom .t-title {
  font-size: 0.82rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--offer.bottom .t-date {
  font-size: 0.71rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--bando.bottom .t-title {
  font-size: 0.73rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--bando.bottom .t-date {
  font-size: 0.64rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-title {
  font-size: 0.66rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-date {
  font-size: 0.57rem;
}

.hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-wish {
  font-size: 0.57rem;
}

.hero-float-layer .hero-live-card.is-empty-slot {
  opacity: 0.92;
}

@media (max-width: 900px) {
  /* Spotlight sempre in primo piano su mobile/tablet */
  .hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom {
    z-index: 60;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--offer {
    top: 6%;
    left: 70%;
    right: auto;
    width: 152px;
    transform: translateX(-50%)
      rotateX(var(--screen-rotate-x)) rotateY(var(--screen-rotate-y))
      rotateZ(var(--screen-rotate-z)) skewY(var(--screen-skew-y))
      translateY(var(--card-scroll-y-offer, 0px));
  }

  .hero-float-layer > a.hero-live-card.hero-fc--community {
    top: 22%;
    left: 6%;
    right: auto;
    width: 142px;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom {
    top: 40%;
    left: 63%;
    right: auto;
    width: 178px;
    transform: translateX(-50%)
      rotateX(var(--screen-rotate-x)) rotateY(var(--screen-rotate-y))
      rotateZ(var(--screen-rotate-z)) skewY(var(--screen-skew-y))
      translateY(var(--card-scroll-y-spotlight, 0px));
  }

  .hero-float-layer > a.hero-live-card.hero-fc--bando.bottom {
    top: 62%;
    right: 4%;
    left: auto;
    width: 158px;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--shift.bottom {
    top: 80%;
    left: 52%;
    right: auto;
    width: 188px;
    transform: translateX(-50%)
      rotateX(var(--screen-rotate-x)) rotateY(var(--screen-rotate-y))
      rotateZ(var(--screen-rotate-z)) skewY(var(--screen-skew-y))
      translateY(var(--card-scroll-y-shift, 0px));
  }
}

@media (max-width: 520px) {
  /* Su schermi piccoli aumentiamo la separazione verticale per leggibilità */
  .hero-float-layer > a.hero-live-card.hero-fc--offer {
    top: 6%;
    left: 72%;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--community {
    top: 22%;
    left: 6%;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom {
    top: 51%;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--bando.bottom {
    top: 90%;
    right: -20%;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--shift.bottom {
    top: 82%;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--offer,
  .hero-float-layer > a.hero-live-card.hero-fc--community,
  .hero-float-layer > a.hero-live-card.hero-fc--bando.bottom,
  .hero-float-layer > a.hero-live-card.hero-fc--shift.bottom {
    width: 150px;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom {
    width: 210px;
  }

  /* la spotlight resta più ampia, le altre leggermente più compatte */

  .hero-float-layer .hero-live-card .t-title {
    font-size: 0.78rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom .t-title {
    font-size: 0.95rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom .t-date {
    font-size: 0.81rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--spotlight.bottom .t-wish {
    font-size: 0.86rem;
    color: var(--primary-color-darker);
  }

  .hero-float-layer > a.hero-live-card.hero-fc--community.bottom .t-title {
    font-size: 0.86rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--community.bottom .t-date {
    font-size: 0.75rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--offer.bottom .t-title {
    font-size: 0.76rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--offer.bottom .t-date {
    font-size: 0.68rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--bando.bottom .t-title {
    font-size: 0.7rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--bando.bottom .t-date {
    font-size: 0.63rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-title {
    font-size: 0.64rem;
  }

  .hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-date,
  .hero-float-layer > a.hero-live-card.hero-fc--shift.bottom .t-wish {
    font-size: 0.58rem;
  }
}
