/* Lo scarabocchio che svela */
:root {
  --cielo: #8ED3EE;
  --cielo-alto: #5DBFE6;
  --sole: #FFE45C;
  --mare: #2E9FD0;
  --mare-fondo: #1F86BA;
  --mare-scuro: #176E9C;
  --inchiostro: #2B1408;
  --carta: #FFF4DC;
  --arancio: #FF6B2C;
  --margine: clamp(18px, 4vw, 56px);
  --alto: 100vh;
}
@supports (height: 100svh) {
  :root { --alto: 100svh; }
}

* { box-sizing: border-box; }
html {
  background: var(--cielo-alto);
}
/* finché la copertina c'è, anche il fondo della pagina è arancio: Safari colora le sue barre con quello */
html.coperta {
  background: var(--arancio);
}
html,
body {
  margin: 0;
}
body {
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
}

/* ---------------------------------------------------------------- la copertina */
.copertina {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
html.coperta .copertina {
  pointer-events: auto;
}
.copertina__fondo {
  position: absolute;
  inset: 0;
  background: var(--arancio);
}
.copertina__segno {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.copertina__tratto {
  fill: none;
  stroke: var(--arancio);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.copertina__marchio {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: clamp(110px, 16vmin, 150px);
  aspect-ratio: 1;
  translate: -50% -50%;
}
.tappo {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tappo__bordo {
  fill: var(--carta);
}
.tappo__anello {
  fill: none;
  stroke: var(--inchiostro);
  stroke-width: 2.2;
}
.tappo__nome {
  grid-area: 1 / 1;
  color: var(--inchiostro);
  font-size: clamp(1.1rem, 2.4vmin, 1.4rem);
  font-stretch: 125%;
  font-weight: 900;
  letter-spacing: -0.02em;
  rotate: -8deg;
}

/* ---------------------------------------------------------------- la testata */
.testata {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(14px, 2.4vw, 28px) var(--margine);
}
.testata a {
  color: var(--inchiostro);
  text-decoration: none;
}
.testata__marchio {
  font-size: clamp(1.3rem, 1rem + 1vw, 1.9rem);
  font-stretch: 125%;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.testata__voci {
  display: flex;
  gap: 0.35rem;
}
.testata__voci a {
  padding: 0.45em 0.85em;
  border-radius: 999px;
  font-size: clamp(0.88rem, 0.82rem + 0.2vw, 1rem);
  font-weight: 560;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.testata__voci a:focus-visible {
  background: var(--carta);
}
@media (hover: hover) {
  .testata__voci a:hover { background: var(--carta); }
}

/* ---------------------------------------------------------------- il poster */
.prima {
  position: relative;
  min-height: var(--alto);
  overflow: hidden;
  background: linear-gradient(to bottom, var(--cielo-alto), var(--cielo) 62%);
}
.scena {
  position: absolute;
  inset: 0;
}
.scena__sole {
  position: absolute;
  right: 7vw;
  bottom: 12%;
  width: min(60vmin, 560px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--sole);
}
.scena__mare {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 30%;
}
.onda--prima { fill: var(--mare); }
.onda--seconda { fill: var(--mare-fondo); }
.onda--terza { fill: var(--mare-scuro); }
@media (prefers-reduced-motion: no-preference) {
  .onda { animation: dondola 7s ease-in-out infinite alternate; }
  .onda--seconda { animation-duration: 9s; animation-delay: -3s; }
  .onda--terza { animation-duration: 6s; animation-delay: -1s; }
}
@keyframes dondola {
  to { transform: translateX(-360px); }
}

.prima__testi {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: space-between;
  gap: 5vh;
  min-height: var(--alto);
  padding: calc(clamp(14px, 2.4vw, 28px) * 2 + 2.6rem) var(--margine) calc(var(--alto) * 0.3);
}
.nota {
  max-width: 34ch;
  margin: 0;
  font-size: clamp(0.92rem, 0.84rem + 0.3vw, 1.08rem);
  font-weight: 480;
  line-height: 1.38;
  opacity: 0.78;
}
.titolo {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(3rem, 1rem + 8.4vw, 10.5rem);
  font-stretch: 118%;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.88;
}
.parola {
  display: inline-block;
  white-space: nowrap;
}
.lettera {
  display: inline-block;
  transform-origin: 50% 80%;
}
.sotto {
  max-width: 26ch;
  margin: -2vh 0 0;
  font-size: clamp(1.05rem, 0.9rem + 0.6vw, 1.5rem);
  font-weight: 560;
  line-height: 1.25;
}
.riga {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.riga__dentro {
  display: inline-block;
  transform-origin: 0 0;
}

.rivedi {
  position: absolute;
  right: var(--margine);
  bottom: clamp(16px, 3vw, 32px);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.75em 1.15em;
  border: 1.5px solid var(--inchiostro);
  border-radius: 999px;
  background: var(--carta);
  color: var(--inchiostro);
  font: inherit;
  font-size: clamp(0.9rem, 0.85rem + 0.2vw, 1rem);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease-out, background-color 0.25s ease;
}
.rivedi svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: rotate 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}
/* solo con un puntatore vero: al telefono l'hover resterebbe acceso dopo il tocco */
@media (hover: hover) {
  .rivedi:hover { background: var(--sole); }
  .rivedi:hover svg { rotate: -140deg; }
}
.rivedi:active { transform: scale(0.97); }
.rivedi:focus-visible {
  outline: 2px solid var(--inchiostro);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .testata__voci a:not(:last-child) { display: none; }
  .titolo {
    font-size: clamp(2.6rem, 14.5vw, 4.6rem);
    font-stretch: 105%;
  }
  .scena__sole {
    right: -12vw;
    bottom: 22%;
    width: 78vw;
  }
  .scena__mare { height: 24%; }
  .prima__testi { padding-bottom: calc(var(--alto) * 0.3); }
  .rivedi {
    left: var(--margine);
    right: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rivedi svg { transition: none; }
}
