/* ============================================================
   LATITUDINE 40 — pagina-manifesto
   ============================================================ */

:root {
  --navy-900: #081C31; /* sfondo */
  --navy-800: #0E2A47; /* secondo livello */
  --gold:     #C9A96A; /* oro sabbia */
  --cream:    #F7F3EA; /* testi */
  --slate:    #8A9BAC; /* testi secondari */

  --font-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-sans:  "Jost", "Helvetica Neue", Arial, sans-serif;

  /* v1.1 — foto di sfondo: sostituire none con url("foto.jpg").
     L'overlay navy in .bg::after è già pronto, il layout non cambia. */
  --bg-photo: none;
}

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

html {
  height: 100%;
}

body {
  /* position:fixed blocca anche il rubber-band scroll di iOS Safari */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--navy-900);
  color: var(--cream);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- sfondo (pronto per la foto v1.1) ---------- */

.bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--bg-photo);
  background-size: cover;
  background-position: center;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120% 90% at 50% 10%,
    rgba(14, 42, 71, 0.55) 0%,
    rgba(8, 28, 49, 0.92) 60%,
    rgba(8, 28, 49, 0.97) 100%
  );
}

/* ---------- struttura ---------- */

.scene {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px 16dvh; /* lascia respiro al mare in basso */
}

/* ---------- simbolo ---------- */

.logo {
  margin-bottom: clamp(20px, 4dvh, 36px);
}

.logo svg {
  display: block;
  width: clamp(92px, 26vw, 128px);
  height: auto;
}

/* ---------- wordmark ---------- */

.wordmark {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.75rem, 7.5vw, 3.25rem);
  letter-spacing: 0.22em;
  text-indent: 0.22em; /* riequilibra il tracking dell'ultima lettera */
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--cream);
  white-space: nowrap;
}

/* ---------- coordinate ---------- */

.coords {
  margin-top: clamp(10px, 1.8dvh, 16px);
  font-size: clamp(0.75rem, 3.4vw, 0.95rem);
  font-weight: 400;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: var(--gold);
  white-space: nowrap;
  /* larghezza e altezza riservate: nessun layout shift tra vuoto e pieno */
  min-height: 1.5em;
  min-width: 14.1em;
  text-align: left;
}

/* Con JS attivo il testo statico resta nascosto finché il typewriter non parte;
   senza JS la classe .js non c'è e il testo statico del markup resta visibile. */
.js .coords {
  visibility: hidden;
}

.cursor {
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 3px;
  background: var(--gold);
  vertical-align: -0.12em;
  opacity: 0;
}

.cursor.on {
  animation: blink 1s step-end infinite;
}

.cursor.off {
  animation: none;
  transition: opacity 0.8s ease;
  opacity: 0 !important;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ---------- payoff e contesto ---------- */

.payoff {
  margin-top: clamp(22px, 4dvh, 34px);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.15rem, 4.8vw, 1.5rem);
  color: var(--cream);
}

.context {
  margin-top: clamp(8px, 1.4dvh, 12px);
  font-size: clamp(0.75rem, 3.1vw, 0.85rem);
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--slate);
}

/* ---------- social ---------- */

.social {
  margin-top: clamp(26px, 5dvh, 44px);
  display: flex;
  gap: clamp(14px, 4vw, 24px);
}

.social a {
  display: grid;
  place-items: center;
  width: 44px;  /* touch target */
  height: 44px;
  color: var(--cream);
  transition: color 0.3s ease, transform 0.3s ease;
}

.social a svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.social a:hover,
.social a:focus-visible {
  color: var(--gold);
  transform: translateY(-2px);
}

/* ---------- mail ---------- */

.mail {
  margin-top: clamp(12px, 2.2dvh, 20px);
  padding: 4px 2px;
  font-size: clamp(0.75rem, 3vw, 0.85rem);
  letter-spacing: 0.08em;
  color: var(--slate);
  text-decoration: none;
  border-bottom: 1px solid rgba(138, 155, 172, 0.35);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.mail:hover,
.mail:focus-visible {
  color: var(--gold);
  border-color: rgba(201, 169, 106, 0.55);
}

a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---------- il mare ---------- */

.sea {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 23dvh;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  animation: appear 1.8s ease 0.2s forwards;
}

.wave {
  position: absolute;
  width: 210%;
  will-change: transform;
}

.wave svg {
  display: block;
  width: 100%;
  height: clamp(30px, 6dvh, 52px);
}

.wave-1 { left: -2%;  bottom: 60%; opacity: 0.50; animation: drift  9s ease-in-out -2s infinite alternate; }
.wave-2 { left: -12%; bottom: 33%; opacity: 0.30; animation: drift 12s ease-in-out -6s infinite alternate; }
.wave-3 { left: -22%; bottom: 8%;  opacity: 0.18; animation: drift 15s ease-in-out -4s infinite alternate; }

.wave-1 svg { animation: bob  7s ease-in-out      infinite alternate; }
.wave-2 svg { animation: bob  9s ease-in-out -3s  infinite alternate; }
.wave-3 svg { animation: bob 11s ease-in-out -5s  infinite alternate; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-4%, 0, 0); }
}

@keyframes bob {
  from { transform: translateY(-3px); }
  to   { transform: translateY(3px); }
}

@keyframes appear {
  to { opacity: 1; }
}

/* ---------- sequenza d'ingresso ---------- */

.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- accessibilità ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .sea,
  .wave,
  .wave svg {
    animation: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .sea {
    opacity: 1;
  }
  .cursor {
    display: none;
  }
  /* niente typewriter: il testo statico del markup resta visibile com'è */
  .js .coords {
    visibility: visible;
  }
}

/* ---------- schermi molto bassi (mobile landscape) ---------- */

@media (max-height: 520px) {
  .scene { padding-bottom: 10dvh; }
  .logo { margin-bottom: 12px; }
  .logo svg { width: 76px; }
  .payoff { margin-top: 12px; }
  .social { margin-top: 14px; }
  .mail { margin-top: 8px; }
  .sea { height: 15dvh; }
}
