:root {
  --fondo: #09090b;
  --accento: #ff6a3d;
  --testo: #f6f5f3;
  --testo-2: rgba(246, 245, 243, 0.62);
  --testo-3: rgba(246, 245, 243, 0.38);
  --carta: #f4f3f1;
  --inchiostro: #0d0d10;
  --frost: 9px;
}

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

html, body { height: 100%; }

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: radial-gradient(110% 70% at 50% 100%, #141114 0%, var(--fondo) 62%);
}

/* the warm light that shows through the glass */
.orb {
  position: absolute;
  left: 50%; top: 50%;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(26px);
  will-change: transform;
}
.orb--a {
  width: min(260px, 64vw, 50vh); height: min(260px, 64vw, 50vh);
  margin: calc(min(260px, 64vw, 50vh) / -2) 0 0 calc(min(260px, 64vw, 50vh) / -2);
  background: radial-gradient(closest-side, var(--luce-a, rgba(255, 106, 61, 0.85)), transparent);
}
.orb--b {
  width: min(190px, 46vw, 36vh); height: min(190px, 46vw, 36vh);
  margin: calc(min(190px, 46vw, 36vh) / -2) 0 0 calc(min(190px, 46vw, 36vh) / -2);
  background: radial-gradient(closest-side, var(--luce-b, rgba(255, 176, 140, 0.7)), transparent);
}

.tilt { position: relative; z-index: 1; }

.ticket {
  --w: min(330px, 74vw, 56vh);
  --n: calc(var(--w) * 0.04);
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 1.32);
  padding: calc(var(--w) * 0.068) calc(var(--w) * 0.07) calc(var(--w) * 0.056);
  display: flex;
  flex-direction: column;
  font-size: calc(var(--w) * 0.046);
  cursor: pointer;
  touch-action: none;
  will-change: transform;
}

/* the glass itself, with the two notches of the perforation */
.ticket__glass, .ticket__sheen {
  position: absolute; inset: 0;
  border-radius: calc(var(--w) * 0.07);
  -webkit-mask:
    radial-gradient(circle at 0 var(--cut, 50%), transparent var(--n), #000 calc(var(--n) + 0.6px)),
    radial-gradient(circle at 100% var(--cut, 50%), transparent var(--n), #000 calc(var(--n) + 0.6px));
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle at 0 var(--cut, 50%), transparent var(--n), #000 calc(var(--n) + 0.6px)),
    radial-gradient(circle at 100% var(--cut, 50%), transparent var(--n), #000 calc(var(--n) + 0.6px));
  mask-composite: intersect;
  pointer-events: none;
}
.ticket__glass {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04) 46%, rgba(255, 255, 255, 0.07)),
    rgba(18, 16, 18, 0.34);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.ticket__sheen {
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.09) 46%, rgba(255, 255, 255, 0.02) 54%, transparent 66%);
  background-size: 260% 100%;
  background-position: var(--sx, 50%) 0;
  mix-blend-mode: screen;
}

.ticket > :not(.ticket__glass):not(.ticket__sheen):not(.outline) { position: relative; }

.ticket__head { display: flex; align-items: center; justify-content: space-between; }
.brand {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-size: 0.86em; font-weight: 620; letter-spacing: 0.01em;
}
.brand svg { width: 1.1em; height: 1.1em; fill: none; stroke: var(--accento); stroke-width: 1.7; stroke-linecap: round; }
.admit {
  font-size: 0.7em; font-weight: 560; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--testo-2);
  padding: 0.32em 0.7em;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

.ticket__show { margin-top: 0.9em; }
.artist {
  font-size: 2.7em;
  line-height: 0.98;
  font-weight: 700;
  font-variation-settings: "wdth" 118;
  letter-spacing: -0.03em;
}
.tour { margin-top: 0.35em; font-size: 0.8em; color: var(--testo-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.facts { display: grid; grid-template-columns: 1.15fr 0.8fr 1fr; gap: 0.6em; margin-top: 0.95em; }
.facts dt { font-size: 0.64em; letter-spacing: 0.07em; text-transform: uppercase; color: var(--testo-3); font-weight: 560; }
.facts dd { margin-top: 0.2em; font-size: 0.86em; font-weight: 620; white-space: nowrap; }

.perf { height: 0; margin: 1.05em 0 0; }

.code {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.55em;
  padding-top: 0.7em;
}

.qr {
  position: relative;
  width: calc(var(--w) * 0.4);
  aspect-ratio: 1;
  padding: calc(var(--w) * 0.026);
  border-radius: calc(var(--w) * 0.04);
  background: var(--carta);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.qr__glow {
  position: absolute; inset: -18%;
  border-radius: 30%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.12) 60%, transparent);
  filter: blur(8px);
  opacity: 0;
  z-index: -1;
}
.qr__ink { display: block; width: 100%; height: 100%; }
.qr__ink path { fill: var(--inchiostro); }

/* the frost over the code: blurred, grainy, with a clear circle that grows from the finger */
.frost, .frost__edge {
  position: absolute; inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  --x: 50%; --y: 50%; --r: 0px;
}
.frost {
  -webkit-backdrop-filter: blur(var(--frost)) saturate(1.2) brightness(1.04);
  backdrop-filter: blur(var(--frost)) saturate(1.2) brightness(1.04);
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='120' height='120' filter='url(%23g)'/></svg>"),
    linear-gradient(150deg, rgba(255, 255, 255, 0.24), rgba(236, 232, 228, 0.1));
  background-size: 120px 120px, 100% 100%;
  -webkit-mask: radial-gradient(circle at var(--x) var(--y), transparent var(--r), #000 calc(var(--r) + 14px));
  mask: radial-gradient(circle at var(--x) var(--y), transparent var(--r), #000 calc(var(--r) + 14px));
}
.frost__edge {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.95), rgba(255, 220, 205, 0.7));
  -webkit-mask: radial-gradient(circle at var(--x) var(--y), transparent calc(var(--r) - 1px), #000 calc(var(--r) + 2px), transparent calc(var(--r) + 13px));
  mask: radial-gradient(circle at var(--x) var(--y), transparent calc(var(--r) - 1px), #000 calc(var(--r) + 2px), transparent calc(var(--r) + 13px));
  mix-blend-mode: screen;
  opacity: 0;
}

/* the ring that fills while the finger holds */
.hold {
  position: absolute; left: 0; top: 0;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  pointer-events: none;
  opacity: 0;
  transform: rotate(-90deg);
}
.hold circle { fill: none; stroke-width: 2.4; }
.hold__track { stroke: rgba(13, 13, 16, 0.12); }
.hold__bar { stroke: var(--accento); stroke-linecap: round; stroke-dasharray: 100.6; stroke-dashoffset: 100.6; }

.hint { font-size: 0.78em; font-weight: 580; color: var(--testo-2); }
.hint__mask { position: relative; display: block; height: 1.3em; overflow: hidden; }
.hint__line {
  display: flex; align-items: center; justify-content: center; gap: 0.45em;
  height: 1.3em; white-space: nowrap;
}
.hint__line[data-hint="ready"] { position: absolute; left: 0; right: 0; top: 0; color: var(--testo); }
.hint__line svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hint__line[data-hint="ready"] svg { stroke: var(--accento); stroke-width: 2; }
.serial { font-size: 0.62em; letter-spacing: 0.22em; color: var(--testo-3); font-weight: 560; }

/* the outline with the notches, the light it catches and the beam that runs round once */
.outline { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.outline path { fill: none; }
.outline__base { stroke: rgba(255, 255, 255, 0.12); stroke-width: 1; }
.outline__lit { stroke: url(#lit); stroke-width: 1.3; }
.outline__beam { stroke: #fff; stroke-width: 1.5; stroke-linecap: round; opacity: 0; }
.outline__beam--wide { stroke: var(--accento); stroke-width: 5; filter: blur(3px); }
.outline__perf { stroke: rgba(255, 255, 255, 0.2); stroke-width: 1.2; stroke-dasharray: 2 5; stroke-linecap: round; }

.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  pointer-events: none;
  z-index: 5;
}
.ghost path { fill: #ffffff; stroke: #09090b; stroke-width: 1.4; stroke-linejoin: round; }

@media (prefers-reduced-motion: reduce) {
  .orb { will-change: auto; }
}
