/*
 * Paper Owl Fax. Flat: no gradients, no shadows.
 *
 * Palette
 *   Barred #6E6157  primary mark, headings, labels and links on light
 *   Cream  #F4EDE0  page background (light), text (dark)
 *   Ink    #2B2622  body text (light), page background (dark)
 *   Wax    #A63A2B  one accent per screen: the seal in the owl icon. Not used by the UI.
 *   Bark   #9C8B79  decorative only (borders, rules), never text
 *
 * Contrast (WCAG): Ink on Cream 12.9:1, Barred on Cream 5.1:1, Cream on Ink
 * 12.9:1, Cream on Barred 5.1:1. Barred on Ink is only 2.5:1, so dark mode
 * uses Cream for all text and keeps Barred for borders.
 * test/unit/brand.test.ts checks these pairings from this file.
 */
:root {
  --barred: #6E6157;
  --cream: #F4EDE0;
  --ink: #2B2622;
  --wax: #A63A2B;
  --bark: #9C8B79;

  --bg: var(--cream);
  --text: var(--ink);
  --heading: var(--barred);
  --label: var(--barred);
  --link: var(--barred);
  --rule: var(--bark);
  --button-bg: var(--ink);
  --button-text: var(--cream);

  --font-heading: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Work Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink);
    --text: var(--cream);
    --heading: var(--cream);
    --label: var(--cream);
    --link: var(--cream);
    --rule: var(--barred);
    --button-bg: var(--cream);
    --button-text: var(--ink);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
}
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; color: var(--heading); line-height: 1.2; }
h1 { font-size: 2rem; margin: 1.75rem 0 0.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; margin: 2rem 0 0.5rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.4rem; }
h4 { font: 500 1rem/1.3 var(--font-heading); color: var(--heading); margin: 1.2rem 0 0.3rem; }
section[id] { scroll-margin-top: 16px; }
p, li { max-width: 68ch; }
strong { font-weight: 500; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

code, pre { font-family: var(--font-mono); font-size: 0.88em; }
pre { border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font: 500 0.75rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--label); }
.table-scroll { overflow-x: auto; }

/* Header and wordmark */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--heading); text-decoration: none; }
.brand-icon { width: 40px; height: 40px; flex: none; }
.wordmark { display: inline-flex; flex-direction: column; line-height: 1; }
.wordmark-name { font: 500 1.5rem/1 var(--font-heading); letter-spacing: -0.01em; color: var(--heading); }
.wordmark-sub { font: 400 0.68rem/1 var(--font-mono); letter-spacing: 0.32em; text-transform: uppercase; color: var(--label); margin-top: 5px; }

.site-footer { margin: 3rem 0 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); font: 400 0.8rem/1.6 var(--font-mono); letter-spacing: 0.04em; }
.site-footer a { color: var(--label); }

/* Cards and the fax summary */
.card { border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.summary { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; align-items: baseline; }
.summary dt { font: 500 0.75rem/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--label); }
.summary dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.price { font-size: 1.4rem; }
.muted { color: var(--label); }
.small { font-size: 0.9rem; }

/* Status: a fax-header style label over a plain line, marked by a left rule */
.status { border: 1px solid var(--rule); border-left-width: 4px; border-radius: var(--radius); padding: 12px 14px; margin: 16px 0; font-weight: 500; }
.status::before { content: "Status"; display: block; font: 500 0.7rem/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); margin-bottom: 2px; }
.status[data-tone="ok"] { border-left-color: var(--heading); }
.status[data-tone="bad"] { border-left-color: var(--text); }
.status .detail { display: block; font-weight: 400; margin-top: 4px; }

/* Rendered fax pages: the paper stays white so the preview matches the fax */
.pages { display: grid; gap: 16px; margin: 16px 0; }
.pages figure { margin: 0; }
.pages canvas { width: 100%; height: auto; display: block; background: #fff; border: 1px solid var(--rule); border-radius: 4px; }
.pages figcaption { font: 400 0.75rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--label); margin-top: 6px; text-align: center; }

/* Pay form and buttons */
.pay-form { display: grid; gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--text); }
.button {
  appearance: none; border: 1px solid var(--button-bg); border-radius: var(--radius); background: var(--button-bg); color: var(--button-text);
  font: 500 1rem/1.2 var(--font-body); padding: 14px 18px; min-height: 48px; width: 100%; cursor: pointer; text-align: center; text-decoration: none; display: inline-block;
}
/* Disabled: solid Barred with Cream text (5.1:1), not faded, so the label stays readable. */
.button:disabled { background: var(--barred); border-color: var(--barred); color: var(--cream); cursor: not-allowed; }
.button.secondary { background: transparent; color: var(--link); border-color: var(--rule); }
.button-row { display: grid; gap: 10px; }
@media (min-width: 560px) { .button-row { grid-template-columns: 1fr 1fr; } }
.error { font-weight: 500; border-left: 4px solid var(--text); padding-left: 10px; }

/* DRAFT marker on the legal pages and the local mock checkout */
.draft-banner { border: 1px solid var(--rule); border-left-width: 4px; border-left-color: var(--text); border-radius: var(--radius); padding: 10px 14px; margin: 16px 0; font: 500 0.8rem/1.5 var(--font-mono); letter-spacing: 0.04em; }
