@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Sans+Condensed:wght@600;700&display=swap");

:root {
  --paper: #ffffff;
  --card: #ffffff;
  --ink: #111111;
  --body: #262626;
  --muted: #6b6b6b;
  --rule: #d4d4d4;
  --rule-soft: #ebebeb;
  --code-bg: #f2f2f2;
  --accent: #111111;
  --accent-soft: #9a9a9a;
  --hl: #ffe94d;
  --hl-ink: #111111;
  --serif: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --display: "IBM Plex Sans Condensed", "IBM Plex Sans", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  margin: 0;
  background: var(--paper);
  color: var(--body);
}
.container {
  max-width: 720px;
  margin: 48px auto 80px;
  padding: 0 20px;
}
h1, h2, h3 {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.2;
}
h1 {
  font-size: 2.4em;
  letter-spacing: -0.015em;
  margin: 0.3em 0 0.5em;
}
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-soft);
}
a:hover {
  background: var(--hl);
  color: var(--hl-ink);
  text-decoration-color: currentColor;
}
a.card:hover, a.stat:hover, .card > a:hover, .bench-grid a:hover, .lightbox:hover {
  background: none;
}
code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 1px 4px;
  border-radius: 0;
}
pre {
  font-family: var(--mono);
  font-size: 0.8em;
  background: var(--code-bg);
  border-left: 3px solid var(--ink);
  padding: 12px 16px;
  overflow-x: auto;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
  font-size: 1em;
}
.diagram {
  margin: 28px 0;
  overflow-x: auto;
}
.diagram svg {
  width: 100%;
  min-width: 600px;
  height: auto;
  display: block;
  font-family: var(--serif);
}
.diagram svg text[font-family] {
  font-family: var(--mono);
}
.diagram figcaption {
  margin-top: 10px;
  font-size: 0.88em;
  color: var(--muted);
}
.meta {
  color: var(--muted);
  font-size: 0.9em;
}
img {
  width: 100%;
  max-width: 720px;
  height: 400px;
  object-fit: cover;
  display: block;
}
img + img {
  margin-top: 16px;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 15, 0.88);
  z-index: 999;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
  text-decoration: none;
}
.lightbox:target {
  display: flex;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  height: auto;
  width: auto;
  object-fit: contain;
  cursor: default;
}

.home {
  max-width: 960px;
}

.kicker {
  font-size: 0.92em;
  color: var(--muted);
  margin: 0 0 4px;
}

h2 {
  font-size: 1.5em;
  margin-top: 60px;
  padding-top: 14px;
  border-top: 4px solid var(--ink);
}

.latest {
  margin: 36px 0 40px;
}
h2.section-label {
  margin: 0 0 8px;
  padding: 6px 0 0;
  border-top: 2px solid var(--ink);
  font-size: 0.95em;
  font-weight: 700;
  color: var(--ink);
}
.latest-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.latest-list li {
  display: grid;
  grid-template-columns: 5.5em 7em 16em 1fr;
  gap: 2px 18px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.latest-list time {
  font-family: var(--mono);
  font-size: 0.75em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.latest-list a {
  font-weight: 600;
}
.latest-list .tag {
  justify-self: start;
}
.latest-list span:not(.tag) {
  color: var(--body);
  font-size: 0.9em;
}
@media (max-width: 640px) {
  .latest-list li {
    grid-template-columns: 5.5em 1fr;
  }
  .latest-list a,
  .latest-list span:not(.tag) {
    grid-column: 2;
  }
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px 24px;
  margin: 24px 0 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 0;
  overflow: hidden;
}
a.card {
  color: inherit;
  text-decoration: none;
}
/* Cards that aren't one big link: the title link stretches over the whole
   card, and the secondary links (Live site, Source, Write-up) sit above it. */
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.card .pin-links a {
  position: relative;
  z-index: 2;
}
/* One hover style for every card: dark border, highlighted title. */
.card:hover {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.card:hover h3,
.card:hover h3 a,
a.card:hover .card-body h3,
a.card.pin:hover h3 {
  background: var(--hl);
  color: var(--hl-ink);
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.card .pin-links a:hover {
  background: var(--hl);
}

.card-grid img {
  width: 100%;
  max-width: none;
  height: 150px;
  object-fit: cover;
  display: block;
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 16px 16px;
}
.card h3 {
  align-self: flex-start;  /* highlight hugs the title instead of the full width */
}
.card-body h3 {
  margin: 0 0 6px;
  font-size: 1.08em;
  line-height: 1.3;
}
.card-body h3 a {
  color: var(--ink);
  text-decoration-color: var(--rule);
}
a.card .card-body h3 {
  color: var(--ink);
}
.card-body p {
  margin: 0 0 12px;
  font-size: 0.88em;
  color: var(--body);
}

/* tags read as a plain list, not pills */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: auto;
}
.tag {
  font-family: var(--mono);
  font-size: 0.7em;
  color: var(--muted);
  white-space: nowrap;
}
.tags .tag:not(:last-child)::after {
  content: "\00b7";
  margin: 0 0.5em;
  color: var(--accent-soft);
}

.fig-top {
  object-position: top;
}

figure.chart {
  margin: 24px 0 8px;
  padding: 18px 18px 10px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 0;
}
figure.chart svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--serif);
}
figure.chart + figcaption,
figure.chart figcaption {
  color: var(--muted);
  font-size: 0.85em;
  margin: 0 0 24px;
}
.chart .ptitle { fill: var(--ink); font-size: 14px; font-weight: 600; }
.chart .lab { fill: var(--body); font-size: 13px; }
.chart .val { fill: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.chart .val.sm { font-size: 11.5px; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.chart .grid { stroke: var(--rule-soft); stroke-width: 1; }
.chart .mark path { transition: opacity 0.1s; }
.chart svg:hover .mark path { opacity: 0.55; }
.chart svg .mark:hover path { opacity: 1; }

table.data {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.86em;
  font-variant-numeric: tabular-nums;
}
table.data th,
table.data td {
  text-align: left;
  vertical-align: top;
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid var(--rule-soft);
}
table.data th {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 2px solid var(--ink);
}
table.data tr.sub th {
  font-weight: 400;
  font-size: 0.85em;
  padding-top: 0;
}
.table-wrap {
  overflow-x: auto;
}

.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  margin: 24px 0 8px;
  background: var(--rule-soft);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.stat {
  display: block;
  background: var(--paper);
  padding: 12px 16px;
  color: inherit;
  text-decoration: none;
}
a.stat:hover .num {
  background: var(--hl);
  color: var(--hl-ink);
}
.stat .num {
  display: block;
  font-family: var(--display);
  font-size: 1.5em;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat .what {
  display: block;
  font-size: 0.8em;
  color: var(--muted);
  margin-top: 4px;
}

.featured {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 0;
  overflow: hidden;
  margin: 24px 0 8px;
}
.featured > a img {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  display: block;
}
.featured .card-body {
  padding: 18px 20px 20px;
}
.featured .card-body h3 {
  font-size: 1.25em;
}
.featured .highlights {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 0 14px;
}
.featured-wide {
  grid-template-columns: 1fr;
  margin-top: 8px;
}
.featured-split {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
  margin: 14px 0 16px;
}
.featured-split figure.chart {
  margin: 0;
}
.featured-split .highlights {
  margin: 0;
}
@media (max-width: 860px) {
  .featured-split {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .featured {
    grid-template-columns: 1fr;
  }
  .featured > a img {
    height: 180px;
    min-height: 0;
  }
}
.container:not(.home) .highlights {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 480px) {
  .highlights,
  .featured .highlights,
  .container:not(.home) .highlights {
    grid-template-columns: 1fr;
  }
  .stat .num {
    font-size: 1.25em;
  }
}

.summary {
  border-left: 4px solid var(--ink);
  background: var(--code-bg);
  padding: 12px 16px;
  margin: 20px 0 8px;
}
.series {
  font-size: 0.85em;
  color: var(--muted);
  margin: 8px 0 0;
}
.series a.current {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.pinned {
  margin: 36px 0 8px;
}
.pinned-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 10px;
}
.pin {
  padding: 16px 18px 16px;
}
.pin .num {
  font-family: var(--display);
  font-size: 1.9em;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.pin .what {
  font-size: 0.82em;
  color: var(--muted);
  margin: 2px 0 12px;
}
.pin h3 {
  margin: 0 0 6px;
  font-size: 1.08em;
  line-height: 1.3;
}
.pin h3 a,
a.card.pin h3 {
  color: var(--ink);
}
.pin p {
  margin: 0 0 12px;
  font-size: 0.88em;
  color: var(--body);
  flex: 1;
}
@media (max-width: 640px) {
  .pinned-grid {
    grid-template-columns: 1fr;
  }
}
.card .pin-links {
  font-size: 0.85em;
  flex: 0;
}

.toc {
  font-size: 0.9em;
  color: var(--muted);
  margin: 20px 0 0;
}
.docs h3 {
  margin: 28px 0 8px;
}
.docs ul, .docs ol {
  padding-left: 1.4em;
}
.docs li {
  margin: 4px 0;
}

/* ---- dark theme: system default unless the visitor picked light; or picked dark ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --paper: #121212;
  --card: #181818;
  --ink: #f0f0f0;
  --body: #d4d4d4;
  --muted: #9a9a9a;
  --rule: #3a3a3a;
  --rule-soft: #262626;
  --code-bg: #1f1f1f;
  --accent: #ffe94d;
  --accent-soft: #8a7d2a;
  --hl: #ffe94d;
  --hl-ink: #111111;
  color-scheme: dark;
  }
  :root:not([data-theme="light"]) svg [fill="#f4f4f4"] { fill: #161616; }
  :root:not([data-theme="light"]) svg [fill="#ffffff"] { fill: #1c1c1c; }
  :root:not([data-theme="light"]) svg [fill="#fff8e1"] { fill: #221f12; }
  :root:not([data-theme="light"]) svg [fill="#cccccc"] { fill: #454545; }
  :root:not([data-theme="light"]) svg [fill="#999999"] { fill: #5c5c5c; }
  :root:not([data-theme="light"]) svg [fill="#eeeeee"] { fill: #222222; }
  :root:not([data-theme="light"]) svg [fill="#111111"] { fill: #f0f0f0; }
  :root:not([data-theme="light"]) svg [fill="#333333"] { fill: #d4d4d4; }
  :root:not([data-theme="light"]) svg [fill="#666666"] { fill: #9a9a9a; }
  :root:not([data-theme="light"]) svg [fill="#2f5a94"] { fill: #8db4ec; }
  :root:not([data-theme="light"]) svg [fill="#3b6aa8"] { fill: #7aa2f7; }
  :root:not([data-theme="light"]) svg [fill="#9a6c05"] { fill: #e3b341; }
  :root:not([data-theme="light"]) svg [fill="#b8502c"] { fill: #f0886a; }
  :root:not([data-theme="light"]) svg [fill="#a3401b"] { fill: #f7a08a; }
  :root:not([data-theme="light"]) svg [fill="#7a4bb8"] { fill: #bc8cff; }
  :root:not([data-theme="light"]) svg [fill="#2c7a3a"] { fill: #7ee787; }
  :root:not([data-theme="light"]) svg [stroke="#f4f4f4"] { stroke: #161616; }
  :root:not([data-theme="light"]) svg [stroke="#ffffff"] { stroke: #1c1c1c; }
  :root:not([data-theme="light"]) svg [stroke="#fff8e1"] { stroke: #221f12; }
  :root:not([data-theme="light"]) svg [stroke="#cccccc"] { stroke: #454545; }
  :root:not([data-theme="light"]) svg [stroke="#999999"] { stroke: #5c5c5c; }
  :root:not([data-theme="light"]) svg [stroke="#eeeeee"] { stroke: #222222; }
  :root:not([data-theme="light"]) svg [stroke="#111111"] { stroke: #f0f0f0; }
  :root:not([data-theme="light"]) svg [stroke="#333333"] { stroke: #d4d4d4; }
  :root:not([data-theme="light"]) svg [stroke="#666666"] { stroke: #9a9a9a; }
  :root:not([data-theme="light"]) svg [stroke="#2f5a94"] { stroke: #8db4ec; }
  :root:not([data-theme="light"]) svg [stroke="#3b6aa8"] { stroke: #7aa2f7; }
  :root:not([data-theme="light"]) svg [stroke="#9a6c05"] { stroke: #e3b341; }
  :root:not([data-theme="light"]) svg [stroke="#b8502c"] { stroke: #f0886a; }
  :root:not([data-theme="light"]) svg [stroke="#a3401b"] { stroke: #f7a08a; }
  :root:not([data-theme="light"]) svg [stroke="#7a4bb8"] { stroke: #bc8cff; }
  :root:not([data-theme="light"]) svg [stroke="#2c7a3a"] { stroke: #7ee787; }
}
:root[data-theme="dark"] {
  --paper: #121212;
  --card: #181818;
  --ink: #f0f0f0;
  --body: #d4d4d4;
  --muted: #9a9a9a;
  --rule: #3a3a3a;
  --rule-soft: #262626;
  --code-bg: #1f1f1f;
  --accent: #ffe94d;
  --accent-soft: #8a7d2a;
  --hl: #ffe94d;
  --hl-ink: #111111;
  color-scheme: dark;
}
:root[data-theme="dark"] svg [fill="#f4f4f4"] { fill: #161616; }
:root[data-theme="dark"] svg [fill="#ffffff"] { fill: #1c1c1c; }
:root[data-theme="dark"] svg [fill="#fff8e1"] { fill: #221f12; }
:root[data-theme="dark"] svg [fill="#cccccc"] { fill: #454545; }
:root[data-theme="dark"] svg [fill="#999999"] { fill: #5c5c5c; }
:root[data-theme="dark"] svg [fill="#eeeeee"] { fill: #222222; }
:root[data-theme="dark"] svg [fill="#111111"] { fill: #f0f0f0; }
:root[data-theme="dark"] svg [fill="#333333"] { fill: #d4d4d4; }
:root[data-theme="dark"] svg [fill="#666666"] { fill: #9a9a9a; }
:root[data-theme="dark"] svg [fill="#2f5a94"] { fill: #8db4ec; }
:root[data-theme="dark"] svg [fill="#3b6aa8"] { fill: #7aa2f7; }
:root[data-theme="dark"] svg [fill="#9a6c05"] { fill: #e3b341; }
:root[data-theme="dark"] svg [fill="#b8502c"] { fill: #f0886a; }
:root[data-theme="dark"] svg [fill="#a3401b"] { fill: #f7a08a; }
:root[data-theme="dark"] svg [fill="#7a4bb8"] { fill: #bc8cff; }
:root[data-theme="dark"] svg [fill="#2c7a3a"] { fill: #7ee787; }
:root[data-theme="dark"] svg [stroke="#f4f4f4"] { stroke: #161616; }
:root[data-theme="dark"] svg [stroke="#ffffff"] { stroke: #1c1c1c; }
:root[data-theme="dark"] svg [stroke="#fff8e1"] { stroke: #221f12; }
:root[data-theme="dark"] svg [stroke="#cccccc"] { stroke: #454545; }
:root[data-theme="dark"] svg [stroke="#999999"] { stroke: #5c5c5c; }
:root[data-theme="dark"] svg [stroke="#eeeeee"] { stroke: #222222; }
:root[data-theme="dark"] svg [stroke="#111111"] { stroke: #f0f0f0; }
:root[data-theme="dark"] svg [stroke="#333333"] { stroke: #d4d4d4; }
:root[data-theme="dark"] svg [stroke="#666666"] { stroke: #9a9a9a; }
:root[data-theme="dark"] svg [stroke="#2f5a94"] { stroke: #8db4ec; }
:root[data-theme="dark"] svg [stroke="#3b6aa8"] { stroke: #7aa2f7; }
:root[data-theme="dark"] svg [stroke="#9a6c05"] { stroke: #e3b341; }
:root[data-theme="dark"] svg [stroke="#b8502c"] { stroke: #f0886a; }
:root[data-theme="dark"] svg [stroke="#a3401b"] { stroke: #f7a08a; }
:root[data-theme="dark"] svg [stroke="#7a4bb8"] { stroke: #bc8cff; }
:root[data-theme="dark"] svg [stroke="#2c7a3a"] { stroke: #7ee787; }

.theme-toggle {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 50;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 4px 10px;
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--hl-ink);
  background: var(--hl);
  border-color: var(--ink);
}

.bench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin: 16px 0 8px;
}
.bench-grid figure {
  margin: 0;
}
.bench-grid figure img {
  width: 100%;
  max-width: none;
  height: 280px;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 0;
  cursor: zoom-in;
}
.bench-grid figcaption {
  font-size: 0.82em;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}
.bench-note {
  font-size: 0.95em;
  margin: 0 0 4px;
}
