
html.mosso { scroll-behavior: smooth; }

.pagina {
  --leggi: rgba(255, 240, 212, .9);
  --colonna: 34em;
  position: relative;
  padding: calc(var(--hud) + 6px) max(var(--m), env(safe-area-inset-right)) 72px max(var(--m), env(safe-area-inset-left));
  background: radial-gradient(130% 460px at 50% 0, var(--viola) 0%, rgba(43, 17, 80, 0) 100%) no-repeat, var(--notte);
}

.testa { position: relative; display: grid; justify-items: center; gap: 12px; max-width: 680px; margin: 0 auto 34px; text-align: center; }
.testa .stellina { z-index: 0; }
.testa__oblo {
  position: relative; z-index: 1; width: 104px; height: 104px; margin-top: 30px; margin-bottom: 4px;
  border-radius: 50%; background: var(--viola-chiaro); border: 3px solid var(--oro);
}
.testa__oblo::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2.5px solid var(--contorno); }
.testa__yumo {
  position: absolute; left: 50%; bottom: 4px; width: auto; height: 132px; max-width: none;
  translate: -50% 0; rotate: var(--inclina, -4deg); transform-origin: 50% 100%;
}
.testa .titolo { font-size: clamp(2.2rem, 10vw, 3.4rem); }
.testa .cartellino { max-width: 100%; justify-content: center; text-align: center; line-height: 1.2; text-wrap: balance; }
@media (max-width: 599px) {
  .testa .cartellino { max-width: min(100%, 19em); }
}
.testa__intro { max-width: 30em; font-size: 17px; font-weight: 600; line-height: 1.5; color: var(--crema-80); text-wrap: balance; }
.testa__grande { max-width: 22em; font-size: clamp(20px, 5.4vw, 27px); font-weight: 700; line-height: 1.32; color: var(--crema); text-wrap: balance; }

html.mosso .testa__yumo { animation: oblo-esce .8s var(--molla) backwards .12s; }
html.mosso .testa .cartellino { animation: timbro .65s var(--molla) backwards .3s; }
@keyframes oblo-esce { from { opacity: 0; transform: translateY(46px) scale(.6); } 40% { opacity: 1; } }

.foglio { max-width: calc(11em + 24px + var(--colonna)); margin: 0 auto; }

.indice {
  margin: 0 0 36px; padding: 14px 18px 8px; background: var(--viola);
  border: 3px solid var(--oro); border-radius: 24px; outline: 3px solid var(--contorno);
}
.indice__titolo { font-size: 17px; color: var(--oro); -webkit-text-stroke-width: 0; }
.indice ol { margin: 4px 0 0; padding: 0; list-style: none; }
.indice li + li { border-top: 1.5px dashed var(--oro-40); }
.indice a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 2px;
  color: var(--crema); text-decoration: none; font-size: 16.5px; font-weight: 650; line-height: 1.3;
  transition: color .2s linear, opacity .15s linear;
}
.indice a:active { opacity: .6; }
.numero {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--oro); border: 2px solid var(--contorno); color: var(--contorno);
  font-family: var(--display); font-size: 15px; line-height: 1; letter-spacing: 0;
  -webkit-text-stroke-width: 0;
}

.capitolo { padding-top: 30px; border-top: 3px dashed var(--oro-40); scroll-margin-top: 18px; }
.capitolo + .capitolo { margin-top: 30px; }
.capitolo:first-child { padding-top: 0; border-top: 0; }
.capitolo__titolo { display: flex; align-items: center; gap: 12px; font-size: clamp(21px, 5.6vw, 27px); line-height: 1.12; color: var(--crema); }
.capitolo__titolo .numero { width: 32px; height: 32px; font-size: 16px; }

.voci { margin: 14px 0 0; }
.voci__riga { padding: 14px 0 16px; }
.voci__riga + .voci__riga { border-top: 1.5px dashed rgba(248, 195, 119, .22); }
.voci dt { margin-bottom: 5px; font-size: 15px; font-weight: 800; letter-spacing: .07em; line-height: 1.35; text-transform: uppercase; color: var(--oro); }
.voci dd { margin: 0; max-width: var(--colonna); font-size: 17px; font-weight: 500; line-height: 1.62; color: var(--leggi); text-wrap: pretty; }
.voci dd + dd { margin-top: 10px; }
.voci strong { font-weight: 750; color: var(--crema); }

.pagina :is(.voci, .blocco, .riquadro, .perso) p a,
.voci dd a {
  color: var(--oro); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
  padding: 16px 2px; margin: -16px -2px; overflow-wrap: anywhere;
}
.pagina a:focus-visible { outline: 3px solid var(--crema); outline-offset: 3px; border-radius: 6px; }

.arriva {
  display: inline-block; margin: 0 6px 2px 0; padding: 2px 10px; border-radius: 99px;
  border: 1.5px dashed var(--oro); color: var(--oro); vertical-align: 1px;
  font-size: 15px; font-weight: 800; letter-spacing: .04em; line-height: 1.4; text-transform: uppercase; white-space: nowrap;
}
.da-fare { padding: 1px 6px; border-radius: 6px; background: var(--caramello); color: var(--contorno); font-weight: 800; white-space: nowrap; }

.foglio__data {
  margin-top: 34px; padding-top: 20px; border-top: 3px dashed var(--oro-40);
  font-size: 15px; font-weight: 600; line-height: 1.5; color: var(--crema-60); text-align: center;
}

.blocco { max-width: 1060px; margin: 0 auto; padding: 42px 0 34px; border-top: 3px dashed var(--oro-40); text-align: center; }
.blocco__titolo { font-size: clamp(26px, 7.4vw, 40px); line-height: 1.05; color: var(--crema); text-wrap: balance; }
.blocco__testo { max-width: var(--colonna); margin: 14px auto 0; font-size: 17px; font-weight: 500; line-height: 1.62; color: var(--leggi); text-wrap: pretty; }
.blocco__titolo + .blocco__testo { margin-top: 12px; }
.blocco__grande { max-width: 22em; margin: 20px auto 0; font-size: clamp(20px, 5.4vw, 26px); font-weight: 700; line-height: 1.35; color: var(--crema); text-wrap: balance; }
.blocco__grande--oro { color: var(--oro); }
.blocco .bottone { margin-top: 26px; }
.pagina .bottone__faccia { white-space: normal; text-wrap: balance; text-align: center; line-height: 1.12; }

.polaroid-fila {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px;
  max-width: 520px; margin: 30px auto 0; padding: 0; list-style: none;
}
.polaroid {
  position: relative; padding: 7px 7px 12px; background: var(--crema); color: var(--contorno);
  border: 3px solid var(--contorno); border-radius: 6px; rotate: var(--inclina, 0deg);
}
.polaroid::before {
  content: ""; position: absolute; z-index: 1; left: 50%; top: -14px; width: 16px; height: 26px; margin-left: -8px;
  border-radius: 4px; background: var(--oro); border: 2.5px solid var(--contorno);
}
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 2px solid var(--contorno); border-radius: 3px; }
.polaroid p { display: grid; justify-items: center; gap: 2px; padding: 9px 2px 0; text-align: center; }
.polaroid strong { font-family: var(--display); font-weight: 400; font-size: 17px; line-height: 1.1; letter-spacing: .03em; text-transform: uppercase; }
.polaroid span { font-size: 15px; font-weight: 600; line-height: 1.3; color: #5A2E10; text-wrap: balance; }
.polaroid em {
  margin-top: 6px; padding: 2px 10px; border-radius: 99px; background: var(--caramello); color: var(--crema);
  font-style: normal; font-size: 15px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}

.riquadri {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  max-width: 560px; margin: 28px auto 0; padding: 0; list-style: none;
}
.riquadri > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.riquadro {
  display: grid; justify-items: center; align-content: start; gap: 8px; padding: 18px 12px 20px;
  background: var(--viola); border: 3px solid var(--oro-40); border-radius: 22px; text-align: center;
}
.riquadro__icona {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: var(--contorno); border: 2.5px solid var(--oro); color: var(--oro);
}
.riquadro__icona .icona { width: 26px; height: 26px; }
.riquadro__icona .bandiera { width: 28px; height: 20px; }
.riquadro h3 { margin: 4px 0 0; font-size: 18px; line-height: 1.1; color: var(--oro); -webkit-text-stroke-width: 0; }
.riquadro p { max-width: 24em; font-size: 16px; font-weight: 500; line-height: 1.5; color: var(--leggi); text-wrap: pretty; }

html.comparse [data-vista]:not(.vista) > * { opacity: 0; }
html.comparse .vista > * { animation: compare .7s var(--molla) backwards calc(var(--i, 0) * 90ms); }
html.comparse .vista .riquadro__icona { animation: gesto .8s var(--molla) backwards calc(.25s + var(--i, 0) * 90ms); }
@keyframes compare { from { opacity: 0; transform: translateY(28px) scale(.9); } 45% { opacity: 1; } }
@keyframes gesto { from { transform: scale(.4) rotate(-25deg); } 60% { transform: scale(1.12) rotate(8deg); } }

.perso { display: grid; justify-items: center; text-align: center; padding-bottom: 80px; }
.perso__cielo { position: relative; width: min(100%, 420px); height: 250px; margin-top: 8px; }
.perso__orbita {
  position: absolute; left: 4%; right: 4%; top: 28%; height: 52%;
  border: 3px dashed var(--oro-40); border-radius: 50%; rotate: -12deg;
}
.perso__pianeta {
  position: absolute; right: 9%; top: 6%; width: 74px; height: 74px; border-radius: 50%;
  background:
    linear-gradient(160deg, transparent 0 30%, rgba(61, 29, 7, .28) 30% 42%, transparent 42% 60%, rgba(61, 29, 7, .28) 60% 70%, transparent 70%),
    var(--viola-chiaro);
  border: 3px solid var(--contorno);
  display: grid; place-items: center;
}
.perso__pianeta::after {
  content: ""; position: absolute; left: -16px; right: -16px; top: 70%; height: 20px; margin-top: -10px;
  border-radius: 50%; border: 3px solid var(--oro); rotate: -18deg;
}
.perso__pianeta span { position: relative; z-index: 1; translate: 0 -4px; font-size: 17px; color: var(--crema); letter-spacing: .02em; }
.perso__yumo {
  position: absolute; left: 50%; top: 8px; width: auto; height: 220px; max-width: none;
  translate: -58% 0; rotate: -14deg;
}
.perso .cartellino { margin-top: 4px; }
.perso .titolo { margin-top: 12px; font-size: clamp(2.2rem, 10vw, 3.6rem); }
.perso__testo { max-width: 26em; margin-top: 14px; font-size: 18px; font-weight: 600; line-height: 1.5; color: var(--crema-80); text-wrap: balance; }
.perso__azioni { display: grid; justify-items: center; gap: 12px; width: 100%; margin-top: 26px; }
.perso__azioni .bottone__faccia { min-height: 56px; font-size: 20px; }
.secondario {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 52px; padding: 0 22px 0 18px;
  border-radius: 99px; background: var(--contorno); border: 2.5px solid var(--oro); color: var(--crema); text-decoration: none;
  font-family: var(--display); font-size: 17px; letter-spacing: .03em; text-transform: uppercase;
  transition: transform .45s var(--molla);
}
.secondario .icona { color: var(--oro); }
.secondario:active { transform: scale(.95); transition-duration: .08s; }
html.mosso .perso__yumo { animation: deriva 1.6s var(--curva) backwards .1s; }
html.mosso .perso__pianeta { animation: timbro .7s var(--molla) backwards .5s; }
html.mosso .perso .cartellino { animation: timbro .65s var(--molla) backwards .35s; }
@keyframes deriva { from { opacity: 0; transform: translate(-70px, -50px) rotate(-50deg) scale(.7); } 30% { opacity: 1; } }

.piede nav a[aria-current="page"] { color: var(--oro); }

@media (max-width: 374px) {
  .polaroid-fila { gap: 24px 10px; }
  .polaroid strong { font-size: 15.5px; }
  .riquadri { gap: 10px; }
  .riquadro { padding: 16px 8px 18px; }
}

@media (orientation: portrait) and (min-width: 600px) {
  .testa__oblo { width: 120px; height: 120px; }
  .testa__yumo { height: 152px; }
  .polaroid-fila { max-width: 600px; gap: 30px 22px; }
}
@media (min-width: 900px), (orientation: landscape) and (min-width: 560px) {
  .pagina { padding-top: calc(var(--hud) + 14px); padding-bottom: 96px; }
  .testa { margin-bottom: 44px; }
  .testa__oblo { width: 124px; height: 124px; margin-top: 34px; }
  .testa__yumo { height: 158px; }
  .testa .titolo { font-size: clamp(2.6rem, min(5vw, 9vh), 4.2rem); }
  .testa__intro { font-size: 18px; }
  .voci__riga { display: grid; grid-template-columns: 11em minmax(0, 1fr); column-gap: 24px; }
  .voci dt { margin: 3px 0 0; }
  .voci dd { grid-column: 2; font-size: 17.5px; }
  .blocco__testo { font-size: 18px; }
  .polaroid-fila { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1060px; gap: 34px 26px; }
  .riquadri { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1060px; gap: 18px; }
  .riquadri > :last-child:nth-child(odd) { grid-column: auto; }
  .riquadro { padding: 24px 22px 26px; }
  .perso__cielo { width: 520px; height: 290px; }
  .perso__yumo { height: 250px; }
}
@media (min-width: 1000px) {
  .foglio--indice {
    max-width: calc(280px + 56px + 11em + 24px + var(--colonna));
    display: grid; grid-template-columns: 280px minmax(0, 1fr); column-gap: 56px; align-items: start;
  }
  .foglio--indice .indice { position: sticky; top: 24px; margin: 0; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .testa__oblo { width: 96px; height: 96px; margin-top: 26px; }
  .testa__yumo { height: 120px; }
  .perso__cielo { height: 230px; }
  .perso__yumo { height: 200px; }
}

@media (hover: hover) and (pointer: fine) {
  .indice a:hover { color: var(--oro); }
  .pagina :is(.voci, .blocco, .riquadro, .perso) p a:hover, .voci dd a:hover { color: var(--crema); }
  .polaroid { transition: rotate .5s var(--molla), scale .5s var(--molla); }
  .polaroid:hover { rotate: 0deg; scale: 1.04; }
  .secondario:hover { transform: translateY(-2px) rotate(-2deg) scale(1.04); }
}

@media print {
  html, body, .pagina { background: #fff !important; color: #222 !important; }
  .hud, .piede, .indice, .testa__oblo, .stellina, .carrello { display: none !important; }
  .pagina { padding: 0; }
  .testa .titolo, .capitolo__titolo { color: #222; -webkit-text-stroke-width: 0; }
  .testa .cartellino { background: none; color: #222; border-color: #999; }
  .voci dt { color: #555; }
  .voci dd, .voci strong, .testa__intro, .foglio__data { color: #222; }
  .voci dd a { color: #222; }
  .capitolo, .voci__riga + .voci__riga, .foglio__data { border-color: #bbb; }
  .capitolo { break-inside: avoid-page; }
  [data-vista] > * { opacity: 1 !important; animation: none !important; }
}
