/* ============================================================
   /mare — landing scroll-driven (storm → calm)
   Lo stage \xE8 alto piu' del viewport: una sticky inner ospita
   il canvas Three.js + due overlay (storm e calm) che si
   incrociano in opacit\xE0 in base a --p (0..1) settato da JS.
   ============================================================ */

.mare-body {
  background: #06121E;
  color: #F7F6F2;
}

/* ---------- Header trasparente ---------- */
.mare-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: transparent;
  border-bottom: 0;
}
.mare-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}
/* Logo PNG (E-BOX) — header + footer */
.logo-img {
  height: 34px;
  width: auto;
  display: block;
}
.mare-header .logo-img { height: 34px; }
.mare-body .footer-brand .logo-img { height: 30px; }
.mare-nav-link {
  color: rgba(247, 246, 242, 0.85);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 10px 16px;
  border: 1px solid rgba(247, 246, 242, 0.35);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.mare-nav-link:hover {
  color: #fff;
  border-color: rgba(247, 246, 242, 0.7);
  background: rgba(247, 246, 242, 0.08);
}

/* ---------- Stage scroll-driven ---------- */
.mare-stage {
  position: relative;
  width: 100%;
  /* l'altezza determina quanto scroll serve per la transizione storm->calm.
     250vh = ~1.5 viewport di scroll dopo il primo schermo. */
  height: 280vh;
  background: #06121E;
}
.mare-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 600px;
  width: 100%;
  overflow: hidden;
  /* --p \xE8 settata da mare.js: 0 = tempesta, 1 = calma */
  --p: 0;
}
/* Video sfondo: due video stacked, crossfade driven da --p */
.mare-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  /* iOS: rendi opaco il poster anche durante il caricamento */
  background: #06121E;
}
/* iOS Safari: nasconde il bottone play centrale che appare quando l'autoplay
   viene bloccato (Low Power Mode, data saver, ecc.). Il poster resta visibile. */
.mare-video::-webkit-media-controls,
.mare-video::-webkit-media-controls-panel,
.mare-video::-webkit-media-controls-overlay-play-button,
.mare-video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.mare-video-storm {
  z-index: 0;
  opacity: 1;
}
.mare-video-calm {
  z-index: 2;
  /* fade in: invisibile fino a p=0.20, full a p=0.75 */
  opacity: clamp(0, calc((var(--p) - 0.20) / 0.55), 1);
  transition: opacity 0.05s linear;
}

/* Poster overlay: copre il <video> per nascondere il play button nativo iOS
   quando l'autoplay viene bloccato. Si scopre quando il video parte davvero
   (evento "playing" → classe .is-playing). */
.mare-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  background: #06121E;
  transition: opacity 0.6s ease;
}
.mare-poster-storm {
  z-index: 1; /* sopra a video-storm */
  opacity: 1;
}
.mare-poster-calm {
  z-index: 3; /* sopra a video-calm */
  opacity: clamp(0, calc((var(--p) - 0.20) / 0.55), 1);
  transition: opacity 0.05s linear;
}
/* Quando il video parte: poster fade-out definitivo */
.mare-poster.is-playing {
  opacity: 0 !important;
  transition: opacity 0.6s ease !important;
}

#mare-bolts {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 5;
  /* fulmini solo in tempesta */
  opacity: clamp(0, calc(1 - var(--p) * 1.8), 1);
}

/* ---------- Overlay layer comune ---------- */
.mare-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 8;
  pointer-events: none;
}
.mare-overlay > * { pointer-events: auto; }

/* Storm overlay: visibile a inizio, fade out tra p=0.15..0.55 */
.mare-overlay-storm {
  opacity: clamp(0, calc((0.55 - var(--p)) / 0.40), 1);
  transform: translateY(calc(var(--p) * -40px));
  transition: opacity 0.05s linear, transform 0.05s linear;
}
/* Calm overlay: invisibile a inizio, fade in tra p=0.55..0.92 */
.mare-overlay-calm {
  opacity: clamp(0, calc((var(--p) - 0.55) / 0.37), 1);
  transform: translateY(calc((1 - var(--p)) * 30px));
  transition: opacity 0.05s linear, transform 0.05s linear;
}

/* Vignette costante per leggibilit\xE0 */
.mare-sticky::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  background: radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.45) 100%);
}

/* Scurimento extra per la tempesta (sopra ai poster, sotto ai bolt) */
.mare-storm-darken {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(0, 8, 18, 0.55), transparent 60%),
    linear-gradient(180deg, rgba(0, 6, 14, 0.40) 0%, rgba(0, 6, 14, 0.05) 35%, rgba(0, 6, 14, 0.30) 100%);
  opacity: clamp(0, calc(1 - var(--p) * 1.6), 1);
  transition: opacity 0.05s linear;
}

/* Lampi: overlay bianco-azzurrino che JS porta brevemente da 0 a una opacit\xE0 picco */
.mare-lightning {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background:
    radial-gradient(ellipse at 65% 30%, rgba(220, 235, 255, 0.95), rgba(180, 205, 240, 0.55) 25%, transparent 70%),
    linear-gradient(180deg, rgba(220, 230, 245, 0.65), rgba(150, 175, 205, 0.0) 60%);
  opacity: 0;
  mix-blend-mode: screen;
  will-change: opacity;
}

/* ---------- Storm copy ---------- */
.mare-eyebrow {
  display: inline-block;
  margin: 0 0 22px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 246, 242, 0.9);
  background: rgba(247, 246, 242, 0.08);
  border: 1px solid rgba(247, 246, 242, 0.18);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.mare-storm-copy {
  color: #F7F6F2;
  max-width: 980px;
}
.mare-claim {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400;
  font-size: clamp(56px, 9vw, 132px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0;
  color: #F7F6F2;
  text-shadow: 0 4px 60px rgba(0, 0, 0, 0.55);
}

.mare-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(247, 246, 242, 0.65);
  pointer-events: none;
  animation: mareHintBob 2.2s ease-in-out infinite;
}
@keyframes mareHintBob {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.65; }
  50%      { transform: translate(-50%, 6px); opacity: 1; }
}

/* ---------- Calm overlay (immagine + copy) ---------- */
.mare-calm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}
.mare-calm-visual {
  display: flex;
  justify-content: center;
  filter:
    drop-shadow(0 30px 50px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 90px rgba(232, 80, 26, 0.30))
    drop-shadow(0 0 18px rgba(150, 200, 255, 0.20));
}
.mare-box-img {
  width: 100%;
  max-width: 620px;
  height: auto;
  display: block;
}
.mare-calm-copy {
  color: #F7F6F2;
  /* Glass panel: leggermente scuro + blur per leggibilit\xE0 sopra al video brillante */
  background: linear-gradient(135deg, rgba(6, 18, 30, 0.55) 0%, rgba(6, 18, 30, 0.32) 100%);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border: 1px solid rgba(247, 246, 242, 0.10);
  border-radius: 22px;
  padding: 34px 36px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.mare-calm-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400;
  font-size: clamp(48px, 6.4vw, 88px);
  line-height: 1.0;
  letter-spacing: -0.02em;
  margin: 12px 0 18px;
  color: #F7F6F2;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}
.mare-calm-sub {
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.5;
  color: rgba(247, 246, 242, 0.92);
  margin: 0 0 28px;
  max-width: 460px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
.mare-cta-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 26px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #F7F6F2;
  text-decoration: none;
  border: 1px solid rgba(247, 246, 242, 0.4);
  border-radius: 999px;
  background: rgba(247, 246, 242, 0.06);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.mare-cta-link:hover {
  background: rgba(247, 246, 242, 0.14);
  border-color: rgba(247, 246, 242, 0.75);
}
.mare-cta-link:hover svg { transform: translateY(2px); }
.mare-cta-link svg { transition: transform 0.2s ease; }

/* ---------- Waitlist section (after stage releases) ---------- */
.mare-cta-section {
  background: #F7F6F2;
  padding: 96px 0 120px;
  position: relative;
  z-index: 5;
}
.mare-cta-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 72px;
  align-items: start;
}
.mare-cta-copy {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mare-cta-copy .eyebrow {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 18px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--brand);
  margin: 0 0 22px;
}
.mare-cta-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 22px;
  max-width: 620px;
}
.mare-cta-sub {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-muted);
  margin: 0;
  max-width: 520px;
}

/* ---------- Footer ---------- */
.mare-body .site-footer {
  background: #06121E;
  color: rgba(247, 246, 242, 0.7);
  border-top: 1px solid rgba(247, 246, 242, 0.08);
}
/* Desktop: evita che il flex column stiri il logo <img> a tutta la colonna.
   Su mobile la media query sotto sovrascrive con align-items: center. */
.mare-body .footer-brand {
  align-items: flex-start;
}
.mare-body .footer-tagline,
.mare-body .footer-legal {
  color: rgba(247, 246, 242, 0.6);
}
/* Mobile: footer mare completamente centrato (logo + tagline + copyright) */
@media (max-width: 960px) {
  .mare-body .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 18px;
    justify-items: center;
  }
  .mare-body .footer-brand {
    align-items: center;
    text-align: center;
  }
  .mare-body .footer-tagline {
    text-align: center;
  }
  .mare-body .footer-legal {
    text-align: center;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .mare-calm-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }
  .mare-calm-copy { display: flex; flex-direction: column; align-items: center; }
  .mare-calm-sub { margin-left: auto; margin-right: auto; }
}
@media (max-width: 860px) {
  .mare-cta-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}
@media (max-width: 640px) {
  .mare-header-inner { height: 72px; }
  /* Logo pi\xF9 grande su mobile */
  .mare-header .logo-img { height: 42px; }
  /* Waitlist pi\xF9 prominente: filled, padding maggiore, allineato vert */
  .mare-nav-link {
    font-size: 13px;
    padding: 12px 20px;
    background: rgba(247, 246, 242, 0.14);
    border-color: rgba(247, 246, 242, 0.55);
    color: #fff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .mare-stage { height: 260vh; }
  .mare-sticky { min-height: 540px; }

  /* Claim "Il mare non scherza" spostato pi\xF9 in basso per liberare le onde */
  .mare-overlay-storm {
    justify-content: flex-end;
    padding-bottom: 22vh;
  }

  .mare-claim { font-size: clamp(44px, 13vw, 72px); }
  .mare-calm-title { font-size: clamp(36px, 10vw, 56px); }
  .mare-calm-sub { font-size: 15px; }
  .mare-cta-section { padding: 64px 0 80px; }
  .mare-hint { font-size: 11px; bottom: 20px; }
  .mare-box-img { max-width: 320px; }
  .mare-calm-copy { padding: 24px 22px; border-radius: 18px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .mare-video,
  #mare-bolts,
  .mare-lightning { display: none; }
  .mare-sticky {
    background:
      radial-gradient(ellipse at 30% 20%, rgba(120, 180, 220, 0.15), transparent 50%),
      radial-gradient(ellipse at 70% 80%, rgba(90, 150, 190, 0.18), transparent 55%),
      linear-gradient(180deg, #06121E, #0E2438);
  }
  .mare-overlay-storm,
  .mare-overlay-calm {
    transform: none !important;
    transition: opacity 0.4s ease;
  }
  .mare-hint { animation: none; }
}

/* ---------- Sound toggle ---------- */
/* top: 100px → posizionato sotto la riga dell'header (80px / 72px mobile)
   per non collidere con il nav "Waitlist" in alto a destra. */
.mare-sound-btn {
  position: fixed;
  top: 100px;
  right: 22px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(247, 246, 242, 0.35);
  background: rgba(6, 18, 30, 0.45);
  color: rgba(247, 246, 242, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.mare-sound-btn:hover {
  color: #fff;
  border-color: rgba(247, 246, 242, 0.7);
  background: rgba(6, 18, 30, 0.65);
}
.mare-sound-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.mare-sound-btn .icon-on { display: none; }
.mare-sound-btn[aria-pressed="true"] .icon-on { display: block; }
.mare-sound-btn[aria-pressed="true"] .icon-muted { display: none; }

@media (max-width: 480px) {
  .mare-sound-btn { top: 88px; right: 18px; width: 36px; height: 36px; }
}
