/* ── Merch/Shop — "album di figurine" / vending machine arcade ──
   Card = sticker vero (leggera rotazione a caso, si raddrizza in hover,
   angolo che si "stacca"). Esaurito = timbro a inchiostro. Prodotti a
   link esterno = biglietto perforato, per dire visivamente "esce dal sito".
   Checkout = scontrino di riscatto, non una cassa. */

.btn-gold {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border: 1px solid var(--gold); background: none;
  color: var(--gold); font-family: var(--font-title); font-size: 0.85rem;
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn-gold:hover { background: var(--gold); color: var(--bg-main); box-shadow: 0 0 16px rgba(201,168,96,0.3); }
.btn-gold:disabled { opacity: 0.5; cursor: default; box-shadow: none; background: none; color: var(--gold); }

/* ── Sfondo pagina: leggera trama a puntini, come un album ── */
.shop-page {
  position: relative;
  padding-bottom: 40px;
  background-image: radial-gradient(circle, rgba(201, 168, 96, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
}

/* ── Ledger LC (readout stile arcade) ── */
.shop-ledger {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 8px 16px;
  border: 1px solid rgba(201, 168, 96, 0.35);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 12px rgba(201, 168, 96, 0.08);
}
.shop-ledger__label {
  font-family: var(--font-title); font-size: 0.62rem; letter-spacing: 0.22em;
  color: var(--gray-mid);
}
.shop-ledger__amount {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 1.15rem; font-weight: 700; color: var(--gold);
  text-shadow: 0 0 10px rgba(201, 168, 96, 0.5);
  letter-spacing: 0.03em;
}
.shop-ledger__amount small { font-size: 0.6rem; margin-left: 3px; opacity: 0.75; }

/* ── Tab: nastro washi leggermente storto ── */
.shop-tabs {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 36px 0 30px;
}
.shop-tab {
  background: rgba(201, 168, 96, 0.05);
  border: 1px dashed rgba(201, 168, 96, 0.3);
  color: var(--gray-mid);
  font-family: var(--font-title);
  font-size: 0.76rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
  transform: rotate(-1deg);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}
.shop-tab:nth-child(3n+2) { transform: rotate(0.8deg); }
.shop-tab:nth-child(3n+3) { transform: rotate(-0.5deg); }
.shop-tab.is-active {
  color: var(--bg-main); background: var(--gold); border: 1px solid var(--gold);
  border-style: solid;
  transform: rotate(0deg) scale(1.04);
  box-shadow: 0 3px 10px rgba(201, 168, 96, 0.3);
}
.shop-tab:hover:not(.is-active) { color: var(--gray-light); border-color: rgba(201, 168, 96, 0.6); }

/* ── Griglia prodotti ── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px 22px;
  padding-bottom: 48px;
}
@media (max-width: 980px) { .shop-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .shop-grid { grid-template-columns: 1fr; gap: 20px; } }

@keyframes shop-drop {
  from { opacity: 0; transform: translateY(-18px) rotate(var(--rot, 0deg)) scale(0.94); }
  to   { opacity: 1; transform: translateY(0)    rotate(var(--rot, 0deg)) scale(1); }
}

.shop-card {
  --rot: -1.2deg;
  position: relative;
  list-style: none;
  border: 1px solid rgba(201, 168, 96, 0.18);
  background: var(--bg-card);
  display: flex; flex-direction: column;
  overflow: visible;
  transform: rotate(var(--rot));
  animation: shop-drop 0.5s cubic-bezier(.2, .9, .3, 1.3) backwards;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: transform 0.35s cubic-bezier(.2, .8, .3, 1.2), box-shadow 0.35s;
}
.shop-card:nth-child(4n+2) { --rot: 1.1deg; }
.shop-card:nth-child(4n+3) { --rot: -0.6deg; }
.shop-card:nth-child(4n+4) { --rot: 1.6deg; }
.shop-card:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(201, 168, 96, 0.35);
  z-index: 2;
}
.shop-card--soldout { filter: grayscale(0.6); opacity: 0.7; }
.shop-card--soldout:hover { transform: rotate(var(--rot)); box-shadow: none; z-index: 1; }

/* angolo che si "stacca" come un vero sticker */
.shop-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 20px; height: 20px;
  background: linear-gradient(135deg, transparent 50%, var(--bg-main) 51%, var(--bg-main) 56%, transparent 57%);
  opacity: 0.9;
  pointer-events: none;
}

.shop-card__flag {
  position: absolute; top: 10px; left: -6px;
  background: var(--bg-main); color: var(--gold);
  font-family: var(--font-title); font-size: 0.6rem; letter-spacing: 0.14em;
  text-transform: uppercase; padding: 3px 10px 3px 12px;
  border: 1px solid rgba(201, 168, 96, 0.4); border-left: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 8px 50%);
  z-index: 3;
}

.shop-card__img {
  appearance: none; -webkit-appearance: none;
  display: block; width: 100%; aspect-ratio: 1 / 1;
  border: none; padding: 0; margin: 0; cursor: zoom-in;
  background: rgba(201, 168, 96, 0.04);
  position: relative; overflow: hidden;
}
.shop-card__img img,
.shop-card__img video { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-card__img-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; opacity: 0.3; }

/* sweep "foil" olografico in hover — solo su chi ha davvero un'immagine */
.shop-card__img:not(:has(.shop-card__img-fallback))::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.22) 45%, rgba(201,168,96,0.35) 50%, rgba(255,255,255,0.22) 55%, transparent 70%);
  background-size: 220% 220%;
  background-position: -40% -40%;
  transition: background-position 0.6s ease;
  pointer-events: none;
}
.shop-card:hover .shop-card__img::before { background-position: 140% 140%; }

.shop-card__count {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0, 0, 0, 0.65); color: var(--gold);
  font-family: 'JetBrains Mono', monospace; font-size: 0.65rem;
  padding: 2px 7px; border: 1px solid rgba(201, 168, 96, 0.4);
}

.shop-stamp {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
  border: 3px solid #8a1f1f; color: #ffdcdc;
  background: rgba(20, 4, 4, 0.72);
  font-family: var(--font-title); font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  padding: 5px 14px;
  box-shadow: 0 0 0 1px rgba(138, 31, 31, 0.4), 0 4px 14px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.shop-card__body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.shop-card__name {
  font-family: var(--font-title); font-size: 1.05rem; color: var(--white); margin: 0;
  letter-spacing: 0.01em;
}
.shop-card__desc { font-size: 0.8rem; color: var(--gray-light); opacity: 0.8; line-height: 1.5; margin: 0; }

.shop-card__foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shop-card__foot--ticket { border-top: 1px dashed rgba(255, 255, 255, 0.15); padding-top: 12px; }

.shop-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-title); font-size: 1.05rem; color: var(--gold);
}

.shop-card__stock { font-size: 0.7rem; color: var(--gold); margin: 2px 0 0; }
.shop-ticket-note { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-mid); }

.shop-card__cta {
  border: 1px solid var(--gold); background: none; color: var(--gold);
  font-family: var(--font-title); font-size: 0.74rem; letter-spacing: 0.06em;
  text-transform: uppercase; text-align: center; text-decoration: none;
  padding: 8px 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.shop-card__cta-ico { font-size: 0.95rem; line-height: 1; }
.shop-card__cta:hover:not(:disabled) { background: var(--gold); color: var(--bg-main); }
.shop-card__cta:active:not(:disabled) { transform: scale(0.95); }
.shop-card__cta--out { border-color: rgba(255, 255, 255, 0.15); color: var(--gray-mid); cursor: default; }
.shop-card__cta--locked { border-color: var(--gray-mid); color: var(--gray-light); }
.shop-card__cta--external { border-color: var(--gray-mid); color: var(--gray-light); }
.shop-card__cta--external:hover { background: var(--gray-mid); color: var(--bg-main); }

@keyframes shop-pop { 0% { transform: scale(1); } 40% { transform: scale(0.88); } 100% { transform: scale(1); } }
.shop-card__cta.is-added { animation: shop-pop 0.3s ease; }

/* biglietto perforato per i prodotti "fuori dal sito" */
.shop-card--ticket {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.18);
}
.shop-card--ticket::after { display: none; }

.shop-empty { text-align: center; padding: 64px 16px; color: var(--gray-light); position: relative; }
.shop-empty__stamp {
  display: inline-block; margin-bottom: 18px;
  border: 3px solid var(--gold); color: var(--gold);
  font-family: var(--font-title); font-size: 0.8rem; letter-spacing: 0.3em;
  padding: 6px 20px; transform: rotate(-3deg); opacity: 0.75;
}
.shop-empty .btn-gold { margin-top: 20px; display: inline-flex; }

.shop-disclaimer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 0 64px;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--gray-mid);
}
.shop-disclaimer a { color: var(--gold); }

/* ── Sticky cart bar: fessura gettoniera ── */
.shop-cartbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  background: var(--bg-card);
  border-top: 1px solid var(--gold);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.2, .8, .3, 1.2);
}
.shop-cartbar.is-on { transform: translateY(0); }
.shop-cartbar__in {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gray-light);
  font-size: 0.9rem;
}
.shop-cartbar__coin { font-size: 1.2rem; display: inline-block; }
@keyframes shop-coin-drop {
  0%   { transform: translateY(-10px) rotate(0deg); opacity: 0.4; }
  60%  { transform: translateY(2px) rotate(180deg); opacity: 1; }
  100% { transform: translateY(0) rotate(360deg); opacity: 1; }
}
.shop-cartbar__coin.is-bouncing { animation: shop-coin-drop 0.5s ease; }
#shop-cartbar-summary { flex: 1; }
.shop-cartbar__go {
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--bg-main);
  font-family: var(--font-title);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 9px 18px;
  cursor: pointer;
}

/* ── Modale — scontrino di riscatto ── */
.shop-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.shop-modal[hidden] { display: none; }
.shop-modal__box {
  position: relative;
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 96, 0.3);
  max-width: 400px;
  width: 100%;
  padding: 30px 24px 24px;
  max-height: 88vh;
  overflow-y: auto;
}
.shop-receipt::before {
  content: '';
  position: absolute; top: -1px; left: 0; right: 0; height: 8px;
  background-image: linear-gradient(-45deg, var(--bg-main) 6px, transparent 0), linear-gradient(45deg, var(--bg-main) 6px, transparent 0);
  background-position: left top;
  background-repeat: repeat-x;
  background-size: 12px 8px;
}
.shop-receipt__kicker {
  font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; letter-spacing: 0.16em;
  color: var(--gray-mid); text-align: center; margin: 4px 0 2px;
}
.shop-modal__box h2 { font-family: var(--font-title); color: var(--white); font-size: 1.15rem; margin: 0 0 16px; text-align: center; }
.shop-modal__x {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--gray-mid);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.shop-modal__x:hover { color: var(--gold); }

.shop-modal__items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; font-family: 'JetBrains Mono', monospace; }
.shop-modal__item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.82rem; color: var(--gray-light);
}
.shop-modal__item-name { flex: 1; }
.shop-modal__item-qty { display: flex; align-items: center; gap: 6px; }
.shop-modal__item-qty button {
  width: 22px; height: 22px; border: 1px solid var(--gray-mid); background: none;
  color: var(--gray-light); cursor: pointer; line-height: 1;
}
.shop-modal__item-qty button:hover { border-color: var(--gold); color: var(--gold); }
.shop-modal__item-price { color: var(--gold); min-width: 60px; text-align: right; }

.shop-receipt__rule {
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  margin: 10px 0;
}

.shop-modal__totals {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.88rem; color: var(--gray-light);
  font-family: 'JetBrains Mono', monospace;
}
.shop-modal__totals strong { color: var(--gold); }

.shop-modal__note { font-size: 0.76rem; color: var(--gray-mid); line-height: 1.6; margin: 14px 0 0; text-align: center; }
.shop-modal__msg { font-size: 0.8rem; color: #e05656; margin: 10px 0 0; text-align: center; }

.shop-modal__actions { display: flex; gap: 10px; margin-top: 20px; }
.shop-modal__actions .btn,
.shop-modal__actions .btn-gold { flex: 1; text-align: center; justify-content: center; }

/* ── Toast ── */
.shop-toast {
  position: fixed;
  left: 50%; bottom: 90px;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.85rem;
  padding: 10px 18px;
  z-index: 110;
}
.shop-toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .shop-card { animation: none; }
  .shop-cartbar__coin.is-bouncing { animation: none; }
  .shop-card__cta.is-added { animation: none; }
}
