/* Courtesy page "Grazie" — Oglio Po Pesca / Oglio Po Reti
   File condiviso: le due pagine differiscono solo per la classe sul <body>. */

@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Verdi del marchio */
  --green-light: #4c7044;
  --green: #416038;
  --green-deep: #23421a;
  --text: #f4f1e4;
  /* Accento: giallo pesca (sovrascritto per reti) */
  --accent: #febf00;
  --accent-dark: #d39f03;
}

/* Reti: il fiume prende gli azzurri del nodo del logo (#2a72b0) */
body.reti {
  --accent: #ffc333;
  --accent-dark: #e67d00;
  --green-light: #4a8bc4;
  --green: #26679f;
  --green-deep: #0f3358;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  /* bianco dietro la riva, verde profondo in fondo (anche per l'overscroll) */
  background: linear-gradient(180deg, #fff 0, #fff 50%, var(--green-deep) 50%);
  color: var(--text);
  font-family: "Poppins", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Riva: fascia bianca con logo ---------- */
.shore {
  position: relative;
  z-index: 0;
  background: #fff;
  text-align: center;
  padding: clamp(32px, 7vh, 72px) 16px clamp(16px, 3vh, 32px);
}

.shore img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* ---------- Acqua ---------- */
.river {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 190px 16px clamp(56px, 10vh, 110px);
  /* La parte alta è trasparente: la superficie la disegnano le onde */
  background: linear-gradient(180deg, transparent 0, transparent 110px, var(--green) 110px, var(--green) 30%, var(--green-deep) 100%);
  z-index: 1;
}

/* Onde: tre livelli che scorrono a velocità diverse.
   Il tracciato è periodico su 1440px, quindi la ripetizione è continua. */
.wave {
  position: absolute;
  left: 0;
  right: 0;
  height: 120px;
  background-repeat: repeat-x;
  background-size: 1440px 120px;
  pointer-events: none;
  will-change: background-position;
}

.wave--back {
  top: 0;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'%3E%3Cpath fill='%235f8455' d='M0 34C120 27 240 20 360 20S600 27 720 34 960 48 1080 48 1320 41 1440 34V117H0z'/%3E%3C/svg%3E");
  animation: flow 38s linear infinite;
  opacity: 0.55;
}

.wave--mid {
  top: 30px;
  z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1080 120' preserveAspectRatio='none'%3E%3Cpath fill='%234c7044' d='M0 34C90 27 180 20 270 20S450 27 540 34 720 48 810 48 990 41 1080 34V117H0z'/%3E%3C/svg%3E");
  background-size: 1080px 120px;
  animation: flow-mid 26s linear infinite;
}

.wave--front {
  top: 60px;
  z-index: 4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1800 120' preserveAspectRatio='none'%3E%3Cpath fill='%23416038' d='M0 34C150 27 300 20 450 20S750 27 900 34 1200 48 1350 48 1650 41 1800 34V117H0z'/%3E%3C/svg%3E");
  background-size: 1800px 120px;
  animation: flow-front 20s linear infinite reverse;
}

@keyframes flow {
  from { background-position-x: 0; }
  to   { background-position-x: -1440px; }
}
@keyframes flow-front {
  from { background-position-x: 0; }
  to   { background-position-x: -1800px; }
}
@keyframes flow-mid {
  from { background-position-x: 0; }
  to   { background-position-x: -1080px; }
}

/* ---------- Pesca: galleggiante ---------- */
.bobber {
  position: absolute;
  top: 30px;
  right: 16%;
  z-index: 3;
  width: 30px;
  pointer-events: none;
}

.bobber__body {
  position: relative;
  transform-origin: 50% 80%;
  animation: bob 4.2s ease-in-out infinite;
}

/* La lenza sale fino in cima alla pagina */
.bobber__body::before {
  content: "";
  position: absolute;
  bottom: calc(100% - 2px);
  left: 50%;
  width: 1px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(35, 35, 35, 0) 0%, rgba(35, 35, 35, 0.45) 30%, rgba(35, 35, 35, 0.55) 100%);
  transform: translateX(-50%);
}

.bobber svg {
  display: block;
  width: 30px;
  height: auto;
}

.ripple {
  position: absolute;
  left: 50%;
  top: 80px;
  width: 44px;
  height: 10px;
  margin-left: -22px;
  border: 1.5px solid rgba(244, 241, 228, 0.45);
  border-radius: 50%;
  opacity: 0;
  animation: ripple 4.2s ease-out infinite;
}
.ripple:nth-of-type(2) { animation-delay: 1.4s; }
.ripple:nth-of-type(3) { animation-delay: 2.8s; }

/* Copia sopra l'onda frontale, sincronizzata con l'originale:
   sopra il pelo dell'acqua coincide con il galleggiante, sotto lo mostra velato */
.bobber--ghost {
  z-index: 5;
  opacity: 0.4;
}
.bobber--ghost .bobber__body::before {
  display: none;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(7px) rotate(3deg); }
}

@keyframes ripple {
  0%   { width: 22px;  height: 5px;  margin-left: -11px; opacity: 0.7; }
  100% { width: 140px; height: 30px; margin-left: -70px; margin-top: -12px; opacity: 0; }
}

/* ---------- Reti: maglia di rete nell'acqua ---------- */
.net {
  position: absolute;
  inset: 60px -260px -200px;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M0 28L28 0l28 28-28 28z' fill='none' stroke='%23f4f1e4' stroke-opacity='.12' stroke-width='1.2'/%3E%3Ccircle cx='28' cy='0' r='1.8' fill='%23f4f1e4' fill-opacity='.16'/%3E%3Ccircle cx='0' cy='28' r='1.8' fill='%23f4f1e4' fill-opacity='.16'/%3E%3Ccircle cx='56' cy='28' r='1.8' fill='%23f4f1e4' fill-opacity='.16'/%3E%3Ccircle cx='28' cy='56' r='1.8' fill='%23f4f1e4' fill-opacity='.16'/%3E%3C/svg%3E");
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(180deg, transparent 8%, #000 32%, #000 62%, transparent 85%);
  mask-image: linear-gradient(180deg, transparent 8%, #000 32%, #000 62%, transparent 85%);
  transform: rotate(-14deg);
  animation: sway 14s ease-in-out infinite alternate;
}

@keyframes sway {
  from { transform: rotate(-14deg) translate(-24px, -6px) skewX(-3deg); }
  to   { transform: rotate(-14deg) translate(24px, 6px) skewX(3deg); }
}

/* ---------- Messaggio ---------- */
.message {
  position: relative;
  z-index: 5;
  max-width: 34em;
  margin: 0 auto;
  text-align: center;
  font-size: clamp(1.05rem, 0.9rem + 0.8vw, 1.4rem);
  line-height: 1.75;
}

.message p {
  margin: 0 0 1.4em;
  text-wrap: balance;
  animation: surface 1.6s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.message p:last-child { margin-bottom: 0; }
.message p:nth-child(1) { animation-delay: 0.4s; }
.message p:nth-child(2) { animation-delay: 1.4s; }
.message p:nth-child(3) { animation-delay: 2.4s; }

.message strong {
  display: block;
  font-weight: 500;
  font-size: 1.45em;
  line-height: 1.3;
  color: var(--accent);
  margin-bottom: 0.25em;
}

@keyframes surface {
  from { opacity: 0; transform: translateY(18px); filter: blur(3px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* la rete inclinata non deve uscire dal fiume (niente scroll extra) */
body.reti .river {
  overflow: hidden;
}

body.reti .wave--back {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'%3E%3Cpath fill='%237fa9d1' d='M0 34C120 27 240 20 360 20S600 27 720 34 960 48 1080 48 1320 41 1440 34V117H0z'/%3E%3C/svg%3E");
}
body.reti .wave--mid {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1080 120' preserveAspectRatio='none'%3E%3Cpath fill='%234a8bc4' d='M0 34C90 27 180 20 270 20S450 27 540 34 720 48 810 48 990 41 1080 34V117H0z'/%3E%3C/svg%3E");
}
body.reti .wave--front {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1800 120' preserveAspectRatio='none'%3E%3Cpath fill='%2326679f' d='M0 34C150 27 300 20 450 20S750 27 900 34 1200 48 1350 48 1650 41 1800 34V117H0z'/%3E%3C/svg%3E");
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .river { padding-top: 170px; }
  .bobber { right: 7%; }
}

/* ---------- Movimento ridotto: stessa pagina, ferma ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
  }
  .ripple { display: none; }
}
