/* KTLX case report — plain scrolling document, no framework, no external fonts.
   Deliberately restrained: this is a proposal-support report, meant to be read
   and printed, not presented. */

:root {
  --ink: #1b1d21;
  --muted: #5a6068;
  --rule: #d8dade;
  --paper: #ffffff;
  --wash: #f6f7f8;
  --accent: #1f4e79;      /* headings and links */
  --flag: #8a4b2a;        /* caveats and limitations */
  --flag-wash: #fdf5f0;
  --measure: 74ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0 1.25rem 5rem;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.68 Georgia, "Times New Roman", serif;
}

.wrap {
  max-width: 62rem;
  margin: 0 auto;
}

/* ---------- masthead ---------- */

header.masthead {
  padding: 3.25rem 0 1.5rem;
  border-bottom: 2px solid var(--ink);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font: 600 0.78rem/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.byline {
  margin: 0;
  max-width: var(--measure);
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- headings and text ---------- */

h2 {
  margin: 3rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  color: var(--accent);
  font-size: 1.4rem;
  line-height: 1.3;
}

h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.1rem;
  line-height: 1.35;
}

p, li { max-width: var(--measure); }

p { margin: 0 0 1.05rem; }

ul, ol { margin: 0 0 1.05rem; padding-left: 1.3rem; }

li { margin-bottom: 0.45rem; }

a { color: var(--accent); }

strong { font-weight: 700; }

code {
  padding: 0.1em 0.35em;
  background: var(--wash);
  border-radius: 3px;
  font: 0.86em/1.4 ui-monospace, "SF Mono", Consolas, monospace;
}

/* ---------- headline numbers ---------- */

.keynumbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  margin: 1.8rem 0 2rem;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.keynumbers div {
  padding: 1.05rem 1.15rem;
  background: var(--paper);
}

.keynumbers b {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--accent);
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.keynumbers span {
  color: var(--muted);
  font: 0.85rem/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- figures ---------- */

figure {
  margin: 2rem 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--paper);
}

figcaption {
  margin-top: 0.7rem;
  max-width: var(--measure);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

figcaption .lab {
  color: var(--ink);
  font-weight: 700;
}

/* the GIF is shown inline; print drops it in favour of the static panels */
@media print {
  figure img[src$=".gif"] { display: none; }
}

/* ---------- tables ---------- */

.tablewrap { overflow-x: auto; margin: 1.4rem 0; }

table {
  border-collapse: collapse;
  width: 100%;
  font: 0.88rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

th, td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

thead th {
  border-bottom: 2px solid var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

tbody tr:hover { background: var(--wash); }

caption {
  caption-side: bottom;
  padding-top: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: left;
}

/* ---------- caveat blocks ---------- */

.caveat {
  margin: 1.5rem 0;
  padding: 0.95rem 1.2rem;
  background: var(--flag-wash);
  border-left: 4px solid var(--flag);
}

.caveat p { margin-bottom: 0.6rem; }
.caveat p:last-child { margin-bottom: 0; }
.caveat strong { color: var(--flag); }

/* ---------- workflow diagram (CSS only, no Mermaid runtime) ---------- */

.flow {
  margin: 1.6rem 0 2rem;
  padding: 1.2rem;
  background: var(--wash);
  border: 1px solid var(--rule);
  font: 0.85rem/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.flow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.flow-row:last-child { margin-bottom: 0; }

.flow-lab {
  flex: 0 0 5.5rem;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.node {
  padding: 0.45rem 0.7rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
}

.node.obs { border-left-color: #4a7c59; }
.node.join { border-left-color: var(--flag); font-weight: 700; }

.arrow { color: var(--muted); }

/* ---------- appendix ---------- */

.appendix {
  margin-top: 1.2rem;
  padding: 1.2rem 1.4rem;
  background: var(--wash);
  border: 1px solid var(--rule);
  font-size: 0.92rem;
}

.appendix h3 { margin-top: 0; }

.appendix ul { margin-bottom: 0; }

footer.colophon {
  margin-top: 3.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- print ---------- */

@media print {
  body { padding: 0; font-size: 11pt; }
  h2 { page-break-after: avoid; }
  figure, table, .caveat { page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
