:root {
  --fondo: #efede8;
  --pannello: #fbfaf7;
  --inchiostro: #141416;
  --grigio: #8b8a86;
  --biglietto: #18181b;
  --carta: #f3f1ec;
  --spento: #8f8e95;
  --accento: #ff6a3d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* the wallet: everything inside is measured on its height (cqh), so it scales as one piece */
.wallet {
  position: relative;
  height: min(88vh, 600px, calc((100vw - 32px) / 0.62));
  aspect-ratio: 0.62;
  container-type: size;
  border-radius: 4.6cqh;
  background: var(--pannello);
  box-shadow: 0 0 0 1px rgba(20, 20, 22, 0.06), 0 1.4cqh 4cqh -1.6cqh rgba(40, 32, 20, 0.18);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.wallet__head {
  position: absolute; left: 0; right: 0; top: 0;
  height: 9.5cqh;
  padding: 2.6cqh 4.2cqh 0;
  display: flex; justify-content: space-between; align-items: flex-start;
}
.wallet__title { font-size: 3.1cqh; font-weight: 680; font-stretch: 112%; letter-spacing: -0.02em; line-height: 1; }
.wallet__sub { margin-top: 0.7cqh; font-size: 1.55cqh; color: var(--grigio); font-weight: 500; }
.wallet__done {
  font: inherit; font-size: 1.7cqh; font-weight: 620;
  color: var(--inchiostro);
  background: rgba(20, 20, 22, 0.06);
  border: 0; border-radius: 99px;
  padding: 0.75cqh 1.8cqh;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}
.wallet.is-open .wallet__done { pointer-events: auto; }

.deck { position: absolute; inset: 0; perspective: 1400px; }

/* one ticket: the wrapper is GSAP's (transform), the card is CSS's (mask, colours) */
.t {
  position: absolute; left: 3.4cqh; right: 3.4cqh; top: 0;
  height: 56cqh;
  will-change: transform;
  transform-origin: 50% 40%;
  cursor: grab;
}
.t__shadow {
  position: absolute; left: 6%; right: 6%; top: 8cqh; bottom: 2cqh;
  border-radius: 3cqh;
  background: rgba(30, 22, 12, 0.55);
  filter: blur(2.6cqh);
  opacity: 0.2;
  will-change: transform, opacity;
}
.t__card {
  position: absolute; inset: 0;
  border-radius: 2.6cqh;
  background: var(--biglietto);
  color: var(--carta);
  overflow: hidden;
  /* the two half-moon notches at the perforation */
  -webkit-mask: radial-gradient(circle 1.5cqh at 0 33cqh, #0000 97%, #000 100%), radial-gradient(circle 1.5cqh at 100% 33cqh, #0000 97%, #000 100%);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle 1.5cqh at 0 33cqh, #0000 97%, #000 100%), radial-gradient(circle 1.5cqh at 100% 33cqh, #0000 97%, #000 100%);
  mask-composite: intersect;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
/* a hairline of light along the top edge */
.t__card::before {
  content: ""; position: absolute; left: 2.6cqh; right: 2.6cqh; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
}

.t__head {
  height: 10cqh;
  padding: 0 2.6cqh;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1.6cqh;
}
.t__name { font-size: 2.35cqh; font-weight: 660; font-stretch: 108%; letter-spacing: -0.01em; line-height: 1.05; white-space: nowrap; }
.t__kind { margin-top: 0.45cqh; font-size: 1.35cqh; color: var(--spento); white-space: nowrap; }
.t__when { text-align: right; }
.t__date { font-size: 1.7cqh; font-weight: 600; white-space: nowrap; }
.t__time { margin-top: 0.45cqh; font-size: 1.35cqh; color: var(--spento); }

.t__venue {
  margin: 1.4cqh 2.6cqh 0;
  padding-top: 1.6cqh;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 1.55cqh; color: #c9c7c1;
}
.t__grid {
  margin: 2.2cqh 2.6cqh 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1cqh;
}
.t__grid dt { font-size: 1.15cqh; letter-spacing: 0.08em; text-transform: uppercase; color: var(--spento); font-weight: 560; }
.t__grid dd { margin-top: 0.6cqh; font-size: 2.15cqh; font-weight: 640; font-stretch: 104%; white-space: nowrap; }
.t__grid dd.is-accent { color: var(--accento); }

.t__perf {
  position: absolute; left: 2.4cqh; right: 2.4cqh; top: 33cqh; height: 0;
  border-top: 1.5px dashed rgba(255, 255, 255, 0.18);
}

.t__code {
  position: absolute; left: 2.6cqh; right: 2.6cqh; top: 36.4cqh; bottom: 2.6cqh;
  border-radius: 1.8cqh;
  background: #e8e6e1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--inchiostro);
  transition: background-color 0.5s ease, box-shadow 0.5s ease;
}
.t__code.is-bright {
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6), 0 0 3.4cqh rgba(255, 255, 255, 0.28);
}
.t__bars { width: 78%; height: 7.6cqh; display: block; }
.t__bars rect { fill: var(--inchiostro); }
.t__num { margin-top: 0.9cqh; font-size: 1.3cqh; letter-spacing: 0.16em; font-weight: 560; }
.t__ready {
  position: absolute; top: 1.1cqh; right: 1.6cqh;
  font-size: 1.15cqh; font-weight: 640; letter-spacing: 0.04em;
  color: var(--accento);
  opacity: 0;
}

.t__shine {
  position: absolute; inset: 0;
  background: linear-gradient(112deg, transparent 38%, rgba(255, 255, 255, 0.16) 48%, rgba(255, 255, 255, 0.05) 54%, transparent 62%);
  background-size: 260% 100%;
  background-position: 50% 0;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

@media (hover: hover) {
  .wallet__done:hover { background: rgba(20, 20, 22, 0.1); }
}

.ghost {
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px;
  fill: #111; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}
