/* Maré Crochet, bozza 3D. Palette e caratteri del brand: avorio, sabbia, turchese, oceano, inchiostro. */
:root {
  --avorio: #F7F3EC;
  --sabbia: #EDE5D6;
  --sabbia-scura: #DDD0BA;
  --inchiostro: #1E1B16;
  --grigio: #6E675C;
  --turchese: #5BB8B4;
  --turchese-chiaro: #8AD1CD;
  --oceano: #2E6E77;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", "Segoe UI", sans-serif;
  --testata-h: 114px;
  --molla: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--avorio); scrollbar-gutter: stable; }

body {
  background: var(--avorio);
  color: var(--inchiostro);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { max-width: 100%; display: block; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 1.5rem; }

section[id] { scroll-margin-top: 110px; }

/* ---------- etichette e titoli ---------- */
.label {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--oceano);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  text-wrap: balance;
}

/* il titolo principale della pagina è l'etichetta della hero: resta com'era a vedersi */
.hero-label:where(h1) { line-height: inherit; text-wrap: wrap; }
/* testo per Google e per i lettori di schermo, non si vede */
.solo-lettori { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

h2 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 0.75rem 0 1.25rem; }
h3 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0.5rem 0 1rem; }
em { font-style: italic; }

/* grana di sabbia su tutta la pagina */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.045;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- stati iniziali di ciò che viene animato (solo con JS e senza "riduci movimento") ---------- */
.js:not(.rm) [data-ai] { opacity: 0; }
.js:not(.rm) .hero-label,
.js:not(.rm) .tagline,
.js:not(.rm) .hero-cta { opacity: 0; transform: translateY(18px); }
.js .borsa-img { opacity: 0; }
.js.senza-3d .borsa-img { opacity: 1; transition: opacity 0.9s ease; }

/* ---------- testata ---------- */
.testata {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--avorio) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--sabbia-scura);
  transition: box-shadow 0.35s ease;
}

.testata.scorrendo { box-shadow: 0 6px 24px color-mix(in srgb, var(--inchiostro) 10%, transparent); }

/* tappo avorio sopra la barra: copre la striscia che Safari iOS lascia vedere durante lo scroll */
.testata::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 120vh;
  background: var(--avorio);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.1rem 1.5rem;
  max-width: 1060px;
  margin: 0 auto;
}

.nav-logo img { height: 46px; width: auto; }

.nav-links { display: flex; gap: 2rem; }

.nav-links a {
  position: relative;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--inchiostro);
  padding-bottom: 5px;
  transition: color 0.25s;
}

.nav-links a:hover { color: var(--oceano); }

/* al passaggio, sotto il link scorre una piccola onda */
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 6px; /* controllo-trattini:ok, onda disegnata che scorre al passaggio del mouse */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='6' viewBox='0 0 16 6'%3E%3Cpath d='M0 3 Q4 0 8 3 T16 3' fill='none' stroke='%235BB8B4' stroke-width='1.3'/%3E%3C/svg%3E") repeat-x left center / 16px 6px;
  opacity: 0;
  transition: opacity 0.3s;
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after { opacity: 1; animation: onda-scorre 1.1s linear infinite; }

@keyframes onda-scorre { to { background-position-x: 16px; } }

.menu-btn {
  display: none;
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  cursor: pointer;
}

.menu-btn span {
  display: block;
  height: 1.6px;
  border-radius: 2px;
  background: var(--inchiostro);
  margin: 5.5px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-btn.aperto span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.aperto span:nth-child(2) { opacity: 0; }
.menu-btn.aperto span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@keyframes affiora { to { opacity: 1; transform: none; } }

/* splash d'acqua quando si apre il menu da telefono */
.splash { position: absolute; pointer-events: none; z-index: 12; }

.splash .goccia {
  position: absolute;
  left: -3px;
  top: -3px;
  width: var(--g, 7px);
  height: var(--g, 7px);
  border-radius: 50%;
  background: var(--turchese);
  opacity: 0.9;
  animation: schizzo var(--t, 0.6s) cubic-bezier(0.16, 0.6, 0.45, 1) forwards;
}

@keyframes schizzo {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.9; }
  100% { transform: translate(var(--dx, -30px), var(--dy, 20px)) scale(0.15); opacity: 0; }
}

.splash .anello {
  position: absolute;
  left: -16px;
  top: -16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--turchese);
  opacity: 0.7;
  animation: anello-splash 0.55s ease-out forwards;
}

@keyframes anello-splash { to { transform: scale(2.2); opacity: 0; } }

/* ---------- hero: cielo, mare in 3D, riva ---------- */
.hero {
  position: relative;
  min-height: calc(100svh - var(--testata-h));
  overflow: hidden;
  display: flex;
  justify-content: center;
  text-align: center;
  background: var(--sabbia);
}

.cielo {
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--avorio) 0%, #F6F1E7 34%, var(--sabbia) 62%);
  overflow: hidden;
}

/* luce del sole che vaga lenta nel cielo */
.cielo::before {
  content: "";
  position: absolute;
  top: -20%;
  left: 10%;
  width: 55vmin;
  height: 55vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 205, 150, 0.38), transparent 65%);
  filter: blur(10px);
  animation: sole 36s ease-in-out infinite alternate;
}

@keyframes sole {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(38vw, 9vh) scale(1.15); }
}

/* senza WebGL: una fascia di mare dipinta e la borsa che galleggia */
.senza-3d .cielo::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 36%;
  height: 26%;
  background: linear-gradient(color-mix(in srgb, var(--turchese) 55%, var(--avorio)), color-mix(in srgb, var(--turchese) 22%, var(--sabbia)) 70%, var(--sabbia));
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 60%, transparent);
  mask-image: linear-gradient(transparent, #000 18%, #000 60%, transparent);
}

.senza-3d .borsa-slot { animation: galleggia 4.8s ease-in-out infinite alternate; }

@keyframes galleggia {
  from { transform: translateY(6px) rotate(-1.1deg); }
  to   { transform: translateY(-12px) rotate(1.1deg); }
}

.mare-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.9s ease;
  touch-action: pan-y;
}

.mare-pronto .mare-3d { opacity: 1; }
.senza-3d .mare-3d { display: none; }

.hero-contenuto {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 2.25rem 1.5rem 5rem;
  pointer-events: none;
}

.hero-contenuto a { pointer-events: auto; }

.borsa-slot {
  position: relative;
  width: min(360px, 74vw);
  aspect-ratio: 1000 / 811;
  margin: 2.1rem 0 4.75rem;
}

.borsa-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px color-mix(in srgb, var(--oceano) 22%, transparent));
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  line-height: 1.4;
  color: #575045;
  max-width: 32ch;
  margin: 0 auto 2rem;
}

.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

.riva { position: absolute; bottom: -1px; left: 0; width: 100%; line-height: 0; z-index: 3; pointer-events: none; }
.riva svg { width: 100%; height: 60px; display: block; }

/* ---------- pulsanti ---------- */
.btn {
  display: inline-block;
  position: relative;
  overflow: hidden;
  z-index: 0;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.95rem 2.2rem;
  border: 1px solid var(--inchiostro);
  color: var(--inchiostro);
  background: color-mix(in srgb, var(--avorio) 70%, transparent);
  cursor: pointer;
  transition: color 0.35s, border-color 0.35s;
}

.btn-testo { display: inline-block; pointer-events: none; }

/* al passaggio, un'onda risale e riempie il pulsante */
.btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  height: calc(100% + 12px);
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='12' viewBox='0 0 40 12'%3E%3Cpath d='M0 12 L0 6 Q10 0 20 6 Q30 12 40 6 L40 12 Z' fill='%232E6E77'/%3E%3C/svg%3E"), linear-gradient(var(--oceano), var(--oceano));
  background-repeat: repeat-x, no-repeat;
  background-size: 40px 12px, 100% calc(100% - 11px);
  background-position: left top, left 11px;
  transition: transform 0.4s var(--molla);
}

.btn:hover::before, .btn:focus-visible::before { transform: translateY(-100%); }
.btn:hover, .btn:focus-visible { color: var(--avorio); border-color: var(--oceano); }

.btn.pieno { background: var(--oceano); border-color: var(--oceano); color: var(--avorio); }

.btn.pieno::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='12' viewBox='0 0 40 12'%3E%3Cpath d='M0 12 L0 6 Q10 0 20 6 Q30 12 40 6 L40 12 Z' fill='%231E1B16'/%3E%3C/svg%3E"), linear-gradient(var(--inchiostro), var(--inchiostro));
}

.btn.pieno:hover, .btn.pieno:focus-visible { border-color: var(--inchiostro); }

/* onde divisorie in fondo alle sezioni */
.onda { position: absolute; bottom: -1px; left: 0; width: 100%; line-height: 0; z-index: 3; pointer-events: none; }
.onda svg { width: 100%; height: 60px; display: block; }

/* ---------- storia ---------- */
.storia { background: var(--sabbia); padding: 3.5rem 0 7rem; position: relative; }

.storia-intro { max-width: 62ch; margin: 0 auto; text-align: center; }

.storia-intro p {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  line-height: 1.6;
  color: var(--inchiostro);
}

/* il gomitolo in 3D: si può far girare con il dito o con il mouse */
.gomitolo {
  position: relative;
  width: min(300px, 64vw);
  aspect-ratio: 1;
  margin: 1.25rem auto 0;
  cursor: grab;
  touch-action: pan-y;
}

.gomitolo:active { cursor: grabbing; }

.gomitolo-3d { position: relative; z-index: 1; width: 100%; height: 100%; display: block; }

.gomitolo-ombra {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 9%;
  height: 9%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--inchiostro) 34%, transparent), transparent 70%);
  filter: blur(7px);
}

.senza-3d .gomitolo { display: none; }

.capitoli { position: relative; display: grid; gap: 4.5rem; padding-top: 4.5rem; }

.filo-capitoli {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.filo-capitoli path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.filo-linea { stroke: var(--turchese); stroke-width: 2.4; }
.filo-ombra { stroke: color-mix(in srgb, var(--oceano) 30%, transparent); stroke-width: 2.4; transform: translate(1.5px, 3px); filter: blur(1.5px); }

.uncinetto {
  position: absolute;
  left: 0;
  top: 0;
  width: 58px;
  height: 16px;
  overflow: visible;
  transform-origin: 0 50%;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  filter: drop-shadow(1px 3px 3px color-mix(in srgb, var(--inchiostro) 25%, transparent));
}

.capitolo {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(70px, 120px) minmax(0, 1fr);
  gap: 1.5rem 2.5rem;
  align-items: start;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* numeri romani in rilievo: lo spessore è fatto di strati d'ombra, l'inclinazione segue lo scroll */
.capitolo .numero {
  font-family: var(--serif);
  font-size: clamp(3.4rem, 7vw, 5.2rem);
  font-style: italic;
  line-height: 1;
  text-align: right;
  perspective: 500px;
}

.capitolo .numero span {
  display: inline-block;
  color: var(--turchese);
  transform: rotateY(var(--giro, -18deg)) rotateX(6deg);
  transform-origin: 60% 50%;
  text-shadow:
    1px 1px 0 #4FA9A6, 2px 2px 0 #469C9A, 3px 3px 0 #3E8F8F,
    4px 4px 0 #378386, 5px 5px 0 #32787E, 6px 6px 0 var(--oceano),
    10px 14px 18px color-mix(in srgb, var(--oceano) 30%, transparent);
  will-change: transform;
}

.capitolo p { color: var(--grigio); max-width: 58ch; }

/* ---------- creazioni: la giostra ---------- */
.creazioni { padding: 6rem 0; text-align: center; overflow: hidden; }

.giostra {
  --carta-w: clamp(210px, 21vw, 280px);
  position: relative;
  margin: 2.75rem 0 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.giostra::-webkit-scrollbar { display: none; }

.giostra-pista { display: flex; gap: 1.25rem; width: max-content; padding: 0 1.5rem; }

.opera { margin: 0; flex: 0 0 auto; width: var(--carta-w); }

.opera-cornice {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--sabbia);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--inchiostro) 13%, transparent);
}

.opera img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--molla);
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.opera figcaption {
  margin-top: 0.8rem;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--grigio);
}

/* con JS la fila diventa un anello che gira nello spazio */
.giostra.tre-d {
  overflow: hidden;
  height: calc(var(--carta-w) * 1.25 + 6.5rem);
  perspective: 1500px;
  perspective-origin: 50% 40%;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}

.giostra.tre-d.trascino { cursor: grabbing; }

.giostra.tre-d .giostra-pista {
  position: absolute;
  left: 50%;
  top: 1.75rem;
  display: block;
  width: var(--carta-w);
  margin-left: calc(var(--carta-w) / -2);
  padding: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.giostra.tre-d .opera {
  position: absolute;
  left: 0;
  top: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  cursor: pointer;
}

/* riflesso di luce che attraversa la foto al passaggio */
.opera-cornice::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.38) 50%, transparent 60%);
  background-size: 260% 100%;
  background-position: 130% 0;
  transition: background-position 0.9s var(--molla);
  pointer-events: none;
}

@media (hover: hover) {
  .opera:hover img { transform: scale(1.06); }
  .opera:hover .opera-cornice::after { background-position: -40% 0; }
}

.giostra-comandi {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.js .giostra-comandi { display: flex; }

.giostra-freccia {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--sabbia-scura);
  background: transparent;
  color: var(--inchiostro);
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, color 0.3s, transform 0.3s var(--molla);
}

.giostra-freccia svg { width: 16px; height: 16px; display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.giostra-freccia:hover { background: var(--oceano); border-color: var(--oceano); color: var(--avorio); }
.giostra-freccia:active { transform: scale(0.92); }

.giostra-conta {
  min-width: 6.5em;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--grigio);
}

.giostra-conta b { font-weight: 400; color: var(--oceano); }

/* pulsante che apre la galleria, ritagliato a forma di onda */
.galleria-apri {
  --forma-onda: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 64' preserveAspectRatio='none'%3E%3Cpath d='M0,34 C0,20 8,9 22,9 Q54,-3 86,9 Q118,21 150,9 Q182,-3 214,9 Q246,21 278,9 C292,9 300,20 300,34 C300,52 292,64 278,64 L22,64 C8,64 0,52 0,34 Z' fill='%23000'/%3E%3C/svg%3E");
  margin: 0.25rem 0 3rem;
  border: 0;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  line-height: 1;
  padding: 1.35rem 2.3rem 1.4rem;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='7' viewBox='0 0 36 7'%3E%3Cpath d='M0 7 L0 3.5 Q9 0 18 3.5 Q27 7 36 3.5 L36 7 Z' fill='%235BB8B4' fill-opacity='.5'/%3E%3C/svg%3E"),
    linear-gradient(rgba(91, 184, 180, 0.5), rgba(91, 184, 180, 0.5)),
    linear-gradient(180deg, #F0E9DC, #E4DAC6);
  background-repeat: repeat-x, no-repeat, no-repeat;
  background-size: 36px 7px, 100% 6px, 100% 100%;
  background-position: left bottom 6px, left bottom, left top;
  -webkit-mask-image: var(--forma-onda);
  mask-image: var(--forma-onda);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.nota-foto {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--grigio);
}

.nota-foto a { color: var(--oceano); }

/* ---------- galleria a schermo intero ---------- */
.galleria {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--avorio);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s;
}

.galleria.aperta { opacity: 1; visibility: visible; }

.galleria-onda {
  position: sticky;
  top: 0;
  z-index: 2;
  line-height: 0;
  background: var(--avorio);
  padding-top: 1.25rem;
}

.galleria-onda svg { width: 100%; height: 42px; display: block; }

.galleria-testa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 0.75rem;
  line-height: 1.75;
}

.galleria-chiudi {
  background: none;
  border: 1px solid var(--sabbia-scura);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--inchiostro);
  cursor: pointer;
  transition: background 0.25s, transform 0.25s;
}

.galleria-chiudi:hover { background: var(--sabbia); transform: rotate(90deg); }

.galleria-griglia {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 5rem;
  columns: 3 240px;
  column-gap: 1rem;
  perspective: 1200px;
}

/* le foto si alzano dall'acqua una dopo l'altra, ruotando */
.galleria-griglia figure {
  break-inside: avoid;
  margin: 0 0 1rem;
  opacity: 0;
  transform: translateY(40px) rotateX(-22deg);
  transform-origin: 50% 100%;
  transition: opacity 0.8s ease, transform 0.9s var(--molla);
}

.galleria.aperta .galleria-griglia figure { opacity: 1; transform: none; }

.galleria-griglia img { width: 100%; height: auto; border-radius: 2px; transition: transform 0.5s ease; }

.galleria-griglia figure.scelta img { box-shadow: 0 0 0 3px var(--avorio), 0 0 0 5px var(--turchese); }

.galleria-griglia figcaption {
  margin-top: 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--grigio);
}

/* ---------- banda: il mare che respira ---------- */
.banda {
  position: relative;
  overflow: hidden;
  min-height: min(66vh, 580px);
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--oceano);
}

.banda-sfondo { position: absolute; inset: 0; }

.banda-sfondo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: respiro 22s ease-in-out infinite alternate;
}

@keyframes respiro {
  from { transform: scale(1); }
  to   { transform: scale(1.09); }
}

.banda-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.banda-3d.pronta { opacity: 1; }

.banda::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(30, 27, 22, 0.3), rgba(30, 27, 22, 0.16));
  pointer-events: none;
}

.banda-testo { position: relative; z-index: 1; padding: 4rem 1.5rem; pointer-events: none; }
.banda-testo .label { color: var(--avorio); opacity: 0.9; }

.banda-frase {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  line-height: 1.4;
  color: var(--avorio);
  max-width: 40ch;
  margin: 0.75rem auto 0;
  text-shadow: 0 2px 18px rgba(30, 27, 22, 0.45);
  text-wrap: balance;
}

/* ---------- chi c'è dietro ---------- */
.chi { background: var(--sabbia); padding: 6rem 0 7rem; position: relative; }

.chi-inner {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 3.5rem;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.ritratto-scena { perspective: 900px; }

.ritratto-cornice {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  will-change: transform;
}

.ritratto {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 6px solid var(--avorio);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--inchiostro) 16%, transparent);
  background: var(--avorio);
  transform: translateZ(26px);
}

.ritratto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

/* anelli d'acqua che si allargano dietro il ritratto */
.anello-acqua {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--turchese);
  opacity: 0;
  animation: anello 5.2s ease-out infinite;
}

.anello-acqua.a2 { animation-delay: 2.6s; }

@keyframes anello {
  0%   { transform: scale(0.96); opacity: 0.7; }
  100% { transform: scale(1.34); opacity: 0; }
}

.chi p { color: var(--grigio); max-width: 55ch; }

.firma {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--inchiostro) !important;
  margin-top: 1.25rem;
}

/* ---------- contatto ---------- */
.contatto { padding: 6rem 0 5rem; }

.contatto-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 4rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  align-items: start;
}

.contatto p.invito { color: var(--grigio); max-width: 42ch; margin-bottom: 2rem; }

.recapiti { display: grid; gap: 0.6rem; }

.recapiti a {
  color: var(--oceano);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--oceano) 35%, transparent);
  width: fit-content;
  transition: border-color 0.25s;
}

.recapiti a:hover { border-color: var(--oceano); }

form { display: grid; gap: 1.1rem; }

.campo { display: grid; gap: 0.35rem; position: relative; }

/* quando scrivi, sotto il campo scorre una corrente turchese */
.campo::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px; /* controllo-trattini:ok, bordo del campo che si colora mentre scrivi */
  background: linear-gradient(90deg, var(--turchese), var(--oceano), var(--turchese));
  background-size: 200% 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
  pointer-events: none;
}

.campo:focus-within::after { transform: scaleX(1); animation: corrente 2.4s linear infinite; }

@keyframes corrente { to { background-position-x: -200%; } }

.campo label {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--grigio);
}

.campo input,
.campo textarea {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 300;
  color: var(--inchiostro);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--sabbia-scura);
  border-radius: 0;
  padding: 0.55rem 0.1rem;
  outline: none;
  transition: border-color 0.25s;
  resize: vertical;
}

.campo input:focus,
.campo textarea:focus { border-color: var(--oceano); }

form .btn { justify-self: start; }

.form-nota { font-size: 0.85rem; color: var(--grigio); }

/* ---------- piè di pagina ---------- */
footer {
  border-top: 1px solid var(--sabbia-scura);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--grigio);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

footer img { height: 40px; width: auto; margin: 0 auto 1rem; opacity: 0.9; }
footer a { color: var(--oceano); text-decoration: none; }

/* marea continua: tre onde che scorrono senza fine a velocità diverse */
.marea-footer {
  position: relative;
  height: 30px;
  width: min(440px, 82%);
  margin: 0 auto 1.5rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='12' viewBox='0 0 110 12'%3E%3Cpath d='M0 6 Q27.5 0 55 6 T110 6' fill='none' stroke='%238AD1CD' stroke-width='1.2' stroke-opacity='0.55'/%3E%3C/svg%3E") repeat-x left 45% / 110px 12px;
  animation: marea-scorre 16s linear infinite;
}

.marea-footer::before,
.marea-footer::after { content: ""; position: absolute; inset: 0; }

.marea-footer::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='12' viewBox='0 0 90 12'%3E%3Cpath d='M0 6 Q22.5 0 45 6 T90 6' fill='none' stroke='%235BB8B4' stroke-width='1.4' stroke-opacity='0.7'/%3E%3C/svg%3E") repeat-x left 30% / 90px 12px;
  animation: marea-scorre 7s linear infinite;
}

.marea-footer::after {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='12' viewBox='0 0 70 12'%3E%3Cpath d='M0 6 Q17.5 0 35 6 T70 6' fill='none' stroke='%232E6E77' stroke-width='1.2' stroke-opacity='0.5'/%3E%3C/svg%3E") repeat-x left 70% / 70px 12px;
  animation: marea-scorre 11s linear infinite reverse;
}

@keyframes marea-scorre { to { background-position-x: 220px; } }

/* ---------- livello della marea (avanzamento della pagina), filo del cursore, avviso ---------- */
.marea-livello {
  position: fixed;
  right: 18px;
  top: 50%;
  width: 5px; /* controllo-trattini:ok, barra di avanzamento della pagina */
  height: 130px;
  margin-top: -65px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--sabbia-scura) 70%, transparent);
  overflow: hidden;
  z-index: 15;
  display: none;
}

.marea-livello .acqua {
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--turchese-chiaro), var(--turchese) 30%, var(--oceano));
  transform: scaleY(var(--livello, 0));
  transform-origin: 50% 100%;
}

.filo-cursore {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 40;
  pointer-events: none;
  display: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) {
  .js:not(.rm) .marea-livello { display: block; }
  .js:not(.rm) .filo-cursore { display: block; }
}

.avviso {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.9rem 1.4rem;
  background: var(--oceano);
  color: var(--avorio);
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 14px 34px color-mix(in srgb, var(--inchiostro) 24%, transparent);
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.6s var(--molla), opacity 0.4s;
  pointer-events: none;
}

.avviso.visibile { transform: translate(-50%, 0); opacity: 1; }

/* ---------- meno movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  .cielo::before, .banda-sfondo img, .anello-acqua,
  .marea-footer, .marea-footer::before, .marea-footer::after { animation: none; }
  .nav-links a::after, .campo::after { animation: none; }
  .btn::before, .galleria-griglia figure { transition: none; }
  .senza-3d .borsa-slot { animation: none; }
}

/* ---------- telefono ---------- */
@media (max-width: 720px) {
  :root { --testata-h: 92px; }

  .menu-btn { display: block; }
  .nav { padding: 1.5rem 1rem; }
  .nav-logo img { height: 36px; }
  section[id] { scroll-margin-top: 96px; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: linear-gradient(color-mix(in srgb, var(--avorio) 97%, transparent), color-mix(in srgb, var(--turchese) 10%, var(--avorio)));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.5rem 0 1.1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: opacity 0.4s ease, transform 0.45s var(--molla), visibility 0.45s;
  }

  /* il bordo inferiore della tendina è un'onda */
  .nav-links::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='12' viewBox='0 0 60 12'%3E%3Cpath d='M0 0 L60 0 L60 3 Q45 11 30 6 Q15 1 0 8 Z' fill='%23EAF1EC'/%3E%3C/svg%3E") repeat-x left top / 60px 12px;
  }

  .nav-links.aperto { opacity: 1; visibility: visible; transform: none; }

  .nav-links a {
    font-size: 0.82rem;
    letter-spacing: 0.3em;
    padding: 0.95rem 1.5rem;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
  }

  .nav-links a::after { display: none; }
  .nav-links.aperto a { animation: affiora 0.45s ease forwards; }
  .nav-links.aperto a:nth-child(2) { animation-delay: 0.09s; }
  .nav-links.aperto a:nth-child(3) { animation-delay: 0.18s; }

  .hero-contenuto { padding: 1.5rem 1.25rem 5rem; }
  .hero-label { font-size: 0.68rem; letter-spacing: 0.24em; line-height: 2; }
  .hero-label .sep { display: none; }
  .hero-label .parte { display: block; }
  .borsa-slot { width: min(300px, 70vw); margin: 1.35rem 0 3.25rem; }
  .tagline { font-size: 1.25rem; margin-bottom: 1.5rem; }
  .hero-cta { width: 100%; max-width: 340px; flex-direction: column; gap: 0.8rem; }
  .btn { width: 100%; padding: 1rem 1.5rem; text-align: center; }

  .storia { padding: 3.5rem 0 5rem; }
  .storia-intro { padding: 0 0.5rem; }
  .gomitolo { width: min(240px, 62vw); }
  .capitoli { gap: 3rem; padding-top: 3.5rem; }
  .capitolo { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .capitolo .numero { text-align: left; padding-left: 0.5rem; }

  .creazioni { padding: 4rem 0 3.5rem; }
  .giostra { --carta-w: 60vw; margin-top: 2rem; }
  .giostra.tre-d { perspective: 1000px; }
  .galleria-apri { width: auto; margin: 0.25rem 0 2.75rem; padding: 1.25rem 2rem 1.35rem; }
  .nota-foto { font-size: 1.05rem; }
  .galleria-griglia { columns: 1; padding: 1rem 1.25rem 4rem; }
  .galleria-onda svg { height: 28px; }

  .banda { min-height: 50vh; }

  .chi { padding: 4rem 0 5rem; }
  .chi-inner { grid-template-columns: minmax(0, 1fr); gap: 2.25rem; justify-items: center; text-align: center; }
  .ritratto-scena { width: min(210px, 58vw); }

  .contatto { padding: 4rem 0 3.5rem; }
  .contatto-inner { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .contatto h2 { margin-bottom: 1rem; }
  form .btn { justify-self: stretch; }

  footer { padding: 2.25rem 1.25rem; }
}

/* ---------- scorrimento morbido (Lenis) e righe dei titoli ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

/* margine alla maschera delle righe: i discendenti e il corsivo non vengono tagliati */
.riga-mask { padding: 0.08em 0.08em 0.16em; margin: -0.08em -0.08em -0.16em; }

/* ---------- interruttori dello Studio Maré (?modifica): spengono un effetto alla volta ---------- */
body.off-gomitolo .gomitolo { display: none !important; }
body.off-filo .filo-capitoli, body.off-filo .uncinetto { visibility: hidden !important; }
body.off-banda .banda { display: none !important; }
body.off-livello .marea-livello { display: none !important; }
body.off-cursore .filo-cursore { display: none !important; }
body.off-marea .marea-footer { display: none !important; }
body.off-splash .splash { display: none !important; }
