/*
 * PurrProfit — one stylesheet, no build step.
 *
 * Mobile first: one column at phone width with a 16px gutter, wider from
 * 720px. Light and dark follow the device (prefers-color-scheme). Every
 * button and link that acts like one is at least 48px tall. Colour pairs
 * are chosen for at least 4.5:1 with the background they sit on in both
 * schemes; the accent green is never used for small text on the wash.
 */

:root {
  color-scheme: light dark;

  --ink: #1b2421;
  --muted: #4b5753;
  --line: #c9d3ce;
  --paper: #ffffff;
  --wash: #f2f5f3;

  --accent: #0b5d3b;        /* 7.9:1 with white */
  --on-accent: #ffffff;
  --accent-soft: #e1efe7;

  --warn: #8f1d1d;          /* 8.9:1 with white */
  --warn-soft: #fdecec;
  --notice-ink: #3d2a00;
  --notice-bg: #fff6d6;
  --notice-line: #8a6d00;

  --rec-bg: #fdecec;
  --rec-ink: #5c1010;
  --rec-line: #8f1d1d;

  --focus: #b5470b;
  --radius: 12px;
  --gutter: 16px;
  --max: 1040px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7eeea;
    --muted: #a8b6b0;
    --line: #3a4742;
    --paper: #121715;
    --wash: #1a211e;

    --accent: #74d6a4;      /* 10:1 with --paper */
    --on-accent: #0b1a12;
    --accent-soft: #1e3329;

    --warn: #ff9b9b;
    --warn-soft: #3a1717;
    --notice-ink: #ffe9a8;
    --notice-bg: #2e2508;
    --notice-line: #b8962a;

    --rec-bg: #3a1414;
    --rec-ink: #ffc2c2;
    --rec-line: #ff8a8a;

    --focus: #ffb37a;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.1rem; margin-top: 1.4em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
main.wrap { padding-top: 24px; padding-bottom: 48px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--paper); color: var(--ink); padding: 12px; z-index: 10; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid var(--line); background: var(--wash); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
.brand { font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; min-height: 48px; display: inline-flex; align-items: center; }
.who { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: .95rem; color: var(--muted); }

/* ---------- buttons ---------- */

.button, button.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; min-width: 48px; padding: 12px 20px;
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none;
  border-radius: var(--radius); border: 2px solid var(--accent); cursor: pointer;
  background: var(--paper); color: var(--accent);
}
.button.primary { background: var(--accent); color: var(--on-accent); }
.button.quiet { border-color: var(--line); color: var(--ink); background: transparent; padding: 10px 16px; }
.button:hover { text-decoration: underline; }

/* ---------- forms ---------- */

.field { margin: 0 0 20px; }
.field > label, .field legend { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { display: block; color: var(--muted); font-size: .92rem; margin: -2px 0 8px; }
.field .error { display: block; color: var(--warn); font-weight: 700; margin: 6px 0 0; }
fieldset.field { border: 0; padding: 0; }
input[type="text"], input[type="date"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 10px;
}
textarea { min-height: 140px; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--warn); }
.choice { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; font-weight: 400; }
.choice input { width: 24px; height: 24px; margin: 0; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; }

/* ---------- messages ---------- */

.said { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 8px; padding: 12px 16px; }
.alert { background: var(--warn-soft); color: var(--ink); border-left: 4px solid var(--warn); border-radius: 8px; padding: 12px 16px; margin: 0 0 16px; }
.notice { background: var(--notice-bg); color: var(--notice-ink); border: 2px dashed var(--notice-line); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; }
.meta { color: var(--muted); font-size: .95rem; }
.as-written { white-space: pre-line; background: var(--wash); border-left: 4px solid var(--line); border-radius: 8px; padding: 12px 16px; }

/* ---------- lists of businesses ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.businesses { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.businesses li { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.businesses a { display: block; padding: 14px 16px; min-height: 48px; font-weight: 700; text-decoration: none; }
.businesses a:hover .name { text-decoration: underline; }
.businesses .meta { display: block; font-weight: 400; margin-top: 2px; }

/* ---------- the chart of accounts ---------- */

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.chart { width: 100%; border-collapse: collapse; font-size: .97rem; }
.chart th, .chart td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.chart thead th { font-size: .85rem; color: var(--muted); font-weight: 700; }
.chart td.code { font-variant-numeric: tabular-nums; white-space: nowrap; width: 4.5em; }
.chart td.line { white-space: nowrap; width: 6em; }
.chart .child td.name { padding-left: 28px; }

/* ---------- wider screens ---------- */

@media (min-width: 720px) {
  h1 { font-size: 2.2rem; }
  .form-narrow { max-width: 640px; }
  .businesses { grid-template-columns: repeat(2, 1fr); }
}
