/* public/app.css — the admin app and the public page.
 *
 * ⛔ CSS SYSTEM COLOURS, NOT A PALETTE. Canvas, CanvasText, AccentColor and
 * friends resolve to the viewer's own light or dark scheme, so there is no
 * second palette to maintain and no flash of the wrong one. Same decision as
 * the snippet.
 *
 * ⚠ MOBILE FIRST IS THE DONE-WHEN, not a preference: "Jorg adds a site from his
 * phone and pastes the snippet into a test page in under 3 minutes". Every tap
 * target here is at least 40px, every layout is one column until 40rem, and
 * nothing needs a hover to be discoverable.
 */

:root {
  color-scheme: light dark;
  --gap: 1rem;
  --line: 1px solid ButtonBorder;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: Canvas;
  color: CanvasText;
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
}

header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: Canvas;
  border-bottom: var(--line);
}

header.top a.brand { font-weight: 650; text-decoration: none; color: inherit; }
header.top nav { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; }

main { max-width: 44rem; margin: 0 auto; padding: 1rem 1rem 4rem; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 1.25rem 0 0.5rem; }
h2 { font-size: 1.125rem; margin: 2rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.35rem; }
p { margin: 0 0 var(--gap); }
.lead { font-size: 1.125rem; }
.muted { color: GrayText; }
.small { font-size: 0.875rem; }
.ok { color: #15803d; }
.bad { color: #b91c1c; }
@media (prefers-color-scheme: dark) {
  .ok { color: #4ade80; }
  .bad { color: #f87171; }
}

a { color: AccentColor; }

.card {
  border: var(--line);
  border-radius: var(--radius);
  padding: 0.875rem;
  margin: 0 0 var(--gap);
  background: Canvas;
}
.card h3 { margin-top: 0; }

.grid { display: grid; gap: var(--gap); }
@media (min-width: 40rem) { .grid.two { grid-template-columns: 1fr 1fr; } }

.row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.between { justify-content: space-between; }

.num { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0.5rem 0; }
.num div { min-width: 5rem; }
.num b { display: block; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.num span { font-size: 0.8125rem; color: GrayText; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 2.5rem; margin: 0.5rem 0; }
.spark i { flex: 1; background: AccentColor; border-radius: 2px 2px 0 0; min-height: 2px; opacity: 0.85; }
.spark i.none { background: ButtonBorder; }

.chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
}
.chip.on { border-color: AccentColor; color: AccentColor; }
.chip.warn { border-color: #b91c1c; color: #b91c1c; }

form { margin: 0; }
label { display: block; margin: 0 0 0.75rem; font-size: 0.875rem; color: GrayText; }
input[type=text], input[type=email], input[type=password], textarea, select {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0.25rem;
  padding: 0.6rem;
  border: var(--line);
  border-radius: 9px;
  background: Field;
  color: FieldText;
  font: inherit;
}
textarea { min-height: 5rem; }
input[type=checkbox] { width: 1.4rem; height: 1.4rem; vertical-align: -3px; }
/* The whole label is the tap target, not just the box. Measured in a browser on
   17 September 2026: the box alone was 18px, which is a miss on a moving train. */
label.row { min-height: 2.75rem; align-items: center; }

button, .btn {
  min-height: 2.5rem;
  padding: 0.45rem 0.85rem;
  border: var(--line);
  border-radius: 9px;
  background: ButtonFace;
  color: ButtonText;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.primary, .btn.primary {
  background: AccentColor;
  color: AccentColorText;
  border-color: AccentColor;
  font-weight: 600;
}
button.small { min-height: 2.15rem; padding: 0.3rem 0.6rem; font-size: 0.8125rem; }
button.on { border-color: AccentColor; color: AccentColor; font-weight: 600; }
button:disabled { opacity: 0.55; cursor: default; }

/* Filters are links, never a form. Same rule as Pelgrim's /finds.php, and the
   reason is the same: a view is then a URL you can bookmark. */
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 var(--gap); }
.filters a {
  padding: 0.6rem 0.8rem;
  border: var(--line);
  border-radius: 999px;
  font-size: 0.8125rem;
  text-decoration: none;
  color: inherit;
}
.filters a.on { border-color: AccentColor; color: AccentColor; font-weight: 600; }

.find { border: var(--line); border-radius: var(--radius); padding: 0.75rem; margin: 0 0 0.6rem; }
.find .note { margin: 0.35rem 0; }
.find .meta { font-size: 0.8125rem; color: GrayText; }
.find form { display: inline; }
.find .acts { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.6rem; }

pre.snippet {
  margin: 0.5rem 0;
  padding: 0.75rem;
  border: var(--line);
  border-radius: 9px;
  background: Field;
  color: FieldText;
  overflow-x: auto;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.notice { border: var(--line); border-left: 4px solid AccentColor; border-radius: 9px; padding: 0.75rem; margin: 0 0 var(--gap); }
.notice.bad { border-left-color: #b91c1c; }

footer.foot { max-width: 44rem; margin: 0 auto; padding: 2rem 1rem 3rem; color: GrayText; font-size: 0.8125rem; border-top: var(--line); }

ol.steps { padding-left: 1.25rem; }
ol.steps li { margin-bottom: 0.75rem; }
table.compare { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.compare th, table.compare td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: var(--line); vertical-align: top; }
