/* The one look for every page on the site: the same top bar, footer, colours and text, so every page is
   laid out the same way for a screen reader (skip link, header, main, footer) and by eye.
   Every page links this file and nothing else for its layout (tools/check-pages.mjs checks). */

/* ── Colours: light and dark, all text at least 4.5:1, focus rings 3:1 ─────────────────────── */
:root { color-scheme: light dark; --bg: #fdfdfb; --fg: #1a1a1a; --accent: #0b5cad; --muted: #4a4a4a; --line: #d6d6d0; --danger: #b00020;
  /* A QR code stays dark on white in both themes, or phone cameras can't read it. */
  --qr-light: #ffffff; --qr-dark: #000000; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #121417; --fg: #f1f1f1; --accent: #7cb8ff; --muted: #c4c4c4; --line: #33373d; --danger: #ff8a80; }
}

* { box-sizing: border-box; }
body { margin: 0; font: 1.125rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }

/* ── The skip link, top bar, page and footer ───────────────────────────────────────────────── */
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--accent); color: var(--bg); padding: .5rem 1rem; z-index: 10; }

header, main, footer { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem; }
/* Pages with tables and forms (admin, my account, the flight map) have more room, top bar and footer included. */
body.wide header, body.wide main, body.wide footer { max-width: 72rem; }
header { padding-top: 1rem; }
.topbar ul { list-style: none; margin: 0 0 2rem; padding: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; }
.topbar .home { font-weight: 600; }

footer { border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1rem; padding-bottom: 3rem; }
footer ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }

/* ── Text ──────────────────────────────────────────────────────────────────────────────────── */
h1 { font-size: 2.25rem; line-height: 1.2; margin: 0 0 .75rem; }
h2 { font-size: 1.5rem; margin: 2.5rem 0 .75rem; }
h3 { font-size: 1.25rem; margin: 0 0 .25rem; }
p { color: var(--muted); }
.lead { font-size: 1.25rem; color: var(--fg); }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[aria-current="page"] { font-weight: 600; text-decoration: none; }
/* Actions that can't be undone, such as deleting an account. */
.danger { color: var(--danger); }
/* A danger button sets its own background too: the browser's default button grey in dark mode leaves the red text
   at 2.3:1. */
button.danger { background: var(--bg); border: 2px solid var(--danger); border-radius: 4px; font-weight: 600; }

/* ── The home page's project list and buttons ──────────────────────────────────────────────── */
.project { border-top: 1px solid var(--line); padding: 1.25rem 0; }
.status { font-weight: 600; color: var(--fg); }
.button { display: inline-block; background: var(--accent); color: var(--bg); padding: .6rem 1.1rem; border-radius: 4px; text-decoration: none; font-weight: 600; margin: .25rem .75rem .25rem 0; }

/* ── WCAG 2.2 AA basics for forms ──────────────────────────────────────────────────────────── */
/* 1.4.10 Reflow: fields keep their set width on wide screens but never get wider than the screen, so nothing
   scrolls sideways on a phone or at 400% zoom. */
input, textarea, select { max-width: 100%; box-sizing: border-box; font: inherit; }
button { font: inherit; padding: .35rem .9rem; }

/* 1.4.10 / 1.4.12: a long word or email address wraps instead of pushing the page wide. */
body { overflow-wrap: break-word; }
table { max-width: 100%; }

/* 2.5.8 Target Size: every button, field, checkbox and radio button is at least 24 by 24 CSS pixels
   (1.5rem at the default text size). */
button, input:not([type=checkbox]):not([type=radio]) { min-height: 1.5rem; }
input[type=checkbox], input[type=radio] { width: 1.5rem; height: 1.5rem; vertical-align: middle; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── The admin pages ───────────────────────────────────────────────────────────────────────── */
/* Fields: a set width on wide screens, never wider than the screen (the max-width above). */
.field { width: 100%; max-width: 25rem; }
.field-short { width: 100%; max-width: 16.5rem; }
/* A long message, such as the update-list email. */
.field-wide { max-width: 40rem; }
/* The email review on the Broadcast page: the email itself, in a frame that can't run anything. */
.email-preview { display: block; width: 100%; max-width: 46rem; min-height: 12rem; border: 1px solid var(--line); margin: .5rem 0 1rem; }
/* Text that keeps its own line breaks, such as a support ticket. */
.keep-lines { white-space: pre-line; }
.link-list li { margin: .5rem 0; }
/* A wide table scrolls inside its own box on a narrow screen, so the page itself never scrolls sideways
   (1.4.10). The box can take keyboard focus so it can be scrolled without a mouse. */
.table-box { overflow-x: auto; margin: 1rem 0; }
/* Headings, messages and boxes that take focus (tabindex) show it like links and buttons do. */
[tabindex]:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.data { border-collapse: collapse; width: 100%; }
.data caption { text-align: left; font-weight: 600; padding: .25rem 0; }
.data th, .data td { text-align: left; vertical-align: top; padding: .4rem .75rem .4rem 0; border-bottom: 1px solid var(--line); }
.actions button { margin: .25rem .5rem .25rem 0; }
/* The admin pages' breadcrumb: the same links in the same place on every admin page (3.2.3). */
.crumbs ol { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
/* Two-step sign-in: the QR code on a white quiet zone, sized to fit a phone screen, and the setup key's groups of
   four shown large for reading by eye. */
.qr { display: inline-block; background: var(--qr-light); color: var(--qr-dark); padding: 1rem; width: 100%; max-width: 18rem; }
.qr svg { display: block; width: 100%; height: auto; }
.key-groups li { margin: .4rem 0; }
.key-group { display: inline-block; min-width: 4.5ch; margin-right: .75rem; font: 600 1.375rem/1.2 ui-monospace, Consolas, monospace; color: var(--fg); letter-spacing: .15em; }

/* ── Forms people fill in (sign up, join the beta, My account) ─────────────────────────────── */
/* Every field has its label above it, a help line under the label when it needs one, and an error line that is
   empty until there's something to fix. Fields and the error text use the page's colours, so they keep their
   contrast in light and dark (borders 3:1 or better, text 4.5:1 or better). */
.form label, .form legend { display: block; font-weight: 600; color: var(--fg); margin: 1.25rem 0 .25rem; }
.form .check label { display: inline; font-weight: 400; margin: 0 0 0 .4rem; }
.form .check { margin: 1rem 0; }
.form fieldset { border: 1px solid var(--line); padding: .25rem 1rem 1rem; margin: 1.25rem 0; }
.form fieldset .check { margin: .5rem 0; }
.form input:not([type=checkbox]):not([type=radio]), .form textarea {
  display: block; width: 100%; max-width: 25rem; padding: .4rem .5rem;
  color: var(--fg); background: var(--bg); border: 1px solid var(--muted); border-radius: 3px; }
.form textarea { max-width: 36rem; }
.form button[type=submit] { margin-top: 1.5rem; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.help { margin: 0 0 .35rem; font-size: 1rem; }
.error { color: var(--danger); font-weight: 600; margin: .25rem 0; }
.error:empty { display: none; }
.form [aria-invalid="true"] { border: 2px solid var(--danger) !important; }
/* A button that is busy keeps its focus (a disabled one would drop it), and looks unavailable. */
[aria-disabled="true"] { opacity: .6; cursor: progress; }
/* The two sign-up choices on the home page and the sign-up page. */
.choice { border-top: 1px solid var(--line); padding: 1rem 0; }
.choice h3 { margin-top: 0; }
/* A short list of facts, such as a ticket's status and date. */
.facts { list-style: none; padding: 0; }
.facts li { margin: .25rem 0; }
