/* Letters From Vigo · sito della roadmap
   "Sentiero nel bosco al crepuscolo, inciso nel legno scuro".
   Texture e illustrazioni: Tools/Web/roadmap_art.py. Contenuti: docs/roadmap.json (via app.js). */

:root {
  /* legno */
  --legno-0: #0f0905;
  --legno-1: #1b120c;
  --legno-2: #2a1a11;
  --legno-3: #3d2617;
  --legno-4: #4a2f1c;
  /* crepuscolo */
  --arancio: #ff8a3d;
  --ambra: #ffb45e;
  --oro: #ffd27a;
  --notte: #2b3f73;
  --azzurro: #4f74b8;
  --celeste: #8fb6ff;
  --viola: #6c4a9e;
  --muschio: #7fb36a;
  /* testo */
  --crema: #fbeedb;
  --crema-2: #ecd6b6;
  --crema-3: #d9c09c;
  --inchiostro: #2a1806;
  --carta: #f3e8d4;

  --f-titolo: "Fraunces", "Georgia", "Times New Roman", serif;
  --f-sc: "Alegreya SC", "Georgia", serif;
  --f-testo: "Alegreya Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --f-mano: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --gutter: clamp(16px, 3vw, 44px);
  --max: 1380px;
  --banda: clamp(150px, 16vw, 250px);
  --med: 92px;
  --corsia: 60px;

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--legno-1);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-x: clip;
  color: var(--crema);
  font: 400 1.0625rem/1.55 var(--f-testo);
  background:
    linear-gradient(180deg, rgba(255, 138, 61, .05), transparent 18%, transparent 55%, rgba(43, 63, 115, .12) 85%, rgba(108, 74, 158, .1)),
    url("assets/legno.webp") 50% 0 / 900px auto repeat,
    var(--legno-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* vignettatura della tavola */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(130% 95% at 50% 45%, transparent 52%, rgba(6, 2, 0, .62) 100%),
    linear-gradient(90deg, rgba(6, 2, 0, .38), transparent 9%, transparent 91%, rgba(6, 2, 0, .38));
}

img { max-width: 100%; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

:focus-visible {
  outline: 3px solid var(--celeste);
  outline-offset: 3px;
  border-radius: 4px;
}

.salta {
  position: absolute;
  z-index: 50;
  left: 12px;
  top: -60px;
  padding: 10px 16px;
  background: var(--oro);
  color: var(--inchiostro);
  font-weight: 700;
  border-radius: 4px;
  text-decoration: none;
}
.salta:focus { top: 12px; }

main, .piede { position: relative; z-index: 1; }

/* =========================================================================================
   Testata: crepuscolo a strati
   ========================================================================================= */
.testata {
  position: relative;
  z-index: 1;
  height: clamp(600px, 100svh, 1060px);
  overflow: hidden;
  isolation: isolate;
  -webkit-mask-image: linear-gradient(#000 78%, transparent 100%);
  mask-image: linear-gradient(#000 78%, transparent 100%);
}

.testata__scena { position: absolute; inset: 0; z-index: -2; background: #141d45; }

.strato {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 50% 100%;
  will-change: transform;
  animation: sorge 1.6s cubic-bezier(.2, .7, .2, 1) both;
}
.strato--cielo { animation-name: albeggia; animation-duration: 1.2s; }
.strato--monti { animation-delay: .12s; }
.strato--valle { animation-delay: .26s; }
.strato--primo { animation-delay: .4s; }

@keyframes sorge { from { opacity: 0; translate: 0 46px; } to { opacity: 1; translate: 0 0; } }
@keyframes albeggia { from { opacity: 0; } to { opacity: 1; } }

/* velo scuro dietro al titolo per la leggibilita' */
.testata::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(62% 58% at 20% 34%, rgba(7, 10, 30, .62), rgba(7, 10, 30, .25) 55%, transparent 75%);
}

.testata__testo {
  position: absolute;
  left: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  top: clamp(84px, 15vh, 170px);
  width: min(780px, 58vw);
  will-change: transform, opacity;
}
.testata__testo > * { animation: sorge 1.1s cubic-bezier(.2, .7, .2, 1) both; }
.testata__testo > :nth-child(1) { animation-delay: .45s; }
.testata__testo > :nth-child(2) { animation-delay: .58s; }
.testata__testo > :nth-child(3) { animation-delay: .75s; }
.testata__testo > :nth-child(4) { animation-delay: 1.1s; }

.occhiello {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 700 1rem/1 var(--f-sc);
  letter-spacing: .22em;
  text-transform: lowercase;
  color: var(--oro);
}
.occhiello::before {
  content: "";
  width: 46px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--arancio));
}
.occhiello--centro { justify-content: center; }
.occhiello--centro::after {
  content: "";
  width: 46px;
  height: 2px;
  background: linear-gradient(90deg, var(--arancio), transparent);
}

.titolo {
  margin-top: 18px;
  font-family: var(--f-titolo);
  font-weight: 800;
  font-size: clamp(3.3rem, 1.6rem + 7vw, 9.4rem);
  line-height: .86;
  letter-spacing: -.02em;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  color: #fff3e0;
  text-shadow: 0 2px 0 rgba(40, 14, 4, .35), 0 0 46px rgba(255, 138, 61, .38);
}
.titolo__nome { display: block; text-wrap: balance; }
.titolo__sotto {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 14px;
  margin-top: clamp(14px, 1.6vw, 24px);
  font: 700 clamp(1.05rem, .8rem + .9vw, 1.6rem)/1 var(--f-sc);
  letter-spacing: .32em;
  text-transform: lowercase;
  color: var(--ambra);
  text-shadow: 0 0 22px rgba(255, 138, 61, .55);
}
.titolo__sotto::before,
.titolo__sotto::after {
  content: "";
  width: 9px;
  height: 9px;
  background: var(--arancio);
  transform: rotate(45deg);
  box-shadow: 0 0 10px var(--arancio);
}

.testata__descr {
  margin-top: 26px;
  max-width: 34em;
  font-size: clamp(1.05rem, .95rem + .4vw, 1.3rem);
  line-height: 1.5;
  color: #f6e6cf;
  text-shadow: 0 1px 2px rgba(5, 6, 20, .9), 0 0 18px rgba(5, 6, 20, .7);
}

.testata__azioni {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 30px;
  margin-top: 30px;
}

.testata__giu {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  color: var(--oro);
  font: 700 .86rem/1 var(--f-sc);
  letter-spacing: .2em;
  text-transform: lowercase;
  text-decoration: none;
  text-shadow: 0 1px 3px #000;
}
.testata__giu::after {
  content: "";
  width: 11px;
  height: 11px;
  margin-top: -5px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  rotate: 45deg;
  animation: cenno 2.2s ease-in-out infinite;
}
.testata__giu:hover { color: #fff3d0; }
@keyframes cenno { 0%, 100% { translate: 0 0; } 50% { translate: 0 6px; } }

/* ---- launcher del gioco (campo opzionale "launcher" del JSON) ----------------------- */
.scarica-box { display: grid; justify-items: start; gap: 8px; }
.scarica-box[hidden] { display: none; }
.scarica-box--piede { margin-top: 10px; }
.scarica {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 26px 10px 10px;
  border-radius: 14px;
  color: #2a1205;
  font: 800 1.22rem/1.1 var(--f-titolo);
  font-variation-settings: "SOFT" 100, "WONK" 0;
  text-decoration: none;
  background: radial-gradient(130% 170% at 26% 16%, #fff0c4 0%, var(--oro) 28%, var(--ambra) 58%, #e0702a 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 252, 235, .7),
    inset 0 -3px 0 rgba(130, 45, 0, .45),
    0 0 0 4px #0b0603,
    0 0 0 5.5px rgba(255, 214, 170, .22),
    0 0 34px rgba(255, 150, 60, .5),
    0 14px 24px -8px rgba(0, 0, 0, .75);
  transition: translate .2s ease, box-shadow .3s ease, filter .3s ease;
}
.scarica:hover {
  translate: 0 -2px;
  filter: brightness(1.06);
  box-shadow:
    inset 0 2px 0 rgba(255, 252, 235, .7),
    inset 0 -3px 0 rgba(130, 45, 0, .45),
    0 0 0 4px #0b0603,
    0 0 0 5.5px rgba(255, 214, 170, .3),
    0 0 54px rgba(255, 150, 60, .75),
    0 18px 28px -8px rgba(0, 0, 0, .75);
}
.scarica:active { translate: 0 1px; }
.scarica__lume {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  font-size: 26px;
  color: var(--oro);
  background: radial-gradient(circle at 40% 30%, #4a2a14, #1d1008);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 245, 220, .5);
}
.scarica__lume .ico { stroke-width: 4; filter: drop-shadow(0 0 4px rgba(255, 160, 70, .9)); }
.scarica__nota {
  padding-left: 4px;
  font-size: .92rem;
  color: #f1dcc0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
}
.scarica--piccolo {
  gap: 10px;
  padding: 6px 18px 6px 6px;
  border-radius: 11px;
  font-size: 1rem;
  box-shadow:
    inset 0 2px 0 rgba(255, 252, 235, .7),
    inset 0 -3px 0 rgba(130, 45, 0, .45),
    0 0 0 3px #0b0603,
    0 0 20px rgba(255, 150, 60, .4);
}
.scarica--piccolo .scarica__lume { width: 32px; height: 32px; border-radius: 8px; font-size: 19px; }
.scarica-box--piede .scarica__nota { font-size: .86rem; text-shadow: none; color: var(--crema-3); }

/* =========================================================================================
   Riepilogo: targa di legno + targhetta d'ottone
   ========================================================================================= */
.riepilogo {
  position: relative;
  z-index: 3;
  max-width: var(--max);
  margin: calc(-1 * clamp(110px, 13vw, 200px)) auto 0;
  padding-inline: var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px;
}

.targa {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  width: min(100%, 580px);
  padding: 26px 32px 26px 26px;
  border-radius: 9px 12px 8px 11px;
  rotate: -.8deg;
  background:
    linear-gradient(180deg, rgba(255, 210, 160, .08), rgba(20, 8, 2, .26) 70%, rgba(20, 8, 2, .4)),
    url("assets/legno_chiaro.webp") 0 0 / 820px auto,
    var(--legno-4);
  box-shadow:
    inset 0 1px 0 rgba(255, 228, 190, .26),
    inset 0 -3px 0 rgba(0, 0, 0, .34),
    inset 0 0 0 1px rgba(10, 4, 0, .5),
    inset 0 0 50px rgba(22, 9, 2, .6),
    0 2px 0 #0e0703,
    0 34px 50px -24px rgba(0, 0, 0, .95),
    0 10px 22px -10px rgba(0, 0, 0, .7);
}

.chiodo {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #efe0c2, #8c7558 50%, #2b1f14);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .7), 0 0 0 2px rgba(0, 0, 0, .2);
}
.chiodo--1 { top: 11px; left: 11px; }
.chiodo--2 { top: 11px; right: 11px; }
.chiodo--3 { bottom: 11px; left: 11px; }
.chiodo--4 { bottom: 11px; right: 11px; }

.targa__anello {
  --p: 0;
  position: relative;
  width: 136px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #1f1209 0 60%, #140b05 61% 100%);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 220, 180, .18);
}
.targa__anello::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--arancio), var(--oro) calc(var(--p) * 1%), rgba(255, 214, 170, .07) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
  filter: drop-shadow(0 0 6px rgba(255, 138, 61, .55));
}
.targa__pct {
  font: 900 2.9rem/1 var(--f-titolo);
  font-variation-settings: "SOFT" 100, "WONK" 0;
  color: var(--oro);
  text-shadow: 0 0 18px rgba(255, 138, 61, .5);
}
.targa__pct small { font-size: .45em; margin-left: 2px; color: var(--ambra); }

.targa__etichetta {
  font: 700 .95rem/1 var(--f-sc);
  letter-spacing: .14em;
  text-transform: lowercase;
  color: var(--oro);
}
.targa__conti {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.conto__dentro {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 9px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.conto .medaglione--mini { grid-row: span 2; }
.conto b {
  font: 800 1.7rem/1 var(--f-titolo);
  color: var(--crema);
}
.conto__dentro > span:last-child {
  font: 500 .9rem/1.1 var(--f-testo);
  color: var(--crema-2);
}
.conto__link {
  margin: -4px -8px -4px -4px;
  padding: 4px 8px 4px 4px;
  border-radius: 8px;
  transition: background-color .2s ease;
}
.conto__link > span:last-child {
  color: var(--oro);
  text-decoration: underline;
  text-decoration-color: rgba(255, 180, 94, .55);
  text-underline-offset: 3px;
}
.conto__link:hover { background: rgba(255, 180, 94, .13); }

.targa__qui {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 6px 14px 6px 8px;
  border-radius: 8px;
  color: var(--crema);
  font: 500 .98rem/1.25 var(--f-testo);
  text-decoration: none;
  background: rgba(12, 5, 1, .38);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 220, 180, .12);
  transition: background-color .2s ease;
}
.targa__qui:hover { background: rgba(255, 138, 61, .18); }
.targa__qui::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 2px;
  border-right: 2px solid var(--oro);
  border-bottom: 2px solid var(--oro);
  rotate: 45deg;
}
.targa__lume {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 26px;
  color: var(--oro);
  filter: drop-shadow(0 0 6px rgba(255, 160, 70, .9));
}
.targa__qui-et { margin-right: 4px; font: 600 1.3rem/1 var(--f-mano); color: var(--oro); }
.targa__qui-fase { font-weight: 500; }
.targa__alpha {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font: 700 .9rem/1 var(--f-sc);
  letter-spacing: .06em;
  color: var(--crema-2);
}
.targa__alpha .barra { flex: 1 1 80px; }
.targa__alpha b { font: 800 1.05rem/1 var(--f-titolo); color: var(--oro); }
.targa__data {
  margin-top: 14px;
  font-size: .92rem;
  color: var(--crema-3);
}
.targa__data time { color: var(--crema); font-weight: 500; }

.ottone {
  position: relative;
  width: min(100%, 380px);
  margin-right: clamp(0px, 3vw, 46px);
  padding: 15px 30px 15px 30px;
  color: var(--inchiostro);
  border-radius: 4px;
  rotate: 1.1deg;
  background: linear-gradient(128deg, #f3d996 0%, #c9a35f 28%, #ecce86 50%, #b08743 76%, #dcb86f 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 225, .75),
    inset 0 -2px 0 rgba(90, 60, 10, .5),
    0 0 0 1px rgba(60, 35, 5, .6),
    0 20px 28px -16px rgba(0, 0, 0, .95);
}
.ottone__vite {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2c8, #8a6a30 60%, #4a3510);
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .4);
}
.ottone__vite::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 50%;
  height: 1.4px;
  margin-top: -.7px;
  background: rgba(50, 30, 5, .7);
  rotate: 35deg;
}
.ottone__vite--b { left: auto; right: 11px; }
.ottone__titolo {
  font: 700 .82rem/1 var(--f-sc);
  letter-spacing: .16em;
  text-transform: lowercase;
  text-shadow: 0 1px 0 rgba(255, 246, 214, .65);
}
.ottone__testo {
  margin-top: 6px;
  font: 500 1rem/1.38 var(--f-testo);
  text-shadow: 0 1px 0 rgba(255, 246, 214, .5);
}

/* =========================================================================================
   Il sentiero
   ========================================================================================= */
.sentiero {
  position: relative;
  padding-bottom: clamp(20px, 3vw, 40px);
}

.tracciato {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}

.partenza, .sentiero__percorso { position: relative; z-index: 1; }

/* solco bruciato: alone scuro, labbro chiaro sotto, fondo nero */
.tratto path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tratto__bruciato { stroke: rgba(9, 3, 0, .42); stroke-width: 24px; }
.tratto__labbro { stroke: rgba(255, 214, 170, .1); stroke-width: 11px; transform: translate(0, 2px); }
.tratto__solco { stroke: #0a0502; stroke-width: 9px; }
.tratto__alone { stroke: rgba(255, 138, 61, .2); stroke-width: 17px; }
.tratto__filo { stroke: var(--arancio); stroke-width: 3.6px; }
.tratto__anima { stroke: #ffe3ad; stroke-width: 1.3px; }

/* tratto ancora da percorrere: traccia appena scurita, solco inciso a trattini */
.tratto--spento .tratto__bruciato { stroke: rgba(9, 3, 0, .2); stroke-width: 15px; }
.tratto--spento .tratto__labbro { stroke: rgba(255, 214, 170, .11); stroke-width: 8px; stroke-dasharray: 12 15; }
.tratto--spento .tratto__solco { stroke: #0b0502; stroke-width: 6px; stroke-dasharray: 12 15; }
.tratto--sottile .tratto__bruciato { stroke-width: 9px; }
.tratto--sottile .tratto__labbro { stroke-width: 5.5px; stroke-dasharray: 7 13; }
.tratto--sottile .tratto__solco { stroke-width: 4px; stroke-dasharray: 7 13; }

.brace { opacity: 0; transition: opacity .3s; }
.brace--viva { opacity: 1; }
.brace__alone { fill: rgba(255, 138, 61, .35); animation: brucia 1.1s ease-in-out infinite alternate; }
.brace__nucleo { fill: #fff0c4; filter: drop-shadow(0 0 4px var(--arancio)); }
@keyframes brucia { from { opacity: .55; } to { opacity: 1; } }

/* cartelli di legno del sentiero */
.partenza {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(40px, 5vw, 80px);
  margin-bottom: clamp(36px, 5vw, 64px);
}
.cartello {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 40px 14px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 210, 160, .08), rgba(20, 8, 2, .3)),
    url("assets/legno_chiaro.webp") 0 0 / 700px auto,
    var(--legno-4);
  box-shadow:
    inset 0 1px 0 rgba(255, 228, 190, .25),
    inset 0 -3px 0 rgba(0, 0, 0, .35),
    inset 0 0 30px rgba(22, 9, 2, .55),
    0 18px 30px -14px rgba(0, 0, 0, .9);
}
.cartello::before,
.cartello::after {
  content: "";
  position: absolute;
  top: -34px;
  width: 3px;
  height: 36px;
  background: linear-gradient(#000 0, #2a1a11);
}
.cartello::before { left: 26px; rotate: 8deg; }
.cartello::after { right: 26px; rotate: -8deg; }
.cartello__testo {
  font: 800 clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem)/1 var(--f-titolo);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  color: #f4dcae;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .75), 0 1px 0 rgba(255, 230, 190, .16), 0 0 18px rgba(255, 160, 70, .18);
}
.cartello__conta {
  margin-top: 6px;
  font: 700 .82rem/1 var(--f-sc);
  letter-spacing: .2em;
  text-transform: lowercase;
  color: var(--oro);
}
.partenza__ancora {
  display: block;
  width: 14px;
  height: 14px;
  margin-top: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe2a8, var(--arancio) 55%, #8a3a10);
  box-shadow: 0 0 0 5px #0a0502, 0 0 18px rgba(255, 138, 61, .8);
}

/* ---- le tappe ------------------------------------------------------------------------- */
.tappe {
  list-style: none;
  margin: 0 auto;
  padding: 0 var(--gutter);
  max-width: var(--max);
}
.tappe--oltre { --med: 76px; }

.tappa {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--banda) minmax(0, 1fr);
  align-items: start;
}
.tappa + .tappa { margin-top: clamp(56px, 6.4vw, 110px); }
.tappa { scroll-margin-top: 70px; }
.tappa--sinistra { grid-template-areas: "scheda perno foto"; }
.tappa--destra { grid-template-areas: "foto perno scheda"; }

.tappa__perno {
  grid-area: perno;
  position: relative;
  display: flex;
  justify-content: flex-start;
  padding: 26px 12px 0;
}
.tappa--destra .tappa__perno { justify-content: flex-end; }

/* ---- medaglioni ----------------------------------------------------------------------- */
.medaglione {
  --p: 0;
  position: relative;
  flex: none;
  width: var(--med);
  height: var(--med);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #c09a76;
  background: radial-gradient(circle at 38% 30%, #3a2416, #1c1109 62%, #120a05);
  box-shadow:
    inset 0 4px 8px rgba(0, 0, 0, .78),
    inset 0 -2px 0 rgba(255, 214, 170, .12),
    0 0 0 5px #0b0603,
    0 0 0 6.5px rgba(255, 214, 170, .13),
    0 12px 22px rgba(0, 0, 0, .65);
  transition: box-shadow .8s ease, filter .8s ease, scale .6s cubic-bezier(.3, 1.5, .5, 1), opacity .5s;
}
.medaglione .ico { width: 54%; height: auto; stroke-width: 3.3; }

.medaglione[data-stato="fatto"] {
  color: #3b1d0a;
  background: radial-gradient(circle at 36% 28%, #ffe6ad, var(--ambra) 48%, #d9682a 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 250, 230, .55),
    inset 0 -6px 10px rgba(120, 40, 0, .45),
    0 0 0 5px #0b0603,
    0 0 0 6.5px rgba(255, 214, 170, .18),
    0 12px 22px rgba(0, 0, 0, .65);
  filter: saturate(.7) brightness(.82);
}
.acceso .medaglione[data-stato="fatto"],
.medaglione--mini[data-stato="fatto"] {
  filter: none;
  box-shadow:
    inset 0 3px 0 rgba(255, 250, 230, .55),
    inset 0 -6px 10px rgba(120, 40, 0, .45),
    0 0 0 5px #0b0603,
    0 0 0 6.5px rgba(255, 214, 170, .18),
    0 0 34px rgba(255, 150, 60, .55),
    0 12px 22px rgba(0, 0, 0, .65);
}
.medaglione__spunta {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 36%;
  height: 36%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #10210a;
  background: radial-gradient(circle at 35% 30%, #c8eaa6, var(--muschio) 60%, #4f8a3c);
  box-shadow: 0 0 0 3px #0b0603, 0 3px 6px rgba(0, 0, 0, .6);
  scale: 0;
  transition: scale .55s cubic-bezier(.3, 1.6, .5, 1) .15s;
}
.medaglione__spunta .ico { width: 72%; height: auto; stroke-width: 6.5; }
.acceso .medaglione__spunta { scale: 1; }

.medaglione[data-stato="in_corso"] {
  color: var(--ambra);
  background: radial-gradient(circle at 38% 30%, #40271a, #1d120a 65%);
  box-shadow:
    inset 0 4px 8px rgba(0, 0, 0, .7),
    0 0 0 4px #0b0603,
    0 0 0 7px var(--azzurro),
    0 0 0 9px rgba(143, 182, 255, .35),
    0 12px 22px rgba(0, 0, 0, .65);
}
.medaglione[data-stato="in_corso"]::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: conic-gradient(var(--arancio) calc(var(--p) * 1%), rgba(255, 214, 170, .08) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
}
.medaglione[data-stato="in_corso"] .ico { filter: drop-shadow(0 0 6px rgba(255, 138, 61, .8)); }
.acceso .medaglione[data-stato="in_corso"] { animation: pulsa 2.8s ease-in-out infinite; }
@keyframes pulsa {
  0%, 100% {
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, .7), 0 0 0 4px #0b0603, 0 0 0 7px var(--azzurro),
      0 0 0 9px rgba(143, 182, 255, .35), 0 0 18px 2px rgba(255, 138, 61, .25), 0 12px 22px rgba(0, 0, 0, .65);
  }
  50% {
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, .7), 0 0 0 4px #0b0603, 0 0 0 7px var(--celeste),
      0 0 0 9px rgba(143, 182, 255, .55), 0 0 46px 10px rgba(255, 138, 61, .55), 0 12px 22px rgba(0, 0, 0, .65);
  }
}

.medaglione--mini {
  --med: 26px;
  display: inline-block;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .7), 0 0 0 3px #0b0603, 0 0 0 4px rgba(255, 214, 170, .14);
}
.medaglione--mini[data-stato="fatto"] { box-shadow: inset 0 2px 0 rgba(255, 250, 230, .5), 0 0 0 3px #0b0603, 0 0 14px rgba(255, 150, 60, .5); }
.medaglione--mini[data-stato="in_corso"] { box-shadow: inset 0 2px 3px rgba(0, 0, 0, .7), 0 0 0 3px #0b0603, 0 0 0 5px var(--azzurro), 0 0 12px rgba(255, 138, 61, .45); }
.medaglione--mini[data-stato="in_corso"]::before { inset: 3px; background: var(--arancio); -webkit-mask: none; mask: none; opacity: .85; }

/* ---- lanterna "Siamo qui" ------------------------------------------------------------- */
.qui {
  position: absolute;
  top: 8px;
  left: calc(12px + var(--med) + 10px);
  display: grid;
  justify-items: center;
  pointer-events: none;
  z-index: 3;
}
.tappa--destra .qui { left: auto; right: calc(12px + var(--med) + 10px); }
.qui__gancio { width: 2px; height: 14px; background: linear-gradient(#000, #3a2416); }
.qui__lume {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 44px;
  color: var(--oro);
  animation: tremola 3.2s ease-in-out infinite;
  transform-origin: 50% -14px;
}
.qui__lume::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 90, .55), rgba(255, 138, 61, .18) 45%, transparent 70%);
  animation: fiamma 1.7s ease-in-out infinite alternate;
}
.qui__lume .ico { position: relative; stroke-width: 3.2; filter: drop-shadow(0 0 5px rgba(255, 160, 70, .95)); }
.qui__testo {
  margin-top: 4px;
  font: 600 1.45rem/1 var(--f-mano);
  color: var(--oro);
  white-space: nowrap;
  rotate: -5deg;
  text-shadow: 0 0 14px rgba(255, 138, 61, .65), 0 2px 2px rgba(0, 0, 0, .9);
}
@keyframes tremola { 0%, 100% { rotate: -4deg; } 50% { rotate: 4deg; } }
@keyframes fiamma { from { opacity: .65; scale: .92; } to { opacity: 1; scale: 1.06; } }

/* ---- scheda (targa di legno) ---------------------------------------------------------- */
.scheda {
  grid-area: scheda;
  position: relative;
  padding: clamp(22px, 2.3vw, 32px) clamp(20px, 2.5vw, 36px) clamp(22px, 2.4vw, 30px);
  color: var(--crema);
  border-radius: 7px 11px 8px 12px;
  background:
    linear-gradient(180deg, rgba(255, 210, 160, .07), rgba(20, 8, 2, .3) 70%, rgba(20, 8, 2, .42)),
    url("assets/legno_chiaro.webp") 0 0 / 820px auto,
    var(--legno-4);
  box-shadow:
    inset 0 1px 0 rgba(255, 228, 190, .24),
    inset 0 -3px 0 rgba(0, 0, 0, .32),
    inset 0 0 0 1px rgba(10, 4, 0, .5),
    inset 0 0 46px rgba(22, 9, 2, .62),
    0 2px 0 #0e0703,
    0 28px 42px -22px rgba(0, 0, 0, .92),
    0 8px 18px -8px rgba(0, 0, 0, .6);
  transition: opacity .8s ease, translate .9s cubic-bezier(.2, .8, .2, 1);
}
.tappa:nth-child(3n + 1) .scheda { background-position: 0 0, 120px 40px, 0 0; }
.tappa:nth-child(3n + 2) .scheda { background-position: 0 0, 340px 210px, 0 0; }
.tappa:nth-child(3n) .scheda { background-position: 0 0, 610px 90px, 0 0; }

.scheda__chiodo {
  position: absolute;
  top: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #efe0c2, #8c7558 50%, #2b1f14);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .7), 0 0 0 2px rgba(0, 0, 0, .22);
}
.scheda__chiodo--a { left: 12px; }
.scheda__chiodo--b { right: 12px; }

.scheda__testa {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 18px;
  align-items: center;
}
.scheda__codice {
  min-width: 1.05ch;
  font-family: var(--f-titolo);
  font-weight: 900;
  font-size: clamp(3rem, 2.2rem + 2.3vw, 4.7rem);
  line-height: .8;
  letter-spacing: -.03em;
  font-variation-settings: "SOFT" 0, "WONK" 0;
  color: #22130a;
  text-shadow: 0 1.5px 0 rgba(255, 220, 180, .24), 0 -1px 0 rgba(0, 0, 0, .55);
  text-align: center;
}
.tappa--in-corso .scheda__codice {
  color: #3d1a07;
  text-shadow: 0 1.5px 0 rgba(255, 180, 94, .5), 0 -1px 0 rgba(0, 0, 0, .55), 0 0 22px rgba(255, 138, 61, .3);
}
.scheda__fase {
  font: 700 .9rem/1.1 var(--f-sc);
  letter-spacing: .1em;
  text-transform: lowercase;
  color: var(--ambra);
}
.scheda__titolo {
  margin-top: 4px;
  font: 700 clamp(1.5rem, 1.1rem + 1.1vw, 2.15rem)/1.04 var(--f-titolo);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  color: #fff4e3;
  text-wrap: balance;
}
.scheda__sotto {
  margin-top: 6px;
  font: italic 500 1.1rem/1.3 var(--f-testo);
  color: #f6d4a6;
}

.scheda__stato {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 18px;
}
.scheda__pct {
  min-width: 3.2ch;
  font: 800 1.05rem/1 var(--f-titolo);
  color: var(--oro);
  text-align: right;
}
.tappa--da-fare .scheda__pct { color: var(--crema-3); }

.cartellino {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px 13px 6px 22px;
  font: 700 .92rem/1 var(--f-sc);
  letter-spacing: .06em;
  color: var(--fg, #10210a);
  background: var(--bg, var(--muschio));
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%);
}
.cartellino::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: rgba(10, 5, 0, .55);
}
.cartellino--fatto { --bg: linear-gradient(90deg, #6ea85a, #9fcf82); --fg: #0f1e09; }
.cartellino--in-corso { --bg: linear-gradient(90deg, var(--arancio), var(--ambra)); --fg: #2a1205; }
.cartellino--da-fare { --bg: linear-gradient(90deg, #2b3f73, #3a5592); --fg: #e2ecff; }

.barra {
  --p: 0%;
  position: relative;
  flex: 1 1 90px;
  min-width: 70px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: #170c05;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .85), 0 1px 0 rgba(255, 220, 180, .15);
}
.barra__riempi {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--arancio), var(--oro));
  box-shadow: 0 0 10px rgba(255, 138, 61, .65);
  transition: width 1.2s cubic-bezier(.2, .8, .2, 1) .25s;
}
.barra--fatto .barra__riempi { background: linear-gradient(90deg, #5f9a4c, #a9d98a); box-shadow: 0 0 8px rgba(127, 179, 106, .5); }

.scheda__descr {
  margin-top: 16px;
  font-size: 1.06rem;
  line-height: 1.55;
  color: #f4e3ca;
}
.scheda__punti {
  list-style: none;
  margin: 14px 0 0;
  padding: 14px 0 0;
  display: grid;
  gap: 8px;
  border-top: 1px dashed rgba(255, 214, 170, .2);
}
.scheda__punti li {
  position: relative;
  padding-left: 24px;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--crema-2);
}
.scheda__punti li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .3em;
  width: 12px;
  height: 14px;
  background: var(--muschio);
  clip-path: polygon(50% 0, 88% 44%, 68% 44%, 100% 78%, 58% 78%, 58% 100%, 42% 100%, 42% 78%, 0 78%, 32% 44%, 12% 44%);
}
.tappa--in-corso .scheda__punti li::before { background: var(--ambra); }
.tappa--da-fare .scheda__punti li::before { background: #9aa9c9; }

/* ---- foto e cartoline appoggiate sul legno -------------------------------------------- */
.foto {
  grid-area: foto;
  position: relative;
  justify-self: center;
  width: min(100%, 470px);
  margin: clamp(30px, 4.4vw, 76px) 0 0;
  rotate: var(--rot, 0deg);
  transition: rotate .5s cubic-bezier(.2, .8, .2, 1), translate .7s cubic-bezier(.2, .8, .2, 1), scale .5s, opacity .8s;
}
.foto:hover, .foto:focus-within { rotate: 0deg; scale: 1.02; }

.foto__carta {
  position: relative;
  padding: 11px 11px 0;
  border-radius: 2px;
  background: linear-gradient(160deg, #f8efdf, #ecdec4 55%, #e0cba8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    0 0 0 1px rgba(60, 40, 20, .3),
    0 28px 36px -18px rgba(0, 0, 0, .95),
    0 6px 12px rgba(0, 0, 0, .38);
}
.foto__apri {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #20140c;
  cursor: zoom-in;
}
.foto__apri img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}
.foto__didascalia {
  padding: 9px 6px 12px;
  font: 600 1.38rem/1.12 var(--f-mano);
  color: #3a2314;
  text-align: center;
}

.puntina {
  position: absolute;
  z-index: 3;
  top: -9px;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffc0a2, #d2462a 45%, #7a1d0e);
  box-shadow: 0 3px 4px rgba(0, 0, 0, .55), 3px 8px 7px -3px rgba(0, 0, 0, .45);
}
.tappa:nth-child(even) .puntina { background: radial-gradient(circle at 35% 30%, #d5e4ff, #4f74b8 45%, #1f2f5c); }
.foto--cartolina .puntina { background: radial-gradient(circle at 35% 30%, #fff1c4, #c9a35f 45%, #6a4b18); }

/* cartolina: bordo "posta aerea", francobollo e timbro */
.foto--cartolina .foto__carta {
  padding: 12px 12px 0;
  border: 7px solid transparent;
  background:
    linear-gradient(160deg, #f8efdf, #ecdec4 55%, #e0cba8) padding-box,
    repeating-linear-gradient(-45deg, #b8432f 0 12px, #f3e8d4 12px 20px, #2b3f73 20px 32px, #f3e8d4 32px 40px) border-box;
}
.foto--cartolina .foto__apri { cursor: zoom-in; }
.francobollo {
  position: absolute;
  z-index: 2;
  top: 6px;
  right: 8px;
  width: 63px;
  height: 72px;
  padding: 5px;
  display: grid;
  place-items: center;
  font-size: 34px;
  color: var(--oro);
  rotate: 4deg;
  background:
    linear-gradient(170deg, #233466, #5a4590 55%, #e0704a 120%) content-box,
    #f7eedc;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle 3.4px, transparent 97%, #000) -4.5px -4.5px / 9px 9px;
  mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle 3.4px, transparent 97%, #000) -4.5px -4.5px / 9px 9px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4));
}
.francobollo .ico { stroke-width: 3.4; filter: drop-shadow(0 0 4px rgba(255, 138, 61, .8)); }
.timbro {
  position: absolute;
  z-index: 2;
  top: 4px;
  right: 46px;
  width: 92px;
  height: 92px;
  color: rgba(255, 240, 214, .62);
  rotate: -14deg;
  pointer-events: none;
}

.foto__vuota {
  aspect-ratio: 3 / 2;
  display: grid;
  place-items: center;
  color: var(--oro);
  background: linear-gradient(180deg, #121a40, #3b3a78 40%, #a8577e 68%, var(--arancio) 86%, var(--ambra));
}
.ico--grande { width: 34%; height: auto; aspect-ratio: 1; stroke-width: 2.6; filter: drop-shadow(0 0 16px rgba(255, 138, 61, .65)); }

/* ---- traguardo Alpha ----------------------------------------------------------------- */
.traguardo {
  position: relative;
  isolation: isolate;
  margin-top: clamp(20px, 3vw, 60px);
  padding-top: 50px;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: visible;
}
.traguardo__testo {
  position: relative;
  z-index: 2;
  align-self: center;
  width: min(100% - 2 * var(--gutter), 760px);
  text-align: center;
}
.emblema {
  --p: 0;
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 66px;
  color: #3b1d0a;
  background: radial-gradient(circle at 36% 28%, #fff0c4, var(--oro) 40%, var(--arancio) 100%);
  box-shadow:
    inset 0 4px 0 rgba(255, 252, 235, .6),
    inset 0 -8px 14px rgba(140, 50, 0, .45),
    0 0 0 7px #0b0603,
    0 0 0 9px rgba(255, 214, 170, .2),
    0 0 60px rgba(255, 150, 60, .5),
    0 18px 30px rgba(0, 0, 0, .7);
}
.emblema::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: conic-gradient(var(--oro) calc(var(--p) * 1%), rgba(255, 214, 170, .1) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  filter: drop-shadow(0 0 6px rgba(255, 180, 94, .7));
}
.emblema .ico { stroke-width: 3; }
.traguardo__titolo {
  margin-top: 10px;
  font: 900 clamp(4.4rem, 2.6rem + 7vw, 10rem)/.84 var(--f-titolo);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  letter-spacing: -.03em;
  background: linear-gradient(180deg, #fff6da 10%, var(--oro) 48%, var(--arancio) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(255, 138, 61, .45)) drop-shadow(0 3px 0 rgba(40, 12, 2, .6));
}
.traguardo__descr {
  margin: 20px auto 0;
  max-width: 36em;
  font-size: clamp(1.08rem, 1rem + .35vw, 1.28rem);
  line-height: 1.5;
  color: #f8e9d2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
}
.traguardo__avanz {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(100%, 460px);
  margin: 24px auto 0;
  font: 700 .95rem/1 var(--f-sc);
  letter-spacing: .06em;
  color: var(--crema-2);
}
.traguardo__avanz .barra { flex: 1 1 120px; height: 12px; }
.traguardo__avanz b { font: 800 1.2rem/1 var(--f-titolo); color: var(--oro); }
.traguardo__conto { margin-top: 10px; font-size: .98rem; color: var(--crema-3); }

.traguardo__scena {
  position: relative;
  z-index: 1;
  margin-top: -9.5vw;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent 0, #000 26%, #000 84%, transparent 100%);
  mask-image: linear-gradient(transparent 0, #000 26%, #000 84%, transparent 100%);
}
.traguardo__scena img { display: block; width: 100%; height: auto; max-width: none; }

.lucciole { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.lucciole span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff1c2;
  box-shadow: 0 0 10px 3px rgba(255, 200, 100, .7);
  scale: var(--s);
  animation: lucciola var(--t) ease-in-out var(--d) infinite;
}
@keyframes lucciola {
  0%, 100% { translate: 0 0; opacity: .15; }
  30% { opacity: 1; }
  50% { translate: 18px -26px; opacity: .55; }
  75% { translate: -10px -12px; opacity: .95; }
}

/* ---- oltre l'alpha e fine del sentiero ------------------------------------------------- */
.oltre {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: clamp(10px, 2vw, 30px) 0 clamp(50px, 6vw, 90px);
}
.oltre__ancora {
  display: block;
  width: 12px;
  height: 12px;
  margin-bottom: 44px;
  border-radius: 50%;
  background: #2a1a11;
  box-shadow: 0 0 0 4px #0a0502, 0 0 0 5.5px rgba(255, 214, 170, .14);
}
.cartello--oltre {
  padding: 14px 52px 13px 34px;
  border-radius: 4px;
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 50%, calc(100% - 26px) 100%, 0 100%);
  rotate: -2deg;
}
.cartello--oltre::before, .cartello--oltre::after { display: none; }
.cartello--oltre .cartello__testo { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem); }

.fine {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: clamp(56px, 6vw, 100px);
  text-align: center;
}
.fine__ometto {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  font-size: 58px;
  color: #b48e6c;
}
.fine__ometto .ico { stroke-width: 2.6; }
.fine p {
  font: 600 1.5rem/1 var(--f-mano);
  color: var(--crema-3);
}

/* =========================================================================================
   Piede
   ========================================================================================= */
.piede {
  margin-top: clamp(10px, 2vw, 30px);
  padding: clamp(40px, 5vw, 64px) var(--gutter) 44px;
  background: linear-gradient(180deg, transparent, rgba(6, 3, 1, .7) 40%);
  border-top: 1px solid rgba(255, 214, 170, .08);
}
.piede__dentro {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 36px clamp(30px, 5vw, 80px);
}
.piede__titolo {
  font: 700 1rem/1 var(--f-sc);
  letter-spacing: .2em;
  text-transform: lowercase;
  color: var(--oro);
}
.legenda__gruppi {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px 34px;
  margin-top: 18px;
}
.legenda__voci {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.legenda__voce {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 32px;
  color: var(--crema-2);
  font-size: .98rem;
}
.legenda__voce b { color: var(--crema); font-weight: 700; }
.legenda__tratto {
  flex: none;
  width: 44px;
  height: 9px;
  margin-inline: -9px;
  background:
    repeating-linear-gradient(90deg, #070302 0 10px, transparent 10px 17px) 0 0 / 100% 6px no-repeat,
    repeating-linear-gradient(90deg, rgba(255, 214, 170, .28) 0 10px, transparent 10px 17px) 0 2.5px / 100% 6px no-repeat;
}
.legenda__tratto--acceso {
  background: #070302;
  box-shadow: inset 0 0 0 3px #070302, inset 0 0 0 9px var(--arancio), 0 0 12px rgba(255, 138, 61, .6);
}
.piede__info { display: grid; gap: 8px; align-content: start; }
.piede__marchio { font: 800 1.35rem/1.1 var(--f-titolo); font-variation-settings: "SOFT" 100, "WONK" 1; color: var(--crema); }
.piede__data { color: var(--crema-2); }
.piede__data time { color: var(--oro); font-weight: 500; }
.crediti { font-size: .95rem; color: var(--crema-3); }
.crediti--piccoli { font-size: .86rem; }

/* =========================================================================================
   Lightbox
   ========================================================================================= */
.lightbox {
  width: min(96vw, 1500px);
  max-height: 94vh;
  padding: 14px 14px 0;
  border: 0;
  border-radius: 3px;
  color: var(--inchiostro);
  background: linear-gradient(160deg, #f8efdf, #e8d8bc);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .8);
  overflow: visible;
}
.lightbox::backdrop { background: rgba(8, 4, 2, .82); backdrop-filter: blur(3px); }
.lightbox[open] { animation: albeggia .3s ease both; }
.lightbox__figura { margin: 0; }
.lightbox__img { display: block; width: 100%; max-height: calc(94vh - 90px); object-fit: contain; background: #20140c; }
.lightbox__didascalia { padding: 10px 6px 14px; font: 600 1.6rem/1.1 var(--f-mano); text-align: center; color: #3a2314; }
.lightbox__chiudi-form { position: absolute; top: -18px; right: -18px; margin: 0; z-index: 2; }
.lightbox__chiudi {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  font-size: 22px;
  color: #3b1d0a;
  background: radial-gradient(circle at 36% 28%, #ffe6ad, var(--ambra) 50%, #d9682a);
  box-shadow: 0 0 0 4px #0b0603, 0 6px 14px rgba(0, 0, 0, .6);
  cursor: pointer;
}
.lightbox__chiudi .ico { stroke-width: 6; }
.lightbox__chiudi:hover { filter: brightness(1.08); }
html:has(.lightbox[open]) { overflow: hidden; }

.errore, .senza-js {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 40px auto;
  padding: 18px 22px;
  border-radius: 6px;
  background: #3a1a0c;
  color: var(--crema);
  border: 1px solid var(--arancio);
}

/* =========================================================================================
   Comparsa allo scorrimento (solo con JS e senza "riduci movimento")
   ========================================================================================= */
.anima .tappa:not(.visto) .scheda { opacity: 0; translate: -34px 0; }
.anima .tappa--destra:not(.visto) .scheda { translate: 34px 0; }
.anima .tappa:not(.visto) .foto { opacity: 0; translate: 0 36px; }
.anima .tappa:not(.visto) .medaglione { opacity: 0; scale: .55; }
.anima .tappa:not(.visto) .barra__riempi { width: 0; }
.anima .tappa .foto { transition-delay: 0s, .12s, 0s, .12s; }
.anima .traguardo:not(.visto) .traguardo__testo { opacity: 0; translate: 0 30px; }
.anima .traguardo .traguardo__testo { transition: opacity 1s ease, translate 1.1s cubic-bezier(.2, .8, .2, 1); }
.anima .traguardo:not(.visto) .barra__riempi { width: 0; }
.anima .riepilogo:not(.visto) .targa { opacity: 0; translate: 0 26px; }
.anima .riepilogo .targa { transition: opacity .9s ease .2s, translate 1s cubic-bezier(.2, .8, .2, 1) .2s; }
.anima .riepilogo:not(.visto) .barra__riempi { width: 0; }

/* =========================================================================================
   Schermi medi e telefoni: il sentiero corre a sinistra, schede a destra
   ========================================================================================= */
@media (max-width: 1100px) {
  :root { --banda: 150px; --med: 80px; }
  .tappe--oltre { --med: 68px; }
  .foto { width: min(100%, 400px); }
  .tappa--qui .foto { margin-top: 124px; }
}

@media (max-width: 899px) {
  :root { --med: 54px; --corsia: 58px; }
  .tappe--oltre { --med: 48px; }

  .testata { height: auto; min-height: clamp(560px, 92svh, 860px); }
  .tappa { scroll-margin-top: 96px; }
  .testata::after { background: radial-gradient(110% 60% at 30% 26%, rgba(7, 10, 30, .66), rgba(7, 10, 30, .2) 60%, transparent 80%); }
  .testata__testo { position: relative; top: auto; left: auto; width: auto; padding: 64px var(--gutter) 150px; }
  .titolo { font-size: clamp(3rem, 1.5rem + 9vw, 5.6rem); }

  .riepilogo { align-items: stretch; margin-top: -96px; }
  .targa { width: 100%; rotate: 0deg; gap: 18px; padding: 22px 20px 20px; }
  .targa__anello { width: 104px; }
  .targa__pct { font-size: 2.2rem; }
  .ottone { width: auto; margin-right: 0; rotate: .5deg; }

  .partenza { align-items: flex-start; padding-left: var(--gutter); }
  .partenza .cartello { margin-left: 0; }
  .partenza__ancora { margin-left: calc(var(--corsia) / 2 - 7px); }

  .tappa,
  .tappa--sinistra,
  .tappa--destra {
    grid-template-columns: var(--corsia) minmax(0, 1fr);
    grid-template-areas: "perno scheda" "perno foto";
    column-gap: 12px;
  }
  .tappa__perno,
  .tappa--destra .tappa__perno {
    grid-row: 1 / span 2;
    justify-content: center;
    padding: 20px 0 0;
  }
  .qui,
  .tappa--destra .qui {
    top: -44px;
    left: calc(50% + var(--med) / 2 + 4px);
    right: auto;
    grid-auto-flow: column;
    align-items: end;
    gap: 6px;
  }
  .qui__gancio { display: none; }
  .qui__lume { width: 34px; height: 34px; font-size: 34px; }
  .qui__testo { font-size: 1.3rem; }
  .tappa--qui { margin-top: 74px !important; }
  .tappa--qui .foto { margin-top: 26px; }

  .scheda__testa { gap: 4px 14px; }
  .foto { justify-self: start; width: min(100% - 12px, 400px); margin: 26px 0 0 8px; }
  .anima .tappa:not(.visto) .scheda,
  .anima .tappa--destra:not(.visto) .scheda { translate: 0 28px; }

  .traguardo__scena { margin-top: -60px; }
  .traguardo__scena img { width: 240%; margin-left: -83%; }

  .oltre { align-items: flex-start; padding-left: var(--gutter); }
  .oltre__ancora { margin-left: calc(var(--corsia) / 2 - 6px); }
  .cartello--oltre { margin-left: 4px; }
  .fine { align-items: flex-start; padding-left: calc(var(--gutter) + var(--corsia) / 2 - 32px); text-align: left; }

  .piede__dentro { grid-template-columns: 1fr; }
  .legenda__gruppi { grid-template-columns: 1fr; }
}

@media (min-width: 600px) and (max-width: 899px) {
  .traguardo__scena { margin-top: -80px; }
  .traguardo__scena img { width: 170%; margin-left: -45%; }
}

@media (max-width: 420px) {
  :root { --corsia: 50px; --med: 48px; --gutter: 14px; }
  body { font-size: 1rem; }
  .scheda { padding: 20px 16px 20px; }
  .scheda__codice { font-size: 2.6rem; }
  /* targa: anello piccolo accanto a etichetta e contatori, barra e link a tutta larghezza */
  .targa { grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; padding: 20px 18px 18px; }
  .targa__corpo { display: contents; }
  .targa__anello { width: 84px; grid-row: 1 / span 2; }
  .targa__pct { font-size: 1.75rem; }
  .targa__etichetta { align-self: end; font-size: .84rem; letter-spacing: .1em; }
  .targa__conti { margin-top: 2px; align-self: start; gap: 6px 14px; }
  .conto b { font-size: 1.45rem; }
  .targa__alpha, .targa__qui, .targa__data { grid-column: 1 / -1; }
  .targa__alpha { margin-top: 8px; }
  .targa__qui { margin-top: 2px; justify-self: start; }
  .targa__data { margin-top: 0; }
  .scarica { font-size: 1.1rem; }
  .cartellino { font-size: .85rem; }
  .francobollo { width: 54px; height: 63px; font-size: 28px; }
  .timbro { width: 78px; height: 78px; right: 38px; }
}

@media (min-width: 1800px) {
  :root { --max: 1520px; --med: 100px; --banda: 270px; }
  body { font-size: 1.125rem; }
  .occhiello { font-size: 1.15rem; }
  .testata__giu { font-size: 1rem; }
  .scarica { font-size: 1.35rem; }
  .foto { width: min(100%, 540px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
  }
}
