/*
 * fd-theme-2 - home.css
 * Home cinematica: scena 3D procedurale con 6 atti narrativi pilotati da assets/js/home.js.
 * Il JS aggiorna le custom property di .fd-home-scene (--p, --tiltX, ...) e gli stili
 * inline dei blocchi (transform, filter, opacity); il resto e' qui.
 */

/* ==========================================================================
   Reset overflow: necessario perche' lo sticky della scena funzioni
   ========================================================================== */
html {
  overflow-x: clip;
}

body {
  position: relative;
  overflow: visible;
}

/* ==========================================================================
   Tracciato a scorrimento (600 viewport di altezza)
   ========================================================================== */
.fd-home-track {
  --safe-top: 70px;
  position: relative;
  width: 100%;
  height: 600vh;
  height: 600svh;
  background-color: #04060b;
  color: #f1f5f9;
}

@media (width >= 48rem) {
  .fd-home-track {
    --safe-top: 80px;
  }
}

/* Barra di progresso superiore */
.fd-home-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981, #a855f7);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ==========================================================================
   Scena (sticky; is-fixed / is-bottom la bloccano quando lo sticky non basta)
   ========================================================================== */
.fd-home-scene {
  /* Proprietà dinamiche controllate dal motore JS */
  --accentGlow: rgba(59, 130, 246, 0.35);
  --hintFade: 0;

  position: sticky;
  top: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  will-change: transform;
}

.fd-home-scene.is-fixed {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100vw;
}

.fd-home-scene.is-bottom {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 0;
  z-index: 10;
  width: 100%;
}

/* ==========================================================================
   Stage di sfondo: video guidato dallo scroll, velo e luce dell'atto (nessun testo)
   ========================================================================== */
.fd-home-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.fd-home-stage__bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, #080d1a 0%, #030509 100%);
}

.fd-home-stage__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80vw;
  height: 80vw;
  max-width: 900px;
  max-height: 900px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accentGlow) 0%, transparent 65%);
  filter: blur(80px);
  opacity: 0.45;
  transform: translate(-50%, -50%);
  transition: background 0.6s ease;
  will-change: transform, opacity;
}

/* Video di sfondo guidato dallo scroll */
.fd-home-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .6;
  filter: saturate(.9);
}

/* Velo scuro + vignettatura: i testi degli atti restano leggibili sopra il video */
.fd-home-stage__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 30%, rgba(4, 6, 11, .75) 100%),
    linear-gradient(to bottom, rgba(4, 6, 11, .7) 0%, rgba(4, 6, 11, .45) 30%, rgba(4, 6, 11, .45) 70%, rgba(4, 6, 11, .85) 100%);
}

/* ==========================================================================
   Copy e atti narrativi
   ========================================================================== */
.fd-home-copy {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

/* Atto: contenuto centrato; su mobile padding ridotto e niente overflow */
.fd-home-act {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 0.75rem 16px;
  overflow: hidden;
  pointer-events: none;
}

/* Spazio di sicurezza inferiore tra bottoni hero e scroll hint */
.fd-home-act--hero {
  padding-bottom: 5.5rem;
}

/* Overlay scuro morbido sull'hero su mobile */
@media (width < 48rem) {
  .fd-home-act--hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 50% 45%, rgba(3, 7, 18, 0.55) 0%, rgba(3, 7, 18, 0.35) 65%, transparent 100%);
    pointer-events: none;
  }
}

@media (width >= 48rem) {
  .fd-home-act {
    padding: var(--safe-top) 4vw 40px;
    overflow: visible;
  }
}

@media (width >= 64rem) {
  .fd-home-act {
    padding: var(--safe-top) 5vw 40px;
  }
}

/* Box dei contenuti: tutta larghezza su mobile, spaziosi e centrati su desktop */
.fd-home-block {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  text-align: center;
  transform-origin: 50% 50%;
  pointer-events: auto;
  will-change: transform, opacity, filter;
}

.fd-home-block--left {
  text-align: left;
}

/* Il JS nasconde i blocchi fuori dalla finestra del loro atto */
.fd-home-block.is-hidden {
  visibility: hidden;
}

@media (width >= 48rem) {
  .fd-home-block {
    max-width: min(1140px, 92vw);
  }
}

@media (width >= 64rem) {
  .fd-home-block {
    max-width: min(1200px, calc(100vw - 120px));
  }
}

/* Mobile: nessun taglio di testo, scroll interno fluido */
@media (width < 48rem) {
  .fd-home-block {
    max-height: calc(100svh - 85px);
    padding: 0.5rem 0.25rem;
    overflow-y: auto;
  }

  .fd-home-block::-webkit-scrollbar {
    width: 3px;
  }

  .fd-home-block::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: rgba(56, 189, 248, 0.35);
  }
}

/* Badge eyebrow */
.fd-home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 9999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

@media (width >= 48rem) {
  .fd-home-eyebrow {
    margin-bottom: 1.25rem;
    font-size: 0.75rem;
  }
}

.fd-home-eyebrow__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: fd-home-pulse 2s infinite;
}

@keyframes fd-home-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ==========================================================================
   Bottoni
   ========================================================================== */
.fd-home-btn {
  border-radius: 9999px;
  font-size: var(--text-sm);
  line-height: var(--text-sm--line-height);
  letter-spacing: var(--tracking-wider);
  text-align: center;
  text-transform: uppercase;
  transition-property: all;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: var(--default-transition-duration);
}

/* Pieno bianco con ombra morbida */
.fd-home-btn--light {
  font-weight: var(--font-weight-extrabold);
  color: var(--color-black);
  background-color: var(--color-white);
  box-shadow:
    0 20px 25px -5px color-mix(in oklab, var(--color-white) 10%, transparent),
    0 8px 10px -6px color-mix(in oklab, var(--color-white) 10%, transparent);
}

/* Scuro con bordo */
.fd-home-btn--dark {
  font-weight: var(--font-weight-semibold);
  color: var(--color-white);
  background-color: var(--color-neutral-900);
  border: 1px solid var(--color-neutral-700);
}

/* Hero: pieno a larghezza intera su mobile, compatto da 640px */
.fd-home-btn--hero {
  width: 100%;
  padding: 0.875rem 1.75rem;
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
}

.fd-home-btn--hero-secondary {
  background-color: color-mix(in oklab, var(--color-neutral-900) 90%, transparent);
}

@media (width >= 40rem) {
  .fd-home-btn--hero {
    width: auto;
    padding: 1rem 2rem;
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }
}

/* Contatti */
.fd-home-btn--contact {
  width: 100%;
  padding: 1rem 2rem;
}

@media (width >= 40rem) {
  .fd-home-btn--contact {
    width: auto;
  }
}

.fd-home-btn--mail {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Verde smeraldo (offerta All Inclusive) */
.fd-home-btn--emerald {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 1rem 2rem;
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-black);
  background-color: var(--color-emerald-400);
  box-shadow:
    0 20px 25px -5px color-mix(in oklab, var(--color-emerald-400) 20%, transparent),
    0 8px 10px -6px color-mix(in oklab, var(--color-emerald-400) 20%, transparent);
}

@media (width >= 40rem) {
  .fd-home-btn--emerald {
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }
}

.fd-home-btn__icon {
  width: 1rem;
  height: 1rem;
  margin-left: 0.5rem;
}

.fd-home-btn__icon--mail {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0;
}

@media (hover: hover) {
  .fd-home-btn--light:hover {
    background-color: var(--color-cyan-300);
    scale: 105%;
  }

  .fd-home-btn--dark:hover {
    background-color: var(--color-neutral-800);
  }

  .fd-home-btn--emerald:hover {
    background-color: var(--color-emerald-300);
    scale: 105%;
  }
}

/* ==========================================================================
   Atto 0: hero
   ========================================================================== */
.fd-home-hero__title {
  margin-bottom: 1.5rem;
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-extrabold);
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
  color: var(--color-white);
  filter: drop-shadow(var(--drop-shadow-2xl));
}

.fd-home-hero__break {
  display: none;
}

.fd-home-hero__gradient {
  --fd-gradient-stops: var(--color-blue-400), var(--color-cyan-400), var(--color-purple-400);
}

.fd-home-hero__desc {
  max-width: var(--container-3xl);
  margin-inline: auto;
  margin-bottom: 2rem;
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  font-weight: var(--font-weight-light);
  color: var(--color-neutral-300);
}

.fd-home-hero__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: var(--container-sm);
  margin-inline: auto;
}

@media (width >= 40rem) {
  .fd-home-hero__title {
    font-size: var(--text-4xl);
  }

  .fd-home-hero__break {
    display: inline;
  }

  .fd-home-hero__desc {
    margin-bottom: 2.5rem;
    font-size: var(--text-lg);
  }

  .fd-home-hero__actions {
    flex-direction: row;
    gap: 1rem;
    width: auto;
    max-width: none;
  }
}

@media (width >= 48rem) {
  .fd-home-hero__title {
    font-size: var(--text-5xl);
  }

  .fd-home-hero__desc {
    font-size: var(--text-xl);
  }
}

@media (width >= 64rem) {
  .fd-home-hero__title {
    font-size: var(--text-6xl);
  }
}

/* ==========================================================================
   Titoli e testi guida degli atti 1, 2, 3, 5
   ========================================================================== */
.fd-home-title {
  font-weight: var(--font-weight-extrabold);
  letter-spacing: var(--tracking-tight);
  color: var(--color-white);
  filter: drop-shadow(var(--drop-shadow-2xl));
}

.fd-home-title--approach {
  margin-bottom: 1.5rem;
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
}

.fd-home-title--offer {
  margin-bottom: 1.5rem;
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
}

.fd-home-title--tech {
  margin-bottom: 1rem;
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
}

.fd-home-title--contact {
  margin-bottom: 1rem;
  font-size: var(--text-3xl);
  line-height: var(--text-3xl--line-height);
}

.fd-home-title--approach .fd-home-title__gradient {
  --fd-gradient-stops: var(--color-blue-400), var(--color-cyan-400), var(--color-teal-300);
}

.fd-home-title--offer .fd-home-title__gradient {
  --fd-gradient-stops: var(--color-emerald-400), var(--color-teal-300);
}

.fd-home-title--tech .fd-home-title__gradient {
  --fd-gradient-stops: var(--color-purple-400), var(--color-pink-400), var(--color-indigo-300);
}

.fd-home-lead {
  margin-inline: auto;
  font-weight: var(--font-weight-light);
  line-height: var(--leading-relaxed);
  color: var(--color-neutral-300);
  filter: drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);
}

.fd-home-lead--offer {
  max-width: var(--container-3xl);
  margin-bottom: 2rem;
  font-size: var(--text-base);
}

.fd-home-lead--tech {
  max-width: var(--container-3xl);
  margin-bottom: 2rem;
  font-size: var(--text-base);
}

.fd-home-lead--contact {
  max-width: var(--container-2xl);
  margin-bottom: 2rem;
  font-size: var(--text-sm);
}

@media (width >= 40rem) {
  .fd-home-title--approach {
    margin-bottom: 2rem;
    font-size: var(--text-3xl);
  }

  .fd-home-title--offer,
  .fd-home-title--tech,
  .fd-home-title--contact {
    font-size: var(--text-4xl);
  }

  .fd-home-title--tech,
  .fd-home-title--contact {
    margin-bottom: 1.5rem;
  }

  .fd-home-title--contact {
    line-height: var(--text-4xl--line-height);
  }

  .fd-home-lead--offer,
  .fd-home-lead--tech {
    margin-bottom: 2.5rem;
    font-size: var(--text-lg);
  }

  .fd-home-lead--contact {
    margin-bottom: 2.5rem;
    font-size: var(--text-base);
  }
}

@media (width >= 48rem) {
  .fd-home-title--approach {
    font-size: var(--text-4xl);
  }

  .fd-home-title--offer,
  .fd-home-title--tech,
  .fd-home-title--contact {
    font-size: var(--text-5xl);
  }

  .fd-home-title--contact {
    line-height: var(--text-5xl--line-height);
  }

  .fd-home-lead--offer {
    font-size: var(--text-xl);
  }

  .fd-home-lead--contact {
    font-size: var(--text-lg);
  }
}

@media (width >= 64rem) {
  .fd-home-title--approach {
    font-size: var(--text-5xl);
  }

  .fd-home-title--offer,
  .fd-home-title--contact {
    font-size: var(--text-6xl);
  }

  .fd-home-title--contact {
    line-height: var(--text-6xl--line-height);
  }
}

/* ==========================================================================
   Atto 1: pilastri dell'approccio
   Il colore e' un modificatore (--blue, --emerald, --purple, --orange) che imposta le custom property.
   ========================================================================== */
.fd-home-pillars {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.875rem;
  text-align: left;
}

@media (width >= 40rem) {
  .fd-home-pillars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

.fd-home-pillar {
  --pillar-accent: var(--color-blue-500);
  --pillar-icon: var(--color-blue-300);
  --pillar-from: color-mix(in oklab, var(--color-blue-950) 60%, transparent);
  --pillar-via: color-mix(in oklab, var(--color-slate-900) 80%, transparent);
  --pillar-to: color-mix(in oklab, var(--color-blue-900) 30%, transparent);

  position: relative;
  padding: 1rem;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background-image: linear-gradient(to bottom right in oklab, var(--pillar-from), var(--pillar-via), var(--pillar-to));
  -webkit-backdrop-filter: blur(var(--blur-md));
  backdrop-filter: blur(var(--blur-md));
  transition-property: all;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: 0.3s;
}

.fd-home-pillar--emerald {
  --pillar-accent: var(--color-emerald-500);
  --pillar-icon: var(--color-emerald-300);
  --pillar-from: color-mix(in oklab, var(--color-emerald-950) 60%, transparent);
  --pillar-to: color-mix(in oklab, var(--color-emerald-900) 30%, transparent);
}

.fd-home-pillar--purple {
  --pillar-accent: var(--color-purple-500);
  --pillar-icon: var(--color-purple-300);
  --pillar-from: color-mix(in oklab, var(--color-purple-950) 60%, transparent);
  --pillar-to: color-mix(in oklab, var(--color-purple-900) 30%, transparent);
}

.fd-home-pillar--orange {
  --pillar-accent: var(--color-orange-500);
  --pillar-icon: var(--color-orange-300);
  --pillar-from: color-mix(in oklab, var(--color-amber-950) 60%, transparent);
  --pillar-to: color-mix(in oklab, var(--color-orange-900) 35%, transparent);
}

/* Alone luminoso nell'angolo */
.fd-home-pillar__glow {
  position: absolute;
  right: -2rem;
  bottom: -2rem;
  width: 7rem;
  height: 7rem;
  border-radius: 9999px;
  background-color: color-mix(in oklab, var(--pillar-accent) 15%, transparent);
  filter: blur(var(--blur-2xl));
  pointer-events: none;
  transition-property: all;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: var(--default-transition-duration);
}

.fd-home-pillar__inner {
  position: relative;
  z-index: 10;
}

.fd-home-pillar__head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.fd-home-pillar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-lg);
  background-color: color-mix(in oklab, var(--pillar-accent) 20%, transparent);
  color: var(--pillar-icon);
  transition-property: transform, translate, scale, rotate;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: var(--default-transition-duration);
}

/* L'SVG arriva dal campo pillar_icon: dimensione e colore sono dati dal contenitore */
.fd-home-pillar__icon svg {
  width: 1rem;
  height: 1rem;
}

.fd-home-pillar__title {
  font-size: var(--text-sm);
  line-height: var(--text-sm--line-height);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--color-white);
}

.fd-home-pillar__desc {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-normal);
  line-height: var(--leading-relaxed);
  color: var(--color-neutral-200);
}

@media (width >= 40rem) {
  .fd-home-pillar {
    padding: 1.25rem;
    border-radius: var(--radius-2xl);
  }

  .fd-home-pillar__title {
    font-size: var(--text-base);
    line-height: var(--text-base--line-height);
  }

  .fd-home-pillar__desc {
    font-size: 13px;
  }
}

@media (hover: hover) {
  .fd-home-pillar:hover {
    translate: 0 -0.125rem;
  }

  .fd-home-pillar:hover .fd-home-pillar__glow {
    background-color: color-mix(in oklab, var(--pillar-accent) 25%, transparent);
  }

  .fd-home-pillar:hover .fd-home-pillar__icon {
    scale: 105%;
  }
}

/* ==========================================================================
   Atto 2: offerta All Inclusive
   ========================================================================== */
.fd-home-offer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.fd-home-offer__price {
  padding: 0.875rem 1.5rem;
  text-align: center;
  border: 1px solid color-mix(in oklab, var(--color-emerald-500) 30%, transparent);
  border-radius: var(--radius-2xl);
  background-color: color-mix(in oklab, var(--color-slate-900) 60%, transparent);
  box-shadow:
    0 10px 15px -3px color-mix(in oklab, var(--color-emerald-950) 20%, transparent),
    0 4px 6px -4px color-mix(in oklab, var(--color-emerald-950) 20%, transparent);
  -webkit-backdrop-filter: blur(var(--blur-md));
  backdrop-filter: blur(var(--blur-md));
}

.fd-home-offer__label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-neutral-400);
}

.fd-home-offer__value {
  font-size: var(--text-2xl);
  line-height: var(--text-2xl--line-height);
  font-weight: var(--font-weight-black);
  color: var(--color-white);
}

.fd-home-offer__sub {
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
  font-weight: var(--font-weight-normal);
  color: var(--color-neutral-400);
}

@media (width >= 40rem) {
  .fd-home-offer {
    flex-direction: row;
    gap: 2rem;
  }

  .fd-home-offer__price {
    text-align: left;
  }

  .fd-home-offer__value {
    font-size: var(--text-3xl);
    line-height: var(--text-3xl--line-height);
  }

  .fd-home-offer__sub {
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }
}

@media (width >= 48rem) {
  .fd-home-offer__value {
    font-size: var(--text-4xl);
    line-height: var(--text-4xl--line-height);
  }
}

/* ==========================================================================
   Atto 3: tecnologia, SEO e AI
   ========================================================================== */
.fd-home-tech {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
  max-width: var(--container-4xl);
  margin-inline: auto;
  text-align: left;
}

@media (width >= 40rem) {
  .fd-home-tech {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

.fd-home-tech__box {
  --tech-400: var(--color-purple-400);
  --tech-500: var(--color-purple-500);
  --tech-950: var(--color-purple-950);

  padding: 1.25rem;
  border: 1px solid color-mix(in oklab, var(--tech-500) 30%, transparent);
  border-radius: var(--radius-2xl);
  background-color: color-mix(in oklab, var(--color-slate-900) 60%, transparent);
  box-shadow:
    0 10px 15px -3px color-mix(in oklab, var(--tech-950) 20%, transparent),
    0 4px 6px -4px color-mix(in oklab, var(--tech-950) 20%, transparent);
  -webkit-backdrop-filter: blur(var(--blur-md));
  backdrop-filter: blur(var(--blur-md));
  transition-property: all;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: var(--default-transition-duration);
}

.fd-home-tech__box--cyan {
  --tech-400: var(--color-cyan-400);
  --tech-500: var(--color-cyan-500);
  --tech-950: var(--color-cyan-950);
}

.fd-home-tech__title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
  font-size: var(--text-base);
  line-height: var(--text-base--line-height);
  font-weight: var(--font-weight-bold);
  color: var(--color-white);
}

.fd-home-tech__icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--tech-400);
}

.fd-home-tech__desc {
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  font-weight: var(--font-weight-normal);
  color: var(--color-neutral-300);
}

@media (width >= 40rem) {
  .fd-home-tech__box {
    padding: 1.5rem;
  }

  .fd-home-tech__title {
    font-size: var(--text-lg);
    line-height: var(--text-lg--line-height);
  }

  .fd-home-tech__desc {
    font-size: var(--text-sm);
  }
}

@media (hover: hover) {
  .fd-home-tech__box:hover {
    border-color: color-mix(in oklab, var(--tech-400) 60%, transparent);
    translate: 0 -0.125rem;
  }
}

/* ==========================================================================
   Atto 4: portfolio (carosello con swipe su mobile, 3 colonne da 768px)
   ========================================================================== */
.fd-home-portfolio__head {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.fd-home-portfolio__title {
  font-size: var(--text-2xl);
  line-height: var(--text-2xl--line-height);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: var(--tracking-tight);
  color: var(--color-white);
  filter: drop-shadow(var(--drop-shadow-2xl));
}

.fd-home-portfolio__desc {
  margin-top: 0.5rem;
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
  color: var(--color-neutral-300);
  filter: drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);
}

.fd-home-portfolio__link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.25rem;
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-blue-400);
  transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke;
  transition-timing-function: var(--default-transition-timing-function);
  transition-duration: var(--default-transition-duration);
}

.fd-home-portfolio__link-icon {
  width: 1rem;
  height: 1rem;
}

@media (hover: hover) {
  .fd-home-portfolio__link:hover {
    color: var(--color-blue-300);
  }
}

.fd-home-portfolio__grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

.fd-home-portfolio__empty {
  grid-column: span 3 / span 3;
  padding-block: 2.5rem;
  text-align: center;
  color: var(--color-neutral-500);
}

/* Indicatore di swipe (solo mobile) */
.fd-home-portfolio__swipe {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 0.625rem;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-neutral-400);
}

.fd-home-portfolio__swipe-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
  background-color: var(--color-blue-400);
  animation: var(--animate-pulse);
}

@media (width >= 40rem) {
  .fd-home-portfolio__head {
    flex-direction: row;
    align-items: flex-end;
    margin-bottom: 2rem;
  }

  .fd-home-portfolio__title {
    font-size: var(--text-3xl);
    line-height: var(--text-3xl--line-height);
  }

  .fd-home-portfolio__desc {
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }

  .fd-home-portfolio__grid {
    gap: 1.5rem;
  }
}

@media (width >= 48rem) {
  .fd-home-portfolio__title {
    font-size: var(--text-4xl);
    line-height: var(--text-4xl--line-height);
  }

  .fd-home-portfolio__desc {
    font-size: var(--text-base);
    line-height: var(--text-base--line-height);
  }

  .fd-home-portfolio__link {
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
  }

  .fd-home-portfolio__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fd-home-portfolio__swipe {
    display: none;
  }
}

@media (width >= 64rem) {
  .fd-home-portfolio__title {
    font-size: var(--text-5xl);
    line-height: var(--text-5xl--line-height);
  }

  .fd-home-portfolio__grid {
    gap: 2rem;
  }
}

/* Mobile: la griglia diventa un carosello con scroll-snap orizzontale */
@media (width < 48rem) {
  .fd-home-portfolio__grid {
    display: flex;
    gap: 0.85rem;
    margin-inline: -0.25rem;
    padding-inline: 0.25rem;
    padding-bottom: 0.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .fd-home-portfolio__grid > .fd-card-portfolio {
    flex-shrink: 0;
    min-width: 80vw;
    max-width: 80vw;
    height: 290px;
    min-height: 275px;
    padding: 1.25rem;
    border-radius: 1.25rem;
    scroll-snap-align: center;
  }

  .fd-home-portfolio__grid > .fd-card-portfolio .fd-card-portfolio__title {
    font-size: 1.15rem;
    line-height: 1.3;
  }
}

/* ==========================================================================
   Atto 5: contatti
   ========================================================================== */
.fd-home-contact__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  margin-bottom: 2rem;
}

@media (width >= 40rem) {
  .fd-home-contact__actions {
    flex-direction: row;
    width: auto;
  }
}

.fd-home-btn--contact-secondary {
  background-color: var(--color-neutral-900);
}

.fd-home-contact__note {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--text-xs--line-height);
  color: var(--color-neutral-400);
}

/* ==========================================================================
   Rail di navigazione laterale (solo desktop)
   ========================================================================== */
.fd-home-railbox {
  position: fixed;
  top: 50%;
  right: 1.25rem;
  z-index: 40;
  display: none;
  transform: translateY(-50%);
  pointer-events: auto;
}

@media (width >= 64rem) {
  .fd-home-railbox {
    display: block;
  }
}

.fd-home-rail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fd-home-rail__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  background: none;
  border: 0;
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 0.3s, transform 0.3s;
}

.fd-home-rail__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-family: monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: all 0.3s;
}

.fd-home-rail__label {
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #94a3b8;
  background: rgba(8, 13, 25, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
  transition: all 0.25s;
}

/* Sotto i 1536px le etichette compaiono come tooltip laterale (solo voce attiva o in hover) */
@media (width <= 96rem) {
  .fd-home-rail__label {
    position: absolute;
    right: 36px;
    opacity: 0;
    transform: translateX(10px);
  }
}

@media (hover: hover) {
  .fd-home-rail__item:hover {
    opacity: 0.95;
    transform: translateX(-2px);
  }

  .fd-home-rail__item:hover .fd-home-rail__label {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Focus da tastiera discreto; l'etichetta compare come in hover */
.fd-home-rail__item:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.6);
  outline-offset: 4px;
  opacity: 0.95;
}

.fd-home-rail__item:focus-visible .fd-home-rail__label {
  opacity: 1;
  transform: translateX(0);
}

/* Voce attiva (dopo l'hover: a parita' di specificita' prevale) */
.fd-home-rail__item.is-active {
  opacity: 1;
  transform: translateX(-4px);
}

.fd-home-rail__item.is-active .fd-home-rail__num {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.fd-home-rail__item.is-active .fd-home-rail__label {
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.3);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

@media (width <= 96rem) {
  .fd-home-rail__item.is-active .fd-home-rail__label {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================================================
   Indicazione di scroll iniziale
   ========================================================================== */
.fd-home-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  opacity: calc(1 - var(--hintFade) * 3);
  transform: translateX(-50%);
  transition: opacity 0.3s;
  pointer-events: none;
}

.fd-home-hint.is-hidden {
  visibility: hidden;
}

.fd-home-hint__text {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #94a3b8;
}

.fd-home-hint__chevron {
  width: 18px;
  height: 18px;
  border-right: 2px solid #38bdf8;
  border-bottom: 2px solid #38bdf8;
  transform: rotate(45deg);
  animation: fd-home-bounce 2s infinite;
}

@keyframes fd-home-bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0) rotate(45deg); }
  40% { transform: translateY(8px) rotate(45deg); }
  60% { transform: translateY(4px) rotate(45deg); }
}

@media (width < 48rem) {
  .fd-home-hint {
    bottom: 0.85rem;
    gap: 0.25rem;
  }

  .fd-home-hint__text {
    padding: 2px 8px;
    font-size: 0.56rem;
    letter-spacing: 0.12em;
    background: rgba(3, 7, 18, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }

  .fd-home-hint__chevron {
    width: 14px;
    height: 14px;
  }
}

/* ==========================================================================
   Coreografia: entrata a cascata degli elementi di ogni atto (indici da home.js)
   Prima dell'avvio dello script gli elementi dei blocchi non attivi sono nascosti; il
   paracadute fd-failsafe (premium.php) li rende comunque visibili se il JS non parte.
   ========================================================================== */
.fd-home-line {
  display: inline-block;
}

@media screen and (prefers-reduced-motion: no-preference) {
  html.fd-js:not(.fd-failsafe) .fd-home-block:not(.is-on) > *,
  html.fd-js:not(.fd-failsafe) .fd-home-block:not(.is-on) .fd-home-anim {
    opacity: 0;
  }

  html.fd-js .fd-home-block.is-on .fd-home-anim {
    animation: fd-home-in .95s cubic-bezier(.16, 1, .3, 1) backwards;
    animation-delay: calc(120ms + var(--fd-i, 0) * 85ms);
  }

  /* Righe dei titoli: salgono da sotto una maschera */
  html.fd-js .fd-home-block.is-on .fd-home-line {
    animation-name: fd-home-line-in;
    animation-duration: 1.1s;
  }

  /* Testo sfumato: entra come le altre righe, poi i colori scorrono lentamente */
  html.fd-js .fd-home-block.is-on .fd-home-line.fd-gradient-text {
    animation:
      fd-home-line-in 1.1s cubic-bezier(.16, 1, .3, 1) calc(120ms + var(--fd-i, 0) * 85ms) backwards,
      fd-home-shine 7s ease-in-out 1.4s infinite alternate;
  }

  /* Rail laterale e indicazione di scroll: entrano dopo l'hero */
  html.fd-js .fd-home-rail > li {
    animation: fd-home-rail-in .8s cubic-bezier(.16, 1, .3, 1) backwards;
  }

  .fd-home-rail > li:nth-child(1) { animation-delay: .7s; }
  .fd-home-rail > li:nth-child(2) { animation-delay: .77s; }
  .fd-home-rail > li:nth-child(3) { animation-delay: .84s; }
  .fd-home-rail > li:nth-child(4) { animation-delay: .91s; }
  .fd-home-rail > li:nth-child(5) { animation-delay: .98s; }
  .fd-home-rail > li:nth-child(6) { animation-delay: 1.05s; }

  html.fd-js .fd-home-hint {
    animation: fd-home-fade-in 1s ease 1.3s backwards;
  }

  /* Vita anche a pagina ferma: il video "respira" e segue appena il mouse, la luce pulsa */
  .fd-home-video {
    translate: var(--fd-px, 0) var(--fd-py, 0);
    transition: translate 1.6s cubic-bezier(.22, 1, .36, 1);
    animation: fd-home-drift 26s ease-in-out infinite alternate;
  }

  .fd-home-stage__glow {
    animation: fd-home-glow 7s ease-in-out infinite alternate;
  }
}

.fd-home-track .fd-gradient-text {
  background-size: 200% 100%;
}

@keyframes fd-home-in {
  from {
    opacity: 0;
    translate: 0 1.5rem;
    filter: blur(8px);
  }
}

@keyframes fd-home-line-in {
  from {
    opacity: 0;
    translate: 0 .55em;
    filter: blur(6px);
    clip-path: inset(0 0 100% 0);
  }

  to {
    clip-path: inset(-25% -5% -25% -5%);
  }
}

@keyframes fd-home-shine {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

@keyframes fd-home-rail-in {
  from {
    opacity: 0;
    translate: 1.25rem 0;
  }
}

@keyframes fd-home-fade-in {
  from { opacity: 0; }
}

@keyframes fd-home-drift {
  from { transform: scale(1.06) rotate(0deg); }
  to { transform: scale(1.14) rotate(.6deg); }
}

@keyframes fd-home-glow {
  from { opacity: .3; }
  to { opacity: .55; }
}

/* ==========================================================================
   Movimento ridotto: ferma le animazioni decorative continue
   (!important necessario per battere i selettori piu' specifici delle singole animazioni)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .fd-home-track *,
  .fd-home-track *::before,
  .fd-home-track *::after {
    animation: none !important;
  }
}
