/* Type: Schibsted Grotesk (text) and JetBrains Mono (code), both SIL OFL. See fonts/OFL-*.txt */
@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk.woff") format("woff"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk-italic.woff") format("woff"); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono.woff") format("woff"); font-weight: 100 800; font-style: normal; font-display: swap; }

/*
  Quiet page, one signature: the annotated intro. Dotted phrases unfold the
  detail behind them. Single column; indigo appears only where you interact.
*/
:root {
  --bg: #FAFAFB;
  --raised: #FFFFFF;
  --ink: #0F1115;
  --text: #3A3F48;
  --muted: #7A808B;
  --line: #E4E6EA;
  --dot: #A3A9B3;
  --hover: #F0F1F4;
  --accent: #3352F5;
  --code-bg: #F0F1F4;
  --code-kw: #3352F5;
  --code-str: #23794D;
  --code-num: #B2512B;
  --code-comment: #8C929C;
  --shadow: 0 1px 2px rgba(15, 17, 21, 0.04), 0 12px 32px -8px rgba(15, 17, 21, 0.18);

  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --page: 620px;
  --pad: 24px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0C0E;
    --raised: #141619;
    --ink: #F1F2F4;
    --text: #B8BDC6;
    --muted: #7C828D;
    --line: #23262B;
    --dot: #565C65;
    --hover: #17191D;
    --accent: #7D93FF;
    --code-bg: #131518;
    --code-kw: #93A5FF;
    --code-str: #86CFA2;
    --code-num: #EFA57D;
    --code-comment: #6B717C;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 16px 40px -8px rgba(0, 0, 0, 0.7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* touch-action: no double-tap zoom on phones, pinch zoom still works */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }

body {
  margin: 0 auto;
  max-width: calc(var(--page) + 2 * var(--pad));
  padding: 0 var(--pad) 128px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

::selection { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--ink); }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
  transition: text-decoration-color 0.15s ease;
}
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

p { margin: 0; }
.quiet { color: var(--muted); }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--raised);
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1;
}

/* Masthead */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 36px 0 0;
  margin-bottom: 80px;
}
.name { color: var(--ink); font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }

/* Lead: the annotated intro. The name opens it on the homepage. */
.intro-name {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.intro-role { margin: 2px 0 20px; color: var(--muted); font-size: 14px; }
.lead { padding-top: 64px; }
/* One flowing intro: every paragraph the same voice, no section labels */
.lead > p:not(.intro-role) {
  color: var(--ink);
  font-size: 20px;
  font-weight: 450;
  line-height: 1.6;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}
.lead > p:not(.intro-role) + p,
.lead > .term-panel + p { margin-top: 18px; }
.term {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  text-decoration-color: var(--dot);
  transition: color 0.15s, text-decoration-color 0.15s;
}
@media (hover: hover) and (pointer: fine) {
  .term:hover { text-decoration-color: var(--accent); }
}
.term[aria-expanded="true"] { color: var(--accent); text-decoration-color: var(--accent); }

/* Detail card. Motion follows Emil Kowalski's accordion recipe: JS measures the
   content and sets an explicit height; CSS transitions height and opacity together
   with a strong ease-out, so a rapid click retargets from wherever it is. The
   card's padding and border live inside the animated box and never snap. */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); }
.term-panel {
  height: 0;
  overflow: hidden;
  opacity: 0;
  transition: height 200ms var(--ease-out), opacity 200ms var(--ease-out);
}
.term-panel.is-open { opacity: 1; }
.term-panel-inner { padding-top: 20px; }
.term-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
}
@media (prefers-reduced-motion: reduce) {
  .term-panel { transition: opacity 150ms ease; }
}
.term-label { color: var(--muted); font-size: 13.5px; }
.term-text { margin-top: 4px; color: var(--ink); font-size: 16px; line-height: 1.6; }

/* Sections */
.block { margin-top: 64px; }
.year + .year { margin-top: 40px; }
.label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}
.label a { color: inherit; text-decoration: none; }
.label a:hover { color: var(--ink); }
.block > .quiet { margin-top: 4px; }

/* Rows: soft hover plate that bleeds past the text edge */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 24px;
  margin: 0 -12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.12s ease;
}
a.row:hover { background: var(--hover); }
.row-main { display: block; min-width: 0; }
.row-title { display: block; font-weight: 500; letter-spacing: -0.005em; }
.row-desc { display: block; margin-top: 1px; color: var(--muted); font-size: 15px; }
.row-desc a { color: var(--muted); }
.row-desc a:hover { color: var(--ink); }
.row-end { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.draft { margin-left: 8px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 12px; font-weight: 400; vertical-align: 1px; }
.after { margin-top: 8px; font-size: 15px; }

.inline-links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; list-style: none; }

/* Page and article headers */
.page-head { margin-bottom: 40px; }
.title {
  margin: 0;
  color: var(--ink);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.sub { margin-top: 10px; }
.meta { font-size: 14px; }
.draft-note { margin-bottom: 20px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 14px; }
article + .block { margin-top: 88px; }

/* Prose */
.prose { font-size: 17px; line-height: 1.72; }
.prose > * + * { margin-top: 1.2em; }
.prose p { text-wrap: pretty; }
.prose h2, .prose h3, .prose h4 { margin: 2.2em 0 0; color: var(--ink); line-height: 1.35; letter-spacing: -0.012em; text-wrap: balance; }
.prose h2 { font-size: 21px; font-weight: 600; }
.prose h3 { font-size: 18px; font-weight: 600; }
.prose h4 { font-size: 17px; font-weight: 600; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.55em; }
.prose .anchor { margin-left: 8px; color: var(--muted); font-weight: 400; text-decoration: none; opacity: 0; transition: opacity 0.12s; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus-visible { opacity: 1; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--muted); }
.prose blockquote { margin: 1.6em 0; padding: 0 1.2em; color: var(--ink); font-size: 19px; line-height: 1.55; letter-spacing: -0.008em; }
.prose blockquote > * + * { margin-top: 0.8em; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.6em 0; }
.prose img, .prose video, .prose picture { display: block; max-width: 100%; height: auto; border-radius: 10px; }
.prose figure { margin-left: 0; margin-right: 0; }
.prose figcaption { margin-top: 10px; color: var(--muted); font-size: 14px; }

/* Code */
code, samp { font-family: var(--mono); font-size: 0.84em; font-variant-ligatures: none; }
:not(pre) > code { padding: 0.12em 0.36em; background: var(--code-bg); border-radius: 5px; color: var(--ink); }
pre {
  margin-left: -16px;
  margin-right: -16px;
  padding: 16px;
  background: var(--code-bg);
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
  tab-size: 4;
}
pre code { font-size: inherit; background: none; padding: 0; color: inherit; }
pre.z-code { color: var(--ink); background: var(--code-bg); }
.z-comment { color: var(--code-comment); font-style: italic; }
.z-keyword, .z-storage, .z-keyword.z-operator.z-word { color: var(--code-kw); }
.z-keyword.z-operator, .z-punctuation { color: var(--muted); }
.z-string { color: var(--code-str); }
.z-constant.z-numeric, .z-constant.z-language, .z-constant.z-character { color: var(--code-num); }

/* Tables */
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 8px 20px 8px 0; text-align: left; border-bottom: 1px solid var(--line); }
.prose th { color: var(--muted); font-weight: 500; }

/* Footnotes */
.prose sup { line-height: 0; }
.prose .footnote-reference a { padding: 0 1px; color: var(--accent); text-decoration: none; font-weight: 600; }
.prose .footnote-definition, .prose .footnotes { color: var(--muted); font-size: 15px; }
.prose .footnotes { margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.prose .footnotes ol { padding-left: 1.2em; }

@media (max-width: 600px) {
  .masthead { padding-top: 24px; margin-bottom: 56px; }
  .block { margin-top: 52px; }
  .lead > p:not(.intro-role) { font-size: 18px; }
  .lead { padding-top: 40px; }
  .title { font-size: 26px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .row-end { font-size: 13px; }
  pre { margin-left: calc(-1 * var(--pad)); margin-right: calc(-1 * var(--pad)); border-radius: 0; }
}
