/* La mappa del tesoro */
:root {
  --tavolo: #15262a;              /* the table the map lies on */
  --tavolo-chiaro: #1f3539;
  --scritta: #efe2c4;             /* the words on the table */
  --scritta-tenue: rgba(239, 226, 196, 0.62);
  --pergamena: #ecdcb4;           /* the parchment */
  --pergamena-scura: #d4bb86;     /* its burnt edges */
  --terra: #e2c891;               /* the island */
  --inchiostro: #3d2b1c;          /* the brown ink of every line */
  --mare: #6f8f88;                /* the sea ink */
  --palma: #5f7a3a;               /* palms and grass */
  --rosso: #b23a22;               /* the trail, the X and the walker */
  --oro: #e0a93b;                 /* the coins */
  --legno: #7a4f2c;               /* the rolls and the chest */
  --alto: 100vh;
  --alto-grande: 100vh;
}
@supports (height: 100svh) {
  :root { --alto: 100svh; }
}
/* the still stage is as tall as the screen with the Safari bar pulled back */
@supports (height: 100lvh) {
  :root { --alto-grande: 100lvh; }
}

* { box-sizing: border-box; }
html,
body {
  margin: 0;
  background: var(--tavolo);
  color: var(--scritta);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
}
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* ---------------------------------------------------------------- the trip */
.viaggio {
  position: relative;
  height: calc(var(--alto-grande) * 9);
  background:
    radial-gradient(120% 80% at 50% 40%, var(--tavolo-chiaro) 0%, var(--tavolo) 70%);
}
.palco {
  position: sticky;
  top: 0;
  height: var(--alto-grande);
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 2.4vh, 26px) clamp(16px, 3vw, 40px) clamp(16px, 3vh, 34px);
  overflow: hidden;
}

.testa {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex: none;
}
.testa__titolo {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 46px);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
}
.testa__titolo em {
  font-style: italic;
  color: var(--oro);
}
.riga {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}
.riga > span { display: inline-block; }
.testa__cenno {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--scritta-tenue);
  white-space: nowrap;
}
.testa__cenno svg {
  width: 14px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tavolo {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  margin-top: clamp(10px, 2vh, 22px);
}

/* the map: the script gives it its size, the parchment is cut by the unrolling */
.mappa {
  position: relative;
  width: 300px;
  height: 200px;
}
.foglio {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background:
    radial-gradient(140% 120% at 50% 50%, transparent 55%, rgba(122, 79, 44, 0.32) 100%),
    radial-gradient(40% 30% at 22% 30%, rgba(255, 248, 225, 0.5), transparent 70%),
    radial-gradient(30% 26% at 78% 76%, rgba(190, 150, 90, 0.22), transparent 70%),
    var(--pergamena);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(61, 43, 28, 0.25);
  clip-path: inset(50% 0% 50% 0%);
}
.carta {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* the two wooden rolls: GSAP moves .rullo, the CSS centres .rullo__legno on it */
.rullo {
  position: absolute;
  left: -2.4%;
  right: -2.4%;
  top: 50%;
  height: 0;
  pointer-events: none;
}
.rullo__legno {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: clamp(16px, 2.6vw, 28px);
  transform: translateY(-50%);
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 22px, rgba(0, 0, 0, 0.08) 22px 24px),
    linear-gradient(180deg, #a87447 0%, var(--legno) 45%, #4c2f18 100%);
  background-position: var(--giro, 0px) 0, 0 0;
  box-shadow: 0 6px 12px -4px rgba(0, 0, 0, 0.6);
}
.rullo__legno::before,
.rullo__legno::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 1.15em;
  height: 1.6em;
  font-size: clamp(16px, 2.6vw, 28px);
  transform: translateY(-50%);
  border-radius: 40%;
  background: linear-gradient(180deg, #c99a52, #8a5a22);
  box-shadow: inset 0 0 0 2px rgba(61, 43, 28, 0.5);
}
.rullo__legno::before { left: -0.6em; }
.rullo__legno::after { right: -0.6em; }
.rullo--basso .rullo__legno {
  transform: translateY(-50%);
}

/* the wax seal on the closed scroll */
.sigillo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(48px, 6vw, 72px);
  height: clamp(48px, 6vw, 72px);
  margin: calc(clamp(48px, 6vw, 72px) / -2) 0 0 calc(clamp(48px, 6vw, 72px) / -2);
  overflow: visible;
  pointer-events: none;
}
.sigillo__cera {
  fill: var(--rosso);
  stroke: #7c2414;
  stroke-width: 2;
}
.sigillo__segno {
  fill: none;
  stroke: #7c2414;
  stroke-width: 4;
  stroke-linecap: round;
}

/* ---------------------------------------------------------------- inside the map */
.carta text { font-family: 'Caveat Variable', 'Comic Sans MS', cursive; }
.inchiostro { fill: none; stroke: var(--inchiostro); stroke-linecap: round; stroke-linejoin: round; }
.lossodromia { fill: none; stroke: var(--inchiostro); stroke-opacity: 0.16; stroke-width: 1; }
.cornice { fill: none; stroke: var(--inchiostro); stroke-opacity: 0.7; }
.onda { fill: none; stroke: var(--mare); stroke-width: 1.8; stroke-linecap: round; }
.riva { fill: none; stroke: var(--mare); stroke-linecap: round; }
.terra { fill: var(--terra); stroke: var(--inchiostro); stroke-width: 2.4; stroke-linejoin: round; }
.collina { fill: none; stroke: var(--inchiostro); stroke-opacity: 0.55; stroke-width: 1.6; stroke-linecap: round; }
.erba { fill: none; stroke: var(--palma); stroke-width: 1.6; stroke-linecap: round; }
.tronco { fill: none; stroke: var(--inchiostro); stroke-width: 3.2; stroke-linecap: round; }
.fronda { fill: var(--palma); stroke: var(--inchiostro); stroke-width: 1.2; stroke-linejoin: round; }
.cocco { fill: var(--legno); stroke: var(--inchiostro); stroke-width: 1; }
.roccia { fill: #cdb27c; stroke: var(--inchiostro); stroke-width: 2; stroke-linejoin: round; }
.tratteggio { fill: none; stroke: var(--inchiostro); stroke-opacity: 0.5; stroke-width: 1.3; stroke-linecap: round; }
.buio { fill: #2a1d12; }
.pipistrello { fill: #2a1d12; }
.vulcano { fill: #c9a874; stroke: var(--inchiostro); stroke-width: 2; stroke-linejoin: round; }
.lava { fill: none; stroke: var(--rosso); stroke-width: 3; stroke-linecap: round; }
.fumo { fill: var(--pergamena); stroke: var(--inchiostro); stroke-width: 1.6; }
.sentiero { fill: none; stroke: var(--rosso); stroke-width: 3.4; stroke-linecap: round; }
.maschera { fill: none; stroke: #fff; stroke-width: 26; stroke-linecap: butt; stroke-linejoin: round; }
.croce { fill: none; stroke: var(--rosso); stroke-width: 6; stroke-linecap: round; }
.buca { fill: #4a3220; }
.cassa { fill: var(--legno); stroke: var(--inchiostro); stroke-width: 2; stroke-linejoin: round; }
.cassa-coperchio { fill: #8e5d34; stroke: var(--inchiostro); stroke-width: 2; stroke-linejoin: round; }
.cassa-dentro { fill: #3a2414; }
.ferro { fill: none; stroke: #3a2a1a; stroke-width: 2.6; }
.serratura { fill: var(--oro); stroke: var(--inchiostro); stroke-width: 1.4; }
.mucchio { fill: var(--oro); stroke: var(--inchiostro); stroke-width: 1.4; }
.moneta { fill: var(--oro); stroke: var(--inchiostro); stroke-width: 1.4; }
.moneta-segno { fill: none; stroke: #a56f15; stroke-width: 1.2; }
.raggio { fill: none; stroke: var(--oro); stroke-width: 2.6; stroke-linecap: round; }
.scafo { fill: var(--legno); stroke: var(--inchiostro); stroke-width: 1.6; stroke-linejoin: round; }
.vela { fill: #f7ecd2; stroke: var(--inchiostro); stroke-width: 1.4; stroke-linejoin: round; }
.albero { fill: none; stroke: var(--inchiostro); stroke-width: 2; stroke-linecap: round; }
.bandiera { fill: var(--rosso); }
.ancora { fill: none; stroke: var(--inchiostro); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pedina { fill: var(--rosso); stroke: var(--inchiostro); stroke-width: 1.6; stroke-linejoin: round; }
.ombra { fill: rgba(61, 43, 28, 0.25); }
.pinna { fill: #50625e; stroke: var(--inchiostro); stroke-width: 1.2; stroke-linejoin: round; }
.scia { fill: none; stroke: var(--mare); stroke-width: 1.6; stroke-linecap: round; }
.penna { fill: #f8f1df; stroke: var(--inchiostro); stroke-width: 1.3; stroke-linejoin: round; }
.penna-asta { fill: none; stroke: var(--inchiostro); stroke-width: 1.4; stroke-linecap: round; }
.nota { fill: var(--inchiostro); font-weight: 600; }
.nota--rossa { fill: var(--rosso); }
.nome-isola {
  fill: var(--inchiostro);
  font-family: 'Fraunces Variable', Georgia, serif !important;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.rosa-punta { fill: var(--inchiostro); }
.rosa-punta--chiara { fill: var(--pergamena); stroke: var(--inchiostro); stroke-width: 1.2; stroke-linejoin: round; }
.rosa-anello { fill: none; stroke: var(--inchiostro); stroke-width: 1.4; }
.rosa-nord { fill: var(--rosso); font-family: 'Fraunces Variable', Georgia, serif !important; font-weight: 700; }
.tocco { fill: transparent; cursor: pointer; }

/* ---------------------------------------------------------------- the closing */
.fine {
  min-height: 60vh;
  display: grid;
  place-items: center;
  padding: 80px 16px;
  text-align: center;
  background: var(--tavolo);
}
.fine__frase {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(30px, 5vw, 64px);
  line-height: 1.08;
  font-weight: 400;
}
.fine__frase em {
  font-style: italic;
  color: var(--oro);
}

/* fewer moves: the map is already open and the trail already walked */
@media (prefers-reduced-motion: reduce) {
  .viaggio { height: auto; }
  .palco { position: relative; }
  .foglio { clip-path: none; }
}
