/* Assay Console. Palette from tools/reporting/palette.json; colour marks status and category, never severity. */
:root {
  --ink: #1a1c20;
  --muted: #5d6470;
  --hairline: #e4e7ec;
  --navy: #1b3b6f;
  --teal: #146b6b;
  --amber: #8a5f1f;
  --violet: #5b4b8a;
  --rose: #8a3d5b;
  --green: #1f6446;
  --blue: #1b5fa8;
  --bg: #ffffff;
  --panel: #f4f5f8;
  --teal-tint: #e7f0f0;
  --amber-tint: #f4ede3;
  --violet-tint: #efedf3;
  --rose-tint: #fbedea;
  --green-tint: #e8f4ec;
  --code-bg: #faf7f2;
  --header-h: 3.5rem;
  --radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; overflow-wrap: anywhere; }
main { max-width: 72rem; margin: 0 auto; padding: 1rem; }
main:focus { outline: none; }
h1, h2, h3, h4, h5, h6 { line-height: 1.25; color: var(--navy); }
h1 { font-size: 1.8rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.35rem; margin-top: 2rem; }
a { color: var(--blue); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
code { background: var(--code-bg); padding: 0 0.2em; border-radius: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 0.5rem; }
.muted, .meta { color: var(--muted); }
.meta { font-size: 0.9rem; }
.lede { font-size: 1.1rem; }
.empty { color: var(--muted); font-style: italic; }

/* Header and navigation */
header.site {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  padding: 0.5rem 1rem; background: var(--navy); color: #fff; min-height: var(--header-h);
}
header.site a { color: #fff; }
.brand { font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.brand span { font-weight: 400; opacity: 0.85; }
nav.primary ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; margin: 0; padding: 0; }
nav.primary a { text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
nav.primary a[aria-current="page"] { border-bottom-color: #fff; font-weight: 600; }
.site-search { display: flex; gap: 0.25rem; margin-left: auto; }
.site-search input { width: 14rem; max-width: 45vw; }
.viewer summary { cursor: pointer; }
.viewer-panel { position: absolute; right: 1rem; background: #fff; color: var(--ink); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 0.75rem 1rem; box-shadow: 0 4px 16px rgb(0 0 0 / 0.12); }
.viewer-panel p { margin: 0 0 0.5rem; }
footer.site { max-width: 72rem; margin: 3rem auto 1rem; padding: 1rem; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; }

/* Forms and buttons */
input, select, button { font: inherit; }
input, select { padding: 0.35rem 0.5rem; border: 1px solid #b8bec8; border-radius: 4px; max-width: 100%; }
button, .button {
  display: inline-block; padding: 0.4rem 0.9rem; border-radius: 4px; border: 1px solid var(--navy);
  background: #fff; color: var(--navy); cursor: pointer; text-decoration: none; font-weight: 600;
}
button.primary, .button { background: var(--navy); color: #fff; }
.stack { display: grid; gap: 0.4rem; max-width: 22rem; }
.stack button { margin-top: 0.75rem; justify-self: start; }
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; background: var(--panel); padding: 0.75rem; border-radius: var(--radius); }
.filters .field { display: grid; gap: 0.2rem; }
.filters .actions { display: flex; gap: 0.75rem; align-items: center; }
.notice { background: var(--teal-tint); border-left: 4px solid var(--teal); padding: 0.6rem 0.9rem; }
.error { background: var(--rose-tint); border-left: 4px solid var(--rose); padding: 0.6rem 0.9rem; }
.login { max-width: 28rem; margin: 2rem auto; }
.contact { color: var(--muted); margin-top: 1.5rem; }

/* Badges: at most two per card; colours are status, not severity */
.badges { margin: 0 0 0.25rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid; }
.badge.exercise { color: var(--rose); background: var(--rose-tint); }
.badge.decision { color: var(--amber); background: var(--amber-tint); }
.badge.lifecycle { color: var(--green); background: var(--green-tint); }
.badge.progress { color: var(--teal); background: var(--teal-tint); }
.badge.blocked { color: var(--violet); background: var(--violet-tint); }
.badge.muted { color: var(--muted); background: var(--panel); }
.legend dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
.legend dd { margin: 0; }

/* Cards and lists */
.cards, .featured { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.card, .feature { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 1rem; background: #fff; }
.feature { border-top: 4px solid var(--teal); }
.is-exercise { border-left: 4px solid var(--rose); }
.card h3, .feature h3 { margin: 0.25rem 0; font-size: 1.1rem; }
.exercise-note { font-size: 0.85rem; color: var(--rose); margin: 0.25rem 0; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag { font-size: 0.82rem; padding: 0.1rem 0.5rem; border-radius: 4px; background: var(--panel); text-decoration: none; color: var(--navy); border: 1px solid var(--hairline); }
.tag.active { background: var(--navy); color: #fff; }
.events { list-style: none; padding: 0; margin: 0; }
.events li { border-bottom: 1px solid var(--hairline); padding: 0.6rem 0; }
.events p { margin: 0.15rem 0; }
.consequence, .observed { color: var(--muted); font-size: 0.9rem; }
.pager { display: flex; gap: 1.5rem; margin: 1.5rem 0; }
.presets a { margin-right: 0.75rem; }
.presets a[aria-current="true"] { font-weight: 700; }
.coverage-note, .export-note { color: var(--muted); font-size: 0.88rem; }

/* Hub */
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0; margin: 0 0 0.5rem; font-size: 0.9rem; }
.breadcrumb li + li::before { content: "›"; margin-right: 0.25rem; color: var(--muted); }
.banner { padding: 0.6rem 0.9rem; border-radius: var(--radius); background: var(--panel); border-left: 4px solid var(--navy); }
.banner.exercise { background: var(--rose-tint); border-left-color: var(--rose); }
.banner.withdrawn, .banner.superseded { background: var(--amber-tint); border-left-color: var(--amber); }
.bottom-line { font-size: 1.05rem; font-weight: 500; }
.facts { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 0.3rem 1rem; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
.report { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 0.5rem 1rem; margin-bottom: 1rem; }
.revision { border-top: 1px solid var(--hairline); padding: 0.5rem 0; }
.revision:first-of-type { border-top: 0; }
.downloads { padding-left: 1.2rem; }
.hash, .ioc { word-break: break-all; }
.count { display: inline-block; margin-right: 1rem; }

/* Tables scroll inside labelled containers; the page never overflows */
.table-scroll { overflow-x: auto; max-width: 100%; margin: 1rem 0; border: 1px solid var(--hairline); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--hairline); }
th { background: var(--panel); }
td.right, th.right { text-align: right; }
td.center, th.center { text-align: center; }
caption { text-align: left; font-weight: 600; padding: 0.4rem 0.6rem; }

/* Reader */
.reader { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.toc-drawer { position: sticky; top: calc(var(--header-h) + 1rem); max-height: calc(100vh - var(--header-h) - 2rem); overflow-y: auto; font-size: 0.9rem; }
.toc-drawer summary { font-weight: 600; cursor: pointer; }
.toc { list-style: none; padding: 0; }
.toc li { margin: 0.25rem 0; }
.toc-l2 { padding-left: 0.75rem; }
.toc-l3 { padding-left: 1.5rem; }
.report-body { min-width: 0; }
.anchor-target, [id] { scroll-margin-top: calc(var(--header-h) + 1rem); }
.permalink { text-decoration: none; color: var(--muted); font-size: 0.8em; }
.callout { border-radius: var(--radius); padding: 0.75rem 1rem; margin: 1rem 0; }
.callout.bottomline { background: var(--teal-tint); border-left: 5px solid var(--teal); }
.callout.means-for-you { background: var(--amber-tint); border-left: 5px solid var(--amber); }
.callout.redteam { background: var(--rose-tint); border-left: 5px solid var(--rose); }
.finding-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; font-size: 0.88rem; background: var(--panel); padding: 0.4rem 0.75rem; border-radius: var(--radius); }
.finding-meta div { display: flex; gap: 0.4rem; }
.finding-meta dt { font-weight: 600; }
.finding-meta dd { margin: 0; }
figure { margin: 1rem 0; }
figure.code { position: relative; }
figure.code figcaption { background: var(--amber); color: #fff; padding: 0.2rem 0.6rem; font-size: 0.85rem; border-radius: var(--radius) var(--radius) 0 0; }
pre { background: var(--code-bg); padding: 0.75rem; overflow-x: auto; margin: 0; border-radius: 0 0 var(--radius) var(--radius); }
figure.code button.copy { position: absolute; right: 0.4rem; bottom: 0.4rem; font-size: 0.8rem; padding: 0.15rem 0.5rem; }
.figure img { max-width: 100%; height: auto; }
blockquote { border-left: 4px solid var(--hairline); margin: 1rem 0; padding: 0 1rem; color: var(--muted); }

@media (max-width: 900px) {
  .reader { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .toc-drawer { position: static; max-height: none; border: 1px solid var(--hairline); border-radius: var(--radius); padding: 0.5rem 0.75rem; }
  .site-search { margin-left: 0; width: 100%; }
  .site-search input { flex: 1; width: auto; max-width: none; }
  .viewer-panel { right: 0.5rem; left: 0.5rem; }
  header.site { position: static; }
  .anchor-target, [id] { scroll-margin-top: 1rem; }
}

@media (max-width: 420px) {
  main { padding: 0.75rem; }
  h1 { font-size: 1.5rem; }
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 0.4rem; }
}

@media print {
  header.site, footer.site, .toc-drawer, .filters, button { display: none; }
}

/* Search snippets: server-built segments, highlighted with the template's own <mark>. */
.snippet {
  color: var(--muted);
  font-size: 0.95rem;
}
.snippet mark {
  background: var(--amber-tint);
  color: var(--ink);
  padding: 0 0.1em;
  border-radius: 2px;
}
