/* ==========================================================================
   Kalendo V2 — movimento e pagina del destinatario
   Filosofia: poche animazioni, fisiche (molle, inerzia, rimbalzo), niente bagliori, sfocature o scintille a caso.
   Si carica DOPO v2.css e ridefinisce animazioni e aspetto del calendario "visto da chi lo riceve".
   ========================================================================== */

:root {
  --spring: cubic-bezier(.3, 1.3, .5, 1);        /* molla con un piccolo rimbalzo */
  --settle: cubic-bezier(.22, 1, .36, 1);         /* arrivo morbido */
  --smooth: cubic-bezier(.65, 0, .35, 1);         /* partenza e arrivo dolci */
}
html { scroll-behavior: auto; }

/* ---------- Passaggio tra le pagine ---------- */
/* Le transizioni tra pagine non nell'app sulla Home: su iPhone lì possono mandare la pagina in crash («si è verificato ripetutamente un errore») */
@media not (display-mode: standalone) { @view-transition { navigation: auto; } }
::view-transition-old(root) { animation: vtOut .22s ease both; }
::view-transition-new(root) { animation: vtIn .5s var(--settle) both; }
@keyframes vtOut { to { opacity: 0; } }
@keyframes vtIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Comparsa delle sezioni ---------- */
.reveal { opacity: 0; transform: translate3d(0, 22px, 0); transition: opacity .75s var(--settle), transform .95s var(--settle); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; will-change: auto; }
.reveal-d1, .reveal-d2, .reveal-d3 { transition-delay: 0s; }   /* il ritardo lo dà lo scaglionamento in motion.js */

/* ---------- Titoli: ogni parola sale da una mascherina ---------- */
.js .hero h1:not(.words-ready) { visibility: hidden; }
.words-ready .w { display: inline-block; overflow: hidden; vertical-align: top; padding: .08em .03em .16em; margin: -.08em -.03em -.16em; }
.words-ready .wi { display: inline-block; transform: translate3d(0, 112%, 0) rotate(5deg); transform-origin: 0 100%; animation: wordRise 1s var(--settle) both; }
@keyframes wordRise { to { transform: none; } }
.script-write { display: block; clip-path: inset(-12% 100% -12% 0); animation: scriptWrite 1.4s cubic-bezier(.5, .1, .25, 1) both; }
@keyframes scriptWrite { to { clip-path: inset(-12% -6% -12% 0); } }
@media (max-width: 960px) { .script-write { display: inline-block; } }

/* ---------- Intestazione ---------- */
.site-header { transition: transform .55s var(--settle), background .4s, padding .4s; }
.site-header.hide { transform: translateY(-110%); }
/* Con il menu a tutto schermo aperto la barra non deve avere NESSUNA trasformazione: un elemento «fixed» dentro un contenitore trasformato si
   misura sul contenitore e il menu si ridurrebbe all'altezza della barra */
.site-header:has(.nav.open) { transform: none !important; translate: none !important; transition: none !important; }

/* ---------- Pulsanti: niente riflesso che scorre, solo la pressione ---------- */
.btn::after { display: none; }
.btn { transition: transform .35s var(--spring), box-shadow .25s var(--settle), background .2s; }

/* ---------- Hero: caselle, lucine e mascotte con vita ---------- */
.hero-door .leaf { transition: transform 1.3s var(--spring), box-shadow 1.2s var(--settle); }
.hero-door .peek { transform: scale(.55) rotate(-8deg); opacity: 0; transition: transform 1.1s var(--spring) .12s, opacity .45s ease .12s; }
.hero-door.open .peek { transform: none; opacity: 1; }
.hero-cal { animation-duration: 8s; }

.bulb { animation: bulbWave 3.6s ease-in-out infinite; filter: none; transform: none; }
@keyframes bulbWave { 0%, 100% { opacity: 1; } 50% { opacity: .42; } }
.garland svg { transform-origin: 50% 0; animation: garlandSway 9s ease-in-out infinite alternate; }
@keyframes garlandSway { from { transform: rotate(-.3deg); } to { transform: rotate(.3deg); } }

/* la mascotte respira, ammicca e saluta (le regole valgono anche dentro <use>) */
.mc-eyes { transform-origin: 100px 107px; transform-box: view-box; animation: blink 5.2s infinite; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.08); } }
.mc-arm { transform-origin: 150px 196px; transform-box: view-box; animation: wave 7s ease-in-out infinite; }
@keyframes wave { 0%, 58%, 100% { transform: rotate(0); } 64% { transform: rotate(-20deg); } 70% { transform: rotate(6deg); } 76% { transform: rotate(-16deg); } 82% { transform: rotate(3deg); } 88% { transform: rotate(0); } }
.mc-pom { transform-origin: 100px 32px; transform-box: view-box; animation: pom 4.4s ease-in-out infinite alternate; }
@keyframes pom { from { transform: rotate(-3.5deg); } to { transform: rotate(3.5deg); } }
.gnome, .gnome-big { animation: none; }
.gnome use, .gnome-big use { animation: breathe2 4.8s ease-in-out infinite; transform-origin: 100px 250px; transform-box: view-box; }
@keyframes breathe2 { 50% { transform: scaleY(1.018) scaleX(.994); } }
.candy-heart { animation: heartBeat 3.4s ease-in-out infinite; }
@keyframes heartBeat { 0%, 100% { transform: rotate(-12deg) scale(1); } 10% { transform: rotate(-12deg) scale(1.07); } 20% { transform: rotate(-12deg) scale(1); } 28% { transform: rotate(-12deg) scale(1.04); } 38% { transform: rotate(-12deg) scale(1); } }
.hero-tag { animation: tagFloat 6s ease-in-out infinite; }
@keyframes tagFloat { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-7px) rotate(.6deg); } }

/* ---------- I 4 passi: la linea si disegna mentre scorri ---------- */
.steps::before { transform: scaleX(var(--p, 0)); transform-origin: left center; transition: transform .2s linear; }

/* ---------- Ornamenti: dondolio più naturale ---------- */
.ornament { animation: swing2 5s ease-in-out infinite; }
@keyframes swing2 { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

/* ==========================================================================
   Calendario (home, anteprima, destinatario): caselle con molla
   ========================================================================== */
.door .leaf { transition: transform 1.15s var(--spring), box-shadow .9s var(--settle), filter .3s; }
.door:hover:not(.opened):not(.locked) .leaf { transform: rotateY(-14deg); transition: transform .5s var(--settle), box-shadow .5s, filter .3s; filter: none; }
.door.opened .leaf { box-shadow: -10px 0 18px -6px rgba(0, 0, 0, .4), inset 0 0 0 1px var(--door-edge); }
.door .sheen, .door .back .glow { display: none; }
.door.today .leaf { animation: todayWiggle 5.5s ease-in-out infinite; }
@keyframes todayWiggle { 0%, 84%, 100% { transform: none; } 87% { transform: rotate(-2.4deg); } 90% { transform: rotate(2.2deg); } 93% { transform: rotate(-1.3deg); } 96% { transform: rotate(.7deg); } }
.door.shake { animation: shake2 .5s var(--settle); }
@keyframes shake2 { 20% { transform: translateX(-5px) rotate(-1deg); } 40% { transform: translateX(4px) rotate(.8deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.door-grid.doors-enter .door { animation: doorIn .95s var(--spring) both; animation-delay: calc(var(--i, 0) * 38ms); }
@keyframes doorIn { from { opacity: 0; transform: translateY(30px) rotateX(-28deg) scale(.92); } }
.door.opened .back img, .door.opened .bk-photo { animation: photoDevelop 2.2s ease-out both; }
/* la foto "si sviluppa": parte chiara, sbiadita e sfocata, poi diventa nitida e a colori */
@keyframes photoDevelop { 0% { transform: scale(1.12); filter: brightness(2.6) saturate(0) sepia(.5) blur(8px); opacity: .4; } 45% { transform: scale(1.05); filter: brightness(1.4) saturate(.4) sepia(.3) blur(2px); opacity: 1; } 100% { transform: scale(1); filter: none; opacity: 1; } }
.door.opened .bk > * { animation: riseSoft .8s var(--settle) .2s both; }
@keyframes riseSoft { from { opacity: 0; transform: translateY(10px); } }
.door .tip { animation: pop2 .4s var(--spring); }
@keyframes pop2 { from { opacity: 0; transform: translate(-50%, 6px) scale(.9); } }

/* niente raggi, anelli luminosi o onde d'urto dorate: un semplice anello che si allarga */
.light-burst { width: calc(260px * var(--s, 1)); background: none; mix-blend-mode: normal; border: 3px solid rgba(255, 255, 255, .95); box-shadow: none; -webkit-mask: none; mask: none; animation: ringOut .95s cubic-bezier(.15, .7, .2, 1) forwards; }
.light-burst::after { display: none; }
@keyframes ringOut { 0% { opacity: .9; transform: translate(-50%, -50%) scale(.1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); border-width: 1px; } }
.shockwave { border-color: rgba(255, 255, 255, .9); box-shadow: none; animation-duration: 1.4s; }

/* ==========================================================================
   Foglio della casella (modal): carta pulita, testo a mano
   ========================================================================== */
.door-modal-backdrop { background: rgba(36, 59, 69, .72); backdrop-filter: blur(5px); animation: fade .35s ease both; }
.door-modal { animation: modalIn .75s var(--settle) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(40px) scale(.95) rotate(-.8deg); } }
.door-modal::before { display: none; }
.door-modal .close-x { background: #fff; color: var(--teal); box-shadow: 0 4px 0 rgba(36, 59, 69, .25); transition: transform .3s var(--spring); }
.door-modal .close-x:hover { transform: rotate(90deg) scale(1.06); }
.paper {
  background: #fff; border-radius: var(--radius-lg); color: var(--teal);
  box-shadow: 0 10px 0 rgba(36, 59, 69, .2), 0 40px 70px -30px rgba(20, 40, 50, .6);
}
.paper::before { inset: 12px; border: 3px dotted var(--sky); border-radius: 24px; }
.paper .door-label { color: var(--ink-mute); font-family: var(--font-body); font-weight: 600; letter-spacing: .3em; }
.paper .door-label::before, .paper .door-label::after { height: 3px; border-radius: 3px; background: var(--red); width: 22px; }
.paper h2 { color: var(--red-600); font-weight: 800; text-transform: uppercase; font-size: clamp(1.5rem, 3.6vw, 2.1rem); }
.paper .letter-text { font-family: var(--font-script); font-weight: 500; font-size: clamp(1.45rem, 3vw, 1.75rem); line-height: 1.5; color: var(--teal); }
.paper .letter-text .ln { min-height: 1.5em; animation: lineIn 1s var(--settle) both; }
/* La riga "si scrive" da sinistra (clip-path). Alla fine il ritaglio è più largo della riga, così non taglia mai nulla (capolettera, ricci del corsivo). */
@keyframes lineIn { from { opacity: 0; transform: translateY(8px); clip-path: inset(0 100% 0 0); } to { clip-path: inset(-45% -12% -45% -12%); } }
.paper .sign { color: var(--red-600); font-weight: 700; }
/* Capolettera: una lettera grande SULLA riga (non "fluttuante"). Prima era un float più alto della riga e l'animazione "lineIn" (clip-path) lo ritagliava in basso. */
.letter-text .ln:first-child::first-letter { float: none; font-family: var(--font-display); font-style: normal; font-weight: 800; font-size: 2.2em; line-height: .8; vertical-align: baseline; color: var(--red); margin: 0 .08em 0 0; }
.door-modal .paper > * { animation: riseSoft .85s var(--settle) both; }
.door-modal .paper > *:nth-child(1) { animation-delay: .2s; } .door-modal .paper > *:nth-child(2) { animation-delay: .3s; }
.door-modal .paper > *:nth-child(3) { animation-delay: .4s; } .door-modal .paper > *:nth-child(4) { animation-delay: .5s; }
.door-modal .paper > *:nth-child(5) { animation-delay: .6s; } .door-modal .paper > *:nth-child(6) { animation-delay: .7s; }
.door-modal .paper > *:nth-child(n+7) { animation-delay: .8s; }
.door-modal.is24 .paper { animation: none; background: #fff; box-shadow: 0 0 0 6px #fff, 0 0 0 10px var(--red), 0 40px 70px -30px rgba(20, 40, 50, .6); }
.door-modal.is24 h2 { background: none; color: var(--red); -webkit-text-fill-color: currentColor; animation: riseSoft .85s var(--settle) .3s both; }

.polaroid { box-shadow: 0 12px 0 -6px rgba(36, 59, 69, .16), 0 22px 30px -16px rgba(20, 40, 50, .45); animation: polaroidDrop .95s var(--spring) both; }
@keyframes polaroidDrop { from { opacity: 0; transform: translateY(-30px) rotate(-8deg) scale(1.05); } }
.polaroid::before { background: rgba(232, 53, 47, .55); }
.polaroid .ph img { animation: photoDevelop 3.2s ease-out both, drift 22s ease-in-out 3.2s infinite alternate; }
@keyframes drift { to { transform: scale(1.05) translate(-1%, -1%); } }
.caption { font-weight: 600; color: var(--teal); }
.voice-player { background: var(--teal); color: #fff; border-radius: 22px; }
.voice-player .play { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-deep); transition: transform .25s var(--spring), box-shadow .2s; }
.voice-player .play:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-deep); }
.voice-player .wave i { background: rgba(255, 255, 255, .28); }
.voice-player .wave i.on { background: var(--cyan); }
.voucher { background: var(--red); color: #fff; border-radius: 22px; box-shadow: 0 8px 0 var(--red-deep); animation: ticketIn 1s var(--spring) .4s both; }
.voucher::after { display: none; }
.voucher .v-main { border-right-color: rgba(255, 255, 255, .6); }
.voucher .v-main::before, .voucher .v-main::after { background: #fff; }
.voucher small { color: var(--cyan); }
.voucher .v-what { font-weight: 800; }
.voucher .v-stub { color: #fff; }
.reactions { border-top: 3px dotted var(--sky); }
.reactions button { background: var(--cream-100); transition: transform .3s var(--spring); }
.reactions button[aria-pressed='true'] { background: #fff; box-shadow: 0 0 0 3px var(--red); }
.door-nav button { background: #fff; color: var(--teal); box-shadow: 0 4px 0 rgba(36, 59, 69, .22); transition: transform .25s var(--spring); }
.door-nav button:hover:not(:disabled) { transform: translateY(-2px); }
.song { background: var(--teal); border-radius: 22px; box-shadow: 0 8px 0 rgba(36, 59, 69, .2); }
.song-info small { color: var(--cyan); }
.song-info b { font-weight: 700; }
.vinyl-label { background: radial-gradient(circle, #fff, var(--red) 60%); }
.preview-note { background: var(--cyan); color: var(--teal); }

/* i contenuti dentro le caselle aperte */
.bk-letter { background: linear-gradient(160deg, #fff, #eef9fb); color: var(--teal); }
.bk-letter .seal { background: var(--red); color: #fff; box-shadow: 0 3px 0 var(--red-deep); }
.bk-ticket { background: var(--red); color: #fff; }
.bk-ticket::before { border-color: rgba(255, 255, 255, .6); }
.bk-ticket .bk-txt small { color: var(--cyan); }
.bk-voice { background: var(--teal); color: #fff; }
.bk-voice .bars i { background: var(--cyan); }
.bk-voice .mic { stroke: var(--cyan); filter: none; }
.bk-voice .bk-txt small { color: var(--cyan); }
.bk-video { background: var(--teal); }
.bk-video .play { background: var(--red); color: #fff; }
.bk-song { background: var(--teal); }
.bk-song .bk-txt small { color: var(--cyan); }
.bk-num { font-family: var(--font-display); font-style: normal; font-weight: 800; background: rgba(36, 59, 69, .55); }
.door .back { background: var(--door-back); }
.door .back::after { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }

/* ==========================================================================
   Pagina del destinatario
   ========================================================================== */
.recipient-page { color: #fff; font-family: var(--font-body); }
.recipient-page.bg-neve { background: linear-gradient(180deg, #a7d8de, #b0dce1 50%, #d6eef1); color: var(--teal); }
.recipient-page.bg-notte { background: radial-gradient(1200px 800px at 50% 0%, #476a79, #243b45); }
.recipient-page.bg-velluto { background: radial-gradient(1200px 800px at 50% 0%, #f0463f, #b72621); }
.recipient-page.bg-bosco { background: radial-gradient(1200px 800px at 50% 0%, #84a176, #52663f); }
.recipient-page.bg-kraft { background: radial-gradient(1200px 800px at 50% 0%, #d9b78d, #a9855a); }
.recipient-top { color: inherit; }
.recipient-top .eyebrow { color: inherit; }
.recipient-top .eyebrow::before, .recipient-top .eyebrow::after { background: currentColor; opacity: .6; }
.recipient-top .dedication { font-family: var(--font-script); font-style: normal; font-weight: 600; font-size: 1.7rem; line-height: 1.25; opacity: 1; }
.countdown div { background: #fff; color: var(--teal); box-shadow: 0 5px 0 rgba(36, 59, 69, .2); border-radius: 18px; }
.countdown b { font-family: var(--font-display); font-weight: 800; color: var(--red); }
.countdown span { opacity: 1; color: var(--ink-mute); }
.recipient-foot { color: inherit; opacity: .85; }
.recipient-foot a { color: inherit; font-weight: 700; }
.install-tip { background: #fff; color: var(--teal); border-radius: 18px; box-shadow: 0 5px 0 rgba(36, 59, 69, .2); }
.cal-header .for { color: var(--accent); text-shadow: none; font-weight: 700; }
.cal-header .sub { font-family: var(--font-body); font-weight: 600; letter-spacing: .3em; }

/* ---------- Apertura: busta, scatola, portone ---------- */
.intro { background: linear-gradient(180deg, #a7d8de 0%, #b0dce1 55%, #d6eef1 100%); }
.intro-stage { color: var(--teal); }
.intro-hint { font-family: var(--font-body); font-weight: 600; letter-spacing: .3em; opacity: .85; animation: hintBreathe 2.6s ease-in-out infinite; }
@keyframes hintBreathe { 50% { opacity: .4; transform: translateY(3px); } }
.envelope .env-back { background: #c92a25; box-shadow: 0 10px 0 rgba(36, 59, 69, .2), 0 40px 60px -26px rgba(20, 40, 50, .55); }
.envelope .letter { background: #fff; color: var(--teal); box-shadow: 0 3px 0 rgba(36, 59, 69, .1); transition: transform 1.25s var(--settle) .55s; }
.envelope .letter .for { color: var(--red); font-weight: 700; }
.envelope .env-front::before { background: linear-gradient(170deg, #e8352f, #d12d27); }
.envelope .env-front::after { background: linear-gradient(to top right, transparent calc(50% - 1px), rgba(0, 0, 0, .14) 50%, transparent calc(50% + 1px)) left bottom / 50% 100% no-repeat, linear-gradient(to top left, transparent calc(50% - 1px), rgba(0, 0, 0, .14) 50%, transparent calc(50% + 1px)) right bottom / 50% 100% no-repeat; }
.envelope .env-name { color: #fff; text-shadow: none; font-weight: 700; }
.envelope .flap { background: linear-gradient(180deg, #f0463f, #e8352f); transition: transform 1s var(--smooth), z-index 0s .5s; filter: none; }
.envelope .seal { background: #fff; color: var(--red); box-shadow: 0 5px 0 rgba(0, 0, 0, .2); font-weight: 700; transition: opacity .4s, transform .7s var(--spring); }
.envelope.open .letter { box-shadow: 0 3px 0 rgba(36, 59, 69, .1); }
.giftbox .box { background: #e8352f; box-shadow: 0 10px 0 rgba(36, 59, 69, .2); }
.giftbox .lid { background: #f0463f; box-shadow: none; transition: transform 1.05s var(--spring); }
.giftbox .rib-v { background: #fff; transition: transform 1s var(--settle); }
.giftbox .bow { transition: transform 1.05s var(--spring), opacity .7s; }
.giftbox .tag { background: #fff; color: var(--red); font-weight: 700; box-shadow: 0 4px 0 rgba(36, 59, 69, .2); }
.bigdoor .frame { background: #fff; box-shadow: 0 10px 0 rgba(36, 59, 69, .2); }
.bigdoor .inside { background: radial-gradient(circle at 50% 40%, #fff, var(--cyan-soft) 60%, var(--sky)); }
.bigdoor .panel { background: linear-gradient(160deg, #e8352f, #c92a25); transition: transform 1.5s var(--smooth); box-shadow: inset 0 0 0 8px rgba(255, 255, 255, .18); }
.bigdoor .panel::after { background: #fff; }
.bigdoor .name { color: #fff; text-shadow: none; font-weight: 700; }
.bigdoor.open .inside { animation: none; }
.pin-inputs input { background: #fff; color: var(--teal); box-shadow: 0 5px 0 rgba(36, 59, 69, .2); font-weight: 800; }
.pin-inputs input:focus { box-shadow: 0 0 0 3px var(--red); }
.pin-box { color: var(--teal); }
.pin-box h1, .pin-box h2 { color: inherit; }      /* il titolo prende il colore della schermata: bianco sul cielo di notte (prima restava grigio scuro e non si leggeva) */

/* pulsante musica */
.music-fab { background: #fff; color: var(--teal); backdrop-filter: none; box-shadow: 0 5px 0 rgba(36, 59, 69, .22); font-family: var(--font-display); font-weight: 700; }
.music-fab .eq i { background: var(--red); }
.music-fab.hinting:not(.on) { box-shadow: 0 5px 0 rgba(36, 59, 69, .22); animation: rise .8s var(--settle) 1s both, fabNudge 3s ease-in-out 3s infinite; }
@keyframes fabNudge { 0%, 85%, 100% { transform: none; } 90% { transform: translateY(-5px); } 95% { transform: translateY(0); } }
.music-opt { background: var(--cream-100); color: var(--teal); }
.music-opt[aria-pressed='true'] { background: #fff; box-shadow: inset 0 0 0 3px var(--red); color: var(--red-600); }

/* movimento ridotto: tutto resta fermo ma leggibile */
@media (prefers-reduced-motion: reduce) {
  html:not(.force-motion) .reveal { opacity: 1; transform: none; }
  html:not(.force-motion) .words-ready .wi { transform: none; }
  html:not(.force-motion) .script-write { clip-path: none; }
}

.intro-hint.gone { animation: none; opacity: 0; transition: opacity .35s ease; }

/* selettore lingua IT | EN */
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(51, 78, 90, .1); }
.lang-switch button { border: 0; background: transparent; color: var(--teal); font: 700 .68rem/1 var(--font-display); letter-spacing: .08em; padding: 7px 10px; border-radius: 999px; cursor: pointer; transition: background .25s, color .25s, transform .25s var(--spring); }
.lang-switch button[aria-pressed='true'] { background: #fff; color: var(--red); box-shadow: 0 2px 0 rgba(36, 59, 69, .2); }
.lang-switch button:hover:not([aria-pressed='true']) { transform: translateY(-1px); }
@media (max-width: 920px) { .lang-switch { align-self: center; } .lang-switch button { font-size: .9rem; padding: 10px 16px; } }

/* ---------- Caselle personalizzate: simbolo e carattere del numero ---------- */
.door .deco { position: absolute; top: 8px; left: 9px; width: clamp(13px, 1.9vw, 19px); height: auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .92; pointer-events: none; z-index: 2; }
.door.d24 .deco { width: 24px; top: 12px; left: 13px; }
.door.fs-plain .num { font-family: var(--font-display) !important; font-style: normal !important; font-weight: 800 !important; }
.door.fs-script .num { font-family: var(--font-script) !important; font-style: normal !important; font-weight: 700 !important; font-size: clamp(2rem, 4.2vw, 3.1rem) !important; }
.door.fs-light .num { font-family: var(--font-body) !important; font-style: normal !important; font-weight: 200 !important; }
.door.has-style .leaf { background-image: none; }

/* Simbolo della casella: sta sopra il numero, grande e ben leggibile (prima era un puntino nell'angolo e il numero lo copriva) */
.door.has-deco .leaf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(1px, .5vw, 5px); }
.door.has-deco .deco { position: static; flex: none; width: clamp(19px, 2.6vw, 28px); height: clamp(19px, 2.6vw, 28px); top: auto; left: auto; opacity: 1; stroke-width: 1.7; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .14)); }
.door.has-deco .num { font-size: clamp(1.2rem, 2.7vw, 2rem); }
.door.has-deco.h2 .num, .door.has-deco.w2 .num { font-size: clamp(1.35rem, 3vw, 2.3rem); }
.door.has-deco.fs-script .num { font-size: clamp(1.5rem, 3.2vw, 2.4rem) !important; }
.door.d24.has-deco .deco { width: clamp(26px, 3.6vw, 40px); height: clamp(26px, 3.6vw, 40px); top: auto; left: auto; }
.door.d24.has-deco .num { font-size: clamp(1.8rem, 4vw, 3rem); }

/* La canzone nella finestra della casella: il player di Spotify a tutta larghezza e la frase sotto */
.song-live { margin: 18px 0 6px; }
.song-live .song-embed { min-height: 152px; border-radius: 14px; overflow: hidden; background: #181818; box-shadow: 0 12px 22px -14px rgba(10, 30, 40, .7); }
.song-live .song-embed iframe { display: block; width: 100%; border: 0; border-radius: 14px; }
.song-live .song-quote { margin: 12px 8px 0; text-align: center; font-size: 1.3rem; line-height: 1.3; }



/* ==========================================================================
   Caselle grandi (larghe, alte, la 24): un'anta VERA, con cardine a sinistra.
   - prospettiva ampia (niente deformazioni esagerate) e punto di vista vicino al cardine;
   - spessore reale: si vede il bordo dell'anta mentre gira e, oltre i 90°, il suo retro;
   - la luce cambia con l'angolo: l'anta si scurisce mentre si volta e proietta un'ombra sull'interno;
   - apertura con un piccolo "rimbalzo" di inerzia, chiusura decisa e senza rimbalzo.
   Le caselle piccole restano com'erano.
   ========================================================================== */
.door:is(.w2, .h2, .d24):not(.style-doppia) { perspective: 1700px; perspective-origin: 18% 50%; }
.door:is(.w2, .h2, .d24):not(.style-doppia) .leaf {
  overflow: visible; transform-origin: 0 50%; transform-style: preserve-3d; backface-visibility: hidden; will-change: transform;
  transition: transform 1.25s cubic-bezier(.28, 1.22, .42, 1), box-shadow .8s ease, filter .3s;
}
.door:is(.w2, .h2, .d24):not(.style-doppia):not(.opened) .leaf { transition: transform .95s cubic-bezier(.55, 0, .25, 1), box-shadow .6s ease, filter .3s; }
.door:is(.w2, .h2, .d24):not(.style-doppia):hover:not(.opened) .leaf { transform: rotateY(-9deg); }
.door:is(.w2, .h2, .d24):not(.style-doppia).opened .leaf,
.door:is(.w2, .h2, .d24):not(.style-doppia).opened:hover .leaf { transform: rotateY(-112deg); box-shadow: none; }
/* ombreggiatura sulla faccia: più scura quanto più l'anta si volta */
.door:is(.w2, .h2, .d24):not(.style-doppia) .leaf .shade { position: absolute; inset: 0; z-index: 6; border-radius: inherit; pointer-events: none; opacity: 0; background: linear-gradient(90deg, rgba(8, 16, 24, .08), rgba(8, 16, 24, .62)); transition: opacity 1s ease; }
.door:is(.w2, .h2, .d24):not(.style-doppia):hover:not(.opened) .leaf .shade { opacity: .18; }
.door:is(.w2, .h2, .d24):not(.style-doppia).opened .leaf .shade { opacity: 1; }
/* spessore: il bordo destro dell'anta, 10px dietro la faccia */
.door:is(.w2, .h2, .d24):not(.style-doppia) .leaf .edge { position: absolute; top: 3px; bottom: 3px; right: 0; width: 10px; transform-origin: 100% 50%; transform: rotateY(-90deg); background: inherit; border-radius: 0 3px 3px 0; box-shadow: inset 0 0 0 100px rgba(0, 0, 0, .4); pointer-events: none; }
/* retro dell'anta, visibile quando è aperta oltre i 90° */
.door:is(.w2, .h2, .d24):not(.style-doppia) .leaf .rear { position: absolute; inset: 0; border-radius: inherit; transform: translateZ(-10px) rotateY(180deg); backface-visibility: hidden; background: inherit; box-shadow: inset 0 0 0 300px rgba(0, 0, 0, .3), inset 0 0 0 1px var(--door-edge); pointer-events: none; }
.door:is(.w2, .h2, .d24):not(.style-doppia) .leaf .rear::after { content: ''; position: absolute; inset: 7px; border-radius: 9px; border: 1px dashed rgba(255, 255, 255, .28); }
/* ombra proiettata dall'anta sull'interno (il contenuto della casella) */
.door:is(.w2, .h2, .d24):not(.style-doppia) .back::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none; opacity: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .12) 42%, rgba(0, 0, 0, 0) 70%); transition: opacity 1.1s ease; }
.door:is(.w2, .h2, .d24):not(.style-doppia).opened .back::after { opacity: 1; }
.door:is(.w2, .h2, .d24):not(.style-doppia).opened .back { box-shadow: inset 6px 0 20px rgba(0, 0, 0, .55), inset 0 4px 18px rgba(0, 0, 0, .45); }


/* ---- Caselle grandi: a porta aperta l'anta NON resta visibile ----
   gira come una porta vera e, arrivata in fondo, si dissolve: rimane solo il contenuto della casella.
   Chiudendo, ricompare subito e si richiude. ---- */
.door:is(.w2, .h2, .d24):not(.style-doppia).opened .leaf,
.door:is(.w2, .h2, .d24):not(.style-doppia).opened:hover .leaf {
  transform: rotateY(-104deg); opacity: 0; pointer-events: none;
  transition: transform 1.15s cubic-bezier(.28, 1.15, .42, 1), opacity .45s ease .62s, box-shadow .8s ease;
}
.door:is(.w2, .h2, .d24):not(.style-doppia):not(.opened) .leaf { opacity: 1; transition: transform .95s cubic-bezier(.55, 0, .25, 1), opacity .12s ease, box-shadow .6s ease, filter .3s; }
/* l'ombra proiettata dall'anta compare mentre gira e poi si spegne insieme a lei */
.door:is(.w2, .h2, .d24):not(.style-doppia) .back::after { transition: none; }
.door:is(.w2, .h2, .d24):not(.style-doppia).opened .back::after { opacity: 0; animation: leafShadow 1.5s ease both; }
@keyframes leafShadow { 0% { opacity: 0; } 38% { opacity: 1; } 100% { opacity: 0; } }
.door:is(.w2, .h2, .d24):not(.style-doppia).opened .back { box-shadow: inset 0 4px 18px rgba(0, 0, 0, .5); }

/* L'interno della casella (foto, scritta…) sta SOTTO l'anta: da chiusa o socchiusa non si vede la scritta sopra la porta, ma solo dove la porta lascia spazio */
.door .back { z-index: 1; }
.door .leaf { z-index: 2; }
.door .reaction-badge, .door .today-tag { z-index: 4; }


/* ==========================================================================
   Reazioni ("Rispondi con un'emozione"): niente cerchio rosso.
   Passando sopra l'emoji ondeggia; scelta, rimbalza, si accende su un fondo caldo e una pioggia di piccole copie sale verso l'alto.
   ========================================================================== */
.reactions { gap: 10px; }
.reactions button { position: relative; width: 50px; height: 50px; font-size: 1.5rem; line-height: 1; background: #eef9fb; box-shadow: 0 3px 0 rgba(36, 59, 69, .08); cursor: pointer; transition: transform .35s var(--spring), background .35s ease, box-shadow .35s ease; }
.reactions button .rx { display: inline-block; transition: transform .45s var(--spring); }
.reactions button:hover:not([aria-pressed='true']) { transform: translateY(-3px); background: #fff; box-shadow: 0 10px 14px -8px rgba(36, 59, 69, .45); }
.reactions button:hover:not([aria-pressed='true']) .rx { transform: scale(1.22) rotate(-9deg); }
.reactions button:active .rx { transform: scale(.85); }
.reactions button[aria-pressed='true'] {
  background: radial-gradient(circle at 50% 38%, #fff 0 38%, #ffeef1 78%, #ffe0e6);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .95), 0 0 0 5px rgba(255, 143, 163, .35), 0 12px 22px -8px rgba(232, 53, 47, .5);
  transform: translateY(-4px) scale(1.12);
  animation: rxPick .7s var(--spring);
}
.reactions button[aria-pressed='true'] .rx { transform: scale(1.3); animation: rxBob 2.6s ease-in-out .7s infinite; }
/* un alone morbido (non un anello) che si espande e svanisce */
.reactions button[aria-pressed='true']::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 143, 163, .55), rgba(255, 143, 163, 0) 68%); pointer-events: none; animation: rxHalo 1s ease-out both; }
@keyframes rxPick { 0% { transform: scale(.8); } 35% { transform: translateY(-10px) scale(1.28); } 60% { transform: translateY(1px) scale(1.04); } 100% { transform: translateY(-4px) scale(1.12); } }
@keyframes rxBob { 0%, 100% { transform: scale(1.3) translateY(0) rotate(0); } 50% { transform: scale(1.3) translateY(-2.5px) rotate(4deg); } }
@keyframes rxHalo { from { transform: scale(.7); opacity: 1; } to { transform: scale(2); opacity: 0; } }

/* ---------- Foto: nastro adesivo sopra la foto, ingrandimento, video che non si apre ---------- */
.polaroid::before { z-index: 3; pointer-events: none; }            /* il nastro sta SOPRA la foto (prima finiva dietro per via delle animazioni) */
.polaroid.zoomable { cursor: zoom-in; }
.polaroid.zoomable:focus-visible { outline: 3px solid var(--red); outline-offset: 4px; }
.lightbox { position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; background: rgba(6, 14, 24, .94); animation: lbIn .25s ease both; touch-action: pan-y; }
@keyframes lbIn { from { opacity: 0; } }
.lightbox img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); background: #111; }
.lightbox button { position: absolute; border: 0; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .14); backdrop-filter: blur(6px); border-radius: 999px; font-family: var(--font-display); line-height: 1; transition: background .2s; }
.lightbox button:hover, .lightbox button:focus-visible { background: rgba(255, 255, 255, .3); outline: none; }
.lightbox .lb-close { top: max(14px, env(safe-area-inset-top)); right: 14px; width: 46px; height: 46px; font-size: 1.8rem; }
.lightbox .lb-prev, .lightbox .lb-next { top: 50%; transform: translateY(-50%); width: 46px; height: 58px; font-size: 2.2rem; padding-bottom: 4px; }
.lightbox .lb-prev { left: 10px; } .lightbox .lb-next { right: 10px; }
.lightbox .lb-count { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, .8); font-size: .85rem; letter-spacing: .12em; }
.video-fail { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 26px 22px; border-radius: 18px; background: #eef9fb; color: var(--teal); }
.video-fail .vf-ico { font-size: 2.2rem; }
.video-fail p { margin: 0 0 6px; font-size: .92rem; color: var(--ink-soft, #4a6772); }

/* Doppia porta della casella 24: il "2" e il "4" stanno ai due lati della fessura, così si legge "24" tutto insieme e ben grande */
.door.d24.style-doppia .leaf { display: flex; align-items: center; justify-content: flex-end; padding: 0 1px 0 0; }
.door.d24.style-doppia .leaf.right { justify-content: flex-start; padding: 0 0 0 1px; }
.door.d24.style-doppia .num { font-size: clamp(2.6rem, 6vw, 4.6rem); font-style: normal; font-family: var(--font-display); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
