/* The organiser website's one stylesheet.
   Plain, calm and trustworthy: generous spacing, one accent colour, the system font stack
   (the skins have their own fonts; this website does not need one).

   Every colour is a custom property declared in one of the three blocks below, and
   tests/site-front-test.js reads them straight out of this file and checks that each text and
   background pair reaches 4.5 to 1 using the engine's own contrast() function. If you change a
   colour, run that test.

   Colour scheme: light by default; the dark set is used when the viewer's device asks for dark
   (and the Demo panel can force either, through data-theme on <html>). */

/* ---------------------------------------------------------------- light ---- */
:root {
  --page: #ffffff;
  --surface: #f4f6f9;
  --surface-2: #eaeef4;
  --line: #d8dce3;
  --ink: #16181d;
  --ink-muted: #5a6170;
  --accent: #1f4fa8;             /* link text on --page and --surface */
  --accent-fill: #1f4fa8;        /* a filled button */
  --accent-fill-ink: #ffffff;    /* its text */
  --accent-fill-hover: #17407f;
  --warn-bg: #fff4d6;
  --warn-ink: #5c4300;
  --danger: #a3231b;             /* danger text */
  --danger-fill: #a3231b;
  --danger-fill-ink: #ffffff;
  --ok: #19653a;
  --shadow: 0 1px 2px rgba(20, 24, 32, 0.08), 0 8px 24px rgba(20, 24, 32, 0.06);
  --radius: 10px;
  --tap: 44px;                   /* the smallest a tappable thing may be */
  --gap: 1rem;
}

/* ----------------------------------------------------------------- dark ---- */
/* Guarded so that data-theme="light" wins over the device preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #14161a;
    --surface: #1e2128;
    --surface-2: #262a33;
    --line: #333945;
    --ink: #edeff3;
    --ink-muted: #a8b0be;
    --accent: #8fb6ff;
    --accent-fill: #8fb6ff;
    --accent-fill-ink: #0c1220;
    --accent-fill-hover: #b4cdff;
    --warn-bg: #3a2f10;
    --warn-ink: #ffe09a;
    --danger: #ff9e94;
    --danger-fill: #ff9e94;
    --danger-fill-ink: #2a0a06;
    --ok: #6fd79b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --page: #14161a;
  --surface: #1e2128;
  --surface-2: #262a33;
  --line: #333945;
  --ink: #edeff3;
  --ink-muted: #a8b0be;
  --accent: #8fb6ff;
  --accent-fill: #8fb6ff;
  --accent-fill-ink: #0c1220;
  --accent-fill-hover: #b4cdff;
  --warn-bg: #3a2f10;
  --warn-ink: #ffe09a;
  --danger: #ff9e94;
  --danger-fill: #ff9e94;
  --danger-fill-ink: #2a0a06;
  --ok: #6fd79b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------- basics ---- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; margin-top: 1.25rem; }
p { margin: 0 0 1rem; }
/* Browsers give <figure> a 40px margin on each side, which would squeeze every photo card. */
figure { margin: 0; }
figcaption { margin: 0; }
.lead { font-size: 1.1rem; color: var(--ink-muted); max-width: 40rem; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--page); color: var(--ink); padding: 0.75rem 1rem; z-index: 100;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- shell ---- */
.bar {
  border-bottom: 1px solid var(--line);
  background: var(--page);
}
.bar-inner {
  max-width: 64rem; margin: 0 auto; padding: 0.5rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem;
}
.brand {
  font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; min-height: var(--tap); padding-right: 0.5rem;
}
.brand:hover { text-decoration: underline; }
.bar nav { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; margin-left: auto; }
.bar nav a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 0.5rem;
  color: var(--ink); text-decoration: none; border-radius: 6px;
}
.bar nav a:hover { background: var(--surface); text-decoration: underline; }
.bar nav a[aria-current="page"] { font-weight: 650; box-shadow: inset 0 -3px 0 var(--accent); }

main { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
main.narrow { max-width: 34rem; }

footer.foot {
  max-width: 64rem; margin: 0 auto; padding: 1rem 1rem 3rem;
  color: var(--ink-muted); font-size: 0.875rem; border-top: 1px solid var(--line);
}

/* -------------------------------------------------------------- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: var(--tap); min-width: var(--tap);
  padding: 0.5rem 1.1rem;
  font: inherit; font-weight: 600;
  border-radius: var(--radius); border: 1px solid transparent;
  background: var(--accent-fill); color: var(--accent-fill-ink);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-fill-hover); }
.btn.secondary { background: var(--page); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface); }
.btn.quiet { background: transparent; color: var(--accent); border-color: transparent; padding: 0.5rem 0.6rem; }
.btn.quiet:hover { background: var(--surface); }
.btn.danger { background: var(--danger-fill); color: var(--danger-fill-ink); }
.btn.danger:hover { filter: brightness(0.92); }
.btn.small { min-height: var(--tap); padding: 0.35rem 0.75rem; font-size: 0.9rem; }
.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--surface-2); color: var(--ink-muted); border-color: var(--line);
  cursor: not-allowed;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.btn-row.end { justify-content: flex-end; }

/* ---------------------------------------------------------------- forms ---- */
.field { margin: 0 0 1.25rem; }
.field > label, .fieldset > legend {
  display: block; font-weight: 600; margin-bottom: 0.3rem;
}
.hint { display: block; color: var(--ink-muted); font-size: 0.875rem; margin-bottom: 0.4rem; }
input[type="text"], input[type="email"], input[type="number"], select, textarea {
  width: 100%; min-height: var(--tap);
  padding: 0.55rem 0.7rem;
  font: inherit; color: var(--ink); background: var(--page);
  border: 1px solid var(--line); border-radius: var(--radius);
}
input[readonly] { background: var(--surface); }
textarea { min-height: 5rem; }
/* A box wider than the longest sensible answer is harder to read, not easier. */
.field input, .field select, .field textarea { max-width: 32rem; }
input[type="number"] { max-width: 8rem; }
.linkbox input { max-width: none; }

/* A heading that is focused by script (moving between the steps of a form) should not show a
   focus ring on a first load; it is focused so a screen reader announces the new step. */
[tabindex="-1"]:focus { outline: none; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0 0 1.25rem; }
.fieldset legend { padding: 0 0.35rem; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: var(--tap); padding: 0.35rem 0.8rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--page);
  cursor: pointer;
}
.choice:hover { background: var(--surface); }
.choice input { accent-color: var(--accent-fill); width: 1.1rem; height: 1.1rem; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.field-error { color: var(--danger); font-weight: 600; margin: 0.3rem 0 0; }
.counter { color: var(--ink-muted); font-size: 0.8rem; }

/* ------------------------------------------------------------- messages ---- */
.note, .warn, .bad, .good {
  border: 1px solid var(--line); border-left-width: 5px;
  border-radius: var(--radius); padding: 0.8rem 1rem; margin: 0 0 1.25rem;
  background: var(--surface);
}
.note { border-left-color: var(--accent); }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.bad { border-left-color: var(--danger); }
.bad strong { color: var(--danger); }
.good { border-left-color: var(--ok); }
.note > :last-child, .warn > :last-child, .bad > :last-child, .good > :last-child { margin-bottom: 0; }

/* Status words never rely on colour alone: each carries its own word, and the dot is
   backed up by the text beside it. */
.status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-weight: 650; font-size: 0.875rem;
}
.status::before {
  content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%;
  background: var(--ink-muted); flex: none;
}
.status.is-live::before { background: var(--ok); }
.status.is-running::before { background: var(--accent); }
.status.is-waiting::before { background: var(--warn-ink); }
.status.is-expired::before, .status.is-failed::before { background: var(--danger); }

.pill {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); font-size: 0.8rem; font-weight: 600;
}

/* ---------------------------------------------------------------- lists ---- */
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 42rem) { .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 60rem) { .grid.three { grid-template-columns: repeat(3, 1fr); } }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin: 0 0 1.25rem;
}
.grid > .panel { margin-bottom: 0; }           /* a grid spaces its own children */
.panel h2, .panel h3 { margin-top: 0; }

.event-card { display: flex; flex-direction: column; gap: 0.5rem; }
.event-card h3 { margin: 0; }
.event-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.6rem; font-size: 0.9rem; }
.event-card dt { color: var(--ink-muted); }
.event-card dd { margin: 0; }
.event-card .btn-row { margin-top: auto; padding-top: 0.5rem; }

dl.summary { display: grid; grid-template-columns: 1fr; gap: 0.1rem 1rem; margin: 0 0 1rem; }
@media (min-width: 34rem) { dl.summary { grid-template-columns: 12rem 1fr; } }
dl.summary dt { color: var(--ink-muted); }
dl.summary dd { margin: 0 0 0.5rem; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.actions .btn-row { flex-wrap: nowrap; }     /* Stop and Delete belong on one line */

/* ------------------------------------------------------- the three links ---- */
.linkbox { margin: 0 0 1.25rem; }
.linkbox label { display: block; font-weight: 600; }
.linkbox .hint { margin-bottom: 0.35rem; }
.linkbox .row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.linkbox input { flex: 1 1 16rem; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.85rem; }

/* ------------------------------------------------------------- gallery ----- */
.photos { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
.photo {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem;
}
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; background: var(--surface-2); }
.photo .meta { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; font-size: 0.8rem; color: var(--ink-muted); }
.photo.is-hidden img { opacity: 0.35; }
.photo .btn-row { gap: 0.3rem; }
.photo .btn { padding: 0.25rem 0.5rem; font-size: 0.82rem; min-height: var(--tap); }
.flagged { color: var(--danger); font-weight: 650; }

/* ------------------------------------------------- the skins and samples ---- */
.skin-card { display: flex; flex-direction: column; gap: 0.6rem; }
.skin-card h3 { margin: 0; }
.swatches { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.swatches li { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; font-size: 0.7rem; color: var(--ink-muted); }
.swatches .chip { width: 2.1rem; height: 2.1rem; border-radius: 6px; border: 1px solid var(--line); display: block; }
.fontlist { margin: 0; padding: 0; list-style: none; font-size: 0.85rem; color: var(--ink-muted); }
.fontlist li { padding: 0.05rem 0; }
.fontlist b { color: var(--ink); font-weight: 600; }

/* The sample card. Its outer shape and the photo's size inside it are the same for every
   skin (that is fixed in the engine); only the band, the colours and the fonts change. */
.card {
  background: var(--sk-page, #eee);
  border-radius: 6px;
  padding: 0.9rem;
  display: flex; justify-content: center;
}
.card-band {
  background: var(--sk-band, #ddd);
  color: var(--sk-ink, #111);
  width: 100%; max-width: 15rem;
  padding: 0.6rem 0.6rem 0.9rem;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  position: relative;
}
.card-photo {
  background: var(--sk-photo, #ccc);
  aspect-ratio: 1; width: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-photo svg { width: 100%; height: 100%; display: block; }
.card-caption {
  font-family: var(--sk-font-hand, cursive);
  font-size: 1.3rem; line-height: 1.1;
  margin: 0.5rem 0 0.1rem; text-align: center;
}
.card-names {
  font-family: var(--sk-font-label, serif);
  font-size: 1rem; margin: 0; text-align: center; letter-spacing: 0.02em;
}
.card-date {
  font-family: var(--sk-font-detail, serif);
  font-size: 0.8rem; margin: 0; text-align: center; color: var(--sk-ink-dim, #555);
}
.card-doodle { position: absolute; width: 1.6rem; height: 1.6rem; color: var(--sk-accent, #888); }
.card-doodle.a { top: -0.45rem; left: -0.45rem; }
.card-doodle.b { bottom: -0.5rem; right: -0.4rem; color: var(--sk-accent-strong, #888); }
.card-doodle svg { width: 100%; height: 100%; display: block; }

/* The wall's two colours, shown as a strip so the organiser sees what the projector gets. */
.wallstrip { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.wallstrip span { flex: 1; min-height: 2.2rem; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; }
.wallstrip .w-ground { background: var(--sk-wall-ground, #fff); color: var(--sk-wall-ink, #000); }
.wallstrip .w-tile { background: var(--sk-wall-tile, #eee); color: var(--sk-wall-ink, #000); }
.wallstrip .p-page { background: var(--sk-page, #fff); color: var(--sk-ink, #000); }
.wallstrip .p-band { background: var(--sk-band, #eee); color: var(--sk-ink, #000); }
.wallstrip .p-accent { background: var(--sk-accent, #888); color: var(--sk-page, #fff); }

/* The skin picker: a radio button, the name and a small sample, all one tappable label. */
.pick { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 46rem) { .pick { grid-template-columns: 1fr 1fr; } }
.pick > label {
  display: block; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.75rem; background: var(--page); cursor: pointer;
}
.pick > label:hover { background: var(--surface); }
.pick > label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.pick .head { display: flex; align-items: center; gap: 0.5rem; min-height: var(--tap); font-weight: 650; }
.pick input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent-fill); flex: none; }
/* The live preview should read as one example, not fill the screen. */
#preview .card, #preview .wallstrip { max-width: 26rem; }

/* ------------------------------------------------------------- the steps ---- */
.steps { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0 0 1.25rem; padding: 0; list-style: none; font-size: 0.85rem; }
.steps li { color: var(--ink-muted); padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--surface); }
.steps li[aria-current="step"] { background: var(--accent-fill); color: var(--accent-fill-ink); font-weight: 650; }

/* ------------------------------------------------------------ the QR card --- */
.qrcard {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; background: var(--page);
  max-width: 24rem; margin: 0 auto;
}
.qrcard h2 { margin-top: 0; font-size: 1.5rem; }
.qrbox {
  width: 13rem; height: 13rem; margin: 1rem auto;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--surface-2); color: var(--ink-muted);
  border: 1px dashed var(--line); border-radius: 6px; padding: 0.5rem; font-size: 0.85rem;
}
.qrbox canvas, .qrbox svg, .qrbox img { width: 100%; height: 100%; }
.qr-placeholder p { margin: 0; }
.qrcard .scanline { font-weight: 650; margin: 0.75rem 0 0.25rem; }

/* ---------------------------------------------------------- demo controls --- */
.demo {
  position: fixed; right: 0.75rem; bottom: 0.75rem; z-index: 50;
  max-width: calc(100vw - 1.5rem);
  background: var(--page); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 0.875rem;
}
.demo > summary {
  min-height: var(--tap); display: flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.9rem; cursor: pointer; font-weight: 650; border-radius: var(--radius);
}
.demo[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.demo .body { padding: 0.75rem 0.9rem 0.9rem; max-height: 70vh; overflow-y: auto; width: 20rem; max-width: calc(100vw - 1.5rem); }
.demo h3 { margin: 0.8rem 0 0.3rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.demo h3:first-child { margin-top: 0; }
.demo .btn { width: 100%; margin-bottom: 0.35rem; justify-content: flex-start; }
.demo .toggle { display: flex; align-items: center; gap: 0.5rem; min-height: var(--tap); }
.demo .toggle input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent-fill); }

/* --------------------------------------------------------------- waiting ---- */
.spinner {
  display: inline-block; width: 1rem; height: 1rem; vertical-align: -2px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.busy { color: var(--ink-muted); }

/* A short-lived message after an action. Announced to screen readers through aria-live. */
.toasts { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 60; width: min(28rem, calc(100vw - 2rem)); }
.toast {
  background: var(--ink); color: var(--page);
  padding: 0.6rem 0.9rem; border-radius: var(--radius); margin-top: 0.4rem;
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .spinner { animation: none; border-top-color: var(--accent); }
}

/* ----------------------------------------------------------------- print ---- */
@media print {
  .bar, .foot, .demo, .noprint, .toasts { display: none !important; }
  body { background: #ffffff; color: #000000; }
  main { padding: 0; max-width: none; }
  .qrcard { border: 1px solid #000000; box-shadow: none; max-width: none; page-break-inside: avoid; }
  .qrbox { border-color: #000000; background: #ffffff; color: #000000; }
  a { color: #000000; text-decoration: none; }
}
@page { size: A4; margin: 14mm; }
