/* Dispatch CMS public theme. Colours and fonts come from CSS variables set in the page head. */
:root {
  --primary: #b3261e; --on-primary: #fff; --accent: #1d4ed8; --on-accent: #fff;
  --header-bg: #fff; --header-text: #111827; --footer-bg: #111827; --footer-text: #e5e7eb;
  --font-head: Georgia, serif; --font-body: system-ui, sans-serif;
  --bg: #ffffff; --surface: #f5f6f8; --text: #16181d; --muted: #5b6270; --line: #e3e6eb; --link: var(--primary);
}
@media (prefers-color-scheme: dark) {
  body.auto-dark {
    --bg: #111317; --surface: #1b1e24; --text: #eceef2; --muted: #a3abb8; --line: #2c313a;
    --header-bg: #16191e; --header-text: #f3f4f6; --footer-bg: #0b0d10; --footer-text: #d1d5db; --link: #8ab4ff;
  }
  body.auto-dark .kicker { color: #ffb4a8; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); font-size: 1rem; line-height: 1.6; color: var(--text); background: var(--bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
.wrap { width: min(1160px, 100% - 2rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--text); color: var(--bg); padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: .5rem; top: .5rem; }

/* Header */
.site-header { background: var(--header-bg); color: var(--header-text); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 1rem; padding-block: .9rem; }
.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; }
.brand-name { font-family: var(--font-head); font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 800; letter-spacing: -.01em; }
.brand-logo { max-height: 52px; width: auto; }
.brand-tagline { color: inherit; opacity: .75; font-size: .92rem; border-left: 1px solid currentColor; padding-left: 1rem; }
.nav-toggle { margin-left: auto; display: none; font: inherit; font-weight: 600; background: none; color: inherit; border: 1px solid currentColor; border-radius: 6px; padding: .4rem .8rem; cursor: pointer; }
.site-nav { border-top: 1px solid var(--line); }
.nav-row { display: flex; align-items: center; gap: 1rem; }
.nav-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0 .25rem; margin: 0; padding: 0; flex: 1; }
.nav-list > li { position: relative; }
.nav-list a { display: block; padding: .65rem .7rem; color: inherit; text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav-list a:hover, .nav-list a[aria-current] { color: var(--primary); }
.nav-list a[aria-current] { box-shadow: inset 0 -3px 0 var(--primary); }
.sub-list { list-style: none; margin: 0; padding: .35rem 0; position: absolute; left: 0; top: 100%; min-width: 200px; background: var(--header-bg); border: 1px solid var(--line); border-radius: 0 0 8px 8px; box-shadow: 0 8px 20px rgba(0,0,0,.12); display: none; z-index: 20; }
.sub-list a { padding: .45rem .9rem; font-weight: 500; }
.has-sub:hover > .sub-list, .has-sub:focus-within > .sub-list { display: block; }
.nav-search { display: flex; gap: .3rem; }
.nav-search input, .search-form input { font: inherit; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); width: 9.5rem; }
.nav-search button, .search-form button, .button { font: inherit; font-weight: 600; padding: .4rem .9rem; border: 0; border-radius: 6px; background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; display: inline-block; }
@media (max-width: 760px) {
  .brand-tagline { display: none; }
  .nav-toggle { display: block; }
  .site-nav { display: none; }
  .site-nav.open { display: block; }
  .nav-row { flex-direction: column; align-items: stretch; gap: 0; padding-block: .5rem; }
  .nav-list { flex-direction: column; }
  .nav-list a[aria-current] { box-shadow: inset 3px 0 0 var(--primary); }
  .sub-list { position: static; display: block; border: 0; box-shadow: none; padding: 0 0 .3rem 1rem; }
  .nav-search { padding: .5rem 0; }
  .nav-search input { flex: 1; width: auto; }
}

/* Layout */
.site-main { padding-block: 1.5rem 3rem; min-height: 50vh; }
.home-section { margin-bottom: 2.5rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-top: 3px solid var(--text); padding-top: .6rem; margin-bottom: 1rem; }
.section-head h2 { font-size: 1.35rem; margin: 0; }
.section-head a { font-size: .9rem; font-weight: 600; white-space: nowrap; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.75rem 1.5rem; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 2rem; }
.lead-side { display: grid; gap: 1.1rem; align-content: start; }
@media (max-width: 860px) { .lead-grid { grid-template-columns: 1fr; } }

/* Cards */
.card { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.card-image { display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; background: var(--surface); }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-size: 1.15rem; margin: .15rem 0 .35rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-summary { margin: 0 0 .4rem; color: var(--muted); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin: 0; color: var(--muted); font-size: .82rem; }
.card-lg .card-title { font-size: clamp(1.6rem, 3.6vw, 2.3rem); }
.card-lg .card-summary { font-size: 1.05rem; -webkit-line-clamp: 4; }
.card-sm { flex-direction: row; gap: .9rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.card-sm:last-child { border-bottom: 0; }
.card-sm .card-image { flex: 0 0 108px; aspect-ratio: 4 / 3; border-radius: 6px; }
.card-sm .card-title { font-size: 1.02rem; }
.kicker { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); text-decoration: none; margin: 0; }
a.kicker:hover { text-decoration: underline; }

/* Lists */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: 0 0 1rem; font-size: .88rem; color: var(--muted); }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: .35rem; }
.breadcrumbs a { color: inherit; }
.list-head { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 3px solid var(--text); }
.list-head h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); margin: .1rem 0; }
.list-intro { margin: .3rem 0 0; color: var(--muted); max-width: 70ch; }
.avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.5rem; }
.chip { display: inline-block; padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; color: var(--text); text-decoration: none; background: var(--surface); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.empty-note, .result-count { color: var(--muted); }
.empty-state { text-align: center; padding: 4rem 1rem; max-width: 560px; margin-inline: auto; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 2.5rem; }
.page-link { padding: .45rem 1rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-weight: 600; color: var(--text); }
.page-link.disabled { opacity: .4; }
.page-status { color: var(--muted); font-size: .9rem; }
.search-form { display: flex; gap: .5rem; margin-top: .6rem; max-width: 520px; }
.search-form input { flex: 1; width: auto; padding: .6rem .8rem; }

/* Article */
.article { max-width: 760px; margin-inline: auto; }
.article-head h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); letter-spacing: -.01em; margin: .3rem 0 .6rem; }
.standfirst { font-size: 1.2rem; color: var(--muted); margin: 0 0 1rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; color: var(--muted); font-size: .88rem; margin: 0 0 1.4rem; padding-block: .7rem; border-block: 1px solid var(--line); }
.byline { color: var(--text); font-weight: 600; }
.article-figure { margin: 0 0 1.6rem; }
.article-figure img { width: 100%; border-radius: 8px; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.credit { margin-left: .3rem; font-style: italic; }
.prose { font-size: 1.125rem; line-height: 1.75; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.15em; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose h2 { font-size: 1.55rem; margin-top: 1.8em; }
.prose h3 { font-size: 1.28rem; margin-top: 1.6em; }
.prose h4 { font-size: 1.1rem; }
.prose blockquote { margin-inline: 0; padding: .2rem 0 .2rem 1.2rem; border-left: 4px solid var(--primary); color: var(--muted); font-style: italic; }
.prose img { border-radius: 8px; margin-inline: auto; }
.prose figure { margin-inline: 0; }
.prose pre { background: var(--surface); padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: .9rem; }
.prose code { background: var(--surface); padding: .1em .3em; border-radius: 4px; font-size: .92em; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2em; }
.sources { margin-top: 2.2rem; padding: 1rem 1.2rem; background: var(--surface); border-radius: 8px; font-size: .95rem; }
.sources h2 { font-size: 1.05rem; font-family: var(--font-body); margin-bottom: .4rem; }
.sources ul { margin: 0; padding-left: 1.2rem; }
.article .chip-row { margin-top: 1.6rem; }
.related { margin-top: 3rem; }
.preview-banner { background: #fff4cc; color: #4a3b00; padding: .7rem 1rem; border-radius: 8px; font-weight: 600; }

/* Footer */
.site-footer { background: var(--footer-bg); color: var(--footer-text); padding-block: 2.2rem 1.4rem; font-size: .93rem; }
.site-footer a { color: inherit; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer-name { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; margin: 0 0 .4rem; }
.footer-about { margin: 0; opacity: .8; max-width: 46ch; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.footer-base { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.8rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.18); opacity: .85; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; gap: 1.3rem; } }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .site-header nav, .site-footer, .related, .nav-toggle, .chip-row { display: none; } .prose { font-size: 11pt; } }

/* API guide */
.docs { max-width: 860px; margin-inline: auto; }
.docs h1 { font-size: 2rem; }
.docs h2 { font-size: 1.4rem; margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.docs h3 { font-size: 1.08rem; margin-top: 1.4rem; font-family: var(--font-body); }
.docs pre { background: #14171c; color: #e6e9ef; padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: .85rem; line-height: 1.5; }
.docs code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.docs :not(pre) > code { background: var(--surface); padding: .1em .35em; border-radius: 4px; }
.docs table { width: 100%; border-collapse: collapse; font-size: .92rem; margin-block: .8rem; display: block; overflow-x: auto; }
.docs th, .docs td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.docs th { background: var(--surface); }
