/* GFTV HelloEvents stylesheet.
   Section 1 is the GFTV theme contract from gftv-theme.md: font, structural
   tokens, one colour block per colour theme x mode, derived tokens, and the
   shared primitives (glass, buttons, focus, loading), taken from
   gftv-linktree's style.css so the two sites look and behave alike. Section
   2 is this app's components. No colour is written outside section 1; the
   QR pair is the one exception, explained where it sits. */

/* ---------------------------------------------------------------------- */
/* 1. Theme                                                                */
/* ---------------------------------------------------------------------- */

/* Proxima Nova is licensed and is not on Google Fonts, so it is self hosted.
   Only the regular weight is present; the browser synthesises the rest. */
@font-face {
  font-family: 'Proxima Nova';
  src: url('/assets/fonts/ProximaNova-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* structural, no colour */
:root {
  --glass-blur: 16px;
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, Helvetica, Arial, sans-serif;
  --motion: 180ms;
  /* A QR code has to be dark on light for a scanner to read it, whatever
     mode the page is in. These two are a print rule, not a theme colour. */
  --qr-fg: #000000;
  --qr-bg: #ffffff;
  /* The page tours' dim and chalk (js/tour.js) are the same in every theme
     and mode: the tour reads over a light page or a dark one alike, as
     page-tour-spec.md asks. The second exception, for the same reason. */
  --tour-dim: rgba(8, 14, 10, 0.86);
  --tour-backing: rgba(8, 14, 10, 0.92);
  --tour-glow: rgba(255, 255, 255, 0.35);
  --tour-chalk: #f6f1e6;
  --tour-chalk-faint: rgba(246, 241, 230, 0.4);
  --tour-ink: #1a221d;
  --tour-shade: rgba(0, 0, 0, 0.6);
}

/* one block per colour theme x mode */
:root[data-color-theme="classic"][data-mode="light"] {
  --brand: #ffffff;
  --brand-dark: #4a6a8a;
  --brand-text: #1a3a5a;
  --brand-on: #ffffff;
  --bg: #ffffff;
  --bg-alt: #f5f5f5;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-hover: rgba(245, 245, 245, 0.8);
  --surface-active: rgba(235, 235, 235, 0.95);
  --border: rgba(180, 190, 200, 0.4);
  --border-strong: rgba(140, 155, 170, 0.6);
  --text: #1a1a2e;
  --text-muted: #4a5568;
  --text-light: #6b7280;
  --shadow: rgba(100, 120, 140, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.6);
  --link: #EF3340;
  --link-visited: #4b4bd6;
  --danger: #b03325;
  --danger-hover: #8a2a2a;
  --danger-on: #ffffff;
  --ok: #177038;
  --warn: #8a5200;
  --info: #1d5fa8;
}

:root[data-color-theme="classic"][data-mode="dark"] {
  --brand: #ffffff;
  --brand-dark: #8fb0cf;
  --brand-text: #cfe0f0;
  --brand-on: #10161d;
  --bg: #0f1317;
  --bg-alt: #161b21;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.10);
  --surface-active: rgba(255, 255, 255, 0.14);
  --border: rgba(160, 180, 200, 0.18);
  --border-strong: rgba(160, 180, 200, 0.32);
  --text: #eceff3;
  --text-muted: #a7b2be;
  --text-light: #7d8794;
  --shadow: rgba(0, 0, 0, 0.5);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --link: #ff6b74;
  --link-visited: #a9a9ff;
  --danger: #ff8a80;
  --danger-hover: #ffb3ac;
  --danger-on: #1a0f0e;
  --ok: #6ee7a0;
  --warn: #fbbf24;
  --info: #8cc4ff;
}

:root[data-color-theme="hello"][data-mode="light"] {
  --brand: #fedc00;
  --brand-dark: #9e8800;
  --brand-text: #3a3000;
  --brand-on: #ffffff;
  --bg: #fffde0;
  --bg-alt: #fff9c4;
  --surface: rgba(254, 220, 0, 0.35);
  --surface-hover: rgba(254, 220, 0, 0.55);
  --surface-active: rgba(254, 220, 0, 0.7);
  --border: rgba(200, 170, 0, 0.3);
  --border-strong: rgba(160, 130, 0, 0.5);
  --text: #2e2800;
  --text-muted: #5a4e00;
  --text-light: #7a6c00;
  --shadow: rgba(160, 130, 0, 0.15);
  --glass-highlight: rgba(255, 255, 255, 0.5);
  --link: #EF3340;
  --link-visited: #4b4bd6;
  --danger: #b03325;
  --danger-hover: #8a2a2a;
  --danger-on: #ffffff;
  --ok: #177038;
  --warn: #8a5200;
  --info: #1d5fa8;
}

:root[data-color-theme="hello"][data-mode="dark"] {
  --brand: #fedc00;
  --brand-dark: #fedc00;
  --brand-text: #ffe873;
  --brand-on: #2e2800;
  --bg: #14120a;
  --bg-alt: #1c1a0e;
  --surface: rgba(254, 220, 0, 0.10);
  --surface-hover: rgba(254, 220, 0, 0.16);
  --surface-active: rgba(254, 220, 0, 0.22);
  --border: rgba(254, 220, 0, 0.20);
  --border-strong: rgba(254, 220, 0, 0.36);
  --text: #f5f0dc;
  --text-muted: #c4ba8e;
  --text-light: #9a9270;
  --shadow: rgba(0, 0, 0, 0.55);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --link: #ff6b74;
  --link-visited: #a9a9ff;
  --danger: #ff8a80;
  --danger-hover: #ffb3ac;
  --danger-on: #1a0f0e;
  --ok: #6ee7a0;
  --warn: #fbbf24;
  --info: #8cc4ff;
}

/* derived, resolves per combination */
:root {
  --brand-dark-hover: color-mix(in srgb, var(--brand-dark) 85%, var(--text));
  --text-muted-strong: color-mix(in srgb, var(--text) 70%, transparent);
  --callout-danger-bg: color-mix(in srgb, var(--danger) 14%, transparent);
  --callout-ok-bg: color-mix(in srgb, var(--ok) 14%, transparent);
  --callout-warn-bg: color-mix(in srgb, var(--warn) 14%, transparent);
  --callout-info-bg: color-mix(in srgb, var(--info) 14%, transparent);
  --focus-ring: var(--brand-dark);
  /* Timetable rooms (js/timetable.js): six hues taken from the theme's own
     colours, so every colour theme and mode gets a matching set, plus a
     neutral one for items in no room. Each is a tinted fill and an edge. */
  --tt-c0: var(--brand-dark);
  --tt-c1: var(--ok);
  --tt-c2: var(--warn);
  --tt-c3: var(--link-visited);
  --tt-c4: var(--danger);
  --tt-c5: var(--link);
  --tt-cx: var(--text-muted);
  --tt-fill-mix: 18%;
  --tt-band: color-mix(in srgb, var(--text) 4%, transparent);
  --tt-grid-bg: var(--bg-alt);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font), var(--emoji-fonts); }
/* Only html is held to the screen's height: body grows with the page (min-height below), or the
   sticky header, which can't leave body, would scroll away after the first screenful. */
html { height: 100%; }

html { color-scheme: light; }
:root[data-mode="dark"] { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection { background: var(--brand-dark); color: var(--brand-on); }

/* No underline in any state. See the exceptions section of the theme. */
a, a:link, a:visited, a:hover, a:focus, a:active { text-decoration: none; }
:link { color: var(--link); }
:visited { color: var(--link-visited); }

/* The non-colour distinction that replaces the underline. */
:where(p, li, dd, dt, td, th, blockquote, figcaption, .lede) a { font-weight: 600; }

button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.6; }
input, textarea, select { font: inherit; color: inherit; }

img, svg { display: block; max-width: 100%; }
.icon { display: inline-flex; flex: none; }
.icon svg { width: 1em; height: 1em; }

[hidden] { display: none !important; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* glass primitive */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow) 0 8px 24px, inset 0 1px 0 var(--glass-highlight);
}

/* focus, see the audit section of the theme */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 45%, transparent);
}

/* A heading given focus by script, so a screen reader announces a new step,
   is not a control and shows no ring. */
:where(h1, h2)[tabindex="-1"]:focus,
:where(h1, h2)[tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }

/* loading primitives */
@keyframes gftv-spin { to { transform: rotate(360deg); } }
@keyframes gftv-pulse { 50% { opacity: 0.45; } }
@keyframes gftv-fade-in { from { opacity: 0 } to { opacity: 1 } }

.spinner {
  --spinner-size: 1.25rem;
  --spinner-weight: 2px;
  display: inline-block;
  flex: none;
  width: var(--spinner-size);
  height: var(--spinner-size);
  border-radius: 50%;
  border: var(--spinner-weight) solid color-mix(in srgb, var(--text) 16%, transparent);
  border-top-color: var(--brand-dark);
  animation: gftv-spin 700ms linear infinite;
}

/* On a --brand-dark fill, where the accent border would vanish. */
.btn-primary .spinner {
  border-color: color-mix(in srgb, var(--brand-on) 30%, transparent);
  border-top-color: var(--brand-on);
}

.skeleton {
  background: var(--surface-active);
  border-radius: var(--radius-sm);
  animation: gftv-pulse 1.4s ease-in-out infinite;
}

.delayed { animation: gftv-fade-in 180ms ease 250ms both; }

/* A skeleton that is also .delayed runs both: the fade after 250ms, then the
   pulse. One animation property would otherwise let the fade replace it. */
.skeleton.delayed {
  animation: gftv-fade-in 180ms ease 250ms both, gftv-pulse 1.4s ease-in-out 430ms infinite;
}

/* The one exception to the reduced motion rule: these slow down, not stop. */
@media (prefers-reduced-motion: reduce) {
  .spinner  { animation-duration: 2s   !important; animation-iteration-count: infinite !important; }
  .skeleton { animation-duration: 2.4s !important; animation-iteration-count: infinite !important; }
  .delayed  { animation: none !important; }
  .skeleton.delayed { animation: gftv-pulse 2.4s ease-in-out infinite !important; }
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  background: var(--surface-active);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background-color var(--motion) ease, color var(--motion) ease,
    border-color var(--motion) ease, transform var(--motion) ease;
}
.btn:link, .btn:visited { color: var(--text); }
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  background: var(--brand-dark);
  color: var(--brand-on);
  border-color: transparent;
}
.btn-primary:link, .btn-primary:visited { color: var(--brand-on); }
.btn-primary:hover { background: var(--brand-dark-hover); border-color: transparent; }

.btn-quiet { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-quiet:hover { background: var(--surface-hover); border-color: transparent; color: var(--text); }

.btn-danger { background: var(--danger); color: var(--danger-on); border-color: transparent; }
.btn-danger:hover { background: var(--danger-hover); border-color: transparent; }

.btn-block { width: 100%; }
.btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.btn-small { min-height: 36px; padding: 0.35rem 0.8rem; font-size: 0.9375rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-muted-strong);
  transition: background-color var(--motion) ease, color var(--motion) ease;
}
.icon-btn:hover { background: var(--surface-active); color: var(--text); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.small svg { width: 16px; height: 16px; }

/* modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, var(--bg) 33%, transparent);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  opacity: 1;
  visibility: visible;
  transition: opacity var(--motion) ease, visibility 0s;
}
.modal-backdrop.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--motion) ease, visibility 0s var(--motion);
}
.modal {
  width: 100%;
  max-width: 22rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.25rem;
  /* The backdrop is translucent, so the modal itself needs an opaque ground. */
  background: color-mix(in srgb, var(--bg) 88%, var(--surface));
  transform: translateY(0) scale(1);
  transition: transform var(--motion) ease;
}
.modal.wide { max-width: 30rem; }
/* manage: the cover crop dialog (js/cover-crop.js), its frame the shape of
   the cards' thumbnail */
.modal.crop-modal { max-width: 40rem; }
.crop-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0.75rem 0 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--surface-active);
  cursor: grab;
  touch-action: none;
}
.crop-frame:active { cursor: grabbing; }
.crop-zoom { display: flex; align-items: center; gap: 0.75rem; margin: 0.75rem 0; font-weight: 600; font-size: 0.9375rem; }
.crop-zoom input { flex: 1 1 auto; accent-color: var(--brand-dark); }
.modal-backdrop.hidden .modal { transform: translateY(8px) scale(0.98); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.modal-head h2 { font-size: 1.125rem; font-weight: 600; }
.modal-section-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.modal p + p { margin-top: 0.5rem; }
.modal .actions { margin-top: 1rem; }

/* theme modal */
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-active);
  border: 1px solid var(--border);
  font-weight: 600;
  transition: background-color var(--motion) ease, color var(--motion) ease;
}
.mode-btn svg { width: 18px; height: 18px; }
.mode-btn:hover { background: var(--surface-hover); }
.mode-btn.active { background: var(--brand-dark); color: var(--brand-on); border-color: transparent; }
/* Time based mode: the third button spans the row beneath light and dark. */
.mode-btn-wide { grid-column: 1 / -1; }
.mode-note { margin-top: 0.5rem; font-size: 0.875rem; color: var(--text-muted); }

.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.5rem; }
.swatch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  transition: background-color var(--motion) ease, box-shadow var(--motion) ease;
}
.swatch:hover { background: var(--surface-hover); }
.swatch.active {
  border-color: var(--swatch-color);
  box-shadow:
    0 0 0 2px var(--swatch-color),
    0 0 0 3px color-mix(in srgb, var(--text) 50%, transparent);
}
.swatch-dot {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: var(--swatch-color);
  border: 1px solid color-mix(in srgb, var(--text) 30%, transparent);
}

/* ---------------------------------------------------------------------- */
/* 2. App                                                                  */
/* ---------------------------------------------------------------------- */

body { display: flex; flex-direction: column; min-height: 100dvh; }

/* official banner, see gftv-official.md */
.gov-bar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.gov-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.375rem 1rem;
  padding-top: max(0.375rem, env(safe-area-inset-top));
  white-space: nowrap;
}
.gov-bar-mark { width: 24px; height: 16px; flex: none; border-radius: 2px; }
.gov-bar-line { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gov-bar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: none;
  min-height: 32px;
  padding: 0 0.25rem;
  color: var(--brand-text);
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.gov-bar-toggle svg { width: 14px; height: 14px; transition: transform var(--motion) ease; }
.gov-bar-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
/* Expand and collapse animate an explicit pixel height set by the script;
   at rest the inline height is cleared so the panel sizes to its content. */
.gov-bar-panel { overflow: hidden; transition: height var(--motion) ease; }
.gov-bar-panel-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 1rem;
  font-size: 0.875rem;
  white-space: normal;
}
.gov-bar-point { display: flex; gap: 0.75rem; }
.gov-bar-point > .icon { margin-top: 0.1rem; color: var(--brand-text); }
.gov-bar-point > .icon svg { width: 20px; height: 20px; }
.gov-bar-point h2 { font-size: 0.9375rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.gov-bar-point p + p { margin-top: 0.35rem; }

@media (max-width: 640px) {
  .gov-bar-panel-inner { grid-template-columns: 1fr; }
  .gov-bar-line { font-size: 0.75rem; }
}
.gov-bar-line-short { display: none; }
@media (max-width: 360px) {
  /* Shorter line rather than a second row, per the banner spec. */
  .gov-bar-line-long { display: none; }
  .gov-bar-line-short { display: inline; }
}

/* update prompt bar, see update-bar-spec.md */
.update-notice {
  background: color-mix(in srgb, var(--brand-dark) 12%, transparent);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.875rem;
}
.update-notice-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.5rem 1rem;
}
.update-notice p { flex: 1 1 12rem; min-width: 0; }
.update-notice .btn { flex: none; min-height: 36px; padding: 0.35rem 0.85rem; }

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem max(1rem, calc((100% - 72rem) / 2));
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--motion) ease, background-color 0.25s ease;
}
.site-header.stuck {
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 1.0625rem;
  border-radius: var(--radius-sm);
}
.brand:link, .brand:visited { color: var(--text); }
.brand img { width: 32px; height: 32px; flex: none; border-radius: var(--radius-sm); }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 0.25rem; flex: none; }

/* language switcher, see i18n-retrofit-spec.md 7 and 8 */
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted-strong);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background-color var(--motion) ease, color var(--motion) ease;
}
.lang-btn:hover { background: var(--surface-active); color: var(--text); }
.lang-btn svg { width: 18px; height: 18px; }
.lang-btn .lang-code { display: none; }
@media (max-width: 480px) {
  .lang-btn .lang-name { display: none; }
  .lang-btn .lang-code { display: inline; }
}
.lang-list { list-style: none; display: grid; gap: 0.4rem; margin-top: 0.25rem; }
.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  transition: background-color var(--motion) ease, border-color var(--motion) ease;
}
.lang-option:hover { background: var(--surface-hover); }
.lang-option[aria-selected="true"] { border-color: var(--focus-ring); background: var(--surface-active); }
.lang-option .lang-label { display: inline-flex; align-items: center; gap: 0.65rem; min-width: 0; }
.lang-option .lang-check { visibility: hidden; color: var(--brand-text); }
.lang-option[aria-selected="true"] .lang-check { visibility: visible; }
.lang-option .lang-check svg { width: 18px; height: 18px; }
.lang-option:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.lang-close { margin-top: 1rem; }
@media (max-width: 480px) {
  /* A bottom sheet on a phone, per 8.2. */
  .modal-backdrop.sheet { align-items: flex-end; padding: 0; }
  .modal-backdrop.sheet .modal {
    max-width: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
  }
}

/* page body */
main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}
main.center { justify-content: center; }
.page-card { width: 100%; max-width: 28rem; padding: 1.75rem; }
.page-card + .page-card { margin-top: 1rem; }
.page-head { text-align: center; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.page-head p { margin-top: 0.35rem; color: var(--text-muted); }
.eyebrow {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-text);
}
.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.text-link {
  color: var(--brand-text);
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.text-link:link, .text-link:visited { color: var(--brand-text); }
button.text-link { padding: 0; }

/* forms */
.field { display: block; margin-bottom: 1rem; }
.field > span, .field > label { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9375rem; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-active);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--motion) ease, background-color var(--motion) ease;
}
.field textarea { min-height: 5.5rem; resize: vertical; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-muted-strong); opacity: 1; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--focus-ring); }
.field-hint { margin-top: 0.3rem; font-size: 0.8125rem; color: var(--text-muted); }

/* Password fields with an eye button to show what is typed. */
.password-field { position: relative; }
.password-field input { padding-inline-end: 3rem; }
.password-reveal {
  position: absolute;
  top: 50%;
  inset-inline-end: 0.25rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-muted-strong);
  transition: background-color var(--motion) ease, color var(--motion) ease;
}
.password-reveal:hover { background: var(--surface-hover); color: var(--text); }
.password-reveal svg { width: 20px; height: 20px; }
/* Hide the browser's own reveal control (Edge), so there is only one eye. */
.password-field input::-ms-reveal { display: none; }
.field-status { margin-top: 0.3rem; font-size: 0.875rem; font-weight: 600; min-height: 1.3em; }
.field-status.ok { color: var(--ok); }
.field-status.bad { color: var(--danger); }
.field-status .spinner { --spinner-size: 0.9rem; vertical-align: -2px; margin-inline-end: 0.35rem; }
.actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; }
.actions.inline { flex-direction: row; flex-wrap: wrap; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}
.check input { width: 20px; height: 20px; margin-top: 0.1rem; flex: none; accent-color: var(--brand-dark); }


/* One-time code input: wide spacing, digits only on phones. */
.code-input {
  letter-spacing: 0.3em;
  font-size: 1.375rem !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Segmented choice of second factor. */
.segmented { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--surface-active);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  transition: background-color var(--motion) ease, color var(--motion) ease;
}
.segmented button svg { width: 16px; height: 16px; }
.segmented button[aria-pressed="true"] { background: var(--brand-dark); color: var(--brand-on); border-color: transparent; }
/* the event list on /manage, by status, each with its count */
.list-count { min-width: 1.5em; padding: 0 0.4em; border-radius: 999px; background: var(--surface-active); font-size: 0.8125rem; font-variant-numeric: tabular-nums; text-align: center; }
.segmented button[aria-pressed="true"] .list-count { background: color-mix(in srgb, var(--brand-on) 22%, transparent); }

/* the feed's search, above its pickers */
.feed-search { position: relative; width: 100%; max-width: 32rem; margin-bottom: 1rem; }
.feed-search-icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); display: flex; color: var(--text-muted); pointer-events: none; }
.feed-search-icon svg { width: 18px; height: 18px; }
.feed-search input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.9rem 0.55rem 2.6rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.feed-search input:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: 2px; }

/* callouts */
.callout {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  background: var(--surface-active);
  color: var(--text);
}
.callout.danger { background: var(--callout-danger-bg); color: var(--danger); }
.callout.ok { background: var(--callout-ok-bg); color: var(--ok); }
.callout.warn { background: var(--callout-warn-bg); color: var(--warn); }
.callout:empty { display: none; }
.callout + .callout, * + .callout { margin-top: 0.85rem; }
/* HelloID's tips (screen brightness): a sun beside the text. */
.helloid-tip { display: flex; gap: 0.6rem; align-items: flex-start; }
.helloid-tip > .icon { margin-top: 0.15rem; color: var(--warn); }

/* Cloudflare Turnstile (js/turnstile.js). Takes no room until it is drawn,
   and its iframe fills the form's width. */
.human-check { margin-top: 0.85rem; }
.human-check:empty { display: none; }

/* Backup codes, shown once. */
.codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
  padding: 1rem;
  margin: 0.75rem 0;
  list-style: none;
  background: var(--surface-active);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  user-select: all;
  -webkit-user-select: all;
}
.secret {
  display: block;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
  background: var(--surface-active);
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}


/* QR */
.qr-code { display: flex; justify-content: center; margin: 0.75rem 0; }
.qr-code svg {
  width: 220px;
  height: 220px;
  padding: 12px;
  background: var(--qr-bg);
  border-radius: var(--radius-sm);
}
.qr-code svg rect { fill: var(--qr-bg); }
.qr-code svg path { fill: var(--qr-fg); }
.qr-code.small svg { width: 168px; height: 168px; padding: 8px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: calc(100% - 2rem);
  transform: translate(-50%, 0);
  padding: 0.6rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  color: var(--brand-on);
  background: var(--brand-dark);
  border-radius: 999px;
  box-shadow: var(--shadow) 0 8px 24px;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--motion) ease, transform var(--motion) ease, visibility 0s;
}
.toast.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity var(--motion) ease, transform var(--motion) ease, visibility 0s var(--motion);
}

/* A page of text: the privacy notice. */
.page-card.prose { max-width: 40rem; }
.prose h2 { margin-top: 1.5rem; font-size: 1.125rem; font-weight: 600; }
.prose p, .prose ul { margin-top: 0.6rem; line-height: 1.55; }
.prose ul { display: grid; gap: 0.5rem; padding-inline-start: 1.25rem; list-style: disc; }
.prose .actions { margin-top: 0.85rem; }

/* footer */
.site-footer {
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-light);
}
.site-footer svg { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; color: var(--link); }
.site-footer a { font-weight: 600; }
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.25rem 1rem; margin-bottom: 0.4rem; }

/* ---------------------------------------------------------------------- */
/* 3. Events                                                               */
/* ---------------------------------------------------------------------- */

main.wide { align-items: stretch; }
main.wide > .page-card { margin-inline: auto; }

/* Small utilities, so markup needs no style attributes (the CSP refuses them). */
.u-mt-1 { margin-top: 1rem; }
.u-center { text-align: center; }
.prewrap { white-space: pre-line; overflow-wrap: anywhere; }
.center-row { align-items: center; }

/* home */
.hero { padding: 1.5rem 0 1.25rem; max-width: 44rem; }
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; line-height: 1.15; }
.lede { margin-top: 0.5rem; font-size: 1.0625rem; color: var(--text-muted); }

.feed-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.5rem; }
.feed-controls .segmented { margin-bottom: 0.75rem; }

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}
.event-grid.compact { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.event-grid:empty { display: none; }

.event-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  transition: transform var(--motion) ease, border-color var(--motion) ease;
}
.event-card:link, .event-card:visited { color: var(--text); }
.event-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.event-card:focus-visible { outline-offset: 3px; }

.event-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-active);
  overflow: hidden;
}
.event-cover img { width: 100%; height: 100%; object-fit: cover; }
.event-cover.no-image { display: flex; align-items: center; justify-content: center; color: var(--brand-text); }
.event-cover.no-image > .icon svg { width: 2.5rem; height: 2.5rem; }
.event-cover.large { aspect-ratio: 21 / 9; border-radius: var(--radius) var(--radius) 0 0; }

.date-badge {
  position: absolute;
  top: 0.65rem;
  inset-inline-start: 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.1rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow) 0 4px 12px;
  line-height: 1.1;
}
.date-badge-day { font-size: 1.25rem; font-weight: 700; }
.date-badge-month { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }

.event-card-body { display: flex; flex-direction: column; gap: 0.45rem; padding: 0.9rem 1rem 1.1rem; }
.event-card-title { font-size: 1.125rem; font-weight: 700; line-height: 1.25; }
.event-card-summary {
  color: var(--text-muted);
  font-size: 0.9375rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-meta { list-style: none; display: grid; gap: 0.3rem; font-size: 0.875rem; color: var(--text-muted); }
.event-meta li { display: flex; align-items: flex-start; gap: 0.45rem; }
.event-meta .icon { margin-top: 0.15rem; }
.event-meta .icon svg { width: 15px; height: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-active);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip-cross-border { display: inline-flex; align-items: center; gap: 0.3rem; }
.chip-cross-border svg { width: 14px; height: 14px; }
.external-link-note { margin-top: -0.25rem; text-align: center; }
.rsvp-country p { margin: 0; }
.chip-danger, .chip.status-cancelled { background: var(--callout-danger-bg); color: var(--danger); border-color: transparent; }
.chip.status-published { background: var(--callout-ok-bg); color: var(--ok); border-color: transparent; }
.chip.unreleased { border-style: dashed; border-color: var(--border-strong); }

.skeleton-card .event-cover { border-radius: 0; }
.skeleton.line { height: 0.9rem; margin: 0.2rem 0; }
.skeleton.line.short { width: 60%; }

.empty-state { padding: 1.5rem; text-align: center; color: var(--text-muted); }
.back-link { margin: 0.25rem 0 1rem; }
.back-link a { display: inline-flex; align-items: center; gap: 0.35rem; }
.back-link svg { width: 16px; height: 16px; }
[dir="rtl"] .back-link svg { transform: scaleX(-1); }

.loading-card { display: flex; align-items: center; justify-content: center; gap: 0.75rem; color: var(--text-muted); }

/* event page */
.event-page { display: grid; gap: 1rem; }
.event-hero { overflow: hidden; }
.event-hero-body { padding: 1.25rem 1.5rem 1.5rem; display: grid; gap: 0.5rem; }
.event-hero-body h1 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.event-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.event-section, .event-aside { padding: 1.25rem 1.5rem; }
.event-section h2 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.6rem; }
.event-aside { display: grid; gap: 1rem; }
.event-main { display: grid; gap: 1rem; min-width: 0; }

/* event page: timetable (js/timetable.js). Room colours are the --tt-c*
   tokens in section 1; .tt-c0 to .tt-c5 and .tt-cx pick one as --tt-hue. */
.timetable-section { min-width: 0; }
.timetable-section .row.between { align-items: baseline; flex-wrap: wrap; gap: 0.25rem 1rem; }
.tt-c0 { --tt-hue: var(--tt-c0); }
.tt-c1 { --tt-hue: var(--tt-c1); }
.tt-c2 { --tt-hue: var(--tt-c2); }
.tt-c3 { --tt-hue: var(--tt-c3); }
.tt-c4 { --tt-hue: var(--tt-c4); }
.tt-c5 { --tt-hue: var(--tt-c5); }
.tt-cx { --tt-hue: var(--tt-cx); }
.tt-mark { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.4; }
.tt-mark-now { background: var(--brand-dark); color: var(--brand-on); }
.tt-mark-next { border: 1px solid var(--border-strong); color: var(--text-muted); }
.tt-room { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.tt-room::before { content: ''; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--tt-hue); flex: none; }
.tt-room-tag { padding: 0 0.35rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--tt-hue) 50%, transparent); font-size: 0.6875rem; }

/* timeline: a line down the side, a dot at each time of day (.tl-stop),
   and what starts then beside it. The line is drawn in up to the dots
   reached (.is-reached); the dot of what is on now has a ring (.is-now). */
.tt-timeline { display: grid; gap: 1.5rem; }
.tt-day-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem; }
.tl-line { --tl-gutter: 2rem; --tl-dot: 0.875rem; list-style: none; padding: 0; margin: 0; }
.tl-stop { position: relative; padding: 0 0 1.25rem var(--tl-gutter); }
.tl-stop::before {
  content: ''; position: absolute; left: calc(var(--tl-dot) / 2 - 1px); top: 0.55rem; bottom: -0.55rem; width: 2px;
  background: var(--border-strong);
}
.tl-stop:last-child { padding-bottom: 0; }
.tl-stop:last-child::before { display: none; }
.tl-stop.is-reached::before { background: var(--brand-dark); }
.tl-dot {
  position: absolute; left: 0; top: 0.3rem; z-index: 1; width: var(--tl-dot); height: var(--tl-dot); border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--bg);
  transition: background-color var(--motion), border-color var(--motion), box-shadow var(--motion);
}
.tl-stop.is-reached .tl-dot { border-color: var(--brand-dark); background: var(--brand-dark); }
.tl-stop.is-now .tl-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-dark) 30%, transparent); }
.tl-time { font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.5rem; margin-bottom: 0.35rem; }
.tl-stop.is-now .tl-time { color: var(--brand-text); }
.tl-items { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.tl-item {
  --tt-hue: var(--brand-dark);
  display: grid; gap: 0.15rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-left: 3px solid var(--tt-hue);
  border-radius: var(--radius-sm); background: var(--surface);
  transition: opacity var(--motion), background-color var(--motion), border-color var(--motion);
}
.tl-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.tl-item-title { font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.tt-note { font-size: 0.875rem; color: var(--text-muted); overflow-wrap: anywhere; }
.tl-item.is-now { background: color-mix(in srgb, var(--tt-hue) var(--tt-fill-mix), var(--surface)); border-color: var(--tt-hue); box-shadow: 0 0 0 1px var(--tt-hue); }
.tl-item.is-past { opacity: 0.55; }

/* a timetable's Table / List switch, beside its day buttons */
.tt-layout-switch {
  display: inline-flex; gap: 0.25rem; padding: 0.2rem; margin-bottom: 0.75rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.tt-layout-btn {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 32px; padding: 0.25rem 0.85rem;
  border-radius: 999px; font-weight: 600; font-size: 0.875rem;
}
.tt-layout-btn svg { width: 16px; height: 16px; }
.tt-layout-btn:hover { background: var(--surface-hover); }
.tt-layout-btn[aria-pressed="true"] { background: var(--brand-dark); color: var(--brand-on); }

/* a timetable as a list: each item, its times on the left */
.tt-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.tt-entry {
  display: grid; grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr); gap: 0.25rem 1rem;
  padding: 0.65rem 0.85rem; border: 1px solid var(--border); border-left: 4px solid var(--tt-hue);
  border-radius: var(--radius-sm); background: var(--surface);
  transition: opacity var(--motion), background-color var(--motion), border-color var(--motion);
}
.tt-entry-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.tt-entry-what { display: grid; gap: 0.2rem; min-width: 0; }
.tt-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.tt-entry-title { font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.tt-entry.is-now { background: color-mix(in srgb, var(--tt-hue) var(--tt-fill-mix), var(--surface)); border-color: var(--tt-hue); box-shadow: 0 0 0 1px var(--tt-hue); }
.tt-entry.is-now .tt-entry-time { color: var(--text); }
.tt-entry.is-past { opacity: 0.55; }
@media (max-width: 520px) {
  .tt-entry { grid-template-columns: 1fr; }
}

/* grid: one day, a column per room, 30 minutes = --tt-slot tall */
.tt-days { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.tt-day-btn {
  min-height: 36px; padding: 0.35rem 0.85rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-weight: 600; font-size: 0.875rem;
}
.tt-day-btn:hover { background: var(--surface-hover); }
.tt-day-btn[aria-pressed="true"] { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--brand-on); }
.tt-grid-scroll {
  overflow: auto; max-height: 78vh; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--tt-grid-bg); overscroll-behavior: contain;
}
.tt-grid {
  --tt-slot: 2.4rem;
  --tt-minute: calc(var(--tt-slot) / 30);
  --tt-time-col: 4.25rem;
  position: relative; display: grid;
  grid-template-columns: var(--tt-time-col) repeat(var(--tt-cols), minmax(8.5rem, 1fr));
  grid-template-rows: auto calc(var(--tt-span) * var(--tt-minute));
  min-width: calc(var(--tt-time-col) + var(--tt-cols) * 8.5rem);
}
.tt-grid.no-header { grid-template-rows: 0 calc(var(--tt-span) * var(--tt-minute)); }
.tt-corner, .tt-head {
  position: sticky; top: 0; z-index: 3; padding: 0.45rem 0.4rem; background: var(--tt-grid-bg);
  border-bottom: 1px solid var(--border-strong); text-align: center;
}
.tt-corner { left: 0; z-index: 4; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); display: flex; align-items: flex-end; justify-content: center; }
.tt-head { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.2rem; border-left: 1px solid var(--border); }
.tt-head-tag {
  padding: 0.05rem 0.55rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700;
  background: color-mix(in srgb, var(--tt-hue) 30%, var(--tt-grid-bg)); color: var(--text);
}
.tt-head-name { font-size: 0.8125rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.tt-times, .tt-col { grid-row: 2; position: relative; }
.tt-times {
  grid-column: 1; position: sticky; left: 0; z-index: 2; background: var(--tt-grid-bg);
  border-right: 1px solid var(--border-strong);
}
.tt-time {
  position: absolute; left: 0; right: 0; top: calc(var(--tt-at) * var(--tt-minute));
  padding: 0.15rem 0.4rem 0; font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right;
}
.tt-col {
  list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border);
  background: repeating-linear-gradient(to bottom, var(--tt-band) 0, var(--tt-band) var(--tt-slot), transparent var(--tt-slot), transparent calc(2 * var(--tt-slot)));
}
.tt-block {
  position: absolute; overflow: hidden;
  top: calc(var(--tt-top) * var(--tt-minute) + 1px);
  height: calc(var(--tt-length) * var(--tt-minute) - 2px);
  left: calc(3px + (100% - 6px) * var(--tt-lane) / var(--tt-lanes));
  width: calc((100% - 6px) / var(--tt-lanes) - 2px);
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  padding: 0.3rem 0.35rem; text-align: center; border-radius: 6px;
  background: color-mix(in srgb, var(--tt-hue) 26%, var(--tt-grid-bg));
  border: 1px solid color-mix(in srgb, var(--tt-hue) 60%, transparent);
  color: var(--text); font-size: 0.75rem; line-height: 1.2;
  transition: opacity var(--motion), box-shadow var(--motion);
}
.tt-block-title { font-weight: 700; overflow-wrap: anywhere; }
.tt-block-time { font-size: 0.6875rem; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.tt-block-note { font-size: 0.6875rem; color: var(--text-muted); overflow-wrap: anywhere; }
.tt-block.is-short { flex-direction: row; justify-content: center; padding-top: 0.1rem; padding-bottom: 0.1rem; }
.tt-block.is-short .tt-block-time, .tt-block.is-short .tt-block-note { display: none; }
.tt-block .tt-mark { margin-top: auto; }
.tt-block.is-short .tt-mark { margin-top: 0; }
.tt-block.is-now {
  z-index: 1; background: color-mix(in srgb, var(--tt-hue) 55%, var(--tt-grid-bg));
  border: 2px solid var(--tt-hue); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tt-hue) 35%, transparent), 0 4px 14px var(--shadow);
}
.tt-block.is-now .tt-block-time, .tt-block.is-now .tt-block-note { color: var(--text); }
.tt-block.is-past { opacity: 0.5; }
.tt-now-line {
  grid-row: 2; grid-column: 2 / -1; position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none;
  top: calc(var(--tt-at) * var(--tt-minute)); height: 0; border-top: 2px solid var(--danger);
}
.tt-now-line::before {
  content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
}
.tt-now-label {
  position: absolute; left: 0.5rem; top: -1.35rem; padding: 0 0.4rem; border-radius: 999px;
  background: var(--danger); color: var(--danger-on); font-size: 0.6875rem; font-weight: 700; white-space: nowrap;
}

/* edit form: timetable rooms and items */
.room-list { display: grid; gap: 0.5rem; }
.room-row {
  display: grid; grid-template-columns: 1.5rem minmax(0, 2fr) minmax(0, 1fr) auto; gap: 0.5rem; align-items: end;
  padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.room-number { align-self: center; font-weight: 700; color: var(--text-muted); text-align: center; }
.room-actions { display: flex; gap: 0.25rem; }
/* An itinerary (the timeline view) hides what only a timetable has. */
#epanel-timetable:not(.is-itinerary) .only-timeline,
#epanel-timetable.is-itinerary .only-grid,
#epanel-timetable.is-itinerary #roomsFieldset,
#epanel-timetable.is-itinerary .item-f-end,
#epanel-timetable.is-itinerary .item-f-room { display: none; }
/* On a wide screen an item card is two rows: what, day, start, end; then
   room and note. */
@media (min-width: 900px) {
  .timetable-item-card .form-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .timetable-item-card .form-grid .item-f-title { grid-column: span 3; }
  .timetable-item-card .form-grid .item-f-room { grid-column: span 2; }
  .timetable-item-card .form-grid .item-f-note { grid-column: span 4; }
  .timetable-item-card .form-grid .item-f-room { order: 1; }
  .timetable-item-card .form-grid .item-f-note { order: 2; }
}
@media (max-width: 640px) {
  .room-row { grid-template-columns: 1.5rem minmax(0, 1fr); }
  .room-row .room-tag, .room-row .room-actions { grid-column: 2; }
  /* Icons only: each button is still named for screen readers. */
  .room-actions .btn-label, .timetable-item-card .row .btn-label { display: none; }
  .room-actions { flex-wrap: wrap; }
}

/* event page: ticket tiers */
.tier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.75rem; }
.tier-card { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.tier-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 0.75rem; margin-bottom: 0.5rem; }
.tier-name { font-size: 1rem; font-weight: 700; }
.tier-price { font-weight: 700; color: var(--brand-text); }
.tier-includes { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.35rem; }
.tier-benefits { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.3rem; font-size: 0.9375rem; }
.tier-benefits li { display: flex; gap: 0.4rem; align-items: flex-start; }
.tier-benefits svg { width: 16px; height: 16px; flex: none; margin-top: 0.2rem; color: var(--ok); }
.tier-benefits .tier-included { color: var(--text-muted); }
.facts { display: grid; gap: 0.85rem; }
.facts dt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.facts dt svg { width: 15px; height: 15px; }
.facts dd { margin-top: 0.2rem; overflow-wrap: anywhere; }
.fact-line { display: block; }
.rsvp { display: grid; gap: 0.5rem; }
.rsvp-status { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; color: var(--ok); }
.rsvp-status svg { width: 18px; height: 18px; }
/* Someone's RSVP ID for the event (migrations/013). */
.rsvp-number { font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
/* the number pill at its long size, on the event page and the pass */
.rsvp-number .chip { font-size: 0.875rem; white-space: normal; }
.chip-rsvp-number { font-variant-numeric: tabular-nums; }
.rsvp .small:empty { display: none; }
/* The choice of the whole event or only some of its meals. */
.rsvp-meals { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 0.35rem; }
.rsvp-meals .check { margin-bottom: 0; }

/* account: the reminder times, any of them */
.remind-times { border: 0; padding: 0; margin: 0.25rem 0 0.75rem; min-width: 0; }
.remind-times legend { font-weight: 600; margin-bottom: 0.4rem; padding: 0; }
.remind-options { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.remind-options .check { margin-bottom: 0.25rem; }
.remind-times .field-hint { margin: 0.25rem 0 0; }
.rsvp-meal-list { display: grid; gap: 0.35rem; padding-inline-start: 1.6rem; }
/* Volunteering (migrations/012): the tick box sits with the meal choice,
   and the thanks or benefit note under it. */
.rsvp-volunteer { margin-bottom: 0; }
/* The contact details an event asks for (js/contact-form.js), with the RSVP
   and on the checkout page. */
.rsvp-contact { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 0.5rem; }
.rsvp-contact legend { font-weight: 600; margin-bottom: 0.25rem; }
.rsvp-contact .field, #contactFields .field { margin-bottom: 0.5rem; }
.rsvp-contact p, #contactFields p { margin: 0; }
.rsvp-contact input[aria-invalid="true"], #contactFields input[aria-invalid="true"] { border-color: var(--danger); }
/* The edit form's contact section (js/manage-contact.js): a row for each of
   the editor's own fields, its label, its kind and Remove. */
.contact-presets { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.contact-custom-list { display: grid; gap: 0.5rem; margin: 0.5rem 0; }
.contact-custom-list:empty { display: none; }
.contact-custom-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.contact-custom-row .contact-custom-label { flex: 2 1 12rem; min-width: 0; }
.contact-custom-row .contact-custom-type { flex: 1 1 9rem; min-width: 0; }
.attendee-contact { overflow-wrap: anywhere; }
/* Registration forms (migrations/024): the form (js/registration-form.js),
   the "Registration details" card (js/registration-card.js), and the edit
   form's section (js/manage-registration.js). */
.rsvp-registration .field, #registrationFields .field { margin-bottom: 0.6rem; }
.rsvp-registration p, #registrationFields p { margin: 0 0 0.4rem; }
.reg-field { margin: 0 0 0.8rem; }
.reg-yesno { border: 0; padding: 0; min-width: 0; }
.reg-yesno legend { padding: 0; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9375rem; }
.reg-check > .field-hint { margin: 0 0 0.35rem; font-weight: 600; font-size: 0.9375rem; color: var(--text); }
.reg-field[data-invalid="true"] legend, .reg-field[data-invalid="true"] .check > span { color: var(--danger); }
.reg-choices { display: flex; flex-wrap: wrap; gap: 0.25rem 2rem; }
.field[data-invalid="true"] input, .field[data-invalid="true"] select, .field[data-invalid="true"] textarea { border-color: var(--danger); }
.field[data-invalid="true"] > span:first-child, .field[data-invalid="true"] legend { color: var(--danger); }
.reg-amount { display: flex; align-items: center; gap: 0.5rem; }
.reg-amount input { flex: 1 1 auto; min-width: 0; }
.reg-currency { color: var(--text-muted); font-weight: 600; }
.reg-photo-preview, .reg-photo-shown {
  display: block;
  width: 100%;
  max-width: 18rem;
  aspect-ratio: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 0.35rem 0;
}
.reg-photo .file-btn.is-busy { opacity: 0.6; pointer-events: none; }
.reg-account { display: grid; gap: 0.35rem; margin-bottom: 0.6rem; }
.reg-card {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: grid;
  gap: 0.75rem;
}
.reg-title { margin: 0; }
.reg-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.reg-badge-name { font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.reg-badge-number { font-size: 1.15rem; margin: 0; }
.reg-tier { font-size: 0.95rem; }
.reg-row { display: grid; gap: 0.15rem; min-width: 0; }
.reg-row-head { display: flex; align-items: center; gap: 0.4rem; }
.reg-label { color: var(--text-muted); font-size: 0.92rem; }
.reg-value { overflow-wrap: anywhere; white-space: pre-line; }
.reg-missing .reg-value { color: var(--warn); }
.reg-subtitle { margin: 0; font-size: 1.05rem; }
.reg-divider { border: 0; border-top: 1px solid var(--border-strong); width: 100%; margin: 0.25rem 0; }
.reg-edit {
  border: 0;
  background: none;
  color: var(--link);
  padding: 0.25rem;
  min-width: 2rem;
  min-height: 2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.reg-edit:hover { background: var(--surface-hover); }
.reg-edit:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.reg-editing { padding: 0.6rem; border-radius: var(--radius-sm); background: var(--surface-hover); }
.reg-upgrade { margin-top: 0.9rem; }
.registration-section .reg-card { margin: 0; }
.tier-closed { color: var(--warn); font-weight: 600; }
.upgrade-box { border-top: 1px solid var(--border); padding-top: 0.9rem; }
.reg-presets { display: grid; gap: 0.5rem; margin: 0.4rem 0 0.9rem; }
.reg-preset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; }
.reg-preset-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; }
.reg-preset-extras { display: grid; gap: 0.4rem; margin-top: 0.4rem; padding-inline-start: 1.85rem; }
.reg-preset-extras .field-hint { margin: 0; }
/* The tiers a question is for (only while the event sells tiers). */
.reg-tiers { display: grid; gap: 0.3rem; margin-top: 0.5rem; padding-inline-start: 1.85rem; }
.reg-custom-card .reg-tiers { padding-inline-start: 0; margin-top: 0.75rem; }
.reg-tiers-title { font-weight: 600; font-size: 0.9375rem; }
.reg-tiers-list { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.reg-tiers .field-hint { margin: 0; }
.attendee-registration { margin-top: 0.3rem; }
.attendee-registration summary { cursor: pointer; color: var(--link); }
.attendee-registration .order-lines { margin-top: 0.35rem; }
#registrationFieldsBox[hidden] { display: none; }
.rsvp .rsvp-volunteer-note { margin-top: 0; }
.rsvp-fursuiter-hint { margin: -0.25rem 0 0; padding-inline-start: 1.85rem; }
#rsvpMealChecks { display: grid; gap: 0.35rem; }
.event-aside .actions { margin-top: 0; }

@media (max-width: 800px) {
  .event-layout { grid-template-columns: 1fr; }
  .event-aside { order: -1; }
}

/* account */
.account-layout { display: grid; gap: 1rem; width: 100%; max-width: 44rem; margin: 0 auto; }
.account-layout .page-card { max-width: none; }
.account-layout h2 { font-size: 1.25rem; font-weight: 700; }
.account-layout > .tabs { margin-bottom: 0; }
.account-panel-stack { display: grid; gap: 1rem; }
.profile-row { display: flex; align-items: center; gap: 1rem; }
.profile-row h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-active); }
.section-label {
  margin: 1.25rem 0 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.item-list { list-style: none; display: grid; gap: 0.4rem; margin: 0.25rem 0 0.5rem; }
.item-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.item-row > .icon { color: var(--brand-text); }
.item-row > .icon svg { width: 18px; height: 18px; }
.item-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.item-main > span { overflow: hidden; text-overflow: ellipsis; }
.item-title { font-weight: 600; }
/* An attendee at a convention also has a Volunteered box; on a narrow
   screen it and Remove wrap under the name. */
.attendee-row { flex-wrap: wrap; }
.attendee-row .item-main { flex-basis: 11rem; }
.attendee-volunteered { margin-bottom: 0; font-size: 0.875rem; white-space: nowrap; align-items: center; }
.attendee-volunteered input { margin-top: 0; }
details > summary { cursor: pointer; font-weight: 600; color: var(--brand-text); border-radius: var(--radius-sm); }
.steps-list { display: grid; gap: 0.35rem; padding-inline-start: 1.25rem; margin-bottom: 0.75rem; }

/* manage */
.manage-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 1rem 0 1.25rem; }
.manage-head h1 { font-size: 1.75rem; font-weight: 700; }
#listBox, #editorEmpty, .editor { max-width: none; }
.editor { margin-bottom: 1rem; }
/* Autosave (js/pages/manage.js): a small pill that sticks to the bottom of
   the screen while the edit form is in view, saying whether the changes are
   saved. Empty, it takes no room. */
.autosave-bar {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  pointer-events: none;
}
.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 0 4px 16px var(--shadow);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  pointer-events: auto;
}
.autosave-status:empty { display: none; }
.autosave-status .spinner { --spinner-size: 0.9rem; }
.autosave-status.is-saved { color: var(--ok); }
.autosave-status.is-failed { background: var(--callout-danger-bg); color: var(--danger); border-color: transparent; border-radius: var(--radius-sm); }
.editor h2 { font-size: 1.25rem; font-weight: 700; }
.editor fieldset { border: 0; margin-top: 1.25rem; }
.editor legend {
  margin-bottom: 0.6rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-text);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field input:disabled, .field select:disabled { opacity: 0.6; cursor: not-allowed; }
.attendees { margin-top: 1.25rem; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* The header on a phone: icon-only buttons, the label kept for screen
   readers, so the brand, the buttons, the language and the theme control
   fit in one row at 320px. */
.site-header .brand { flex: 1 1 auto; }
@media (max-width: 480px) {
  .header-actions .btn { min-width: 40px; padding-inline: 0.55rem; }
  .header-actions .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

/* Without a cover picture the event page shows a short band, not a large
   empty frame. */
.event-cover.large.no-image { aspect-ratio: auto; height: 7.5rem; }

/* manage: the cover picture */
.cover-field > span:first-child { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9375rem; }
.cover-preview { max-width: 28rem; margin-bottom: 0.4rem; border-radius: var(--radius-sm); }
.cover-preview.no-image > .icon svg { width: 2rem; height: 2rem; }

/* manage: the gallery (js/manage-gallery.js). Each picture keeps its own
   shape, in columns. */
.gallery-field > span:first-child { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9375rem; }
.gallery-manage {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  columns: 3 11rem;
  column-gap: 0.75rem;
}
.gallery-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.gallery-item.is-cover { border-color: var(--brand-dark); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-dark) 45%, transparent); }
.gallery-item img { display: block; width: 100%; height: auto; background: var(--surface-active); }
.gallery-cover-chip { position: absolute; top: 0.4rem; left: 0.4rem; gap: 0.25rem; background: var(--bg); }
.gallery-cover-chip .icon svg { width: 13px; height: 13px; }
.gallery-item-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.45rem; }
.gallery-use-cover { gap: 0.35rem; }
.gallery-use-cover .icon svg { width: 15px; height: 15px; }
.gallery-remove.armed { width: auto; gap: 0.3rem; padding: 0 0.6rem; background: var(--danger); color: var(--danger-on); font-size: 0.8125rem; font-weight: 600; }
.file-btn.disabled { opacity: 0.55; pointer-events: none; }

/* The event page's gallery (js/event-gallery.js): every picture in its own
   shape, in columns, each opening larger in a dialog. */
.event-gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 3 12rem;
  column-gap: 0.75rem;
}
.event-gallery li { break-inside: avoid; margin-bottom: 0.75rem; }
.gallery-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-active);
  overflow: hidden;
  cursor: zoom-in;
}
.gallery-thumb img { display: block; width: 100%; height: auto; transition: transform var(--motion) ease; }
.gallery-thumb:hover img { transform: scale(1.02); }
.gallery-thumb:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.modal.gallery-modal { max-width: min(64rem, 100%); }
.gallery-view {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: calc(100dvh - 11rem);
  margin: 0.75rem auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--surface-active);
}
.gallery-nav { justify-content: center; }
.file-btn { cursor: pointer; }
.file-btn:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 45%, transparent);
}
.check .text-link { display: inline; }

/* manage: staff tools */
.admin-tools { margin-top: 1rem; max-width: none; }
.admin-tools h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.35rem; }
.row .field.grow { flex: 1 1 14rem; margin-bottom: 0; }
.row:has(.field.grow) { align-items: flex-end; }

/* manage: the sections as tabs (js/tabs.js) */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-active);
  color: var(--text-muted);
  font-weight: 600;
  transition: background-color var(--motion) ease, color var(--motion) ease;
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { background: var(--surface-hover); color: var(--text); }
.tab[aria-selected="true"] { background: var(--brand-dark); color: var(--brand-on); border-color: transparent; }
.tab-panel > .admin-tools:first-child { margin-top: 0; }

/* manage: the edit form's sections as tabs, stuck under the page header
   while the form scrolls (--header-height is set by js/pages/manage.js) */
.editor-tabs {
  position: sticky;
  top: var(--header-height, 0px);
  z-index: 6;
  margin: 1rem 0 0;
  padding: 0.6rem 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
}
.editor-tabs .tab { min-height: 36px; padding: 0.35rem 0.75rem; }
.tab-mark { color: var(--danger); font-weight: 700; }
.tab[aria-selected="true"] .tab-mark { color: inherit; }
.editor-panel > fieldset:first-child { margin-top: 0.75rem; }
/* Basics' Publishing box (manage.html): the event's status, first thing in
   the form, tinted by what it is. */
.editor .publish-box {
  border: 1px solid var(--warn);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 0.5rem 1rem 1rem;
  background: var(--callout-warn-bg);
}
.editor .publish-box[data-status="published"] { background: var(--callout-ok-bg); border-color: var(--ok); }
.editor .publish-box[data-status="cancelled"] { background: var(--callout-danger-bg); border-color: var(--danger); }
.editor .publish-box #f-status { font-weight: 600; }
/* on a phone the tabs scroll sideways in one row rather than taking half
   the screen */
@media (max-width: 640px) {
  .editor-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .editor-tabs::-webkit-scrollbar { display: none; }
  .editor-tabs .tab { flex: none; }
}

/* manage: the event list's pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.75rem; }

/* manage: the description's label with its language picker beside it */
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.35rem; }
.field-head > label { font-weight: 600; font-size: 0.9375rem; }
/* The English / 中文 switcher over the two descriptions (js/lang-switch.js),
   on the edit form and the event page. A dot marks one not written yet. */
.lang-switch { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-active); }
.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 34px;
  padding: 0.2rem 0.75rem;
  border-radius: calc(var(--radius-sm) - 2px);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background-color var(--motion) ease, color var(--motion) ease;
}
.lang-switch-btn:hover { color: var(--text); }
.lang-switch-btn[aria-pressed="true"] { background: var(--brand-dark); color: var(--brand-on); }
.missing-mark { color: var(--danger); font-size: 1.1em; line-height: 1; }
.lang-switch-btn[aria-pressed="true"] .missing-mark { color: inherit; }
.event-section .row.between { margin-bottom: 0.6rem; }
.times-hint { margin: -0.4rem 0 0.9rem; }

/* manage: the locations in "Where" (js/manage-locations.js) */
.location-list { display: grid; gap: 0.75rem; }
.location-card {
  padding: 1rem 1rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.location-card .section-label { margin: 0; }
.location-card .form-grid { margin-top: 0.6rem; }
.location-card .row .grow { flex: 1 1 14rem; min-width: 0; }
.location-card .location-error:empty, .location-status:empty { display: none; }
.location-card .location-copy { gap: 0.25rem; margin: -0.25rem 0 0.5rem; }

/* manage: the event link, with the site's address in front */
.slug-input { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.slug-prefix { color: var(--text-muted); font-size: 0.875rem; white-space: nowrap; }
.field .slug-input input { flex: 1 1 12rem; width: auto; min-width: 0; }
.slug-taken p { margin-bottom: 0.5rem; }

/* manage: the meals people can come to on their own (js/manage-meals.js) */
.meal-rows { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.meal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.meal-row .check { margin-bottom: 0; min-width: 8rem; }
.meal-limit { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-muted); }
.meal-limit input, .field.meal-custom-limit input { width: 7rem; }
.meal-limit input {
  min-height: 40px;
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-active);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.meal-limit input:disabled { opacity: 0.5; }
.field.meal-custom-limit { margin-bottom: 0; flex: none; }
.meal-custom-list { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.meal-custom-list:empty { display: none; }
.meal-custom .field.grow { flex: 1 1 14rem; margin-bottom: 0; }
.meal-custom { align-items: flex-end; }
.meal-custom-item { display: grid; gap: 0.35rem; }
/* where a meal is held, when it is not at the event's place */
.meal-place { padding-inline-start: 1.6rem; }
.meal-place > .check { margin-bottom: 0; font-size: 0.875rem; }
.meal-place-panel { display: grid; gap: 0.5rem; margin-top: 0.5rem; }
.meal-place-panel .field-hint { margin: 0; }
.meal-place-panel .actions.inline { margin: 0; }

/* event page: a location's label above its place */
.location-heading { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); margin-top: 0.35rem; }
.fact-line:first-child .location-heading { margin-top: 0; }

@media (max-width: 480px) {
  .tab { flex: 1 1 calc(50% - 0.4rem); justify-content: center; }
  .pager .btn { padding-inline: 0.6rem; }
}

/* checkout (checkout.html, migrations/016): the event, the ticket and how
   to pay as radio cards, the order, and once a ticket is held, the payment */
.checkout-layout { display: grid; gap: 1rem; width: 100%; max-width: 40rem; margin-inline: auto; }
.checkout-layout > .page-card { max-width: none; }
.checkout-event { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1rem; align-items: center; padding: 1rem; }
.checkout-event h1 { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.checkout-cover { border-radius: var(--radius-sm); }
.checkout-step { border: 0; margin: 0 0 1.25rem; padding: 0; }
.checkout-step legend,
.order-summary .section-label {
  margin-bottom: 0.6rem;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-text);
}
.choice-list { display: grid; gap: 0.5rem; }
.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--motion), background var(--motion);
}
.choice-card:hover { background: var(--surface-hover); }
.choice-card:has(input:checked) { border-color: var(--brand-dark); background: var(--surface-active); }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--brand-dark); outline-offset: 2px; }
.choice-card input { width: 20px; height: 20px; margin-top: 0.1rem; flex: none; accent-color: var(--brand-dark); }
.choice-body { display: grid; gap: 0.15rem; flex: 1; min-width: 0; }
.choice-title { font-weight: 600; overflow-wrap: anywhere; }
.choice-price { display: grid; justify-items: end; gap: 0.1rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.checkout-volunteer { margin-bottom: 1.25rem; }
/* a picked ticket one person can buy more than one of: "How many" under it */
.ticket-pick { display: grid; gap: 0.4rem; }
.ticket-quantity { margin: 0 0 0.25rem; padding-inline-start: 2.75rem; }
.ticket-quantity input { max-width: 7rem; }
.order-summary { margin: 0 0 1rem; padding: 1rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.order-lines { display: grid; gap: 0.4rem; }
.order-lines > div { display: flex; justify-content: space-between; gap: 1rem; }
.order-lines dt { color: var(--text-muted); }
.order-lines dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.order-lines > div:last-child dd { font-weight: 600; }
#payLines { margin: 0.75rem 0 1rem; }
.pay-qr { margin: 0.5rem 0 1rem; display: grid; justify-items: start; gap: 0.4rem; }
/* The QR code at its own shape; on white, so it scans in dark mode too. */
.pay-qr img { max-width: min(100%, 18rem); max-height: 24rem; height: auto; padding: 0.6rem; border-radius: var(--radius-sm); background: var(--qr-bg); }
.rsvp-payment p { margin: 0; }
.chip-warn { background: var(--callout-warn-bg); color: var(--warn); border-color: transparent; }
.chip-ok { background: var(--callout-ok-bg); color: var(--ok); border-color: transparent; }
.chip-info { background: var(--callout-info-bg); color: var(--info); border-color: transparent; }

/* the edit form's Payment section and the attendee list's payments */
.payment-methods { display: grid; gap: 0.15rem; margin-bottom: 0.75rem; }
.payment-indent { padding-inline-start: 1.6rem; }
.pay-qr-preview img { max-width: 12rem; max-height: 16rem; height: auto; padding: 0.5rem; border-radius: var(--radius-sm); background: var(--qr-bg); }
.payment-problems { margin: 0; padding-inline-start: 1.75rem; }
.payment-problems:empty { display: none; }
.attendee-paid { margin-bottom: 0; font-size: 0.875rem; white-space: nowrap; align-items: center; }
.attendee-paid input { margin-top: 0; }
.editor-no-two-step { color: var(--warn); }
.signup-staff-note { margin-bottom: 1rem; }
.signup-staff-note p { margin: 0 0 0.35rem; }
/* a ticket tier's own ways to pay, in its card */
.tier-pay { margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.tier-pay-title { margin: 0 0 0.35rem; font-weight: 600; }
.tier-pay .field-hint { margin: 0 0 0.5rem; }
.tier-methods { margin: 0.5rem 0 0; font-size: 0.875rem; color: var(--text-muted); }
.choice-card.unavailable { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 480px) {
  .checkout-event { grid-template-columns: 5rem minmax(0, 1fr); }
}

/* page tours (js/tour.js, docs/page-tour-spec.md): above everything, dialogs
   and the toast included */
.tour { position: fixed; inset: 0; z-index: 2000; }
.tour-hole {
  position: fixed;
  border-radius: 18px;
  box-shadow: 0 0 0 200vmax var(--tour-dim), 0 0 24px 8px var(--tour-glow);
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
  pointer-events: none;
}
.tour-arrow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.tour-line, .tour-head {
  fill: none;
  stroke: var(--tour-chalk);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Drawn in over its own length on each step; the script sets --len. */
.tour-line { stroke-dasharray: var(--len, 600); stroke-dashoffset: var(--len, 600); }
.tour-line.drawn { animation: tour-draw 0.6s ease forwards; }
@keyframes tour-draw { to { stroke-dashoffset: 0; } }
.tour-skip {
  position: fixed;
  top: max(16px, calc(env(safe-area-inset-top) + 12px));
  left: 16px;
  padding: 8px 14px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--tour-chalk);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
/* Placed by the script: left and top on each step. */
.tour-card { position: fixed; box-sizing: border-box; width: min(460px, calc(100vw - 24px)); color: var(--tour-chalk); }
/* No room for an arrow: the card on its own backing, over the lit element. */
.tour-card.solid { padding: 14px 16px; border-radius: 16px; background: var(--tour-backing); box-shadow: 0 8px 30px var(--tour-shade); }
.tour-text { margin: 0; font-size: 1.3rem; line-height: 1.35; text-shadow: 0 1px 8px var(--tour-shade); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.tour-next {
  padding: 10px 22px;
  font: inherit;
  font-weight: 600;
  color: var(--tour-ink);
  background: var(--tour-chalk);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.tour-skip:focus-visible, .tour-next:focus-visible { outline: 2px solid var(--tour-chalk); outline-offset: 3px; }
.tour-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.tour-dots > span { width: 7px; height: 7px; border-radius: 999px; background: var(--tour-chalk-faint); transition: width 0.2s ease; }
.tour-dots > .on { width: 20px; background: var(--tour-chalk); }
html.touring { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .tour-hole { transition: none; }
  .tour-line.drawn { animation: none; stroke-dashoffset: 0; }
  .tour-dots > span { transition: none; }
}

/* Rich text descriptions (js/rich-text.js): the event page and the editor
   show them alike. Pictures keep their shape; stickers sit in the text. */
.rich-text { overflow-wrap: anywhere; line-height: 1.6; }
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p { margin: 0 0 0.75em; }
.rich-text h2 { margin: 1.2em 0 0.5em; font-size: 1.5rem; line-height: 1.25; }
.rich-text h3 { margin: 1.1em 0 0.45em; font-size: 1.25rem; line-height: 1.3; }
.rich-text h4 { margin: 1em 0 0.4em; font-size: 1.0625rem; line-height: 1.35; }
.rich-text ul, .rich-text ol { margin: 0 0 0.75em; padding-left: 1.6em; }
.rich-text li { margin: 0.15em 0; }
.rich-text blockquote {
  margin: 0 0 0.75em;
  padding: 0.25em 0 0.25em 1em;
  border-left: 3px solid var(--brand-dark);
  color: var(--text-muted);
}
.rich-text hr { margin: 1.25em 0; border: 0; border-top: 1px solid var(--border-strong); }
.rich-text a { color: var(--link); text-decoration: underline; }
.rich-text table { width: 100%; margin: 0 0 0.9em; border-collapse: collapse; font-size: 0.9375rem; }
.rich-text th, .rich-text td { padding: 0.4em 0.6em; border: 1px solid var(--border-strong); vertical-align: top; text-align: left; }
.rich-text th { background: var(--surface-active); font-weight: 700; }
.rich-text th > :last-child, .rich-text td > :last-child { margin-bottom: 0; }
/* In line with the text, as in Word (the site's img rule makes pictures blocks). */
.rich-text img, .rich-text video { display: inline-block; max-width: 100%; height: auto; vertical-align: bottom; border-radius: var(--radius-sm); }
.rich-text .rich-sticker {
  width: 8rem;
  max-width: 40%;
  height: auto;
  vertical-align: middle;
  border-radius: 0;
  background: transparent;
}
.event-description { display: block; }
@media (max-width: 600px) {
  .rich-text table { display: block; overflow-x: auto; }
}

/* manage: the description editor (js/rich-editor.js) */
/* after a paste with lines in it: keep them together, or a paragraph each */
.paste-lines { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.paste-lines .btn[aria-pressed="true"] { border-color: var(--brand-dark); background: var(--surface-active); font-weight: 600; }
.paste-lines .icon-btn { margin-inline-start: auto; }
.description-field .field-label { font-weight: 600; font-size: 0.9375rem; cursor: text; }
.rich-toolbar {
  position: sticky;
  top: calc(var(--header-height, 0px) + 3.6rem);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: center;
  margin-top: 0.4rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--bg);
}
.rich-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; padding-right: 0.5rem; border-right: 1px solid var(--border); }
.rich-group:last-child, .rich-group.rich-table-tools { border-right: 0; }
.rich-table-tools { flex-basis: 100%; padding-top: 0.25rem; border-top: 1px dashed var(--border); }
.rich-table-tools[hidden] { display: none; }
.rich-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.3rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.rich-btn svg { width: 18px; height: 18px; }
.rich-btn:hover { background: var(--surface-hover); }
.rich-btn[aria-pressed="true"] { background: var(--surface-active); border-color: var(--border-strong); }
.rich-btn:disabled { opacity: 0.4; cursor: default; }
.rich-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.rich-text-btn { font-size: 0.8125rem; font-weight: 600; padding: 0 0.55rem; }
.field .rich-select {
  width: auto;
  height: 32px;
  min-height: 32px;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}
.field .rich-select#richBlock { width: 8.5rem; }
.field .rich-font { width: 9.5rem; }
.field .rich-size { width: 4.75rem; }
.rich-custom input[type="color"] { width: 2.5rem; min-height: 1.75rem; padding: 0; }
.rich-colour { position: relative; display: inline-flex; }
.rich-colour-bar { position: absolute; left: 6px; right: 6px; bottom: 4px; height: 3px; border-radius: 2px; background: currentColor; opacity: 0.85; }
.rich-palette {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  width: 15.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  box-shadow: var(--shadow);
}
.rich-palette[hidden] { display: none; }
.rich-palette-none { width: 100%; margin-bottom: 0.4rem; }
.rich-swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.rich-swatch { aspect-ratio: 1; min-width: 0; padding: 0; border: 1px solid var(--border); border-radius: 3px; cursor: pointer; }
.rich-swatch:hover, .rich-swatch:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.rich-custom { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.875rem; }
.rich-custom input { width: 2.5rem; height: 1.75rem; padding: 0; border: 1px solid var(--border); background: none; }
.rich-editor {
  position: relative;
  min-height: 14rem;
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: text;
}
.rich-editor:focus { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.rich-editor[hidden] { display: none; }
.rich-editor.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  color: var(--text-muted);
  pointer-events: none;
}
.rich-editor img { cursor: grab; }
.rich-editor img:hover { outline: 2px solid var(--brand-dark); outline-offset: 1px; }
.rich-editor table td, .rich-editor table th { min-width: 3rem; }
.rich-editor img.rich-pending {
  display: inline-block;
  width: 10rem;
  height: 6rem;
  background: var(--surface-active) linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent) 0 0 / 200% 100%;
  animation: rich-pending 1.2s linear infinite;
}
@keyframes rich-pending { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .rich-editor img.rich-pending { animation: none; }
}

/* manage: the picture dialog (js/picture-picker.js) */
.modal.picture-modal { max-width: 46rem; }
.picker-tabs { display: flex; gap: 0.25rem; margin: 0.5rem 0 0.75rem; border-bottom: 1px solid var(--border); }
.picker-tab {
  padding: 0.5rem 0.9rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.picker-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand-dark); }
.picker-grid {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  columns: 4 8rem;
  column-gap: 0.5rem;
}
.picker-grid li { break-inside: avoid; margin-bottom: 0.5rem; }
.picker-item {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-active);
  overflow: hidden;
  cursor: pointer;
}
.picker-item img { display: block; width: 100%; height: auto; }
.picker-item:hover, .picker-item:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: 1px; }
.picker-stickers { columns: 6 4.5rem; }
.picker-sticker { background: transparent; border-color: transparent; }
.picker-pack h3 { margin: 0.75rem 0 0.25rem; font-size: 1rem; }
.picker-pack-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem; }
.picker-pack-form .field { flex: 1 1 16rem; margin: 0; }

/* account: sticker packs (js/account-stickers.js) */
.sticker-packs { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.sticker-pack { padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sticker-pack-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.sticker-pack-head > div { display: flex; flex-direction: column; }
.sticker-pack-preview { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.sticker-pack-preview img { width: 3rem; height: 3rem; object-fit: contain; }

/* manage: cropping a picture in a description (js/picture-crop.js). The
   whole picture, with the part kept framed and the rest shaded. */
.modal.picture-crop-modal { max-width: 48rem; }
.picture-crop-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin: 0.5rem 0; }
.picture-crop-shape { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9375rem; }
.picture-crop-shape select { min-height: 36px; padding: 0 0.5rem; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-active); color: var(--text); }
.picture-crop-stage {
  display: flex;
  justify-content: center;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-active);
  touch-action: none;
  user-select: none;
}
.picture-crop-stage:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.picture-crop-box { position: relative; display: inline-block; line-height: 0; }
.picture-crop-shade { position: absolute; background: rgba(0, 0, 0, 0.55); pointer-events: none; }
.picture-crop-box img { display: block; max-width: 100%; max-height: min(60vh, 34rem); width: auto; height: auto; }
.picture-crop-frame {
  position: absolute;
  outline: 2px solid #ffffff;
  cursor: move;
}
.picture-crop-frame [data-handle] {
  position: absolute;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #ffffff;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.6);
}
.picture-crop-frame [data-handle="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.picture-crop-frame [data-handle="n"] { left: 50%; top: 0; cursor: ns-resize; }
.picture-crop-frame [data-handle="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.picture-crop-frame [data-handle="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.picture-crop-frame [data-handle="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.picture-crop-frame [data-handle="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.picture-crop-frame [data-handle="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.picture-crop-frame [data-handle="w"] { left: 0; top: 50%; cursor: ew-resize; }
@media (pointer: coarse) {
  .picture-crop-frame [data-handle] { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
}
.rich-editor img[data-gallery-id] { cursor: pointer; }

/* Emoji everywhere on the site (the * rule above uses this list after the
   site's font): each reader's own device's emoji first; any its fonts are
   too old to have come from the site's copy of Noto Color Emoji
   (assets/fonts/emoji/emoji.css, "GFTV Emoji"), so the latest edition shows.
   A font pasted into a description keeps the list after it (js/rich-text.js
   fontFamily). */
:root { --emoji-fonts: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'GFTV Emoji'; }

/* manage: the editor search's dropdown (js/manage-editors.js) */
.editor-search { position: relative; }
.editor-options { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 0.25rem 0 0; padding: 0.25rem; list-style: none; max-height: 16rem; overflow-y: auto; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 8px 24px var(--shadow); }
.editor-option { display: grid; gap: 0.05rem; padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer; }
.editor-option[aria-selected="true"], .editor-option:hover { background: var(--surface-active); }
.editor-option-note { padding: 0.45rem 0.6rem; }

/* manage: the emoji picker (js/emoji-picker.js) */
.rich-palette.emoji-panel { width: min(22rem, calc(100vw - 2rem)); padding: 0.6rem; }
.field .emoji-search { width: 100%; min-height: 36px; padding: 0.35rem 0.6rem; font-size: 0.9375rem; }
.emoji-tones, .emoji-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 0.4rem; }
.emoji-tabs { padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
.emoji-tone, .emoji-tab {
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.emoji-tone[aria-pressed="true"], .emoji-tab[aria-selected="true"] { background: var(--surface-active); border-color: var(--border-strong); }
.emoji-heading { margin: 0.4rem 0 0.2rem; font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.25rem, 1fr));
  max-height: 15rem;
  overflow-y: auto;
  line-height: 1;
}
.emoji-item {
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 1.45rem;
  cursor: pointer;
}
.emoji-item:hover, .emoji-item:focus-visible { background: var(--surface-active); outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.emoji-version { margin: 0.35rem 0 0; font-size: 0.75rem; color: var(--text-muted); text-align: right; }

/* A gallery picture's size in a description (js/rich-text.js
   PICTURE_SIZES): a share of the text's width, Word-like. */
.rich-text img[data-size="small"] { width: 25%; }
.rich-text img[data-size="medium"] { width: 50%; }
.rich-text img[data-size="large"] { width: 75%; }
.rich-text img[data-size="full"] { width: 100%; }
.picture-size { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; margin: 0.25rem 0 0.5rem; padding: 0; border: 0; }
.picture-size legend { width: 100%; margin-bottom: 0.25rem; font-weight: 600; font-size: 0.9375rem; }
.picture-size-option { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 32px; cursor: pointer; }
.picture-size-option input { accent-color: var(--brand-dark); }

/* ---------------------------------------------------------------------------
   ID checks, check-in and entry codes (migrations/027)
   --------------------------------------------------------------------------- */

.pill {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}
.pill-ok { background: var(--callout-ok-bg); color: var(--ok); }
.pill-warn { background: var(--callout-warn-bg); color: var(--warn); }
.pill-beta { background: color-mix(in srgb, var(--link) 14%, transparent); color: var(--link); letter-spacing: 0.02em; text-transform: uppercase; }
.id-way { margin-bottom: 0.25rem; }
.id-way.is-unavailable { opacity: 0.55; }
.id-ways .field-hint { margin: 0 0 0.85rem 1.85rem; }
.verified-mark { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--ok); font-size: 0.8125rem; font-weight: 600; }
.verified-mark svg { width: 16px; height: 16px; }
.id-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Entry codes on the edit form */
.entry-codes { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.entry-code img { width: 64px; height: 64px; object-fit: contain; background: var(--qr-bg); border-radius: var(--radius-sm); flex: none; }
.entry-code input { width: 6rem; }

/* The admins' ID reviews */
.id-reviews { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 1rem; }
.id-review { padding: 1rem; }
.id-review-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; }
.id-review-photos { display: grid; grid-template-columns: 2fr 1fr; gap: 0.75rem; margin: 0.75rem 0; }
.id-review-photos img { width: 100%; max-height: 360px; object-fit: contain; background: var(--bg-alt); border-radius: var(--radius-sm); }
.findings { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.3rem; }
.finding { display: flex; align-items: center; gap: 0.4rem; }
.finding svg { width: 18px; height: 18px; flex: none; }
.finding-true svg { color: var(--ok); }
.finding-false svg { color: var(--danger); }
.id-review-actions { flex-wrap: wrap; gap: 0.5rem; }
.id-review-actions input {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-active);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--motion) ease, background-color var(--motion) ease;
}
.id-review-actions input::placeholder { color: var(--text-muted-strong); opacity: 1; }
.id-review-actions input:focus { border-color: var(--focus-ring); }
@media (max-width: 560px) {
  .id-review-photos { grid-template-columns: 1fr; }
}

/* HelloID (/helloid) */
.helloid { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.helloid-brand { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.5rem; font-weight: 700; color: var(--brand-text); }
.helloid-brand svg { width: 22px; height: 22px; }
.helloid-country {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.helloid-country div { display: grid; }
.helloid-documents { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.helloid-documents li + li { border-top: 1px solid var(--border); }
.helloid-document {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 56px;
  padding: 0.75rem 1rem;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.helloid-document:hover, .helloid-document:focus-visible { background: var(--surface-hover); }
.helloid-document span { flex: 1; }
.helloid-document svg { width: 22px; height: 22px; flex: none; }
.helloid-points { padding-left: 1.25rem; }
.helloid-points li { margin-bottom: 0.5rem; }
.helloid-camera { position: relative; margin: 1rem 0; overflow: hidden; border-radius: var(--radius); background: #000; }
.helloid-camera video, .helloid-camera img { display: block; width: 100%; max-height: 60vh; object-fit: contain; }
.helloid-camera.face video { transform: scaleX(-1); aspect-ratio: 3 / 4; object-fit: cover; }
.helloid-frame { position: absolute; inset: 12% 8%; border: 3px solid rgba(255, 255, 255, 0.85); border-radius: 12px; pointer-events: none; }
.helloid-oval { position: absolute; inset: 12% 20% 18%; border: 3px solid rgba(255, 255, 255, 0.85); border-radius: 50%; pointer-events: none; }
.helloid-prompt {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}
.helloid-prompt:empty { display: none; }
/* The colour flashes: the whole screen, above everything. */
.helloid-flash { position: fixed; inset: 0; z-index: 100; background: #ffffff; }

/* Check-in (/checkin) */
.checkin-head { margin-bottom: 1.25rem; }
.checkin-head h1 { margin: 0; }
.checkin-count { margin: 0.25rem 0 0; font-size: 1.5rem; font-weight: 700; }
#checkinNet.is-offline { color: var(--warn); font-weight: 600; }
.checkin-camera { position: relative; display: grid; place-items: center; min-height: 160px; overflow: hidden; border-radius: var(--radius); background: var(--bg-alt); }
.checkin-camera video { display: block; width: 100%; max-height: 50vh; object-fit: cover; }
.checkin-result { margin-top: 1rem; padding: 1rem; border-radius: var(--radius-sm); }
.checkin-result.is-ok { background: var(--callout-ok-bg); }
.checkin-result.is-warn { background: var(--callout-warn-bg); }
.checkin-result-head { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.25rem; }
.checkin-result-head svg { width: 22px; height: 22px; }
.checkin-name { margin: 0; font-size: 1.375rem; font-weight: 700; }
.checkin-result p { margin: 0.25rem 0; }
.item-row.is-in > svg { color: var(--ok); }
.checkin-beacon { display: grid; justify-items: center; gap: 0.75rem; }
.beacon-qr svg { width: min(80vw, 420px); height: min(80vw, 420px); }
.beacon-qr:fullscreen { display: grid; place-items: center; background: var(--qr-bg); }
.beacon-qr:fullscreen svg { width: min(90vw, 90vh); height: min(90vw, 90vh); }
.checkin-door { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 1rem 0; }
.checkin-door dt { font-weight: 600; }
.checkin-door dd { margin: 0; }

/* The pass on the event page */
.pass-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.pass-card { display: grid; justify-items: center; text-align: center; }
.pass-card .section-label { margin: 0; }
.pass-entry { width: 100%; max-width: 280px; background: var(--qr-bg); border-radius: var(--radius-sm); padding: 8px; }
.pass-offline h1 { margin: 0.5rem 0 1rem; }

/* ---------------------------------------------------------------------------
   The privacy page (privacy.html): a plain document, in the site's colours.
   --------------------------------------------------------------------------- */

body.legal { padding: 32px 16px 48px; }
.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 40px 36px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.legal-home { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 20px; color: var(--text); font-weight: 700; text-decoration: none; }
.legal-home img { border-radius: 9px; display: block; }
.legal-page h1 { margin: 0; font-size: 2rem; line-height: 1.2; }
.legal-date { color: var(--text-muted); margin: 4px 0 20px; }
.legal-page h2 { font-size: 1.25rem; line-height: 1.3; margin: 32px 0 8px; scroll-margin-top: 16px; }
.legal-page h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.legal-page p, .legal-page ul, .legal-page ol { margin: 0 0 12px; }
.legal-page ul, .legal-page ol { padding-left: 22px; }
.legal-page li { margin-bottom: 6px; }
.legal-page a { color: var(--link); }
.legal-short { margin: 20px 0; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.legal-short h2 { margin-top: 0; }
.legal-toc { margin: 20px 0; }
.legal-table { overflow-x: auto; margin: 0 0 12px; }
.legal-table table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.legal-table th, .legal-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
/* /manage's HelloID tuning report. */
.tuning-table { overflow-x: auto; margin: 0.75rem 0; }
.tuning-table table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tuning-table th, .tuning-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tuning-table td + td, .tuning-table th + th { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tuning-table .changed { font-weight: 600; color: var(--brand-text); }
#tuningReport { margin-top: 0.75rem; }
#tuningReport h3 { font-size: 1rem; margin: 1rem 0 0.25rem; }
#tuningReport ul { padding-left: 1.25rem; }
.legal-back { margin-top: 32px; }
@media (max-width: 600px) {
  .legal-page { padding: 24px 18px; }
  .legal-table thead { display: none; }
  .legal-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .legal-table td { display: block; padding: 2px 0; border: 0; }
  .legal-table td::before { content: attr(data-label) ": "; font-weight: 600; }
}

/* HelloMiles (migrations/030): the account page's tab, and the editor's. */
.miles-balance { font-size: 2rem; font-weight: 700; color: var(--brand-text); margin: 0.25rem 0 0; }
.miles-earn { margin: 0.25rem 0 0.75rem; padding-left: 1.25rem; display: grid; gap: 0.25rem; }
.miles-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.miles-what { display: grid; gap: 0.1rem; min-width: 0; overflow-wrap: anywhere; }
.miles-amount { white-space: nowrap; color: var(--brand-text); }
.miles-amount.is-spent { color: var(--text-muted); }
.self-checkin-ways { display: grid; gap: 0.5rem; margin-top: 0.5rem; }
.self-checkin-ways .btn { justify-content: center; }
