/*
 * Events styles. Deliberately self-contained and prefixed (.evt-) so they sit inside any
 * theme's storefront and inside the admin shell without fighting either stylesheet.
 *
 * This file is loaded in *two* places with two different token vocabularies, so every colour
 * names both: `var(--color-role, var(--admin-token, #literal))`. The storefront emits the
 * semantic roles (--color-surface, --color-ink-muted, --color-border, --color-accent) inline
 * on every page; the admin shell defines the design-system tokens (--surface, --muted,
 * --border, --brand-600). Whichever context this lands in, one of the two resolves.
 *
 * It used to name the admin tokens only. On the storefront none of them exist, so every
 * colour silently fell through to its light-mode literal — `background: #fff` under ink that
 * follows the palette. In dark mode that is white text on a white card: /account/calendar/
 * and the waiting-list form were blank panels on every theme. A hard-coded fallback does not
 * fail loudly, it just quietly stops following the palette, so put the role first.
 *
 * The same bug then repeated one level in. Three of the middle names — `--danger-600`,
 * `--danger-700` and `--focus` — are not design-system tokens and never were, so on the *admin*
 * side those colours were the literal too, and stayed light-mode red on a dark tour form once
 * the admin learned to follow the device.
 * `tests/dashboard/test_admin_dark_mode.py::test_no_fallback_names_a_token_that_does_not_exist`
 * checks every middle name here against the tokens `dashboard.css` actually defines: a fallback
 * chain is only as good as the spelling of the thing it falls back to.
 */

.evt-page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.evt-lead {
  color: var(--color-ink-muted, var(--muted, #4b5563));
  margin-bottom: 1.5rem;
}

.evt-card,
.evt-venue,
.evt-feed,
.evt-waitlist,
.evt-tickets {
  border: 1px solid var(--color-border, var(--border, #e5e7eb));
  border-radius: var(--radius, 10px);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  background: var(--color-surface, var(--surface, #fff));
}

.evt-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
}

/* Themes reset every heading's margin at (0,1,2); the extra element keeps this one. */
body section.evt-tickets > h2 {
  margin: 0 0 0.75rem;
}

.evt-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--color-border, var(--border, #e5e7eb));
  font-size: 0.8125rem;
  font-weight: 500;
}

.evt-when,
.evt-intro {
  color: var(--color-ink-muted, var(--muted, #4b5563));
  margin: 0 0 1rem;
}

/* --- fields ------------------------------------------------------------ */

.evt-field[hidden] { display: none; }
.evt-field {
  margin-bottom: 1rem;
}

.evt-field > label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.evt-field input[type="text"],
.evt-field input[type="email"],
.evt-field input[type="tel"],
.evt-field input[type="date"],
.evt-field input[type="number"],
.evt-field select,
.evt-field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border, var(--border, #cbd5e1));
  border-radius: var(--radius-sm, 8px);
  font: inherit;
  color: inherit;
  background: var(--color-surface, var(--surface, #fff));
}

.evt-field-check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.evt-field-check input {
  margin-top: 0.25rem;
  width: 1.05rem;
  height: 1.05rem;
}

.evt-field-check label {
  font-weight: 500;
}

/* A "choose any" question (and a radio group): the question is the fieldset's legend, above its
   options, and each option is Django's own `<label><input> Name</label>` — box beside its words,
   one per line. The browser's fieldset border and padding would be a box inside the form. */
.evt-choices {
  border: 0;
  padding: 0;
  min-width: 0;
}

.evt-choices legend {
  padding: 0;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.evt-choices > div > div {
  margin-bottom: 0.35rem;
}

.evt-choices label:has(> input[type="checkbox"], > input[type="radio"]) {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 400;
}

.evt-choices label > input[type="checkbox"],
.evt-choices label > input[type="radio"] {
  flex: none;
  margin-top: 0.25rem;
  width: 1.05rem;
  height: 1.05rem;
}

.evt-hint {
  color: var(--color-ink-muted, var(--muted, #6b7280));
  font-size: 0.875rem;
  margin: 0.3rem 0 0;
}

.evt-error {
  color: var(--color-danger, var(--danger-fg, #b91c1c));
  font-size: 0.875rem;
  margin: 0.3rem 0 0;
  font-weight: 500;
}

/* Never signal state with colour alone. */
.evt-field.has-error > label::after {
  content: " !";
  font-weight: 700;
}

.evt-field.has-error input,
.evt-field.has-error select,
.evt-field.has-error textarea {
  border-width: 2px;
  border-color: var(--color-danger, var(--danger, #dc2626));
}

.evt-req {
  color: var(--color-danger, var(--danger-fg, #b91c1c));
}

.evt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.evt-summary {
  border: 2px solid var(--color-danger, var(--danger, #dc2626));
  border-radius: var(--radius, 10px);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.evt-summary h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.evt-summary ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* --- waiver + signature ------------------------------------------------- */

.evt-waiver {
  border: 1px solid var(--color-border, var(--border, #e5e7eb));
  border-radius: var(--radius-sm, 8px);
  padding: 1rem;
  margin: 1.25rem 0 0;
}

.evt-waiver legend {
  font-weight: 600;
  padding: 0 0.4rem;
}

.evt-version {
  font-weight: 400;
  color: var(--color-ink-muted, var(--muted, #6b7280));
  font-size: 0.875rem;
}

.evt-waiver-text {
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid var(--color-border, var(--border, #e5e7eb));
  border-radius: var(--radius-sm, 8px);
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: var(--color-surface-raised, var(--surface-2, #f9fafb));
  line-height: 1.6;
}

/* A waiver is prose a merchant wrote in the rich-text editor, so it arrives as
   <p>, <ul> and headings. Every theme resets those to margin: 0 at (0,1,2), which
   is why the clauses ran together on the storefront while the admin (which has
   its own rule) looked formatted. The adjacent-sibling form is (0,1,3) and wins. */

body .evt-waiver-text :is(p, ul, ol, blockquote, h2, h3, h4) + :is(p, ul, ol, blockquote, h2, h3, h4) {
  margin-top: 0.75rem;
}

body .evt-waiver-text :is(ul, ol) {
  padding-left: 1.25rem;
}

body .evt-waiver-text :is(h2, h3, h4) {
  font-size: 1rem;
}

.evt-pad {
  margin-top: 0.5rem;
}

.evt-pad-panel {
  margin-top: 0.75rem;
}

.evt-pad-canvas {
  width: 100%;
  max-width: 32rem;
  height: 9rem;
  display: block;
  border: 1px dashed var(--color-border, var(--border, #9ca3af));
  border-radius: var(--radius-sm, 8px);
  background: #fff;
  touch-action: none;
}

/* --- map ---------------------------------------------------------------- */

.evt-map {
  height: var(--evt-map-height, 320px);
  border-radius: var(--radius, 10px);
  border: 1px solid var(--color-border, var(--border, #e5e7eb));
  margin: 0.75rem 0 0.5rem;
}

.evt-address {
  font-style: normal;
  line-height: 1.5;
}

/* `body p.`/`body …h3`: these are headings and paragraphs, and a theme's margin reset on them is
   (0,1,2) — the directions sat on the map gate, the feed URL on its button and the waiting-list
   heading on its form. This file is linked inside the page, after the theme, so a tie wins. */
body p.evt-directions { margin: 0.75rem 0 0; }
body p.evt-feed-url { margin: 0.5rem 0 1rem; }
body .evt-waitlist h3 { margin: 0 0 0.75rem; }
body .evt-feed h2 { margin: 0 0 0.5rem; }
body h3.evt-venue-title { margin: 0 0 0.5rem; }
/* In the field guide the venue is a sub-block like the others: the same sub-heading, and the same
   air above it as between the guide's own sub-blocks. */
.evt-guide-section > .evt-guide-block + .evt-venue,
.evt-guide-section > .evt-venue:not(:first-of-type) { margin-top: 1.75rem; }
body .evt-guide-section h3.evt-venue-title { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }

.evt-directions a,
.evt-calendar-links a {
  margin-right: 1rem;
}

.evt-calendar-label {
  font-weight: 600;
  margin-right: 0.5rem;
}

.evt-codes code {
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.evt-feed-url code {
  word-break: break-all;
}

/* --- buttons and states -------------------------------------------------- */

.evt-btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid transparent;
  background: var(--color-accent, var(--brand-600, #1d4ed8));
  color: var(--color-accent-ink, #fff);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.evt-btn-secondary {
  background: transparent;
  color: inherit;
  border-color: var(--color-border, var(--border, #cbd5e1));
  font-weight: 500;
}

.evt-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.evt-visibility-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.evt-visibility-form select,
.evt-visibility-form input[type="text"] {
  max-width: 9rem;
}

/* The guide on each date: a name needs its own room, or the column squeezes it to an arrow. */
.evt-guide-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.evt-guide-form select {
  min-width: 9rem;
}

.evt-message {
  border-left: 4px solid var(--color-accent, var(--brand-600, #1d4ed8));
  padding: 0.6rem 0.9rem;
  background: var(--color-surface-raised, var(--surface-2, #f9fafb));
}

.evt-messages {
  list-style: none;
  padding: 0;
}

:where(.evt-page, .evt-venue, .evt-feed, .evt-waitlist) :focus-visible {
  outline: 3px solid var(--color-accent, var(--brand-500, #2563eb));
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .evt-btn,
  .evt-map,
  .evt-waiver-text {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* "Start from details we remember": a small row above a ticket's questions. */
.evt-who { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.evt-who select { min-width: 12rem; max-width: 100%; }

/* --- an agency's guests: the names page and the group-signing page ------ */

.evt-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.evt-counts strong {
  font-size: 1.25rem;
  margin-right: 0.25rem;
}

.evt-table-wrap {
  overflow-x: auto;
}

.evt-guest-table {
  width: 100%;
  border-collapse: collapse;
}

.evt-guest-table th,
.evt-guest-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--color-border, var(--border, #e5e7eb));
}

.evt-guest-table input[type="text"] {
  width: 100%;
  min-width: 12rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--color-border, var(--border, #cbd5e1));
  border-radius: var(--radius-sm, 8px);
  font: inherit;
  font-size: 0.85rem;
  color: inherit;
  background: var(--color-surface, var(--surface, #fff));
}

.evt-inline {
  margin-top: 0.4rem;
}

/* Everybody on a booking, one person at a time (`events/_roster_cards_shop.html`): the people on
   the left with where each stands, the chosen person's whole form on the right. Colours are the
   storefront's roles, so every theme draws it. On a phone the list is a "Person 2 of 4" picker
   above the form. */
.evt-page-wide {
  max-width: 70rem;
}

.evt-roster {
  display: grid;
  grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.evt-roster-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 1rem;
  min-width: 0;
}

.evt-roster-list h2 {
  font-size: 1.05rem;
}

.evt-people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.evt-person {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.65rem;
  border-left: 3px solid var(--color-border, var(--border, #cbd5e1));
  border-radius: var(--radius-sm, 8px);
  color: inherit;
  text-decoration: none;
}

.evt-person:hover {
  text-decoration: underline;
}

.evt-person small {
  font-size: 0.8rem;
  color: var(--color-ink-muted, var(--muted, #4b5563));
}

.evt-person.complete {
  border-left-color: var(--color-accent, var(--brand-600, #2563eb));
}

.evt-person.no_name {
  border-left-color: var(--color-danger, var(--danger, #dc2626));
}

.evt-person.on {
  box-shadow: inset 0 0 0 1px var(--color-accent, var(--brand-600, #2563eb));
}

.evt-roster-picker {
  display: none;
}

.evt-roster-form {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.evt-person-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.evt-person-head h2 {
  margin: 0;
}

.evt-person-head .evt-intro {
  margin: 0;
}

.evt-switch {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  font-size: 0.9rem;
  text-decoration: none;
}

.evt-switch-track {
  position: relative;
  width: 2.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--color-border, var(--border, #cbd5e1));
  flex: none;
}

.evt-switch-track::after {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: var(--color-surface, var(--surface, #fff));
}

.evt-switch.on .evt-switch-track {
  background: var(--color-accent, var(--brand-600, #2563eb));
}

.evt-switch.on .evt-switch-track::after {
  left: 1.1rem;
}

.evt-remember {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm, 8px);
  background: var(--color-surface-muted, var(--surface-2, #f3f4f6));
}

.evt-remember label {
  width: 100%;
}

.evt-box {
  min-width: 0;
}

.evt-box[hidden] {
  display: none;
}

.evt-asked {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

.evt-remembered {
  margin-top: 0.3rem;
}

.evt-same {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.9rem;
  margin: 0.25rem 0 0.9rem;
}

/* One person's form: the remembered-answer picker posts through a form of hidden fields only. */
.evt-from-form {
  display: none;
}

.evt-person-card {
  min-width: 0;
}

.evt-person-form,
.evt-person-questions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.evt-person-questions .evt-box {
  margin: 0;
}

/* The phone's "Person 2 of 4" picker: Back and Next at either end under it. */
.evt-pick-steps {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 0;
}

/* The group link page's line above its heading: the event and its date. */
.evt-eyebrow {
  color: var(--color-ink-muted, var(--muted, #4b5563));
  font-size: 0.9rem;
  margin: 0 0 0.25rem;
}

.evt-person-actions {
  margin-top: 0.5rem;
}

.evt-roster-share input {
  width: 100%;
}

@media (max-width: 900px) {
  .evt-roster {
    grid-template-columns: minmax(0, 1fr);
  }

  .evt-roster-side {
    position: static;
    order: 2;
  }
}

@media (max-width: 720px) {
  .evt-people {
    display: none;
  }

  .evt-roster-picker {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .evt-pick {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
  }

  .evt-pick select {
    flex: 1;
    min-width: 0;
  }

  .evt-switch {
    margin-left: 0;
  }
}

.evt-sheet {
  margin-top: 1rem;
}

.evt-sheet summary {
  cursor: pointer;
  font-weight: 600;
}

.evt-sheet textarea {
  width: 100%;
  font: inherit;
}

/* A done panel is a status, not an error: the summary box's own look with a calm heading. */
.evt-done h2 {
  margin: 0 0 0.25rem;
}

/* On a phone the table is a stack of cards, each cell labelled by its heading, so nothing
   scrolls sideways. */
@media (max-width: 640px) {
  .evt-guest-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .evt-guest-table tr {
    display: block;
    border-bottom: 1px solid var(--color-border, var(--border, #e5e7eb));
    padding: 0.5rem 0;
  }

  .evt-guest-table td {
    display: block;
    border: 0;
    padding: 0.25rem 0;
  }

  .evt-guest-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8rem;
    color: var(--color-ink-muted, var(--muted, #4b5563));
  }
}

/* --- the agency's guest pages, the guest's own page and the trade tag ------ */

/* A form that holds cards and fieldsets: stack them with the room the cards already carry. */
.evt-form {
  display: block;
  max-width: 100%;
}

/* A link inside a sentence. `inherit` rather than the accent: an accent is not guaranteed to
   read as text on every theme's ground, the page's own ink always is. */
.evt-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* The signature box under a waiver: the typed name and, once the script runs, the drawing pad. */
.evt-sign {
  margin-top: 1rem;
}

.evt-sign .evt-pad-canvas {
  max-width: 100%;
}

/* "Where things stand" on the agency's names page. */
.evt-guest-summary {
  background: var(--color-surface-raised, var(--surface-2, #f9fafb));
}

/* "Trade price" beside the from-price. */
.evt-book-trade {
  margin-left: 0.5rem;
  white-space: nowrap;
}
