/* Theme: --brand-base and --accent-base are set per site in the page head. */
:root {
  --brand-base: #0b3d91;
  --accent-base: #f26b21;
  --brand: var(--brand-base);
  --brand-ink: var(--brand-ink-base, #ffffff);
  --accent: var(--accent-base);
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --ink: #14171f;
  --muted: #5d6472;
  --line: #e3e6eb;
  --card: #ffffff;
  --radius: 14px;
  --maxw: 1120px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root[data-scheme="auto"] {
    --brand: color-mix(in srgb, var(--brand-base) 45%, white);
    --brand-ink: #0b1220;
    --accent: color-mix(in srgb, var(--accent-base) 70%, white);
    --bg: #0f1218;
    --bg-soft: #161a22;
    --ink: #eceef2;
    --muted: #9aa2b1;
    --line: #262c38;
    --card: #161a22;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--sans); }
a { color: inherit; }
img, svg { max-width: 100%; display: block; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* header */
.site-head { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.site-head .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -.02em; text-decoration: none; color: var(--brand); display: flex; align-items: baseline; gap: 8px; }
.logo img { height: 30px; width: auto; }
.logo span { font-weight: 500; color: var(--muted); font-size: 15px; letter-spacing: 0; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 22px; font-size: 15px; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--ink); }
.btn { display: inline-block; background: var(--brand); color: var(--brand-ink) !important; padding: 9px 16px; border-radius: 999px; font-weight: 600; text-decoration: none; font-size: 15px; }
@media (max-width: 720px) { .nav a:not(.btn) { display: none; } }

/* home hero */
.hero { padding: 48px 0 12px; }
.hero h1 { font: 700 clamp(30px, 5vw, 46px)/1.1 var(--sans); letter-spacing: -.025em; margin: 0 0 10px; max-width: 18ch; }
.hero p { color: var(--muted); font-size: 19px; margin: 0; max-width: 56ch; }

.featured { display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 32px 0 8px; background: var(--card); text-decoration: none; }
.featured .cover { min-height: 300px; }
.featured .body { padding: 32px; display: flex; flex-direction: column; justify-content: center; }
.featured h2 { font: 700 clamp(22px, 3vw, 30px)/1.2 var(--sans); letter-spacing: -.02em; margin: 10px 0; }
.featured p { color: var(--muted); margin: 0 0 16px; }
@media (max-width: 800px) { .featured { grid-template-columns: 1fr; } .featured .cover { min-height: 180px; } .featured .body { padding: 22px; } }

.kicker { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.byline { font-size: 14px; color: var(--muted); }

/* covers: generated, no image files needed */
.cover { position: relative; background: linear-gradient(135deg, var(--c1), var(--c2)); overflow: hidden; }
.cover::before, .cover::after { content: ""; position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,.28); }
.cover::before { width: 240px; height: 240px; right: -60px; top: -60px; box-shadow: 0 0 0 40px rgba(255,255,255,.07), 0 0 0 90px rgba(255,255,255,.05); }
.cover::after { width: 120px; height: 120px; left: 28px; bottom: -40px; background: rgba(255,255,255,.1); border: 0; }
.cover b { position: absolute; left: 20px; top: 16px; color: #fff; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
/* Cover art uses the site's own colours; --t (0 to 100, from the topic name) varies the blend so topics differ. */
.cover { --c1: color-mix(in srgb, var(--brand-base) calc(55% + var(--t, 50) * 0.45%), var(--accent-base));
         --c2: color-mix(in srgb, color-mix(in srgb, var(--brand-base) calc(100% - var(--t, 50) * 1%), var(--accent-base)) 72%, white); }

/* filters */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 36px 0 18px; }
.chip { border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 7px 14px; border-radius: 999px; font: 500 14px var(--sans); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; padding-bottom: 56px; }
.post-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); text-decoration: none; display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.post-card:hover, .featured:hover { box-shadow: 0 10px 30px rgba(10, 20, 40, .12); }
.post-card:hover { transform: translateY(-2px); }
.post-card .cover { height: 150px; }
.post-card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-card h3 { font: 700 19px/1.3 var(--sans); letter-spacing: -.01em; margin: 0; }
.post-card p { color: var(--muted); font-size: 15px; margin: 0; flex: 1; }
[hidden] { display: none !important; }

/* cta band */
.band { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band .wrap { padding: 44px 20px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.band h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.band p { margin: 0; color: var(--muted); }

/* footer */
.site-foot { padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 14px 24px; justify-content: space-between; }
.site-foot a { color: var(--muted); }

/* article */
.crumbs { font-size: 14px; color: var(--muted); padding: 26px 0 0; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.post-head { padding: 14px 0 26px; max-width: 820px; }
.post-head h1 { font: 700 clamp(30px, 5vw, 44px)/1.12 var(--sans); letter-spacing: -.025em; margin: 10px 0 14px; text-wrap: balance; }
.post-head .dek { font-size: 20px; color: var(--muted); margin: 0 0 16px; }
.post-cover { height: clamp(160px, 28vw, 300px); border-radius: var(--radius); }
.post-layout { display: grid; grid-template-columns: minmax(0, 720px) 260px; gap: 56px; padding: 36px 0 56px; align-items: start; }
@media (max-width: 1000px) { .post-layout { grid-template-columns: minmax(0, 1fr); } .side { display: none; } }
.side { position: sticky; top: 88px; font-size: 14.5px; }
.side h4 { margin: 0 0 10px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.side ol { list-style: none; margin: 0 0 24px; padding: 0; border-left: 2px solid var(--line); }
.side li a { display: block; padding: 5px 0 5px 14px; text-decoration: none; color: var(--muted); margin-left: -2px; border-left: 2px solid transparent; }
.side li a:hover { color: var(--ink); border-left-color: var(--brand); }
.side-cta { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--bg-soft); }
.side-cta p { margin: 0 0 12px; font-weight: 600; font-size: 15.5px; color: var(--ink); }

.takeaways { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 0 var(--radius) var(--radius) 0; background: var(--bg-soft); padding: 18px 22px; margin: 0 0 30px; }
.takeaways h2 { font: 700 12px var(--sans) !important; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin: 0 0 8px !important; }
.takeaways ul { margin: 0; padding-left: 20px; }
.takeaways li { margin: 5px 0; }

.prose { font-size: 18.5px; line-height: 1.7; }
.prose > p:first-of-type { font-size: 20.5px; }
.prose h2 { font: 700 28px/1.2 var(--sans); letter-spacing: -.02em; margin: 44px 0 12px; scroll-margin-top: 84px; }
.prose h3 { font: 700 20px/1.3 var(--sans); margin: 28px 0 6px; }
.prose p { margin: 0 0 18px; }
.prose a { color: var(--brand); text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 20px; }
.prose li { margin: 8px 0; }
.prose blockquote { margin: 28px 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--accent); font: italic 22px/1.5 var(--serif); }
.prose code { font: 15px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; }
.tablewrap { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 10px; }
.prose table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: 16px; }
.prose th, .prose td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--bg-soft); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.prose tr:last-child td { border-bottom: 0; }
.callout { border: 1px dashed var(--accent); border-radius: var(--radius); padding: 18px 20px; margin: 26px 0; background: color-mix(in srgb, var(--accent) 8%, transparent); font-size: 16.5px; }
.callout b { display: block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }

.end-cta { margin: 44px 0 0; border-radius: var(--radius); padding: 30px; background: var(--brand); color: var(--brand-ink); display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.end-cta h2 { margin: 0 0 4px; font: 700 23px var(--sans); letter-spacing: -.02em; color: inherit; }
.end-cta p { margin: 0; opacity: .88; font-size: 16.5px; }
.end-cta .btn { background: var(--brand-ink); color: var(--brand) !important; }

.related { border-top: 1px solid var(--line); padding: 40px 0 0; }
.related > h2 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 18px; }
.related .grid { padding-bottom: 48px; }

/* empty state, topic pages, 404 */
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--muted); margin: 32px 0 56px; }
.page-head { padding: 40px 0 8px; }
.page-head h1 { font: 700 clamp(28px, 4vw, 38px)/1.15 var(--sans); letter-spacing: -.02em; margin: 6px 0 8px; }
.page-head p { color: var(--muted); margin: 0; }
.notfound { padding: 96px 0; text-align: center; }
.notfound h1 { font-size: 40px; margin: 0 0 8px; letter-spacing: -.02em; }
.prose img { border-radius: 10px; margin: 8px 0 20px; }

/* per-site brand: fonts, button shape, header tone (set in the page head) */
:root { --display: var(--sans); --btn-radius: 999px; }
h1, h2, h3, h4, .logo { font-family: var(--display) !important; }
.btn, .chip { border-radius: var(--btn-radius); }
.site-head[data-tone="dark"] { background: var(--head-bg); border-bottom-color: transparent; }
.site-head[data-tone="dark"] .logo, .site-head[data-tone="dark"] .logo span { color: #fff; }
.site-head[data-tone="dark"] .logo span { opacity: .7; }
.site-head[data-tone="dark"] .nav a:not(.btn) { color: rgba(255,255,255,.78); }
.site-head[data-tone="dark"] .nav a:not(.btn):hover { color: #fff; }
.site-head[data-tone="light"] { background: var(--head-bg, var(--bg)); }
@media (prefers-color-scheme: dark) { :root[data-scheme="auto"] .site-head[data-tone="light"] { background: var(--bg); } }
.logo img { max-height: 34px; max-width: 180px; object-fit: contain; }
.site-head[data-tone="light"] .nav a:not(.btn) { color: var(--ink); }
.site-head[data-tone="light"] .nav a:not(.btn):hover { color: var(--brand); }
.nav { font-size: 15.5px; }
