/* gate.css — the holographic festival ticket; tear the stub to enter.
 *
 * The foil is one gradient layer inside the ticket, moved by transform (pointer/tilt +
 * a slow idle drift). It is only twice the ticket's size, never scene-sized.
 */

.gate {
  position: fixed;
  z-index: 100;
  inset: 0;
  width: var(--col);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 38px;
  background:
    url("../assets/img/grain.png") repeat,
    radial-gradient(ellipse 90% 60% at 50% 38%, #3a1234 0%, var(--night) 72%);
  overflow: hidden;
  touch-action: none;
}

.gate.is-leaving {
  animation: gate-out 700ms var(--ease-in-out) 260ms forwards;
  pointer-events: none;
}

.gate.is-gone {
  display: none;
}

@keyframes gate-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* drifting specks of disco light */
.gate__specks {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(3px 3px at 12% 18%, var(--rani), transparent),
    radial-gradient(2px 2px at 78% 12%, var(--lime), transparent),
    radial-gradient(3px 3px at 88% 44%, var(--marigold), transparent),
    radial-gradient(2px 2px at 20% 70%, var(--lime), transparent),
    radial-gradient(3px 3px at 64% 82%, var(--rani), transparent),
    radial-gradient(2px 2px at 40% 30%, var(--marigold), transparent),
    radial-gradient(3px 3px at 8% 90%, var(--marigold), transparent),
    radial-gradient(2px 2px at 92% 76%, var(--lime), transparent),
    radial-gradient(3px 3px at 52% 8%, var(--marigold), transparent),
    radial-gradient(2px 2px at 30% 52%, var(--rani), transparent);
  animation: twinkle 3.2s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}

/* ---- the ticket ------------------------------------------------------------ */
.ticket {
  position: relative;
  display: flex;
  width: min(86vw, 350px);
  height: 196px;
  transform: rotate(-5deg);
  animation: ticket-in 900ms var(--ease-spring) 150ms both;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55));
}

@keyframes ticket-in {
  from {
    opacity: 0;
    transform: translateY(40px) rotate(-14deg) scale(0.9);
  }
}

.ticket__main,
.ticket__stub {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f3f0f7 0%, #d4d6e0 45%, #eeeaf4 70%, #c9ccd8 100%);
  color: var(--ink);
}

.ticket__main {
  flex: 1;
  padding: 18px 16px 16px 20px;
  border-radius: 18px 4px 4px 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
}

/* holographic foil: a pastel rainbow twice the ticket's size, slid by transform */
.ticket__foil {
  position: absolute;
  left: -50%;
  top: -50%;
  width: 200%;
  height: 200%;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 46, 136, 0.28) 0%,
    rgba(255, 210, 63, 0.28) 8%,
    rgba(200, 255, 61, 0.28) 16%,
    rgba(80, 220, 255, 0.28) 24%,
    rgba(160, 110, 255, 0.28) 32%,
    rgba(255, 46, 136, 0.28) 40%
  );
  transform: translate(var(--hx, 0px), var(--hy, 0px));
  pointer-events: none;
}

.ticket__main > p {
  position: relative;
  margin: 0;
}

.ticket__admit {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ticket__name {
  margin-top: 8px !important;
  font-weight: 800;
  font-size: 38px;
  line-height: 0.88;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  font-variation-settings: "wdth" 75, "opsz" 96;
}

.ticket__ed {
  color: var(--rani-deep);
  margin-left: 4px;
}

.ticket__couple {
  margin-top: auto !important;
  font-size: 30px;
  line-height: 1;
}

.ticket__meta {
  margin-top: 6px !important;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---- the stub --------------------------------------------------------------- */
.ticket__stub {
  width: 74px;
  flex: none;
  padding: 0;
  border: 0;
  border-left: 2.5px dashed rgba(20, 10, 18, 0.45);
  border-radius: 4px 18px 18px 4px;
  cursor: grab;
  touch-action: none;
  transform-origin: 0% 100%;
  transition: transform 380ms var(--ease-spring);
}

.ticket__stub.is-dragging {
  cursor: grabbing;
  transition: none;
}

.ticket__stub.is-torn {
  transition: none;
  animation: stub-fly 900ms var(--ease-in-out) forwards;
}

@keyframes stub-fly {
  0% {
    transform: translate(var(--tx, 60px), 0) rotate(var(--tr, 14deg));
  }
  100% {
    transform: translate(calc(var(--tx, 60px) + 90px), 620px) rotate(70deg);
    opacity: 0;
  }
}

/* perforation notches, punched in the night colour */
.ticket__stub::before,
.ticket__stub::after {
  content: "";
  position: absolute;
  left: -11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2a0f27;
}

.ticket__stub::before {
  top: -10px;
}

.ticket__stub::after {
  bottom: -10px;
}

.ticket__stubtext {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(90deg);
  translate: -12px 0;
}

.ticket__barcode {
  position: absolute;
  right: 10px;
  top: 16px;
  bottom: 16px;
  width: 14px;
  background: repeating-linear-gradient(
    180deg,
    var(--ink) 0 2px,
    transparent 2px 4px,
    var(--ink) 4px 5px,
    transparent 5px 8px,
    var(--ink) 8px 11px,
    transparent 11px 13px
  );
}

.ticket.is-torn .ticket__main {
  animation: main-pop 700ms var(--ease-out) forwards;
}

@keyframes main-pop {
  0% {
    transform: none;
  }
  30% {
    transform: rotate(3deg) scale(1.04);
  }
  100% {
    transform: translateY(-30px) rotate(3deg) scale(1.2);
    opacity: 0;
  }
}

/* ---- hint + flash ---------------------------------------------------------------- */
.gate__hint {
  margin: 0;
  font: 700 12px/1.4 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime);
  animation: fade-in 600ms ease 1.1s both;
}

.gate__arrow {
  display: inline-block;
  animation: nudge 1.2s var(--ease-in-out) infinite;
}

@keyframes nudge {
  50% {
    transform: translateX(6px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.gate__flash {
  position: absolute;
  inset: 0;
  background: var(--cream);
  opacity: 0;
  pointer-events: none;
}

.gate.is-leaving .gate__flash {
  animation: flash 600ms ease-out 120ms;
}

@keyframes flash {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
  }
}

.gate__kicker {
  position: relative;
  margin: 0;
  max-width: 320px;
  font-size: 40px;
  line-height: 1;
  text-align: center;
  text-wrap: balance;
  color: var(--cream);
  animation: rise 800ms var(--ease-out) 500ms both;
}
