/* adamjrg v4: clean and sharp */
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-stretch: 75% 100%; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans-italic.woff2") format("woff2"); font-weight: 400 700; font-stretch: 75% 100%; font-style: italic; font-display: swap; }

:root {
  --bg: #ffffff;
  --bg-2: #f5f6f7;
  --ink: #0b0c0e;
  --ink-2: #55595f;
  --line: #e6e7ea;
  --graph: #c9ccd2;
  --accent: #1f5bff;
  --accent-ink: #ffffff;
  --face: var(--gh-font-body, "Instrument Sans"), ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --face-head: var(--gh-font-heading, "Instrument Sans"), ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 72rem;
  --gutter: clamp(20px, 4vw, 40px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0c0e; --bg-2: #141518; --ink: #f2f3f5; --ink-2: #9a9fa8; --line: #24262b; --graph: #3a3d44; --accent: #4f7dff; --accent-ink: #0b0c0e; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.6 var(--face); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--accent); color: var(--accent-ink); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); transition: text-decoration-color .15s, color .15s; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--face-head); margin: 0; text-wrap: balance; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* bar */
.bar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.bar.scrolled { border-bottom-color: var(--line); }
.bar-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.bar-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; text-decoration: none; }
.bar .nav { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: .9375rem; }
.bar .nav a { display: block; padding: 6px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; transition: color .15s, background .15s; }
.bar .nav a:hover { color: var(--ink); background: var(--bg-2); }
.bar .nav-current a { color: var(--ink); }
.home-template .bar .nav-current a { color: var(--ink-2); }

/* buttons */
.btn { display: inline-flex; align-items: center; height: 44px; padding: 0 18px; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 500; font-size: .9375rem; text-decoration: none; transition: transform .15s var(--ease), opacity .15s; }
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.97); }
.btn-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-quiet:hover { opacity: 1; background: var(--bg-2); }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "title title" "text graph"; gap: clamp(24px, 3vw, 40px) clamp(24px, 4vw, 64px); align-items: center; padding-top: clamp(40px, 7vw, 96px); padding-bottom: clamp(32px, 5vw, 64px); }
.hero-text { display: contents; }
.hero h1 { grid-area: title; font-size: min(4.6rem, 6.1vw); line-height: 1.02; letter-spacing: -.04em; font-weight: 600; text-wrap: nowrap; } /* each line sized to fit the content width */
@media (max-width: 600px) { .hero h1 { font-size: 2.5rem; text-wrap: balance; } }
.hero-body { grid-area: text; align-self: start; }
.hero h1 span { display: block; }
.hero-role { color: var(--ink-2); }
.hero-line { margin: 0; max-width: 32rem; font-size: 1.1875rem; line-height: 1.55; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 32px 0 0; }
.graph { grid-area: graph; position: relative; aspect-ratio: 4 / 3; width: 100%; max-height: 420px; }
.graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* blocks */
.block { padding-top: clamp(48px, 7vw, 88px); padding-bottom: clamp(16px, 3vw, 32px); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.block-head h2 { font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; }
.block-head a { color: var(--ink-2); font-size: .9375rem; text-decoration: none; }
.block-head a:hover { color: var(--ink); }
.empty { color: var(--ink-2); margin: 24px 0 0; }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-row a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 24px; padding: 20px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.post-row-title { font-size: 1.1875rem; font-weight: 500; letter-spacing: -.01em; transition: color .15s; }
.post-row a:hover .post-row-title { color: var(--accent); }
.post-row-sub { grid-column: 1; color: var(--ink-2); font-size: .9375rem; }
.post-row time { grid-column: 2; grid-row: 1; color: var(--ink-2); font-size: .9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.about { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); padding-top: 28px; }
.topics { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; }
.topics li { padding: 6px 12px; border-radius: 999px; background: var(--bg-2); font-size: .875rem; color: var(--ink-2); }

/* pages */
.page { padding-top: clamp(40px, 7vw, 80px); padding-bottom: 48px; }
.page-head { max-width: 40rem; margin-bottom: 32px; }
.page-head h1 { font-size: clamp(2.4rem, 1.6rem + 3vw, 3.75rem); letter-spacing: -.04em; line-height: 1.05; font-weight: 600; }
.page-head p { margin: 14px 0 0; color: var(--ink-2); font-size: 1.125rem; }
.pagination { display: flex; gap: 16px; padding: 24px 0; color: var(--ink-2); font-size: .9375rem; }

/* article */
.article { max-width: 44rem; margin: 0 auto; padding: clamp(40px, 7vw, 80px) 0 48px; }
.byline { display: flex; gap: 10px; margin: 0 0 20px; color: var(--ink-2); font-size: .9375rem; }
.byline a { text-decoration: none; }
.article-head h1 { font-size: clamp(2.2rem, 1.5rem + 2.8vw, 3.4rem); line-height: 1.08; letter-spacing: -.04em; font-weight: 600; }
.standfirst { margin: 18px 0 0; font-size: 1.25rem; line-height: 1.5; color: var(--ink-2); }
.meta { margin: 18px 0 0; color: var(--ink-2); font-size: .9375rem; }
.article-image { margin: 40px 0 0; }
.article-image img { border-radius: 12px; width: 100%; }
.prose { font-size: 1.125rem; line-height: 1.7; }
.article .prose { margin-top: 40px; }
.prose > * { margin: 0 0 1.15em; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { font-size: 1.6rem; letter-spacing: -.025em; line-height: 1.2; margin-top: 2em; margin-bottom: .6em; font-weight: 600; }
.prose h3 { font-size: 1.25rem; letter-spacing: -.015em; margin-top: 1.7em; margin-bottom: .5em; font-weight: 600; }
.prose a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: .35em; }
.prose blockquote { margin-left: 0; margin-right: 0; padding: 18px 22px; border-radius: 12px; background: var(--bg-2); color: var(--ink); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose :not(pre) > code { font: .875em var(--mono); background: var(--bg-2); padding: .15em .4em; border-radius: 5px; }
.prose pre { overflow-x: auto; padding: 18px 20px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font: .875rem/1.65 var(--mono); }
.prose table { width: 100%; border-collapse: collapse; font-size: .9375rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: left; }
.prose img { border-radius: 10px; }
.kg-width-wide { width: min(64rem, 100vw - 2 * var(--gutter)); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.kg-width-full { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
.kg-width-full img { border-radius: 0; }
.article-foot { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink-2); }
.sequel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.sequel a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; color: var(--ink); transition: background .15s; }
.sequel a:hover { background: var(--bg-2); }
.sequel small { color: var(--ink-2); }
.sequel .next { grid-column: 2; text-align: right; }
.comments { margin-top: 48px; }

/* footer */
.foot { margin-top: clamp(64px, 10vw, 120px); border-top: 1px solid var(--line); }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 28px; padding-bottom: 40px; color: var(--ink-2); font-size: .9375rem; }
.foot-in p { margin: 0; }
.foot-in ul { display: flex; flex-wrap: wrap; gap: 20px; margin: 0; padding: 0; list-style: none; }
.foot-in a { text-decoration: none; }
.foot-in a:hover { color: var(--ink); }

/* load moment: the hero text arrives, the graph starts drawing */
@media (prefers-reduced-motion: no-preference) {
  .hero h1 { animation: rise .7s var(--ease) both; }
  .hero-body { animation: rise .7s var(--ease) .1s both; }
  .graph { animation: fade 1.2s ease .2s both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "graph" "title" "text"; }
  .graph { aspect-ratio: 16 / 10; max-height: 300px; }
  .about { grid-template-columns: 1fr; }
  .sequel { grid-template-columns: 1fr; }
  .sequel .next { grid-column: 1; text-align: left; }
}
@media (max-width: 520px) {
  .post-row a { grid-template-columns: 1fr; }
  .post-row time { grid-column: 1; grid-row: auto; }
}
.article-foot:not(:has(a)) { display: none; } /* nothing to link to yet: no empty divider */
