/* PaperPrep app. Same tokens, type and components as the landing page (site/index.html):
   the GHR blues as primary, teal for "reported", amber for a question in the margin,
   coral for "not found", a serif display face for headings and quoted lines, a system
   sans for everything else. A manuscript page and its margin notes. */

:root {
  --paper: #f7fafc;
  --sheet: #ffffff;
  --ink: #0c2a3e;
  --muted: #4a5d6e;
  --rule: #d8e3ec;
  --primary: #0369a1;
  --primary-deep: #0c4a6e;
  --primary-wash: #e6f2fa;
  --teal: #0f766e;
  --teal-wash: #dcf5f0;
  --amber: #b45309;
  --amber-mark: #fde68a;
  --amber-wash: #fdf3dc;
  --coral: #be4b3a;
  --coral-wash: #fbe9e5;
  --on-primary: #ffffff;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1822; --sheet: #112330; --ink: #e4eef5; --muted: #9db2c2; --rule: #24394a;
    --primary: #38bdf8; --primary-deep: #7dd3fc; --primary-wash: #10314a;
    --teal: #2dd4bf; --teal-wash: #0f3833; --amber: #fbbf24; --amber-mark: #5c4511; --amber-wash: #33270c;
    --coral: #f58b78; --coral-wash: #3b1a15; --on-primary: #06202f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b1822; --sheet: #112330; --ink: #e4eef5; --muted: #9db2c2; --rule: #24394a;
  --primary: #38bdf8; --primary-deep: #7dd3fc; --primary-wash: #10314a;
  --teal: #2dd4bf; --teal-wash: #0f3833; --amber: #fbbf24; --amber-mark: #5c4511; --amber-wash: #33270c;
  --coral: #f58b78; --coral-wash: #3b1a15; --on-primary: #06202f; color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.65 var(--body);
  overflow-wrap: anywhere;
}
main { max-width: 44rem; margin: 0 auto; padding: 0 1rem 3rem; }
img, svg, video { max-width: 100%; height: auto; }

/* ---------------------------------------------------------------- header, footer */
header.top {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center;
  max-width: 44rem; margin: 0 auto; padding: 1rem 1rem 0.9rem;
}
header.top .brand {
  display: flex; align-items: center; gap: 0.55rem; margin-right: auto;
  color: var(--primary-deep); text-decoration: none; font: 600 1.25rem/1 var(--display);
}
header.top .brand svg { width: 1.6rem; height: 1.6rem; flex: none; }
header.top nav { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.95rem; align-items: center; }
header.top nav a, header.top nav button.link { color: var(--muted); text-decoration: none; }
header.top nav a:hover, header.top nav button.link:hover { color: var(--primary); }
footer.foot { max-width: 44rem; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--rule); }

/* ---------------------------------------------------------------- type */
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; color: var(--primary-deep); text-wrap: balance; }
h1 { font-size: 1.9rem; letter-spacing: -0.01em; margin: 0.75rem 0 1rem; }
h2 { font-size: 1.3rem; margin: 1.9rem 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.4rem; }
a { color: var(--primary); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
p { margin: 0 0 0.9rem; }
.meta, .small, .crumb { color: var(--muted); font-size: 0.9rem; }
.crumb a { color: var(--muted); }
.label, .wording .label { font: 600 0.72rem/1.2 var(--body); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
code, .id { font-family: var(--mono); font-size: 0.9em; }
.id { display: inline-block; min-width: 2.2rem; padding: 0.1rem 0.4rem; margin-right: 0.3rem; border-radius: 99rem; background: var(--primary-wash); color: var(--primary-deep); font-size: 0.8rem; }

/* ---------------------------------------------------------------- notes and warnings */
.warn, .flag {
  border-left: 3px solid var(--amber); background: var(--amber-wash); color: var(--ink);
  padding: 0.75rem 0.9rem; border-radius: 0 0.3rem 0.3rem 0; font-size: 0.95rem; line-height: 1.5;
}
.flag { margin: 0.6rem 0 0.4rem; }

/* ---------------------------------------------------------------- cards, items, numbers */
.card, .item, .number {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 0.4rem;
  padding: 1rem 1.1rem; margin: 0 0 1rem;
  box-shadow: 0 1px 0 var(--rule);
}
.item { border-left-width: 4px; }
.item.status-reported { border-left-color: var(--teal); }
.item.status-partly_reported { border-left-color: var(--amber); }
.item.status-not_found { border-left-color: var(--coral); }
.item.status-not_in_draft_yet { border-left-color: var(--rule); }
.item.status-not_applicable { border-left-color: var(--rule); }
.item.status-not_checked { border-left-color: var(--rule); }
.number.consistent { background: var(--teal-wash); border-color: var(--teal-wash); }
.number.look { background: var(--amber-wash); border-color: var(--amber-wash); }

/* the status word renders as the landing page's pill, coloured by the item's status */
.compare { font-size: 0.95rem; }
.compare strong {
  display: inline-block; font: 600 0.72rem/1 var(--body); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.32rem 0.55rem; border-radius: 99rem; border: 1px solid var(--rule); background: var(--paper); color: var(--muted);
  vertical-align: 0.1em;
}
.item.status-reported .compare strong:last-child { background: var(--teal-wash); color: var(--teal); border-color: var(--teal); }
.item.status-partly_reported .compare strong:last-child { background: var(--amber-wash); color: var(--amber); border-color: var(--amber); }
.item.status-not_found .compare strong:last-child { background: var(--coral-wash); color: var(--coral); border-color: var(--coral); }
.item.status-not_in_draft_yet .compare strong:last-child { background: var(--primary-wash); color: var(--primary-deep); border-color: var(--primary-wash); }

/* quoted lines read as the manuscript: serif on the page colour with a hairline */
ul.quotes, ul.elements, ul.diff { padding-left: 1.2rem; margin: 0.4rem 0 0.8rem; }
ul.quotes li {
  list-style: none; margin: 0 0 0.45rem -1.2rem; padding: 0.5rem 0.8rem;
  font: 0.95rem/1.6 var(--display); color: var(--ink);
  background: var(--paper); border-left: 3px solid var(--teal); border-radius: 0 0.3rem 0.3rem 0;
}
ul.elements li { margin-bottom: 0.2rem; }
ul.elements.missing li { color: var(--amber); }
blockquote { margin: 0.3rem 0 0.5rem; padding: 0.4rem 0.8rem; border-left: 3px solid var(--rule); font: 0.95rem/1.6 var(--display); color: var(--muted); }
.wording { margin-bottom: 0.5rem; }

/* ---------------------------------------------------------------- buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }
.button, button.button {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.7rem 1.1rem; border-radius: 0.4rem;
  border: 2px solid var(--primary); background: var(--primary); color: var(--on-primary);
  font: 600 0.95rem/1 var(--body); text-decoration: none; cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button.secondary { background: transparent; color: var(--primary); }
.button.quiet { background: transparent; color: var(--muted); border-color: var(--rule); font-weight: 500; }
.button.danger { background: var(--coral); border-color: var(--coral); color: #ffffff; }
.button.small { padding: 0.4rem 0.7rem; font-size: 0.85rem; background: transparent; color: var(--primary); border-color: var(--rule); }
.button.small.chosen { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.button.wide { width: 100%; justify-content: flex-start; text-align: left; }
.button:disabled { opacity: 0.5; cursor: default; filter: none; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; color: var(--primary); }
form.inline { display: inline; }
form.respond { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.7rem 0 0.4rem; }

/* ---------------------------------------------------------------- forms */
.stack > * + * { margin-top: 0.8rem; }
label { display: block; font-weight: 600; }
label.choice, label.tap { font-weight: 400; display: block; padding: 0.3rem 0; }
label.attest { padding: 0.75rem 0.9rem; border: 1px solid var(--rule); border-radius: 0.4rem; background: var(--sheet); font-weight: 500; }
input[type=radio], input[type=checkbox] { accent-color: var(--primary); margin: 0; }
input[type=radio]:focus-visible, input[type=checkbox]:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
textarea, input[type=text], input:not([type]), select {
  width: 100%; font: inherit; padding: 0.6rem 0.75rem; border: 1px solid var(--rule); border-radius: 0.4rem;
  background: var(--sheet); color: var(--ink);
}
textarea { font-family: var(--display); line-height: 1.6; min-height: 14rem; }

/* a question and its answers: the sentence reads as a line, the answers sit in a row as pills */
fieldset { border: 1px solid var(--rule); border-radius: 0.4rem; padding: 0.9rem 1rem 0.8rem; margin: 0 0 0.9rem; background: var(--sheet); min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin: 0 0 0.6rem; font-weight: 500; color: var(--ink); line-height: 1.45; }
legend + * { clear: both; }
fieldset.fact legend { font-weight: 500; }
fieldset label.choice {
  display: inline-flex; align-items: center; gap: 0.45rem; margin: 0.2rem 0.5rem 0.2rem 0; padding: 0.4rem 0.85rem;
  border: 1px solid var(--rule); border-radius: 99rem; background: var(--paper); color: var(--ink); font-size: 0.95rem; cursor: pointer;
}
fieldset label.choice:hover { border-color: var(--primary); }
fieldset label.choice:has(input:checked) { background: var(--primary-wash); border-color: var(--primary); color: var(--primary-deep); font-weight: 600; }
fieldset label.choice:has(input:focus-visible) { outline: 2px solid var(--amber); outline-offset: 2px; }
fieldset label.choice input { accent-color: var(--primary); }
fieldset.item-predict { margin-bottom: 0.8rem; }
fieldset.item-predict legend .wording { color: var(--muted); font-size: 0.92rem; font-weight: 400; }
.tap { display: inline-block; margin-right: 0.75rem; }

/* the design finder: each answer is a card to tap, not a button */
.option { margin-bottom: 0.9rem; }
.option > .button.wide {
  display: block; width: 100%; text-align: left; padding: 0.95rem 1.1rem; border-radius: 0.4rem;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--rule); box-shadow: 0 1px 0 var(--rule);
  font: 500 1rem/1.45 var(--body); white-space: normal;
}
.option > .button.wide:hover, .option > .button.wide:focus-visible { border-color: var(--primary); background: var(--primary-wash); color: var(--primary-deep); filter: none; }
.option details { margin: 0.35rem 0 0 0.2rem; }
details summary { cursor: pointer; color: var(--primary); font-size: 0.92rem; }
details p { margin: 0.4rem 0 0.2rem; color: var(--muted); }
.fallback { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--rule); }
.group { margin-top: 1.5rem; }
.key { color: var(--muted); font-size: 0.9rem; }

/* ---------------------------------------------------------------- tables, lists, tabs */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1rem; border: 1px solid var(--rule); border-radius: 0.4rem; background: var(--sheet); }
table.plain { border-collapse: collapse; width: 100%; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
table.plain th, table.plain td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: normal; white-space: nowrap; }
table.plain th { font: 600 0.72rem/1.2 var(--body); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); background: var(--paper); }
table.plain tr:last-child td { border-bottom: 0; }
table.plain tr.total td { font-weight: 600; }
@media (max-width: 40rem) { table.plain { font-size: 0.88rem; } table.plain th, table.plain td { padding: 0.4rem 0.5rem; } }
dl.facts dt { font-weight: 600; margin-top: 0.8rem; }
dl.facts dd { margin: 0.2rem 0 0; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.92rem; margin: 0 0 1rem; }
.tabs a { color: var(--muted); text-decoration: none; padding-bottom: 0.15rem; border-bottom: 2px solid transparent; }
.tabs a:hover, .tabs a[aria-current], .tabs strong { color: var(--primary-deep); border-bottom-color: var(--teal); }

@media (min-width: 40rem) { html { font-size: 18px; } }
@media (prefers-reduced-motion: no-preference) { .flag { animation: settle 0.5s both ease-out; } @keyframes settle { from { transform: translateY(4px); opacity: 0.6; } to { transform: none; opacity: 1; } } }
