/* ============================================================
   Digital Dreams — scroll experience
   ============================================================ */

:root {
  --bg: #050507;
  --fg: #f4f4f6;
  --fg-dim: rgba(244, 244, 246, 0.55);
  --accent: #ffffff;

  /* Variabili guidate da JS in base al progresso dello scroll */
  --veil-opacity: 0;
  --logo-opacity: 0;
  --logo-scale: 0.92;
  --logo-y: 0px;
  --form-opacity: 0;
  --form-y: 40px;
  --hint-opacity: 1;
  --form-bottom-gap: max(3vh, env(safe-area-inset-bottom, 0px) + 12px);

  /* Testo hero: dissolvenza Apple-style guidata da JS */
  --hero-opacity: 1;
  --hero-blur: 0px;
  --hero-scale: 1;

  /* Hint di fine (sopra il logo), guidato da JS */
  --endhint-opacity: 0;
  --endhint-bottom: 66vh;
  --content-top: 62%;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  /* Lo scroll non muove la pagina: è solo input per l'auto-play del video.
     Blocchiamo lo scroll nativo e il bounce/overscroll. */
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---------- Palcoscenico a schermo intero ---------- */

.scroll-track {
  height: 100%;
  position: relative;
}

.stage {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100svh;
  width: 100%;
  overflow: hidden;
}

/* ---------- Video ---------- */

.scrub-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Copertura poster: primo frame mostrato finché il video non scrubba.
   Sta appena sopra il video, sotto la UI. Sparisce al primo scroll. */
.poster-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.poster-cover.is-hidden {
  opacity: 0;
}

.veil {
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: var(--veil-opacity);
  pointer-events: none;
}

/* ---------- Testo hero centrale ---------- */

.hero {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 8vw, 6rem);
  text-align: center;
  pointer-events: none;
  opacity: var(--hero-opacity);
  filter: blur(var(--hero-blur));
  transform: scale(var(--hero-scale));
  transform-origin: center;
  will-change: opacity, filter, transform;
}

.hero-text {
  max-width: 22ch;
  font-size: clamp(1.6rem, 4.6vw, 3.1rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.015em;
  color: #fff;
}

/* ---------- Logo ---------- */

.logo-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: translateY(var(--logo-y));
  will-change: transform;
}

.logo {
  width: min(84vw, 720px); /* lockup orizzontale (logo + DIGITAL DREAMS) */
  height: auto;
  opacity: var(--logo-opacity);
  transform: scale(var(--logo-scale));
  will-change: opacity, transform;
  filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.08));
}

/* ---------- Form di contatto ---------- */

.form-wrap {
  position: absolute;
  left: 50%;
  top: var(--content-top, 62%); /* posizionato da JS: sotto il logo, come un lockup */
  transform: translate(-50%, var(--form-y));
  width: min(90vw, 460px);
  opacity: var(--form-opacity);
  pointer-events: none; /* attivato da JS quando visibile */
  will-change: opacity, transform;
}

.form-wrap.is-interactive {
  pointer-events: auto;
}

/* ---------- Blocco contatti (tagline + email) ---------- */

.contact-card {
  width: min(92vw, 640px);
  text-align: center;
}

.cc-tag {
  margin: 0 auto;
  max-width: 34ch;
  font-size: clamp(1.05rem, 2.3vw, 1.4rem);
  font-weight: 500;
  line-height: 1.35;
  color: #fff;
}

.cc-email {
  display: inline-block;
  margin-top: 2rem;
  font-size: clamp(1rem, 2.1vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.3s ease, opacity 0.3s ease;
}
.cc-email:hover,
.cc-email:focus-visible {
  border-bottom-color: rgba(255, 255, 255, 0.7);
}

/* La navbar a pillola (.pill-nav) è condivisa: sta in css/base.css */

/* ---------- Indicatore di scroll ---------- */

.scroll-hint,
.end-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.scroll-hint {
  bottom: max(3.5vh, env(safe-area-inset-bottom, 0px) + 18px);
  opacity: var(--hint-opacity);
}

/* Hint di fine: in cima, sopra il logo — indica di scorrere verso l'alto */
.end-hint {
  bottom: var(--endhint-bottom, 66vh);
  opacity: var(--endhint-opacity, 0);
}

/* ---------- Loghi clienti: spaziatura specifica nell'hero della landing
   (il componente .trust-* è condiviso, sta in css/base.css) ---------- */

.scroll-hint .trust-strip {
  margin-bottom: 1.9rem;      /* + gap 0.9rem = ~2.8rem dal testo sotto */
}

.scroll-hint-label {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.85);
}

/* Indicatore elegante: sottile traccia con un puntino luminoso che scorre */
.scroll-hint-track {
  position: relative;
  width: 1.5px;
  height: 46px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
.scroll-hint-track::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 3px;
  height: 11px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.65);
  animation: track-dot-down 1.9s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.scroll-hint-track.up::after {
  animation-name: track-dot-up;
}

@keyframes track-dot-down {
  0%   { transform: translateY(-14px); opacity: 0; }
  25%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { transform: translateY(46px); opacity: 0; }
}
@keyframes track-dot-up {
  0%   { transform: translateY(46px); opacity: 0; }
  25%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { transform: translateY(-14px); opacity: 0; }
}

/* ---------- Loader ---------- */

.loader {
  position: absolute;
  inset: 0;
  z-index: 100; /* sopra la navbar (z-index 60): loading screen totalmente pulito */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.6s ease;
}

.loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.loader-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fg);
  animation: loader-pulse 1.1s ease-in-out infinite;
}

.loader-bar {
  width: min(52vw, 240px);
  height: 2px;
  border-radius: 2px;
  background: rgba(244, 244, 246, 0.14);
  overflow: hidden;
}
.loader-bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--fg);
  border-radius: 2px;
  transition: width 0.25s ease;
}
.loader-pct {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

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

/* ---------- Fallback senza JavaScript ---------- */

.noscript-fallback {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  text-align: center;
  padding: 2rem;
}

.noscript-fallback a {
  color: var(--fg);
}

/* ---------- Viewport bassi: blocco contatti più compatto ---------- */

@media (max-height: 720px) {
  .cc-email { margin-top: 1.4rem; }
}

/* ---------- Riduzione del movimento ---------- */

@media (prefers-reduced-motion: reduce) {
  .scroll-hint-track::after,
  .loader-dot {
    animation: none;
  }
}
