/* Event pages (/e/{id}/), served by the eventPage Cloud Function.
   Colours come from site.css. Built for phones first: most buyers arrive from
   a link in WhatsApp or Instagram. */

.ev-page [hidden] { display: none !important; }
.ev-page { display: flex; flex-direction: column; min-height: 100vh; }
.ev-page main { flex: 1 0 auto; }

.ev-wrap { max-width: 1120px; }
.ev-main { padding-top: 16px; padding-bottom: 40px; }
.has-bar .ev-main { padding-bottom: 112px; }

.ev-cover {
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.ev-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }

.ev-page h1 {
  margin: 20px 0 4px;
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.ev-page h2 { margin: 32px 0 12px; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.ev-host { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.ev-partner {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 20%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ev-facts {
  display: grid;
  gap: 1px;
  margin: 20px 0 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--border);
}
.ev-facts div {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
}
.ev-facts dt { color: var(--muted); font-size: 14px; line-height: 1.7; }
.ev-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.ev-dates { margin-top: 20px; }
.ev-dates ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.ev-dates a {
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}
.ev-dates a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #000; }

.ev-description { margin: 0; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }

/* tickets */

.ev-tickets { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.ev-ticket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.ev-ticket.is-picked { border-color: var(--accent); }
.ev-ticket.is-sold-out { opacity: 0.6; }
.ev-ticket-info { min-width: 0; }
.ev-ticket h3 { margin: 0; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.ev-price { margin: 2px 0 0; font-weight: 800; color: var(--accent); }
.ev-ticket-desc { margin: 4px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.ev-stock { margin: 4px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }

.ev-stepper { flex: none; display: flex; align-items: center; gap: 4px; }
.ev-stepper output { min-width: 28px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.ev-stepper button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.ev-stepper button[data-step="1"] { border-color: var(--gold); background: var(--gold); color: #000; }
.ev-stepper button:disabled { opacity: 0.35; cursor: default; }
.ev-stepper button[data-step="1"]:disabled { border-color: var(--border); background: transparent; color: var(--text); }

.ev-notice {
  margin: 12px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-2);
}

/* buttons */

.ev-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--gold);
  color: #000;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.ev-button:disabled { opacity: 0.6; cursor: default; }
.ev-button-quiet { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 700; }

/* sticky total */

.ev-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.ev-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
.ev-bar small { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; }
.ev-bar strong { font-size: 19px; font-weight: 900; line-height: 1.2; }

/* checkout */

.ev-form { margin-top: 12px; scroll-margin-top: 80px; }
.ev-form h2:focus { outline: none; }
.ev-hint { margin: -6px 0 16px; color: var(--text-2); font-size: 15px; }
.ev-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 340px) { .ev-field-row { grid-template-columns: 1fr; gap: 0; } }
.ev-field { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.ev-optional { color: var(--muted); font-weight: 400; }
.ev-voucher { margin-bottom: 14px; }
.ev-voucher .ev-field { margin-bottom: 0; }
.ev-voucher-row { display: flex; gap: 8px; margin-top: 6px; }
.ev-field .ev-voucher-row input { flex: 1; min-width: 0; margin-top: 0; text-transform: uppercase; }
.ev-voucher-row button { flex: none; min-height: 48px; }
.ev-voucher-note { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.ev-voucher-note.is-error { color: #c62828; }
@media (prefers-color-scheme: dark) { .ev-voucher-note.is-error { color: #ef9a9a; } }
.ev-voucher .ev-lines { margin: 12px 0 0; }
.ev-field input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* smaller makes iPhones zoom in on focus */
  font-weight: 400;
}

.ev-mode { margin: 4px 0 14px; padding: 0; border: 0; }
.ev-mode legend { padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.ev-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.ev-choice:has(input:checked) { border-color: var(--accent); }
.ev-choice input, .ev-consent input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--gold-deep); }
.ev-choice strong { display: block; font-size: 15px; }
.ev-choice small { display: block; color: var(--text-2); font-size: 13px; line-height: 1.4; }

.ev-consent { display: flex; align-items: flex-start; gap: 12px; margin: 16px 0; font-size: 14px; line-height: 1.5; color: var(--text-2); cursor: pointer; }
.ev-consent-note { margin: 16px 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }

.ev-error {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid #c62828;
  border-radius: 12px;
  color: #c62828;
  font-size: 15px;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) { .ev-error { border-color: #ef9a9a; color: #ef9a9a; } }
.ev-submit { width: 100%; }
.ev-secure { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 13px; }

/* messages and the ticket */

.ev-message { max-width: 640px; padding-top: 16px; padding-bottom: 48px; }
.ev-event-name { margin: 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.ev-reference { padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.ev-qrs { display: grid; gap: 12px; margin: 20px 0; }
.ev-qr {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  text-align: center;
}
.ev-qr img { display: block; width: 240px; max-width: 100%; height: auto; margin: 0 auto 12px; border-radius: 12px; background: #fff; }
.ev-qr strong { display: block; overflow-wrap: anywhere; }
.ev-qr span { display: block; color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.ev-lines { margin: 20px 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.ev-lines li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.ev-lines li span:last-child { flex: none; }
.ev-total { font-weight: 800; }

/* site.css hides the landing page's nav on phones; this one link stays */
.ev-page .site-nav { display: flex; }

/* the listing (/events/) */

.ev-list { padding-top: 16px; padding-bottom: 40px; }
.ev-list-lead { margin: 0 0 24px; color: var(--text-2); }
.ev-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ev-card a {
  display: block;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
}
.ev-card a:hover { border-color: var(--accent); }
.ev-card img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; }
.ev-card-text { padding: 12px 16px 16px; }
.ev-card p { margin: 0; overflow-wrap: anywhere; }
.ev-page .ev-card h2 { margin: 0 0 4px; color: var(--text); font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
.ev-card .ev-card-date { color: var(--text); font-weight: 600; }
.ev-card .ev-card-price { margin-top: 8px; color: var(--accent); font-weight: 700; }

.ev-footer { padding: 20px 0 28px; border-top: 1px solid var(--border); font-size: 14px; }
.ev-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.ev-footer a { color: var(--text-2); text-decoration: none; }
.ev-footer a:hover { color: var(--text); text-decoration: underline; }

/* desktop: details on the left, buying stays in view on the right */

@media (min-width: 960px) {
  .ev-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    align-items: start;
    gap: 48px;
    padding-top: 32px;
    padding-bottom: 64px;
  }
  .has-bar .ev-main { padding-bottom: 64px; }
  .ev-page .ev-details h1 { margin-top: 28px; font-size: 44px; }

  .ev-buy {
    position: sticky;
    top: 88px; /* clears the site header */
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
  }
  /* the form can be taller than the window: let it scroll with the page */
  .ev-buy:has(.ev-form:not([hidden])) { position: static; }
  .ev-page .ev-buy h2 { margin-top: 0; }
  .ev-buy .ev-ticket, .ev-buy .ev-notice, .ev-buy .ev-choice, .ev-buy .ev-field input { background: var(--bg); }
  .ev-buy .ev-form { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }

  .ev-bar {
    position: static;
    margin-top: 16px;
    padding: 0;
    background: transparent;
    border: 0;
  }

  .ev-message { margin-right: auto; margin-left: auto; }
}
