/* Shared by the blog, posts and the 404 page. Tokens and type match the home page. */
:root {
  --bg: #F2F3F0;
  --fg: #16181B;
  --muted: #5C6066;
  --rule: #D7D9D4;
  --accent: #2338C9;
  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416; --fg: #E8EAE6; --muted: #9A9EA3; --rule: #2A2D30; --accent: #8C9BFF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121416; --fg: #E8EAE6; --muted: #9A9EA3; --rule: #2A2D30; --accent: #8C9BFF;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0 20px;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { max-width: 720px; margin: 0 auto; padding-block: 28px 64px; display: flex; flex-direction: column; gap: 56px; }

/* Top bar */
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; font: 13px var(--mono); letter-spacing: .02em; }
.bar a { color: var(--muted); text-decoration: none; }
.bar a:hover, .bar a[aria-current] { color: var(--fg); }
.bar nav { display: flex; align-items: center; gap: 20px; }

/* Light/dark switch (theme.js): shows the moon in light mode, the sun in dark */
.theme { background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 6px; margin: -6px 0; color: var(--muted); cursor: pointer; line-height: 0; }
.theme:hover { color: var(--fg); border-color: var(--muted); }
.theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme svg { width: 16px; height: 16px; }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
:root[data-theme="dark"] .theme .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: block; }
  :root:not([data-theme="light"]) .theme .moon { display: none; }
}
body { transition: background-color .3s ease, color .3s ease; }
@media (prefers-reduced-motion: reduce) { body { transition: none; } }

h1 { font-weight: 600; font-size: clamp(36px, 7vw, 56px); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 18px; text-wrap: balance; }
.lede { margin: 0; max-width: 34em; font-size: 19px; color: var(--muted); text-wrap: pretty; }
.meta { font: 400 12px/1.6 var(--mono); color: var(--accent); letter-spacing: .03em; margin: 0 0 14px; text-transform: uppercase; }

/* Blog index */
.label { font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.list li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding-block: 18px; border-bottom: 1px solid var(--rule); }
.list .code { font: 400 12px/1.6 var(--mono); color: var(--accent); letter-spacing: .03em; padding-top: 3px; }
.list h2, .list h3 { margin: 0; font-size: 17px; font-weight: 600; }
.list h2 a, .list h3 a { text-decoration: none; }
.list h2 a:hover, .list h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.list p { margin: 4px 0 0; color: var(--muted); font-size: 16px; text-wrap: pretty; }
@media (max-width: 520px) { .list li { grid-template-columns: 1fr; gap: 4px; } }

/* Article */
article { max-width: 36em; }
article header { margin-bottom: 40px; }
.prose p { margin: 0 0 1.1em; text-wrap: pretty; }
.prose h2 { font: 600 22px/1.25 var(--font); letter-spacing: -0.01em; margin: 2.2em 0 .7em; }
.prose h2 .n { font: 500 13px var(--mono); color: var(--accent); letter-spacing: .06em; margin-right: 10px; vertical-align: 2px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0; }
.prose blockquote { margin: 1.6em 0; padding: 0 0 0 18px; border-left: 2px solid var(--accent); font-size: 19px; line-height: 1.5; font-weight: 500; }
.prose blockquote p { margin: 0; }
/* "For product builders": the practical takeaway closing each section */
.prose .builders {
  margin: 1.8em 0;
  padding: 20px 22px 18px;
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--rule));
  border-left: 3px solid var(--accent);
  border-radius: 4px 10px 10px 4px;
}
.prose .builders .tag {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px;
  font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.prose .builders .tag svg { width: 14px; height: 14px; flex: none; }
.prose .builders .tag .n { margin-left: auto; color: var(--muted); letter-spacing: .06em; }
.prose .builders p:last-child { margin: 0; font-size: 16.5px; line-height: 1.6; }
.prose .define { margin: 1.6em 0; padding: 18px; border: 1px solid var(--rule); border-radius: 6px; }
.prose .define dt { font: 500 14px var(--mono); letter-spacing: .04em; }
.prose .define dt i { color: var(--muted); font-style: normal; }
.prose .define dd { margin: 6px 0 0; color: var(--muted); }
.prose .verse { margin: 1.6em 0; padding: 18px; font: 400 15px/1.8 var(--mono); border-left: 2px solid var(--accent); }
.prose .verse p { margin: 0; }

.end { padding-top: 18px; border-top: 1px solid var(--rule); font: 400 13px/1.6 var(--mono); color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
footer { font: 400 12px/1.5 var(--mono); color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 18px; border-top: 1px solid var(--rule); }

/* Code (archive posts) */
.prose code { font: 400 .86em/1.5 var(--mono); background: color-mix(in srgb, var(--fg) 6%, var(--bg)); padding: .1em .35em; border-radius: 4px; }
.prose pre { margin: 1.4em 0; padding: 16px 18px; overflow-x: auto; background: color-mix(in srgb, var(--fg) 5%, var(--bg)); border: 1px solid var(--rule); border-radius: 8px; }
.prose pre code { display: block; padding: 0; background: none; font-size: 13.5px; line-height: 1.6; white-space: pre; }
.prose ul { padding-left: 1.2em; margin: 0 0 1.1em; }
.prose li { margin: .35em 0; }

/* Archive posts: where the post came from, and what's changed since */
.prose .archive-note { font: 400 13px/1.6 var(--mono); color: var(--muted); padding: 0 0 18px; border-bottom: 1px solid var(--rule); margin-bottom: 1.8em; }
.prose .update { margin-top: 2.6em; padding: 4px 22px 20px; border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--rule)); border-radius: 10px; background: color-mix(in srgb, var(--accent) 4%, var(--bg)); }
.prose .update h2 { margin-top: 1em; }
.prose .update p:last-child { margin-bottom: 0; }

/* Figures and source links (posts brought over from Medium) */
.prose figure { margin: 1.8em 0; }
.prose figure img { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--rule); background: #fff; }
.prose figcaption { margin-top: 8px; font: 400 12.5px/1.5 var(--mono); color: var(--muted); }
.prose .embed { font: 400 13px/1.6 var(--mono); color: var(--muted); padding: 10px 14px; border: 1px dashed var(--rule); border-radius: 8px; }

/* Archive posts: the 2026 update sits at the top, then the original post */
.prose .archive-note + .update { margin-top: 0; }
.prose .original-label { margin: 2.4em 0 1.4em; padding-top: 14px; border-top: 1px solid var(--rule); font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* Tables in posts */
.prose .table { overflow-x: auto; margin: 1.6em 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); }
.prose th { font: 500 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
