/* Extensia Events — mobile-first. Swap --accent for the organization's brand color. */
:root {
  --accent: #1d4e89;
  --accent-ink: #ffffff;
  --accent-soft: #e8eff8;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16191d;
  --muted: #5d6570;
  --line: #e2e5ea;
  --good: #1b7a43;
  --good-soft: #e5f4ec;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --warn: #8a5300;
  --warn-soft: #fdf2df;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #7fb0ea;
    --accent-ink: #0b1624;
    --accent-soft: #1b2a3c;
    --bg: #0f1216;
    --surface: #181c22;
    --ink: #eceff3;
    --muted: #a0a8b3;
    --line: #2a3038;
    --good: #5fcf8e;
    --good-soft: #15291e;
    --bad: #ff8a80;
    --bad-soft: #321a18;
    --warn: #f0c36d;
    --warn-soft: #2e2415;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
body.has-buybar { padding-bottom: 84px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 16px 0 12px; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
p { margin: 0 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 40px; }
.wrap.narrow { max-width: 600px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.center { text-align: center; }
.fine { font-size: .85rem; color: var(--muted); }
.back { display: inline-block; margin: 16px 0 12px; text-decoration: none; font-weight: 500; min-height: 44px; line-height: 44px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 16px 0; }
.small-h { font-size: 1rem; margin: 24px 0 8px; }

/* Header */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.site-head .wrap { padding-top: 20px; padding-bottom: 16px; }
.site-head h1 { margin: 0; }
/* An organisation's own logo, shown above its name on its events page. Capped in height so a large
   image cannot push the page title off a phone screen, and width follows so nothing is squashed. */
.org-logo { display: block; height: 40px; width: auto; max-width: 240px; margin: 0 0 10px; }
.org { margin: 0 0 2px; font-weight: 700; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; font-size: .8rem; }

/* Event list */
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
@media (min-width: 700px) { .event-list { grid-template-columns: repeat(2, 1fr); } }
.event-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); height: 100%; }
.event-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--accent-soft); }
.event-card-body { padding: 14px 16px 16px; }
.event-card h2 { font-size: 1.15rem; margin: 2px 0 4px; }
.eyebrow { font-size: .8rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; margin: 0; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 0; }
.price { font-weight: 700; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--bad-soft); color: var(--bad); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* Event page */
.hero, .gallery img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: var(--accent-soft); }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); }
.gallery img { flex: 0 0 100%; scroll-snap-align: center; }
.facts { list-style: none; padding: 0; margin: 0 0 12px; border-top: 1px solid var(--line); }
.facts li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts .k { color: var(--muted); font-size: .9rem; }
/* The same list with room for a real label. Used where the left column says "Phone number" rather
   than "Date" — a person reading a copy of their own record, where squashing the label to two lines
   makes the one page that has to be unambiguous harder to read. */
.facts.wide li { grid-template-columns: minmax(96px, 34%) 1fr; }
.description { margin: 16px 0; }
.description p { margin-bottom: 12px; }
details.calendar, details.lost { margin: 12px 0; }
details > summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 44px; display: flex; align-items: center; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "▾"; margin-left: 6px; font-size: .8em; }
details[open] > summary::after { content: "▴"; }
.cal-links { display: grid; gap: 8px; margin-top: 4px; }
.cal-links a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; font-weight: 500; }
.cal-links.grid { grid-template-columns: 1fr 1fr; margin-bottom: 20px; }
.cal-links.grid a { justify-content: center; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--line); }
.notice.accent { background: var(--accent-soft); }

/* Forms */
.field { margin-bottom: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--bad); }
/* A list of web addresses, one per line: never wrapped and never auto-capitalised, because a
   changed character in a web address is a site that silently stops working. */
textarea { min-height: 7em; line-height: 1.5; resize: vertical; white-space: pre; overflow-wrap: normal; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.stack > * + * { margin-top: 12px; }
.help { font-size: .85rem; color: var(--muted); margin: 4px 0 0; }
.field-error, .error { color: var(--bad); font-size: .9rem; margin: 6px 0 0; font-weight: 500; }
.error { padding: 10px 12px; background: var(--bad-soft); border-radius: 10px; margin: 12px 0; }
.qty { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 0; font-weight: 600; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 52px; height: 48px; border: 0; background: var(--surface); color: var(--accent); font-size: 1.5rem; cursor: pointer; }
.stepper button:disabled { color: var(--line); cursor: default; }
.stepper output { min-width: 44px; text-align: center; font-weight: 700; font-size: 1.1rem; }
.total { display: flex; justify-content: space-between; font-size: 1.05rem; margin: 16px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.cf-turnstile { margin: 8px 0 12px; }
.consent { margin: 16px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.consent legend { padding: 0 6px; font-weight: 600; font-size: .95rem; }
.consent .help { margin: 0 0 10px; }
/* Tick boxes read as one tappable line, so the words are the target and not just the small square. */
.consent .check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; margin: 0 0 8px; min-height: 44px; line-height: 1.4; }
.consent .check:last-child { margin-bottom: 0; }
.consent .check input { width: 22px; min-height: 22px; height: 22px; flex: 0 0 auto; margin-top: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.light { background: rgba(255, 255, 255, .95); color: #111; border-color: transparent; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form.inline { margin: 0; display: inline-flex; }

.buybar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(0, 0, 0, .06); z-index: 10; }
.buybar .btn { min-width: 140px; }
@media (min-width: 900px) { .buybar { display: none; } body.has-buybar { padding-bottom: 0; } }

/* Pay + order */
.summary .line { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.hold { text-align: center; margin: 12px 0 16px; color: var(--muted); }
#payment-element { margin-bottom: 16px; min-height: 120px; }
.status { padding: 16px; border-radius: var(--radius); margin: 16px 0; background: var(--accent-soft); }
.status.good { background: var(--good-soft); }
.status.good .strong { color: var(--good); }
.status.bad { background: var(--bad-soft); }
.status.bad .strong { color: var(--bad); }
/* Something needs the person's attention but nothing is broken — e.g. the ticket is valid
   and on the page, but the email could not be delivered. Not the same as .bad. */
.status.warn { background: var(--warn-soft); }
.status.warn .strong { color: var(--warn); }
.status .strong { font-size: 1.15rem; }
.tickets { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.ticket { display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.ticket .qr { background: #fff; border-radius: 8px; padding: 2px; }
.ticket .qr svg { width: 100%; height: auto; display: block; }
.ticket.void { opacity: .5; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; color: var(--muted); }
@media (max-width: 360px) { .ticket { grid-template-columns: 1fr; } .ticket .qr { max-width: 240px; margin: 0 auto; } }
.center-page { padding-top: 48px; text-align: center; }
@media print { .btn, .back, .buybar, .cal-links { display: none !important; } .ticket { break-inside: avoid; } }

/* Staff */
.staff-head { display: grid; gap: 8px; margin: 16px 0 8px; }
.staff-head h1 { margin: 0; }
.plain { list-style: none; padding: 0; margin: 0; }
.status .plain li + li { margin-top: 8px; }
.admin-event h2 { font-size: 1.1rem; margin: 4px 0; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 8px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile-v { font-size: 1.4rem; font-weight: 700; margin: 0; }
.tile-k { color: var(--muted); font-size: .85rem; margin: 0; }
.reg { margin: 10px 0; }
.reg.void { opacity: .6; }
.reg-top { display: flex; justify-content: space-between; gap: 12px; }
.reg p { margin: 2px 0; overflow-wrap: anywhere; }

.stats { font-size: 1.1rem; margin: 8px 0 12px; }
.camera { background: #000; border-radius: var(--radius); overflow: hidden; position: relative; }
.camera video { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: none; }
.camera.on video { display: block; }
.camera.on #start-cam { display: none; }
.camera #start-cam { border-radius: 0; min-height: 120px; }
.lookup { margin: 20px 0 8px; }
.lookup .row { display: flex; gap: 8px; }
.lookup .row input { flex: 1; }
.lookup-order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 10px 0; }
.lookup-order .tk { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.lookup-order .tk:first-of-type { border-top: 0; }
.lookup-order .btn { min-height: 40px; padding: 0 12px; }
.result { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; color: #fff; background: #555; }
.result[hidden] { display: none; }
.result.ok { background: #157a3f; }
.result.bad { background: #b3261e; }
.result.warn { background: #9a6200; }
.result-inner { width: 100%; max-width: 420px; text-align: center; display: grid; gap: 12px; }
.result-title { font-size: 2rem; font-weight: 800; margin: 0; }
.result-name { font-size: 1.4rem; font-weight: 600; margin: 0; }
.result-detail { margin: 0 0 12px; opacity: .92; }

/* Inside a frame on somebody else's website. The page carries its own background on purpose rather
   than going transparent: borrowing the host site's background would put our dark text on whatever
   colour they chose, and unreadable is worse than slightly mismatched. */
body.embed { padding: 0; }
body.embed main.wrap { padding-top: 12px; padding-bottom: 16px; max-width: 720px; }
body.embed .hero, body.embed .gallery img { border-radius: 0; }
.embed-foot { margin: 20px 0 4px; font-size: 14px; text-align: center; }

/* The two lines an organiser copies. Selectable, never wrapped mid-address, and horizontally
   scrollable, because a line break pasted into the middle of a web address is a broken embed. */
pre.snippet { margin: 8px 0 4px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow-x: auto; }
pre.snippet code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre; }
