/* ==========================================================================
   EventPass storefront — public ticketing pages and the door scanner.
   Loaded after app.css so it only has to describe the shop window; form
   controls, cards and buttons come from the shared design system.
   ========================================================================== */

:root {
  --ep-max: 1180px;
  --ep-poster: linear-gradient(150deg, #1b1b2f 0%, #3a1230 55%, #7f1233 100%);
  --ep-poster-2: linear-gradient(150deg, #0f172a 0%, #1e3a5f 60%, #0e7490 100%);
  --ep-notch: 14px;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body > main { flex: 1 0 auto; }

/* ------------------------------------------------------------------ topbar */
.ep-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.ep-topbar-inner {
  width: min(var(--ep-max), 100% - 2 * var(--s-5));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: var(--s-5);
  min-height: 64px;
}

.ep-topbar .brand { font-weight: 750; letter-spacing: -0.02em; }
.ep-topbar .brand-mark { box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }

.ep-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-1);
  flex-wrap: wrap;
}

.ep-nav > a {
  padding: 8px 12px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.ep-nav > a:hover { background: var(--surface-2); color: var(--text); }
.ep-nav > a.is-active { background: var(--accent-soft); color: var(--accent); }

/* -------------------------------------------------------------------- wrap */
.ep-wrap {
  width: min(var(--ep-max), 100% - 2 * var(--s-5));
  margin-inline: auto;
  padding: var(--s-8) 0 var(--s-16);
}

/* -------------------------------------------------------------------- hero */
.ep-eyebrow {
  margin: 0 0 var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.ep-display {
  margin: 0 0 var(--s-3);
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
  max-width: 16ch;
  text-wrap: balance;
}

.ep-lede {
  margin: 0;
  max-width: 58ch;
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text-soft);
}

.ep-wrap > section:first-child { padding: var(--s-6) 0 var(--s-10); }

/* ------------------------------------------------------------------- cards */
.ep-event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-5);
}

.ep-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), border-color 200ms var(--ease);
}

.ep-card > a { display: block; color: inherit; text-decoration: none; }
.ep-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg, 0 18px 40px rgb(16 19 34 / 12%)); border-color: var(--border-strong); }
.ep-card:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }

.ep-poster {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ep-poster);
  overflow: hidden;
}

.ep-card:nth-child(3n + 2) .ep-poster { background: var(--ep-poster-2); }

.ep-poster > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ep-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(0 0 0 / 0%) 30%, rgb(0 0 0 / 62%) 100%);
  pointer-events: none;
}

.ep-poster-overlay {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4);
  color: #fff;
}

.ep-poster-month {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}

.ep-poster-date {
  font-size: 2.6rem;
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.ep-poster-venue {
  max-width: 55%;
  text-align: right;
  font-size: var(--fs-xs);
  font-weight: 600;
  opacity: 0.95;
}

.ep-card-body { padding: var(--s-4) var(--s-4) var(--s-4); }
.ep-card-title { margin: 0 0 4px; font-size: var(--fs-lg); letter-spacing: -0.02em; line-height: 1.25; }
.ep-card-meta { color: var(--muted); font-size: var(--fs-sm); }
.ep-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-4); }

.ep-price { font-weight: 750; font-size: var(--fs-lg); letter-spacing: -0.02em; }
.ep-price small { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); letter-spacing: 0; text-transform: uppercase; }

/* ------------------------------------------------------------------- pills */
.ep-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.6;
  background: var(--surface-2);
  color: var(--text-soft);
  white-space: nowrap;
}

.ep-pill.is-ok { background: var(--success-soft); color: var(--success); }
.ep-pill.is-warn { background: var(--warning-soft); color: var(--warning); }
.ep-pill.is-bad { background: var(--danger-soft); color: var(--danger); }
.ep-pill.is-accent { background: var(--accent-soft); color: var(--accent); }

/* ----------------------------------------------------------------- section */
.ep-section { margin-top: var(--s-12); }
.ep-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.ep-section-head h2 { margin: 0; font-size: var(--fs-xl); letter-spacing: -0.03em; }

/* --------------------------------------------------------------- event page */
.ep-event-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--s-10);
  align-items: center;
  padding: var(--s-6) 0 var(--s-10);
}

.ep-event-poster {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--ep-poster);
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--accent) 55%, transparent);
}

.ep-event-poster > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.ep-event-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgb(0 0 0 / 0%) 35%, rgb(0 0 0 / 68%) 100%);
}

.ep-poster-inner {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: var(--s-6);
  color: #fff;
}

.ep-poster-big { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1; font-weight: 800; letter-spacing: -0.05em; }

.ep-event-title { margin: 0 0 var(--s-3); font-size: clamp(2rem, 4.4vw, 3.25rem); line-height: 1.05; letter-spacing: -0.045em; }

.ep-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
  margin: var(--s-6) 0 0;
  padding: var(--s-4) 0 0;
  border-top: 1px solid var(--border);
}

.ep-facts dt { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; }
.ep-facts dd { margin: 4px 0 0; font-weight: 600; }

/* ------------------------------------------------------------------- tiers */
.ep-tiers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }

.ep-tier {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.ep-tier:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.ep-tier h3 { margin: 0 0 4px; font-size: var(--fs-lg); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.ep-tier .progress { margin-top: var(--s-3); max-width: 420px; }
.ep-tier.is-paused, .ep-tier.is-closed, .ep-tier.is-ended, .ep-tier.is-sold_out, .ep-tier.is-upcoming { background: var(--surface-2); }
.ep-tier.is-sold_out h3 { color: var(--muted); }
.ep-tier-buy { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-2); text-align: right; }
.ep-tier-form { display: flex; align-items: center; gap: var(--s-2); }
.ep-qty { width: 76px; }
.ep-tier-form .btn { border-radius: var(--r-full); }

.ep-tier-admin { display: block; }
.ep-tier-admin-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.ep-inline-form { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------- checkout */
.ep-checkout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: var(--s-6);
  align-items: start;
  margin-top: var(--s-5);
}

.ep-summary-row { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-2) 0; font-size: var(--fs-sm); border-bottom: 1px dashed var(--border); }
.ep-summary-row:last-of-type { border-bottom: 0; }
.ep-summary-total { font-weight: 750; font-size: var(--fs-md); }

.ep-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: var(--r-full);
  background: var(--warning-soft);
  color: var(--warning);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: var(--fs-xs);
}

/* ----------------------------------------------------------------- tickets */
.ep-tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-4); }

.ep-ticket {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.ep-ticket::before,
.ep-ticket::after {
  content: "";
  position: absolute;
  top: 52px;
  width: var(--ep-notch);
  height: var(--ep-notch);
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
}

.ep-ticket::before { left: calc(var(--ep-notch) / -2 - 1px); }
.ep-ticket::after { right: calc(var(--ep-notch) / -2 - 1px); }

.ep-ticket-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4);
  border-bottom: 1px dashed var(--border);
  background: linear-gradient(120deg, var(--accent-soft), transparent 70%);
}

.ep-ticket-body { padding: var(--s-4); text-align: center; }
.ep-barcode { display: flex; justify-content: center; margin-bottom: var(--s-2); }
.ep-barcode svg { max-width: 100%; height: auto; }
.ep-code { font-family: var(--font-mono); font-size: var(--fs-xs); word-break: break-all; color: var(--text-soft); }
.ep-mono-sm { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
.ep-ticket-void {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--danger);
  background: rgb(255 255 255 / 72%);
  transform: rotate(-12deg) scale(1.2);
  pointer-events: none;
}

/* --------------------------------------------------------------- long copy */
.ep-event-body { margin-top: var(--s-8); }
.ep-prose { font-size: var(--fs-md); line-height: 1.7; color: var(--text-soft); }
.ep-prose h2, .ep-prose h3 { color: var(--text); }
.ep-prose a { color: var(--accent); }

/* ------------------------------------------------------------------ footer */
.ep-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: var(--s-5) 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.ep-footer .ep-topbar-inner { min-height: 0; flex-wrap: wrap; }

/* ------------------------------------------------------------ door scanner */
.ep-door-shell { min-height: 100vh; display: flex; flex-direction: column; gap: var(--s-5); padding: var(--s-4) clamp(12px, 4vw, 40px) var(--s-10); }
.ep-door-top { display: flex; align-items: center; gap: var(--s-3); }
.ep-door-top .brand { color: var(--text); }

.ep-verdict {
  border-radius: var(--r-xl);
  padding: clamp(20px, 4vw, 44px);
  text-align: center;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background 200ms var(--ease), color 200ms var(--ease);
}

.ep-verdict.is-idle { background: var(--surface-2); }
.ep-verdict.is-ok { background: var(--success); color: #fff; border-color: transparent; }
.ep-verdict.is-bad { background: var(--danger); color: #fff; border-color: transparent; }
.ep-verdict-icon { font-size: 3rem; line-height: 1; margin-bottom: var(--s-2); }
.ep-verdict-title { margin: 0; font-size: clamp(1.8rem, 5vw, 3rem); letter-spacing: -0.03em; }
.ep-verdict-sub { margin: var(--s-2) 0 0; opacity: 0.85; }

.ep-scan-form { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.ep-scan-input {
  flex: 1 1 320px;
  min-height: 60px;
  padding: 0 var(--s-4);
  font-size: 1.1rem;
  font-family: var(--font-mono);
  border-radius: var(--r-md);
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}
.ep-scan-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ep-scan-submit {
  flex: 0 0 auto;
  min-height: 60px;
  padding: 0 var(--s-8);
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.ep-scan-submit:hover { background: var(--accent-hover); }

.ep-door-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.ep-door-list li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.ep-door-list .grow { min-width: 0; display: flex; flex-direction: column; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .ep-event-hero { grid-template-columns: 1fr; gap: var(--s-6); }
  .ep-event-poster { aspect-ratio: 16 / 10; }
  .ep-checkout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .ep-wrap { padding-top: var(--s-5); }
  .ep-topbar-inner { min-height: 56px; gap: var(--s-3); }
  .ep-nav { gap: 0; }
  .ep-nav > a { padding: 6px 8px; font-size: var(--fs-xs); }
  .ep-facts { grid-template-columns: 1fr 1fr; }
  .ep-tier { grid-template-columns: 1fr; }
  .ep-tier-buy { align-items: stretch; text-align: left; }
  .ep-tier-form { justify-content: space-between; }
  .ep-tier-form .btn { flex: 1; }
  .ep-summary-row { font-size: var(--fs-xs); }
  .ep-scan-submit { flex: 1 1 100%; }
}

/* ------------------------------------------------------------------ print */
@media print {
  .ep-topbar, .ep-footer, .no-print, .flashes, .flash { display: none !important; }
  body { background: #fff; }
  .ep-wrap { width: 100%; padding: 0; }
  .ep-checkout { grid-template-columns: 1fr; }
  .ep-ticket { break-inside: avoid; border: 1px solid #bbb; }
  .ep-ticket-void { background: rgb(255 255 255 / 85%); }
}

.ep-verdict-icon:has(svg) { display: flex; justify-content: center; }

/* ------------------------------------------------- waitlist & transfers -- */
.ep-waitlist-form { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-3); width: 100%; }
.ep-waitlist-form .row { justify-content: flex-end; }
.ep-waitlist-form .field-errors { margin: 0; }
.ep-transfer-box {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-3);
  background: var(--surface);
}
.ep-transfer-box form { margin-top: var(--s-2); }
