/* ============================================================
   UCLH Health — informational medical reference
   Direction: light, clinical-editorial, trust-forward.
   Body in a humanist serif for long-form reading; UI in a
   neutral grotesque. One restrained slate-teal accent.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&display=swap");

:root {
  --ink:        #16202a;   /* near-black slate, softer than pure black */
  --ink-soft:   #4a5763;
  --ink-faint:  #7c8893;
  --line:       #e3e8ec;
  --line-soft:  #eef2f4;
  --paper:      #ffffff;
  --paper-warm: #f8fafb;
  --accent:     #1f6f78;   /* slate-teal — clinical but not corporate-blue */
  --accent-ink: #16545b;
  --accent-bg:  #eef5f5;

  --font-ui:   "Inter", system-ui, -apple-system, sans-serif;
  --font-read: "Source Serif 4", Georgia, serif;

  --measure: 42rem;        /* comfortable reading width */
  --wrap:    72rem;
  --radius:  6px;
}

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-read);
  font-size: 1.125rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.5rem; }
.wrap--narrow { max-width: var(--measure); }

.skip-link {
  position: absolute; left: -999px;
  background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 10;
}
.skip-link:focus { left: 1rem; top: 1rem; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 5;
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 64px;
}
.brand { display: inline-flex; align-items: baseline; gap: .4rem; text-decoration: none; }
.brand__mark {
  font-family: var(--font-ui); font-weight: 700; letter-spacing: .04em;
  font-size: 1.15rem; color: var(--ink);
}
.brand__sub {
  font-family: var(--font-ui); font-weight: 500; color: var(--accent);
  font-size: 1.15rem;
}
.nav { display: flex; gap: 1.5rem; font-family: var(--font-ui); font-size: .94rem; font-weight: 500; }
.nav a { color: var(--ink-soft); text-decoration: none; }
.nav a:hover { color: var(--accent); }

/* CSS-only hamburger toggle — hidden on desktop; the horizontal nav above
   stays exactly as-is. Shown only below 720px (see responsive section). */
.nav-toggle,
.nav-toggle__btn { display: none; }

/* ---------- typographic primitives ---------- */
.eyebrow {
  font-family: var(--font-ui); font-weight: 600; font-size: .78rem;
  letter-spacing: .09em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 .5rem;
}
h1, h2, h3 { font-family: var(--font-ui); line-height: 1.2; color: var(--ink); }
h1 { font-weight: 700; letter-spacing: -.02em; }
h2 { font-weight: 600; letter-spacing: -.01em; }

/* ---------- article ---------- */
.article { padding: 3rem 0 4rem; }
.article__head { padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.article__title { font-size: clamp(1.9rem, 4vw, 2.7rem); margin: 0 0 .75rem; }
.article__standfirst {
  font-size: 1.3rem; line-height: 1.5; color: var(--ink-soft);
  margin: 0; font-weight: 400;
}

/* signature element: provenance block */
.provenance {
  display: flex; flex-wrap: wrap; gap: .35rem 1.5rem;
  margin-top: 1.5rem;
  font-family: var(--font-ui); font-size: .86rem; color: var(--ink-soft);
  padding: .9rem 1.1rem;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.provenance strong { color: var(--ink); font-weight: 600; }

/* prose */
.prose > * + * { margin-top: 1.25rem; }
.prose h2 { font-size: 1.5rem; margin-top: 2.5rem; }
.prose h3 { font-size: 1.18rem; margin-top: 1.75rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: .4rem; }
.prose blockquote {
  margin: 1.5rem 0; padding: .5rem 0 .5rem 1.25rem;
  border-left: 3px solid var(--accent); color: var(--ink-soft); font-style: italic;
}
.prose code {
  font-family: ui-monospace, monospace; font-size: .9em;
  background: var(--line-soft); padding: .1em .35em; border-radius: 4px;
}

/* sources & disclaimer */
.sources { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.sources__title { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.sources__list { font-family: var(--font-ui); font-size: .9rem; color: var(--ink-soft); }
.disclaimer {
  margin-top: 2.5rem; padding: 1rem 1.25rem;
  background: var(--accent-bg); border-radius: var(--radius);
  font-family: var(--font-ui); font-size: .86rem; color: var(--accent-ink);
}

/* ---------- home / index ---------- */
.hero { padding: 4rem 0 3rem; border-bottom: 1px solid var(--line); }
.hero__title { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0 0 1rem; max-width: 18ch; }
.hero__lede { font-size: 1.35rem; color: var(--ink-soft); max-width: var(--measure); margin: 0; }

.section { padding: 3rem 0; }
.section__title { font-size: 1.6rem; margin: 0 0 .35rem; }
.section__intro { color: var(--ink-soft); margin: 0 0 2rem; max-width: var(--measure); }

.card-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.card {
  display: block; padding: 1.5rem; text-decoration: none; color: inherit;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card__eyebrow { display: block; font-family: var(--font-ui); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: .5rem; }
.card__title { display: block; font-family: var(--font-ui); font-weight: 600; font-size: 1.15rem; line-height: 1.25; margin: 0 0 .5rem; }
.card__desc { font-size: .98rem; color: var(--ink-soft); margin: 0; }

/* ---------- footer ---------- */
.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); background: var(--paper-warm); }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; padding-block: 2.5rem; }
.site-footer__brand { max-width: 28rem; }
.site-footer__brand p { font-size: .95rem; color: var(--ink-soft); margin: .6rem 0 0; }
.site-footer__nav { display: flex; flex-direction: column; gap: .5rem; font-family: var(--font-ui); font-size: .92rem; }
.site-footer__heading { font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: .15rem; }
.site-footer__nav a { color: var(--ink-soft); text-decoration: none; }
.site-footer__nav a:hover { color: var(--accent); }
.site-footer__legal { border-top: 1px solid var(--line); padding-block: 1.25rem; }
.site-footer__legal p { font-family: var(--font-ui); font-size: .82rem; color: var(--ink-faint); margin: 0; }

/* ---------- responsive ---------- */

/* Mobile primary nav: collapse links behind a CSS-only hamburger (no JS).
   A visually-hidden-but-focusable checkbox drives the open/close state; the
   <label> is the visible button. Nav is still auto-generated in header.njk,
   so it keeps listing whatever sections exist. */
@media (max-width: 720px) {
  .site-header__inner { flex-wrap: wrap; }

  /* visible toggle button (the label) */
  .nav-toggle__btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;            /* comfortable 44px tap target */
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--paper); color: var(--ink); cursor: pointer;
  }
  .nav-toggle__btn:hover { border-color: var(--accent); color: var(--accent); }

  /* hamburger icon: three bars that morph into an X when open */
  .nav-toggle__bars {
    position: relative; width: 20px; height: 2px; border-radius: 2px;
    background: currentColor;
    transition: transform .2s ease, background-color .2s ease;
  }
  .nav-toggle__bars::before,
  .nav-toggle__bars::after {
    content: ""; position: absolute; left: 0;
    width: 20px; height: 2px; border-radius: 2px; background: currentColor;
    transition: transform .2s ease;
  }
  .nav-toggle__bars::before { top: -6px; }
  .nav-toggle__bars::after  { top: 6px; }

  /* the checkbox: focusable for keyboard, but visually hidden.
     Focus ring is forwarded to the visible button. */
  .nav-toggle {
    display: block; position: absolute;
    width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  }
  .nav-toggle:focus-visible ~ .nav-toggle__btn {
    outline: 3px solid var(--accent); outline-offset: 2px;
  }

  /* open state → morph bars into an X */
  .nav-toggle:checked ~ .nav-toggle__btn .nav-toggle__bars { background: transparent; }
  .nav-toggle:checked ~ .nav-toggle__btn .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-toggle__btn .nav-toggle__bars::after  { transform: translateY(-6px) rotate(-45deg); }

  /* the menu: hidden until toggled, then a full-width vertical list below the bar */
  .nav { display: none; }
  .nav-toggle:checked ~ .nav {
    display: flex; flex-direction: column;
    flex-basis: 100%; order: 3;           /* drops onto its own row under the bar */
    margin: 0 -1.5rem; padding: .25rem 0;  /* full-bleed to the header edges */
    border-top: 1px solid var(--line);
  }
  .nav a { padding: .8rem 1.5rem; }
  .nav a:hover { background: var(--accent-bg); }
}

@media (max-width: 640px) {
  body { font-size: 1.06rem; }
  .brand__sub { display: none; }
  .provenance { flex-direction: column; gap: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
