/* Shared styling for individual guideline pages.
   The category index (index.html) carries its own styles; this file serves
   the guideline documents themselves, so each one stays small enough to edit
   without scrolling past three hundred lines of CSS. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --nhs-dark: #003087;
  --nhs-blue: #005EB8;
  --nhs-light: #41B6E6;
  --slate: #425563;
  --warm-grey: #f7f7f5;
  --white: #ffffff;
  --border: #e2e2e0;
  --amber: #ED8B00;
  --amber-bg: #fff8ee;
  --red: #DA291C;
  --red-bg: #fdf2f1;
  --shadow: 0 2px 12px rgba(0, 48, 135, 0.08);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--warm-grey);
  color: var(--slate);
  line-height: 1.6;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  justify-content: center;
}

.sheet { max-width: 720px; width: 100%; }

/* ── Back link ── */
.back-link {
  /* Block-level so the category badge below starts a new line, but only as
     wide as its text so the pill shape holds. */
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--nhs-blue);
  text-decoration: none;
  padding: 0.35rem 0.75rem 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.back-link:hover { border-color: var(--nhs-blue); box-shadow: var(--shadow); }

/* ── Title block ── */
.eyebrow {
  display: inline-block;
  margin: 1.75rem 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--nhs-blue);
  border: 1px solid var(--nhs-light);
  border-radius: 100px;
  padding: 0.22rem 0.8rem;
  background: rgba(65, 182, 230, 0.08);
}

h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--nhs-dark);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.subtitle {
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--nhs-blue);
  margin-top: 0.5rem;
  max-width: 60ch;
}

.standfirst {
  font-size: 1rem;
  color: var(--slate);
  margin-top: 0.75rem;
  max-width: 60ch;
}

/* ── Governance metadata ── */
.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.25rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.35rem;
  margin: 1.75rem 0;
}

.meta div { padding: 0.35rem 0; }

.meta dt {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #8a949c;
  margin-bottom: 0.15rem;
}

.meta dd { font-size: 0.88rem; font-weight: 500; color: var(--nhs-dark); }

.overdue {
  display: none;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--red);
  border-radius: 100px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.4rem;
  vertical-align: 1px;
}

.meta.review-overdue .overdue { display: inline-block; }

/* ── Contents ── */
.toc {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.35rem;
  margin-bottom: 2rem;
}

.toc h2 {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--nhs-blue);
  margin-bottom: 0.6rem;
}

.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; margin: 0.3rem 0; }

.toc a {
  font-size: 0.9rem;
  color: var(--slate);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.toc a::before { content: counter(toc) ". "; color: var(--nhs-light); font-weight: 600; }
.toc a:hover { color: var(--nhs-blue); border-bottom-color: var(--nhs-light); }

/* ── Body ── */
article > section { margin-bottom: 2.25rem; scroll-margin-top: 1rem; }

article h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--nhs-dark);
  letter-spacing: -0.01em;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--nhs-light);
  margin-bottom: 0.9rem;
}

article h3 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--nhs-dark);
  margin: 1.4rem 0 0.5rem;
}

article p { margin-bottom: 0.9rem; max-width: 68ch; }
article ul, article ol { margin: 0 0 0.9rem 1.3rem; max-width: 66ch; }
article li { margin-bottom: 0.35rem; }
article strong { color: var(--nhs-dark); font-weight: 600; }

article a { color: var(--nhs-blue); text-decoration: underline; text-underline-offset: 2px; }

/* ── References ── */
.refs { font-size: 0.85rem; color: #5c6771; margin-left: 1.2rem; }
.refs li { margin-bottom: 0.5rem; padding-left: 0.2rem; }

/* ── Tables (dose tables, comparisons) ── */
.table-wrap { overflow-x: auto; margin-bottom: 1.1rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

thead th {
  background: var(--nhs-dark);
  color: var(--white);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-align: left;
  padding: 0.6rem 0.85rem;
}

tbody td { padding: 0.6rem 0.85rem; border-top: 1px solid var(--border); vertical-align: top; }
tbody tr:nth-child(even) { background: #fbfbfa; }

/* ── Callouts ── */
.callout {
  border-left: 3px solid var(--nhs-light);
  background: var(--white);
  border-radius: 0 10px 10px 0;
  padding: 0.95rem 1.2rem;
  margin: 0 0 1.1rem;
}

.callout p:last-child { margin-bottom: 0; }

.callout-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--nhs-blue);
  margin-bottom: 0.35rem;
}

.callout.warning { border-left-color: var(--amber); background: var(--amber-bg); }
.callout.warning .callout-title { color: #b06700; }

.callout.critical { border-left-color: var(--red); background: var(--red-bg); }
.callout.critical .callout-title { color: var(--red); }

/* ── Footer ── */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: #8a949c;
  line-height: 1.6;
}

footer p { margin-bottom: 0.5rem; }
footer a { color: var(--nhs-blue); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Mobile ── */
@media (max-width: 480px) {
  body { padding: 1.5rem 1rem 2rem; }
  h1 { font-size: 1.65rem; }
  .meta { grid-template-columns: 1fr 1fr; }
}

/* ── Print ──
   Guidelines get printed and pinned up. Drop the interface, keep the
   governance metadata, and make sure nothing splits across a page badly. */
@media print {
  @page { margin: 15mm; }

  body { background: var(--white); color: #000; padding: 0; display: block; font-size: 11pt; }
  .sheet { max-width: none; }

  .back-link, .toc { display: none; }

  h1 { font-size: 20pt; }
  article h2 { font-size: 13pt; break-after: avoid; }
  article h3 { break-after: avoid; }
  article p, article li { orphans: 3; widows: 3; }

  .meta { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
  .callout, table, .table-wrap { break-inside: avoid; }
  thead th { background: #eee !important; color: #000 !important; }

  .eyebrow { border: 1px solid #999; color: #000; background: none; }

  /* Printed copies leave the site, so say where they came from. */
  footer::after {
    content: "Printed from sthoscca.com/guidelines — check the site for the current version.";
    display: block;
    margin-top: 0.6rem;
    font-style: italic;
  }
}
