/* ==========================================================================
   Schermata "Condividi": scena notturna con il link, i canali e il messaggio pronto
   ========================================================================== */
body.invio-open { overflow: hidden; }
.invio-screen { position: fixed; inset: 0; z-index: 96; overflow-y: auto; color: #fff; isolation: isolate; font-family: var(--font-body); animation: shIn .5s ease both; }
.invio-screen.out { animation: shOut .38s ease both; }
@keyframes shIn { from { opacity: 0; } }
@keyframes shOut { to { opacity: 0; } }
.invio-screen > :not(.scene-bg) { position: relative; z-index: 3; }
.sh-x { position: fixed !important; top: max(16px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); z-index: 10 !important;   /* sopra il contenuto (che ha z-index 3 per la regola .invio-screen > *): prima il tasto restava coperto e non si poteva toccare */ width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; backdrop-filter: blur(6px); transition: transform .3s var(--spring), background .2s; }
.sh-x:hover { background: rgba(255, 255, 255, .24); transform: rotate(90deg) scale(1.06); }
.invio-wrap { max-width: 1080px; margin: 0 auto; padding: clamp(56px, 9vh, 96px) 24px 150px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
@media (max-width: 900px) { .invio-wrap { grid-template-columns: minmax(0, 1fr); padding-bottom: 170px; } .invio-hero, .invio-side { min-width: 0; } }
.invio-hero > *, .invio-side > * { animation: shRise .8s var(--settle) both; }
.invio-hero > :nth-child(1) { animation-delay: .15s; } .invio-hero > :nth-child(2) { animation-delay: .25s; } .invio-hero > :nth-child(3) { animation-delay: .35s; }
.invio-hero > :nth-child(4) { animation-delay: .45s; } .invio-hero > :nth-child(5) { animation-delay: .55s; } .invio-hero > :nth-child(6) { animation-delay: .65s; }
.invio-side > :nth-child(1) { animation-delay: .3s; } .invio-side > :nth-child(2) { animation-delay: .45s; } .invio-side > :nth-child(3) { animation-delay: .55s; } .invio-side > :nth-child(4) { animation-delay: .65s; }
@keyframes shRise { from { opacity: 0; transform: translateY(22px); } }
.sh-kicker { display: inline-flex; align-items: center; gap: 10px; font: 600 .72rem/1 var(--font-body); letter-spacing: .3em; text-transform: uppercase; color: #aaf3ff; }
.sh-kicker::before { content: ''; width: 24px; height: 2px; background: #aaf3ff; border-radius: 2px; }
.invio-hero h1 { margin: .5em 0 .3em; font: 800 clamp(2rem, 4.6vw, 3.4rem)/1.05 var(--font-display); text-transform: none; color: #fff; text-shadow: 0 4px 24px rgba(5, 20, 32, .5); }
.invio-hero h1 em { display: inline-block; font-size: 1.25em; color: #ffd36b; transform: rotate(-2deg); line-height: .8; padding: 0 .05em; }
.sh-sub { margin: 0 0 24px; max-width: 52ch; color: rgba(255, 255, 255, .86); font-size: 1.05rem; }

.link-box { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 18px; background: rgba(255, 255, 255, .96); color: #1f3540; box-shadow: 0 10px 0 rgba(5, 20, 32, .25), 0 30px 50px -24px rgba(5, 20, 32, .8); max-width: 640px; }
.lk-ico { color: #e8352f; display: grid; flex: none; }
.link-box input { flex: 1; min-width: 0; border: 0; background: none; font: 600 .95rem/1.2 var(--font-body); color: #1f3540; padding: 12px 0; outline: 0; text-overflow: ellipsis; }
.lk-copy { position: relative; flex: none; height: 46px; min-width: 132px; border: 0; border-radius: 12px; background: #e8352f; color: #fff; font: 700 .9rem var(--font-body); cursor: pointer; box-shadow: 0 4px 0 #b02621; transition: transform .2s var(--spring), box-shadow .2s, background .3s; overflow: hidden; }
.lk-copy:hover { transform: translateY(-1px); }
.lk-copy:active { transform: translateY(3px); box-shadow: 0 1px 0 #b02621; }
.lk-copy .t1, .lk-copy .t2 { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .45s var(--spring), opacity .3s; }
.lk-copy .t2 { transform: translateY(100%); opacity: 0; }
.lk-copy.done { background: #2f9a58; box-shadow: 0 4px 0 #1f6e3d; }
.lk-copy.done .t1 { transform: translateY(-100%); opacity: 0; }
.lk-copy.done .t2 { transform: none; opacity: 1; }
.lk-copy.done .t2::before { content: '✓'; margin-right: 8px; }

.channels { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 26px; }
.ch { display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .38); background: rgba(255, 255, 255, .12); color: #fff; font: 600 .88rem var(--font-body); text-decoration: none; cursor: pointer; backdrop-filter: blur(6px); transition: transform .3s var(--spring), background .2s, box-shadow .2s; }
.ch:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .22); box-shadow: 0 12px 20px -12px rgba(0, 0, 0, .6); }
.ch.c-wa { background: #25d366; border-color: #25d366; color: #05381b; }
.ch.c-wa:hover { background: #3be07b; }
.ch.c-tg { background: #229ed9; border-color: #229ed9; }
.ch.c-tg:hover { background: #3bb2ec; }

.msg-box { max-width: 640px; padding: 16px 18px 14px; border-radius: 20px; background: rgba(10, 30, 45, .45); border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(8px); }
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.msg-head b { font: 700 .92rem var(--font-body); }
.msg-tabs { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: rgba(255, 255, 255, .12); }
.msg-tabs button { min-height: 36px; border: 0; background: none; color: #fff; padding: 6px 12px; border-radius: 7px; font: 600 .78rem var(--font-body); cursor: pointer; transition: background .2s, color .2s; }
.msg-tabs button[aria-pressed='true'] { background: #fff; color: #1f3540; }
.msg-box textarea { width: 100%; resize: vertical; min-height: 96px; border: 0; border-radius: 12px; padding: 12px 14px; background: rgba(255, 255, 255, .95); color: #1f3540; font: 500 .94rem/1.5 var(--font-body); }
.msg-box textarea:focus { outline: 3px solid rgba(170, 243, 255, .6); }
.msg-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: .8rem; color: rgba(255, 255, 255, .75); }
.link-btn { padding: 10px 4px; background: none; border: 0; color: #aaf3ff; font: 700 .82rem var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px; }
.link-btn.done { color: #9fe3b4; }

/* colonna a destra */
.gift-card { padding: 20px 18px 16px; border-radius: 24px; background: var(--cal-bg, #334e5a); color: var(--cal-ink, #fff); box-shadow: 0 0 0 5px var(--frame, #1c2f38), 0 0 0 7px var(--frame-line, rgba(255, 255, 255, .35)), 0 24px 40px -18px rgba(0, 0, 0, .7); transform: rotate(1.6deg); position: relative; overflow: hidden; isolation: isolate; animation: shRise .8s var(--settle) .3s both, cardFloat 7s ease-in-out 1.2s infinite; }
.gift-card::before { content: ''; position: absolute; inset: 0; background: var(--cal-pattern, none); z-index: -1; }
@keyframes cardFloat { 50% { transform: rotate(.6deg) translateY(-8px); } }
.gc-for { font: 700 2rem/1 var(--font-script); text-align: center; color: var(--accent, #aaf3ff); }
.gc-sub { font: 600 .58rem/1 var(--font-body); letter-spacing: .26em; text-transform: uppercase; text-align: center; opacity: .8; margin: 8px 0 14px; }
.gc-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.gc-grid i { aspect-ratio: 1; border-radius: 7px; background: var(--door-bg, #4d7080); box-shadow: var(--door-shadow, 0 2px 0 rgba(0, 0, 0, .25)); animation: tileIn .6s var(--spring) both; animation-delay: calc(var(--i) * 28ms + .5s); }
.gc-grid i:nth-child(3n) { background: var(--accent, #e8352f); }
.gc-grid i:nth-child(7n+2) { background: var(--d24-bg, #e8352f); }
.gc-grid i.d24 { grid-column: span 2; aspect-ratio: auto; background: var(--d24-bg, #e8352f); }
@keyframes tileIn { from { opacity: 0; transform: scale(.4) rotate(-12deg); } }
.gc-when { margin-top: 14px; text-align: center; font-size: .8rem; opacity: .92; }
.timeline { list-style: none; margin: 26px 0 0; padding: 0 0 0 26px; display: grid; gap: 18px; position: relative; counter-reset: t; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .55) 0 5px, transparent 5px 10px); }
.timeline li { position: relative; display: grid; gap: 2px; }
.timeline li::before { counter-increment: t; content: counter(t); position: absolute; left: -26px; top: 0; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #1f3540; font: 800 .7rem/20px var(--font-body); text-align: center; box-shadow: 0 0 0 4px rgba(255, 255, 255, .18); }
.timeline b { font: 700 .95rem var(--font-body); }
.timeline span { font-size: .85rem; color: rgba(255, 255, 255, .8); }
.pin-note { margin-top: 22px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .1); border: 1px dashed rgba(255, 255, 255, .4); font-size: .84rem; line-height: 1.5; color: rgba(255, 255, 255, .92); }
.pin-note.on { background: rgba(159, 227, 180, .14); border-color: rgba(159, 227, 180, .7); }
.side-actions { display: grid; gap: 10px; margin-top: 18px; }
.s-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 46px; border-radius: 12px; background: #fff; color: #1f3540; font: 700 .88rem var(--font-body); text-decoration: none; box-shadow: 0 4px 0 rgba(5, 20, 32, .28); transition: transform .25s var(--spring), box-shadow .2s; }
.s-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(5, 20, 32, .28); }
.s-btn.quiet { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5); }
.s-btn.quiet:hover { background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1.5px #fff; }
@media (prefers-reduced-motion: reduce) {html:not(.force-motion) .gift-card { animation: none; } }

/* anteprima del calendario vero nella colonna a destra */
.gift-card.live { padding: 0; background: none; box-shadow: none; overflow: visible; pointer-events: none; }
.gift-card.live::before { display: none; }
.gift-fit { position: relative; width: 100%; }
.gift-card.live .calendar { box-shadow: 0 24px 40px -18px rgba(0, 0, 0, .7); }
.gc-when { margin: 16px 0 0; text-align: center; font-size: .85rem; color: #fff; opacity: .92; }

/* telefono: l'anteprima resta dritta e dentro lo schermo */
@media (max-width: 900px) { .invio-screen { overflow-x: hidden; } .gift-card.live { transform: none; animation: shRise .8s var(--settle) .3s both; } .link-box { flex-wrap: wrap; } .link-box input { flex-basis: 60%; } .lk-copy { flex: 1; } }

/* Dopo l'ingresso (o se le animazioni non sono partite) il contenuto è SEMPRE visibile */
.invio-screen.settled:not(.out) { animation: none; opacity: 1; }
.invio-screen.settled .invio-hero > *, .invio-screen.settled .invio-side > *:not(.gift-card) { animation: none; opacity: 1; transform: none; }
.invio-screen.settled .gift-card { animation: cardFloat 7s ease-in-out infinite; opacity: 1; }

/* Link dentro la pagina "Grazie" */
.grazie-link { margin: 0 auto 22px; max-width: 520px; padding: 16px 18px; border-radius: 20px; background: rgba(255, 255, 255, .92); color: var(--teal, #334e5a); text-align: center; box-shadow: 0 6px 0 rgba(36, 59, 69, .16); }
.grazie-link .gl-t { margin: 0 0 10px; font-size: .95rem; }
.gl-row { display: flex; gap: 10px; align-items: center; }
.gl-row input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 12px; border: 1.5px solid #bccbd2; background: #fff; font: 600 .85rem var(--font-body, sans-serif); color: var(--teal, #334e5a); }
.gl-ch { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
@media (max-width: 520px) { .gl-row { flex-direction: column; align-items: stretch; } }
.grazie-link .btn-ghost { color: var(--teal, #334e5a); box-shadow: inset 0 0 0 2px #bccbd2; background: #fff; }
.grazie-link .btn-ghost:hover { background: #eef9fb; color: var(--teal, #334e5a); }
#done .lead { color: var(--teal, #334e5a); }
