/* A warm, light page that reads like a well-kept clinical handbook: the scale
   in a reading column, the score in a card beside it, and the printed summary
   below. Light only, on purpose. Only the summary prints. */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --sunken: #f4efe6;
  --ink: #29241f;
  --muted: #6b6259;
  --line: #e6ddd0;
  --accent: #2c6658;
  --accent-ink: #ffffff;
  --accent-soft: #e7f0ec;
  --hit: #edf3e3;
  --hit-ink: #34602a;
  --warn: #965712;
  --font-display: "Literata", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.6; }
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.005em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.3; }
h3 { font-size: 18px; line-height: 1.35; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: 15px; color: var(--muted); }
.muted { color: var(--muted); }
.mono, .num { font-variant-numeric: tabular-nums; }

.shell {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* header and footer */
.site-header { background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header .shell { display: flex; align-items: center; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; padding-block: 16px; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; text-decoration: none; color: var(--ink); }
.brand strong { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.brand span { font-size: 15px; color: var(--muted); }
.site-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-nav a { text-decoration: none; color: var(--muted); font-size: 16px; padding-block: 2px; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
main.shell { padding-block: 32px 64px; display: grid; gap: 36px; }
.site-footer { border-top: 1px solid var(--line); }
.site-footer .shell { padding-block: 24px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: 14.5px; color: var(--muted); }
.site-footer a { color: var(--muted); }

/* home */
.hero { display: grid; gap: 14px; max-width: 780px; }
.hero .lede { font-size: 20px; color: var(--muted); }
.byline { font-size: 15px; color: var(--muted); }
.search { display: block; margin-top: 8px; }
.search input {
  width: 100%; font: inherit; font-size: 17px; padding: 13px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.cat-list { display: grid; gap: 32px; }
.cat-block { display: grid; gap: 6px; }
.cat-block h2 { font-size: 21px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); }
.tool-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.tool-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0 14px; align-items: baseline;
  padding: 13px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink);
}
.tool-row:hover .t-name { color: var(--accent); text-decoration: underline; }
.tool-row .t-short { font-weight: 700; color: var(--accent); grid-row: span 2; }
.tool-row .t-name { font-weight: 600; }
.tool-row .t-meta { font-size: 15px; color: var(--muted); }
.empty { color: var(--muted); }

/* tool page */
.crumbs { font-size: 15px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.tool-head { display: grid; gap: 12px; max-width: 820px; }
.tool-head h1 .abbr { color: var(--accent); margin-right: 8px; }
.lead { font-size: 19px; max-width: 64ch; }
.meta-line { font-size: 15.5px; color: var(--muted); }
.reviewer { font-size: 15px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 12px; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.tool-main { display: grid; gap: 28px; min-width: 0; }
.tool-side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); display: grid; gap: 12px; min-width: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 14px; }
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.about-grid h3 { font-size: 17px; margin-bottom: 4px; }
.about-grid p { font-size: 16px; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: grid; gap: 4px; font-size: 15.5px; font-weight: 600; }
.field input, .field textarea, .field select {
  font: inherit; font-size: 16.5px; font-weight: 400; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; width: 100%;
}
.field textarea { min-height: 84px; resize: vertical; }
.privacy { font-size: 15px; color: var(--muted); }

.panel.compact { padding: 14px 18px; gap: 8px; }
.panel.compact h2 { font-size: 18px; }
.field.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field.inline input { width: auto; }
.link-row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.link-row .work { flex: 1 1 auto; min-width: 0; font-size: 14px; }
details.about-box { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
details.about-box summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.about-box .about-grid { margin-top: 14px; }
details.guide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; }
details.guide summary { cursor: pointer; font-weight: 600; }
details.guide ol, details.guide ul { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 16px; }

.items { display: grid; gap: 14px; }
.stem { font-weight: 600; font-size: 18px; max-width: 70ch; }
.item-heading { margin-top: 12px; display: grid; gap: 4px; }
.item-heading h3 { font-size: 19px; }
.item-heading p { font-size: 16px; color: var(--muted); max-width: 72ch; }
fieldset.item { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; display: grid; gap: 12px; min-width: 0; }
fieldset.item legend { padding: 0; font-weight: 600; font-size: 17px; float: left; width: 100%; }
fieldset.item legend + * { clear: both; }
.opts { display: grid; gap: 6px; }
.opts.row { grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); }
.opt {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start;
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; cursor: pointer; background: var(--bg);
}
.opt input { margin: 4px 0 0; accent-color: var(--accent); }
.opt .olabel { font-size: 16px; }
.opt .pts { font-size: 15px; color: var(--muted); min-width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; }
.opt.shaded { background: var(--sunken); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt:has(input:checked) .pts { color: var(--accent); font-weight: 700; }

.bmi-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 12px; }

/* results */
.result-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 16px; }
.result-card > h2 { font-size: 20px; }
.score { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.score:first-of-type { border-top: 0; padding-top: 0; }
.score-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.score-label { font-weight: 600; font-size: 16px; }
.score-val { font-family: var(--font-display); font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-val .of { font-family: var(--font-body); font-size: 16px; font-weight: 400; color: var(--muted); }
.work { font-size: 15.5px; font-variant-numeric: tabular-nums; background: var(--sunken); border-radius: 6px; padding: 6px 10px; overflow-x: auto; white-space: nowrap; }
.status { font-size: 15px; color: var(--muted); }
.status.incomplete { color: var(--warn); }
table.bands { width: 100%; border-collapse: collapse; font-size: 15.5px; }
table.bands td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.bands td:first-child { white-space: nowrap; width: 70px; font-variant-numeric: tabular-nums; }
table.bands tr.hit td { background: var(--hit); color: var(--hit-ink); font-weight: 700; }
.bsrc { font-size: 14px; color: var(--muted); }
.thr { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 15px; }
.compact-scores { display: grid; gap: 6px; }
.compact-scores .cs { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 15.5px; padding-block: 6px; border-top: 1px solid var(--line); }
.compact-scores .cs .work { grid-column: 1 / -1; }
.compact-scores .cs .v { font-weight: 700; font-variant-numeric: tabular-nums; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; border-radius: 6px; padding: 10px 16px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
.btn.secondary { background: var(--surface); color: var(--accent); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.action-note { font-size: 14.5px; color: var(--muted); }

/* summary (screen view) */
.summary-section { display: grid; gap: 12px; }
.summary {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; display: grid; gap: 16px; font-size: 15px; color: var(--ink);
}
.summary h2 { font-size: 21px; }
.summary h3 { font-family: var(--font-body); font-size: 15px; font-weight: 700; color: var(--muted); }
.summary .sum-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.summary table { width: 100%; border-collapse: collapse; }
.summary th, .summary td { text-align: left; padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.summary th { font-size: 13.5px; color: var(--muted); font-weight: 700; }
.summary td.pts, .summary th.pts { text-align: right; width: 56px; font-variant-numeric: tabular-nums; }
.summary .rec { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; }
.summary .rec div { display: grid; gap: 2px; }
.summary .rec span { font-size: 13.5px; color: var(--muted); }
.summary .rec b { font-weight: 500; min-height: 1.5em; border-bottom: 1px solid var(--line); }
.summary .res { display: grid; gap: 4px; }
.summary .foot { font-size: 13px; color: var(--muted); display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.summary .scroll { overflow-x: auto; }
.summary .blank-q { break-inside: avoid; display: grid; gap: 4px; padding-block: 8px; border-bottom: 1px solid var(--line); }
.summary .blank-q ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.summary .blank-line { min-height: 2.4em; border-bottom: 1px solid var(--ink); }

/* questions, help and sources */
.faq, .related, .help, .sources { display: grid; gap: 12px; max-width: 78ch; }
.related ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.faq dl { margin: 0; display: grid; gap: 14px; }
.faq dt { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.faq dd { margin: 4px 0 0; }
.help p, .sources li { font-size: 16px; }
.page-credit { font-size: 13.5px; color: var(--muted); }
.page-credit a { color: var(--muted); }
.sources ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

/* static pages */
.prose { display: grid; gap: 16px; max-width: 70ch; }
.prose h2 { margin-top: 12px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.prose .fine-h { font-size: 17px; margin-top: 24px; color: var(--muted); }
.prose .fine { font-size: 14.5px; color: var(--muted); }
.lic-table-wrap { overflow-x: auto; }
table.lic { width: 100%; border-collapse: collapse; font-size: 15.5px; }
table.lic th { text-align: left; font-size: 14.5px; color: var(--muted); padding: 6px 12px 6px 0; border-bottom: 1px solid var(--ink); }
table.lic td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.lic td:first-child { font-weight: 600; white-space: nowrap; }

.contact-form { display: grid; gap: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* patient and staff pages */
.safety { border-color: var(--warn); border-left-width: 4px; }
.safety p { margin: 0; font-size: 16px; }
.form-note { font-size: 16px; color: var(--warn); min-height: 1.2em; margin: 0; }
.credit { font-size: 14px; color: var(--muted); }
.p-band { margin: 0; font-size: 17px; }
.banner { margin: 0; padding: 8px 12px; border: 1px dashed var(--warn); border-radius: 6px; color: var(--warn); font-size: 15px; font-weight: 600; }
.search-row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.search-row .field { flex: 1 1 240px; }
.pick-list { display: grid; gap: 6px; }
.opt .olabel .muted { font-size: 15px; }

@media (max-width: 900px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .tool-side { position: static; }
  .tool-rows { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .bmi-inputs { grid-template-columns: minmax(0, 1fr); }
  .tool-row { grid-template-columns: 80px minmax(0, 1fr); }
  .summary { padding: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .opt { transition: border-color 0.12s ease, background-color 0.12s ease; }
}

/* print: only the summary */
@media print {
  :root { --bg: #ffffff; --surface: #ffffff; --sunken: #f1f1f1; --ink: #000000; --muted: #444444; --line: #bbbbbb; --hit: #e6e6e6; --hit-ink: #000000; }
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .crumbs, .tool-head, .tool-grid, .faq, .related, .help, .sources, .summary-section > .summary-intro, .no-print { display: none !important; }
  main.shell { padding: 0; max-width: none; }
  .summary { border: 0; padding: 0; }
  .summary tr, .summary .res { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  @page { margin: 14mm; }
}
