/* The event detail page — /events/:id and /programs/:slug/events/:id.

   The fourth 3.0 surface, after the Actions, Calendar and Map tools, and built the
   same way: its own stylesheet loaded via yield :page_stylesheets rather than on
   every page, everything resolving through --zw-* tokens.

   Not zw_components.css. That file is the shared layer, is linked on every page in
   the app, and is deliberately small; a surface's own layout belongs beside the
   other surface stylesheets. */

/* --- page and layout ----------------------------------------------------------- */

/* Deliberately inset from the site header, which is 80rem. The other 3.0 surfaces
   match the header because a map, a calendar grid or a table of actions wants every
   pixel; this page is a document, and its body column at 80rem runs well past a
   comfortable line length. Narrower than the menu above it reads as a page. Wider
   would read as broken. */
.zw-evt-page {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 24px 1rem 64px;
}

@media (min-width: 640px) { .zw-evt-page { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .zw-evt-page { padding-inline: 2rem; } }

.zw-evt-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--zw-blue-700);
}

.zw-evt-back:hover { color: var(--zw-blue-800); }

/* One column until there is room for two. The rail is fixed so the main column
   takes the slack — a fluid rail makes the cover square resize on every breakpoint
   between. */
.zw-evt-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}

@media (min-width: 900px) {
  .zw-evt-layout { grid-template-columns: 320px 1fr; gap: 48px; }
}

.zw-evt-main { min-width: 0; }

/* --- rail ------------------------------------------------------------------------ */

.zw-evt-rail { display: flex; flex-direction: column; gap: 20px; }

/* Sticky only where the rail sits beside the content. Stacked on mobile it is just
   the top of the page and pinning it would cover the thing being read. */
@media (min-width: 900px) {
  .zw-evt-rail { position: sticky; top: 16px; }
}

/* The square belongs to the wrapper, not to a pixel height: the rail is fixed at
   320px on desktop but full width when stacked, and a fixed height stops being
   square the moment the column changes. */
.zw-evt-rail__cover {
  aspect-ratio: 1 / 1;
  border-radius: var(--zw-radius-xl);
  overflow: hidden;
}

.zw-evt-rail__block { padding-top: 20px; border-top: 1px solid var(--zw-border-warm); }

.zw-evt-rail__manage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--fg-2);
  background: var(--zw-surface-warm);
  border-radius: var(--zw-radius-lg);
}

.zw-evt-rail__presenter {
  margin: 6px 0 0;
  font-weight: 600;
  color: var(--zw-ink);
}

.zw-evt-rail__orgs { margin: 8px 0 0; padding: 0; list-style: none; }
.zw-evt-rail__orgs li { display: flex; flex-direction: column; margin-bottom: 8px; }
.zw-evt-rail__org-link { font-weight: 500; color: var(--zw-blue-700); }
.zw-evt-rail__org-link:hover { color: var(--zw-blue-800); }
.zw-evt-rail__org-name { font-weight: 500; color: var(--zw-ink); }
.zw-evt-rail__org-note { font-size: 12px; color: var(--fg-3); }

/* --- host ------------------------------------------------------------------------ */

.zw-evt-host { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

.zw-evt-host__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--zw-radius-pill);
  background: var(--zw-avatar-1);
  color: var(--zw-ink);
  font-size: 13px;
  font-weight: 700;
}

.zw-evt-host__body { min-width: 0; }
.zw-evt-host__name { margin: 0; font-weight: 600; color: var(--zw-ink); }
.zw-evt-host__title { margin: 2px 0 0; font-size: 13px; color: var(--fg-3); }
.zw-evt-host__bio { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: var(--fg-2); }

/* --- attendees -------------------------------------------------------------------- */

.zw-evt-attendees { display: flex; align-items: center; margin-top: 10px; }

.zw-evt-attendees__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: -8px;
  border-radius: var(--zw-radius-pill);
  border: 2px solid var(--zw-paper);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.zw-evt-attendees__more {
  margin-left: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
}

/* --- meta rows ---------------------------------------------------------------------- */

.zw-evt-meta { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.zw-evt-meta__row { display: flex; align-items: center; gap: 12px; }

.zw-evt-meta__pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--zw-radius-md);
  border: 1px solid var(--zw-border-warm);
  background: var(--zw-surface-warm);
}

.zw-evt-meta__pill-month {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--zw-green-700);
}

.zw-evt-meta__pill-day {
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  color: var(--zw-ink);
}

.zw-evt-meta__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--zw-radius-md);
  border: 1px solid var(--zw-border-warm);
  background: var(--zw-surface-warm);
  color: var(--fg-3);
}

.zw-evt-meta__text { display: flex; flex-direction: column; min-width: 0; }
.zw-evt-meta__primary { font-weight: 600; color: var(--zw-ink); }
.zw-evt-meta__secondary { font-size: 14px; color: var(--fg-3); }

/* --- registration ------------------------------------------------------------------ */

.zw-evt-registration { margin-top: 28px; padding: 0; overflow: hidden; }

.zw-evt-registration__header {
  margin: 0;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
  background: var(--zw-surface-warm);
  border-bottom: 1px solid var(--zw-border-warm);
}

.zw-evt-registration__body { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.zw-evt-registration__note { margin: 0; font-size: 13px; color: var(--fg-3); }
.zw-evt-registration__form { display: flex; flex-direction: column; gap: 12px; }
.zw-evt-registration__label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--fg-2); }

.zw-evt-registration__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--zw-border-warm);
  border-radius: var(--zw-radius-lg);
  background: var(--bg-1);
  color: var(--fg-1);
}

.zw-evt-registration__input:focus {
  outline: none;
  border-color: var(--zw-blue-700);
  box-shadow: 0 0 0 3px var(--zw-blue-100);
}

/* Blue acts. Every button on this page is blue or it is not a button. */
.zw-evt-registration__submit {
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--zw-radius-sm);
  background: var(--zw-blue-700);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--zw-ease-duration, 150ms) ease;
}

.zw-evt-registration__submit:hover { background: var(--zw-blue-800); }

/* Sold out is a different action, not a different system: still blue, quieter. */
.zw-evt-registration__submit--waitlist { background: var(--zw-blue-900); }
.zw-evt-registration__submit--waitlist:hover { background: var(--zw-ink); }

.zw-evt-registration__cancel { margin: 0; }

.zw-evt-registration__cancel-button,
.zw-evt-registration__leave-button {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--zw-radius-sm);
  border: 1px solid var(--zw-border-warm);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.zw-evt-registration__cancel-button { color: var(--zw-danger, #b3261e); }
.zw-evt-registration__leave-button { color: var(--fg-2); }
.zw-evt-registration__cancel-button:hover,
.zw-evt-registration__leave-button:hover { background: var(--zw-surface-warm); }

.zw-evt-registration__section { padding-top: 14px; border-top: 1px solid var(--zw-border-warm); }
.zw-evt-registration__capacity { padding-top: 14px; border-top: 1px solid var(--zw-border-warm); }
.zw-evt-registration__qr { width: 128px; margin-top: 8px; }
.zw-evt-registration__qr svg { width: 100%; height: auto; }

/* --- ticket ------------------------------------------------------------------- */

/* Blue acts, so the trigger is blue. Inline rather than full width: on a confirmed
   card the decision has already been made, and a second full-width blue bar would
   read as the thing still to be pressed. */
.zw-evt-ticket__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--zw-radius-sm);
  background: var(--zw-blue-700);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--zw-ease-duration, 150ms) ease;
}

.zw-evt-ticket__trigger:hover { background: var(--zw-blue-800); }

/* The dialog element is the backdrop's own box, so it carries no chrome of its own —
   the visible card is the panel inside it. That split is what makes a click landing
   on the element rather than the panel unambiguously a click outside. */
/* margin: auto is doing real work. The UA stylesheet centres a modal dialog with
   `margin: auto` inside `inset: 0`, and Tailwind's preflight resets margin on every
   element — so without this the ticket opens pinned to the top-left corner. */
.zw-evt-ticket__dialog {
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.zw-evt-ticket__dialog::backdrop { background: rgb(0 0 0 / 0.55); }

.zw-evt-ticket__panel {
  width: min(88vw, 340px);
  padding: 20px;
  border-radius: var(--zw-radius-lg);
  background: var(--bg-1);
}

.zw-evt-ticket__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.zw-evt-ticket__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--zw-ink);
}

.zw-evt-ticket__close {
  display: inline-flex;
  padding: 4px;
  border: 0;
  border-radius: var(--zw-radius-sm);
  background: transparent;
  color: var(--fg-3);
  cursor: pointer;
}

.zw-evt-ticket__close:hover { color: var(--fg-1); }

/* Filling the panel is the whole point of moving the code off the card: at 128px
   inline it had to be held up to the scanner, at full width it reads across a table. */
/* The standalone /ticket page. Same panel as the dialog, centred in the measure
   rather than in the viewport, because here it is the page rather than an overlay. */
.zw-evt-ticket-page .zw-evt-ticket__panel {
  margin: 0 auto;
  border: 1px solid var(--zw-border-warm);
}

.zw-evt-ticket__event { margin: 12px 0 0; font-weight: 600; color: var(--zw-ink); }

.zw-evt-ticket__qr { margin-bottom: 14px; }
.zw-evt-ticket__qr svg { display: block; width: 100%; height: auto; }

.zw-evt-registration__calendar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }

.zw-evt-registration__calendar-link {
  padding: 8px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  border: 1px solid var(--zw-border-warm);
  border-radius: var(--zw-radius-sm);
}

.zw-evt-registration__calendar-link:hover { background: var(--zw-surface-warm); }

/* Sharing moved to the foot of the rail. The rail is a narrow column, so this
   stacks rather than sitting the note and the button on one line the way it did
   at panel width. */
.zw-evt-rail__share { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.zw-evt-rail__share-note { font-size: 14px; color: var(--zw-ink-2); }

.zw-evt-rail__share-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--zw-blue-700);
  cursor: pointer;
}

/* Green measures. A capacity bar is the clearest case of what green is for, and it
   is not a button. */
.zw-evt-capacity {
  height: 6px;
  margin-top: 8px;
  border-radius: var(--zw-radius-pill);
  background: var(--zw-border-warm);
  overflow: hidden;
}

.zw-evt-capacity__fill { height: 100%; background: var(--zw-green-600); }

/* --- state pills ------------------------------------------------------------------- */

.zw-evt-pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: var(--zw-radius-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Green measures a state. These are spans, never buttons. */
.zw-evt-pill--in { background: var(--zw-green-100); color: var(--zw-green-900); }
.zw-evt-pill--waiting { background: var(--zw-sand); color: var(--zw-ink); }

/* --- body ---------------------------------------------------------------------------- */

.zw-evt-prose { margin-top: 8px; line-height: 1.7; color: var(--fg-2); }
.zw-evt-prose p { margin: 0 0 12px; }

.zw-evt-list { margin: 12px 0 0; padding: 0; list-style: none; }
.zw-evt-list li { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; color: var(--fg-2); }
.zw-evt-list__mark { flex-shrink: 0; color: var(--zw-green-600); }

.zw-evt-callout { margin-top: 12px; line-height: 1.7; color: var(--fg-2); }
.zw-evt-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.zw-evt-related { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--zw-border-warm); }

.zw-evt-related__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (min-width: 640px) { .zw-evt-related__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .zw-evt-related__grid { grid-template-columns: repeat(3, 1fr); } }

/* --- sections ---------------------------------------------------------------- */

/* Every section clears whatever precedes it. The sibling rule below only fires
   between two sections, which left the first one in the column flush against the
   registration card — or against the in-progress panel, or the ended notice, none of
   which carry a bottom margin of their own. */
.zw-evt-section { margin-top: 2.5rem; }

/* Between two sections the gap is shared with the rule, so the margin comes back
   down and the padding makes up the rest. */
.zw-evt-section + .zw-evt-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--zw-border-warm);
}

/* --- location ---------------------------------------------------------------- */

.zw-evt-location__address {
  margin: 8px 0 0;
  color: var(--fg-2);
  line-height: 1.6;
}

/* A map with no height is not a small map, it is an invisible one — Leaflet sizes
   itself to its container and the container has no content of its own. */
.zw-evt-location__map {
  height: 280px;
  margin-top: 16px;
  border-radius: var(--zw-radius-xl);
  overflow: hidden;
  border: 1px solid var(--zw-border-warm);
}

/* The venue is the answer to "where is this?"; the street address underneath is for
   getting there. Only rendered when it is saying something the venue line did not. */
.zw-evt-location__venue {
  margin: 8px 0 0;
  font-weight: 600;
  color: var(--zw-ink);
}

/* Ticket type rows.
 *
 * One row per type, each with its own stepper, submitted together. A full row
 * stays in the list rather than vanishing -- a reader should see the session
 * existed and filled, not wonder where it went -- so it is dimmed, not removed.
 */
.zw-tt__eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--zw-ink-3);
  margin: 0 0 0.75rem;
}
.zw-tt__form { display: flex; flex-direction: column; gap: 0.5rem; }
.zw-tt__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--zw-line);
  border-radius: var(--zw-radius-md);
  background: #fff;
}
.zw-tt__row--full { opacity: 0.6; }
.zw-tt__row-text { min-width: 0; }
.zw-tt__row-name { margin: 0; font-weight: 600; color: var(--zw-ink); }
.zw-tt__row-note { margin: 0.125rem 0 0; font-size: 0.8125rem; color: var(--zw-ink-3); }
.zw-tt__row-when { margin: 0.125rem 0 0; font-size: 0.8125rem; color: var(--zw-ink-2); }
.zw-tt__row-desc { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--zw-ink-3); }
.zw-tt__held {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--zw-green-700);
}
/* After the base rule, not before it: both are one class deep, so source order
   is what decides, and a queued person's marker was rendering confirmed-green. */
.zw-tt__held--waiting { color: var(--zw-ink-3); font-weight: 500; }
.zw-tt__empty { font-size: 0.875rem; color: var(--zw-ink-2); }

.zw-tt__cancel {
  margin-left: 0.5rem;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.75rem;
  color: var(--zw-ink-3);
  text-decoration: underline;
  cursor: pointer;
}
.zw-tt__cancel-form { display: none; }

/* The stepper is used by three surfaces now -- the panel, the registration page
 * and every ticket type row -- so it lives here as well as in
 * events_registration.css. The event page loads only this sheet, and the rows
 * were rendering as three unstyled inline elements without it.
 */
.zw-stepper { display: inline-flex; align-items: center; gap: 0.5rem; }
.zw-stepper__btn {
  width: 2rem; height: 2rem;
  border: 1px solid var(--zw-line-2);
  border-radius: var(--zw-radius-sm);
  background: #fff;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--zw-ink);
  cursor: pointer;
}
.zw-stepper__btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.zw-stepper__value { min-width: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }

/* The panel's seat row: label left, stepper right, on its own line above the
 * button. It rendered as bare text because .zw-stepper lived only in the
 * registration page's sheet and this page loads a different one -- and the
 * wrapper itself had no rules at all, so the label and the control ran together.
 */
.zw-evt-registration__tickets {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--zw-line);
}
.zw-evt-registration__tickets-label {
  font-weight: 600;
  color: var(--zw-ink);
}

/* === Verify Email / Sign In ===
   Shown to a guest who registered in this session and has not proven the
   address. Sits under "You're in", because they ARE in — this is about managing
   the registration, not about whether it exists. */
.zw-evt-verify {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--zw-line-2);
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.zw-evt-verify__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--zw-ink);
}

.zw-evt-verify__lede {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--zw-ink-2);
}

.zw-evt-verify__send-button {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid var(--zw-blue-700);
  border-radius: 0.75rem;
  background: transparent;
  color: var(--zw-blue-700);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.zw-evt-verify__send-button:hover { background: var(--zw-blue-50, #eef4fa); }

.zw-evt-verify__form { display: flex; flex-direction: column; gap: 0.5rem; }
.zw-evt-verify__label { font-size: 0.8125rem; font-weight: 600; color: var(--zw-ink-2); }

/* Tabular figures and wide tracking: six digits read one at a time, and
   proportional spacing makes 1 and 7 easy to miscount when checking. */
.zw-evt-verify__input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--zw-line-2);
  border-radius: 0.75rem;
  background: #fff;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.35em;
  text-align: center;
  color: var(--zw-ink);
}
.zw-evt-verify__input:focus {
  outline: 2px solid var(--zw-blue-700);
  outline-offset: 1px;
  border-color: transparent;
}

.zw-evt-verify__submit {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--zw-blue-700);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.zw-evt-verify__submit:hover { background: var(--zw-blue-800); }

/* === Add tickets ===
   Raising the count on a registration that already exists. The stepper carries
   the desired TOTAL, seeded with what the person holds, so it reads the same way
   as the ticket type rows above it. */
.zw-evt-add { display: flex; flex-direction: column; gap: 10px; }

.zw-evt-add__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--zw-ink-2);
}

.zw-evt-add__form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Takes the remaining width so the button is a real target on a phone, where
   the stepper and the button would otherwise crowd each other. */
.zw-evt-add__submit {
  flex: 1 1 auto;
  min-width: 140px;
  padding: 10px 16px;
  border: 1px solid var(--zw-blue-700);
  border-radius: var(--zw-radius-md, 12px);
  background: transparent;
  color: var(--zw-blue-700);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.zw-evt-add__submit:hover { background: var(--zw-blue-50, #eef4fa); }
