/* =============================================================================
   PARTY MATCHER — le pagine dei link condivisi, il segnaposto e la 404 (10 ott 2026)
   =============================================================================
   Si appoggia a site.css (token, vetro, pillole, chip, tinte): qui solo ciò che
   queste pagine hanno di loro.
     • /party/<id> /post/<id> /profile/<id> → le scrive la function sharePage
       (firebase/functions/sharepage.js), con la serata VERA;
     • soon.html → il segnaposto «il sito sta arrivando» (in produzione è `/`);
     • 404.html.
   ⛔ CSP del sito: niente `style=""` e niente script inline (vedi firebase.json).
   ========================================================================== */

body.sh {
  display: grid; grid-template-rows: auto 1fr auto; min-height: 100svh;
  background: #12062a;
}
.sh [hidden] { display: none !important; }

/* ── Lo sfondo: UN mesh animato (MeshGradientBackground.swift, palette `defaultColors`) ──
   La griglia 3×3 dell'app qui è fatta di aloni radiali con gli stessi nove colori, su due
   strati che derivano in versi opposti: la loro somma cambia forma di continuo, come i punti
   del mesh che si muovono. Si anima SOLO `transform` (compositor: nessun ridisegno per
   fotogramma) e, come l'app con Riduci movimento, con prefers-reduced-motion sta fermo. */
.sh-mesh {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: linear-gradient(165deg, #522E8C 0%, #2E0066 55%, #3F2D70 100%);   /* Deep Grape → Twilight → Shadow Violet */
}
.sh-mesh::before,
.sh-mesh::after {
  content: ""; position: absolute; inset: -18%;
  will-change: transform;
}
.sh-mesh::before {
  background:
    radial-gradient(34% 30% at 24% 20%, rgba(200, 101, 252, .95), rgba(200, 101, 252, 0)),   /* Vibrant Neon Purple */
    radial-gradient(36% 32% at 52% 56%, rgba(148, 0, 211, .85), rgba(148, 0, 211, 0)),       /* Dark Orchid */
    radial-gradient(42% 34% at 46% 100%, rgba(46, 0, 102, .95), rgba(46, 0, 102, 0));        /* Twilight Indigo */
  animation: sh-drift-a 26s ease-in-out infinite alternate;
}
.sh-mesh::after {
  background:
    radial-gradient(32% 28% at 82% 16%, rgba(247, 83, 196, .78), rgba(247, 83, 196, 0)),     /* Orchid */
    radial-gradient(34% 30% at 12% 70%, rgba(186, 85, 211, .70), rgba(186, 85, 211, 0)),     /* Medium Orchid */
    radial-gradient(34% 30% at 90% 72%, rgba(139, 0, 139, .78), rgba(139, 0, 139, 0));       /* Dark Magenta */
  animation: sh-drift-b 31s ease-in-out -7s infinite alternate;
}
@keyframes sh-drift-a {
  0%   { transform: translate3d(-5%, -4%, 0) scale(1); }
  50%  { transform: translate3d(4%, 2%, 0) scale(1.1); }
  100% { transform: translate3d(6%, 5%, 0) scale(1.04); }
}
@keyframes sh-drift-b {
  0%   { transform: translate3d(5%, 4%, 0) scale(1.08); }
  50%  { transform: translate3d(-3%, 5%, 0) scale(.98); }
  100% { transform: translate3d(-6%, -5%, 0) scale(1.06); }
}
/* il velo (nell'app: nero sui pop-up): fermo, sopra il mesh e sotto il contenuto */
body.sh::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(130% 90% at 50% 0%, rgba(8, 2, 20, .22), rgba(8, 2, 20, .58));
}

/* ── Testata e piede ─────────────────────────────────────────────────────── */
.sh-top {
  width: min(1120px, 100%); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px clamp(16px, 4vw, 32px) 0;
}
.sh-top .brand { font-size: 17px; }
.sh-shared { font-size: 12px; }
.sh-main { display: grid; place-items: center; padding: clamp(18px, 4vw, 40px) clamp(16px, 4vw, 32px); min-width: 0; }
.sh-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  font-size: 13px; color: var(--text-3); text-align: center;
}
.sh-foot a { color: var(--text-2); text-underline-offset: 3px; }

/* ── La serata ───────────────────────────────────────────────────────────── */
.sh-party { width: min(100%, 980px); display: grid; gap: 22px; min-width: 0; }
.sh-poster {
  position: relative; margin: 0; justify-self: center; width: min(100%, 420px);
  aspect-ratio: 4 / 5; max-height: 48svh;
  border-radius: 28px; overflow: hidden; background: rgba(255, 255, 255, .06);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .14), 0 0 70px rgba(145, 98, 255, .28);
}
/* con l'altezza limitata dallo schermo la larghezza segue il rapporto, non il 100% */
@supports (aspect-ratio: 1) { .sh-poster { width: auto; height: min(48svh, calc((100vw - 32px) * 1.25), 525px); } }
.sh-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sh-poster--none { display: grid; place-items: center; background: linear-gradient(135deg, #9162FF, #C865FC 52%, #F753C4); }
.sh-poster__art { font-size: 88px; color: #fff; filter: drop-shadow(0 0 18px rgba(255, 255, 255, .45)); }
.sh-poster__art .ic { stroke-width: 1.1; }
.sh-status {
  position: absolute; top: 14px; left: 14px;
  padding: 8px 12px; font-size: 12px; letter-spacing: 1.4px;
  background-color: rgba(10, 4, 24, .55);
  background-image: linear-gradient(rgba(var(--rgb), .28), rgba(var(--rgb), .28));
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.sh-status i {                          /* LIVE: il punto che pulsa, come LiveCardView */
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--c); box-shadow: 0 0 10px var(--c);
  animation: sh-pulse 1.6s ease-in-out infinite;
}
@keyframes sh-pulse { 50% { opacity: .35; transform: scale(.8); } }

.sh-info { display: grid; gap: 14px; align-content: center; justify-items: start; min-width: 0; }
.sh-kind { font-size: 12px; }
.sh-title {
  font-size: clamp(28px, 6.4vw, 46px); line-height: 1.06; font-weight: 800; letter-spacing: -.02em;
  text-wrap: balance; overflow-wrap: anywhere;
}
.sh-facts { list-style: none; margin: 0; padding: 6px; width: 100%; display: grid; gap: 2px; border-radius: 22px; }
.sh-facts li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; min-width: 0; }
.sh-facts li + li { border-top: 1px solid rgba(255, 255, 255, .06); }
.sh-facts .ico-disc { width: 38px; height: 38px; font-size: 19px; box-shadow: none; }
.sh-fact { display: grid; gap: 1px; min-width: 0; }
.sh-fact b { font: 600 16px/1.3 var(--font); overflow-wrap: anywhere; }
.sh-fact small { font-size: 14px; color: var(--text-2); }
.sh-ava {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none;
  box-shadow: 0 0 0 2px rgba(var(--rgb), .55), 0 0 12px rgba(var(--rgb), .35);
}
.sh-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-tags .chip { font-size: 12px; letter-spacing: .4px; text-transform: none; padding: 7px 12px; }
.sh-lead { color: var(--text-2); font-size: 15.5px; line-height: 1.5; text-wrap: pretty; }

/* Desktop: la locandina intera a sinistra (2:3 come la pubblica l'app), i dettagli a destra. */
@media (min-width: 860px) {
  .sh-party { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 48px; align-items: center; }
  .sh-poster { width: 100%; height: auto; aspect-ratio: 2 / 3; max-height: none; }
}

/* ── I tasti ─────────────────────────────────────────────────────────────── */
.sh-actions { display: grid; gap: 12px; width: 100%; justify-items: stretch; }
.sh-primary { display: flex; flex-wrap: wrap; gap: 10px; }
.sh-primary .pill { flex: 1 1 200px; }
.sh-primary:not(:has(.pill:not([hidden]))) { display: none; }
.sh-hint { font-size: 13.5px; line-height: 1.45; color: var(--text-2); text-align: center; text-wrap: pretty; }

/* App Store: finché l'app non è pubblica, una capsula ONESTA che non è un tasto (nessun link
   e niente badge ufficiale: il badge va solo su una scheda vera, regole Apple). */
.sh-store { display: grid; justify-items: center; gap: 6px; text-align: center; }
.sh-store__pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: var(--r-pill); font: 600 15px/1.2 var(--font); color: rgba(255, 255, 255, .88);
  background: rgba(255, 255, 255, .07); border: 1px dashed rgba(255, 255, 255, .28);
}
.sh-store__pill .ic { font-size: 18px; color: var(--ph); }
.sh-store small { font-size: 12.5px; color: var(--text-3); }
.sh-store--link img { height: 48px; width: auto; }
.sh-discover {
  justify-self: center; display: inline-flex; align-items: center; gap: 6px;
  font-size: 14.5px; color: var(--text-2); text-decoration: none; padding: 6px 4px;
}
.sh-discover .ic { font-size: 15px; }
@media (hover: hover) { .sh-discover:hover { color: #fff; } }

/* Sul telefono i tasti della serata stanno FERMI in fondo allo schermo (come la barra
   d'azione della web app): la locandina e i dettagli scorrono, «Apri» resta a portata. */
@media (max-width: 859px) {
  .sh--party .sh-primary {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(14, 4, 30, .94) 58%, rgba(14, 4, 30, 0));
    flex-wrap: nowrap;
  }
  .sh--party .sh-primary .pill { flex: 1 1 0; min-width: 0; padding-inline: 16px; font-size: 17px; }
  body.sh--party:has(.sh-primary .pill:not([hidden])) .sh-foot { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
}
@media (min-width: 860px) {
  .sh-party .sh-actions { justify-items: start; }
  .sh-party .sh-primary { width: 100%; max-width: 520px; }
  .sh-party .sh-store { justify-items: start; text-align: left; }
  .sh-party .sh-hint { text-align: left; }
}

/* ── Senza contenuto: un post, un profilo, una serata che non c'è più ───────── */
.sh-generic { display: grid; gap: 22px; justify-items: center; max-width: 440px; }
.sh-generic .sh-kind { justify-self: center; }
.sh-icon { display: grid; place-items: center; }
.sh-generic .actions, .sh-generic .sh-actions { width: 100%; }
.sh-generic .sh-actions .pill { width: 100%; }

/* ── Il segnaposto (soon.html) ───────────────────────────────────────────── */
.sh-soon { width: min(100%, 720px); display: grid; justify-items: center; gap: 22px; text-align: center; }
.sh-appicon {
  width: 112px; height: 112px; border-radius: 26px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .18), 0 0 60px rgba(200, 101, 252, .45);
}
.sh-soon h1 {
  font-size: clamp(42px, 10vw, 84px); line-height: .98; font-weight: 800; letter-spacing: -.035em;
  text-wrap: balance;
}
.sh-soon h1 span { display: block; }
.sh-soon .lead { margin: 0 auto; max-width: 44ch; font-size: clamp(16px, 2.4vw, 19px); }
.sh-genres { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.sh-genres .chip { font-size: 12.5px; letter-spacing: .3px; text-transform: none; padding: 8px 13px; }
.sh-status-line {
  display: inline-flex; align-items: center; gap: 9px;
  font: 500 14px/1.2 var(--font); color: var(--text-2);
}
.sh-status-line i {
  width: 8px; height: 8px; border-radius: 50%; background: #35E07D; box-shadow: 0 0 10px #35E07D;
  animation: sh-pulse 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .sh-mesh::before, .sh-mesh::after, .sh-status i, .sh-status-line i { animation: none; }
}
@media print { .sh-mesh, body.sh::after { display: none; } }
