/* 5-1.dev — an engineering notebook. Paper and ink, one accent, two typefaces. */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/newsreader-roman.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/newsreader-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/fonts/jetbrains-mono.woff2') format('woff2');
}

:root {
  --paper: #f4f0e6;
  --paper-2: #ebe5d6;
  --ink: #1b1913;
  --ink-2: #48433a;
  --muted: #6b6553;
  --rule: #d8cfbb;
  --rule-strong: #1b1913;
  --accent: #b4380f;
  --code-bg: #ede7d8;
  --selection: #f3c9a6;
  --serif: 'Newsreader', ui-serif, 'Iowan Old Style', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 76rem;
  --gutter: clamp(1.25rem, 4.5vw, 3.25rem);
  --label-col: 13rem;
  --measure: 41rem;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --paper: #11100c;
  --paper-2: #1a1813;
  --ink: #ece5d4;
  --ink-2: #c8c0ac;
  --muted: #9b937f;
  --rule: #2e2b23;
  --rule-strong: #ece5d4;
  --accent: #ff8f4d;
  --code-bg: #18160f;
  --selection: #5b2c12;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #11100c;
    --paper-2: #1a1813;
    --ink: #ece5d4;
    --ink-2: #c8c0ac;
    --muted: #9b937f;
    --rule: #2e2b23;
    --rule-strong: #ece5d4;
    --accent: #ff8f4d;
    --code-bg: #18160f;
    --selection: #5b2c12;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 2rem;
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--serif);
  font-optical-sizing: auto;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 60rem) {
  body {
    font-size: 1.1875rem;
  }
}
::selection {
  background: var(--selection);
  color: var(--ink);
}
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
h1,
h2,
h3,
h4 {
  font-weight: 400;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}
p,
li,
dd {
  text-wrap: pretty;
}
em {
  font-style: italic;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  font: 500 0.8rem var(--mono);
  z-index: 10;
}
.skip:focus {
  top: 0.75rem;
}

.masthead,
main,
.colophon {
  width: min(var(--wrap), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* Small caps-ish technical labels. */
.kicker,
.sec-no,
.status,
.fig-unit,
.job-when,
.work-group h4,
.oss-meta,
.tools dt,
.minor,
.page-meta,
.byline,
.toc-label,
.colophon,
.post-list time,
.pl-meta,
figcaption,
.callout-label,
.more,
.sec-aside {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4.25rem;
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  margin-right: auto;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--ink);
  color: var(--paper);
  font: italic 500 1.25rem/1 var(--serif);
  padding-bottom: 0.15rem;
  transition: background 0.2s;
}
.brand:hover .brand-mark {
  background: var(--accent);
}
.brand-name {
  font-size: 1.05rem;
  letter-spacing: -0.005em;
}
.brand:hover {
  color: var(--ink);
}
.masthead ul {
  display: flex;
  gap: clamp(0.9rem, 2.5vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
  font: 450 0.75rem var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.masthead nav a {
  text-decoration: none;
  color: var(--ink-2);
}
.masthead nav a:hover,
.masthead nav a[aria-current='page'] {
  color: var(--accent);
}
.theme {
  appearance: none;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
}
.theme span {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  transition: transform 0.4s;
}
.theme:hover span {
  transform: rotate(180deg);
}
@media (max-width: 40rem) {
  .brand-name {
    display: none;
  }
  .masthead {
    gap: 1rem;
  }
}

/* ---------- shared bits ---------- */

.kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker::before {
  content: '';
  width: 2.25rem;
  height: 1px;
  background: var(--accent);
  flex: none;
}
.kicker a {
  text-decoration: none;
}

.empty {
  color: var(--ink-2);
  font-style: italic;
  margin: 0;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
  padding-block: clamp(3rem, 10vw, 7.5rem) clamp(2.5rem, 6vw, 4.5rem);
}
@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 21rem;
    gap: clamp(3rem, 6vw, 6rem);
    align-items: end;
  }
}
.name {
  font-size: clamp(3.4rem, 10.5vw, 8.25rem);
  line-height: 0.88;
  letter-spacing: -0.04em;
  font-weight: 360;
  margin: 0 0 clamp(1.75rem, 4vw, 2.75rem) -0.04em;
}
.name em {
  font-weight: 300;
  letter-spacing: -0.03em;
  display: inline-block;
}
.lead {
  font-size: clamp(1.45rem, 2.7vw, 2.15rem);
  line-height: 1.22;
  letter-spacing: -0.012em;
  max-width: 24ch;
  margin: 0 0 1.5rem;
  font-weight: 380;
}
.lead em {
  color: var(--accent);
}
.hero-body {
  max-width: 36rem;
  color: var(--ink-2);
  margin: 0 0 2rem;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin: 0;
}
.pulse {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .pulse {
    animation: pulse 2.4s ease-out infinite;
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 0.6rem transparent;
  }
}

.portrait {
  margin: 0;
  max-width: 21rem;
}
@media (max-width: 59.99rem) {
  .portrait {
    max-width: 17rem;
    order: -1;
  }
}
.portrait-frame {
  position: relative;
  isolation: isolate;
}
.portrait-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  translate: 0.8rem 0.8rem;
  border: 1px solid var(--accent);
  z-index: -1;
  transition: translate 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 38% 50%;
  filter: grayscale(1) contrast(1.06) brightness(1.02);
  transition: filter 0.6s ease;
}
.portrait:hover img {
  filter: grayscale(0) contrast(1) brightness(1);
}
.portrait:hover .portrait-frame::before {
  translate: 0.4rem 0.4rem;
}
.portrait figcaption {
  margin-top: 1.4rem;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
}
.portrait figcaption span {
  color: var(--accent);
  margin-right: 0.4rem;
}

/* ---------- figures ---------- */

.figures {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 0 clamp(2rem, 5vw, 4rem);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 48rem) {
  .figures {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .figures > div + div {
    border-left: 1px solid var(--rule);
  }
}
.figures > div {
  padding: 1.5rem 1.5rem 1.6rem 0;
}
@media (min-width: 48rem) {
  .figures > div + div {
    padding-left: 1.5rem;
  }
}
@media (max-width: 47.99rem) {
  .figures > div + div {
    border-top: 1px solid var(--rule);
  }
}
.figures dt {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.fig-value {
  font-size: clamp(2.25rem, 4.2vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums tabular-nums;
  font-weight: 350;
}
.fig-unit {
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.figures dd {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.98rem;
  line-height: 1.45;
  max-width: 30ch;
}

/* ---------- sections ---------- */

.sec {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  border-top: 1px solid var(--rule);
}
@media (min-width: 60rem) {
  .sec {
    grid-template-columns: var(--label-col) minmax(0, 1fr);
    gap: 3rem;
  }
  .sec-head {
    position: sticky;
    top: 2rem;
    align-self: start;
  }
}
.sec-head {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
@media (max-width: 59.99rem) {
  .sec-head {
    flex-direction: row;
    align-items: baseline;
    gap: 1rem;
  }
  .sec-aside {
    margin-left: auto;
  }
}
.sec-no {
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.06em;
}
.sec-head h2 {
  font-size: 1.75rem;
  letter-spacing: -0.015em;
}
.sec-aside {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.5rem;
}
.sec-body {
  max-width: 52rem;
}
.minor {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  margin: 0 0 1.25rem;
}
.more {
  font-size: 0.8rem;
  margin: 1.5rem 0 0;
}
.more a {
  text-decoration: none;
}

/* work */
.job-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.25rem;
  margin: 0 0 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule-strong);
}
.job-org {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.job-role {
  color: var(--ink-2);
  font-style: italic;
}
.job-when {
  margin-left: auto;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.work-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem 2rem;
  padding-block: 1.1rem;
  border-bottom: 1px dotted var(--rule);
}
.work-group:last-child {
  border-bottom: 0;
}
@media (min-width: 40rem) {
  .work-group {
    grid-template-columns: 8.5rem minmax(0, 1fr);
  }
}
.work-group h4 {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.45rem;
}
.work-group ul,
.oss,
.plain,
.post-list,
.colophon-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.work-group li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.55rem;
  line-height: 1.55;
}
.work-group li:last-child {
  margin-bottom: 0;
}
.work-group li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* post lists */
.post-list li {
  border-bottom: 1px solid var(--rule);
}
.post-list li:first-child {
  border-top: 1px solid var(--rule);
}
.post-list a {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.15rem 1.5rem;
  padding-block: 1.15rem;
  text-decoration: none;
}
.post-list.compact a {
  grid-template-columns: 7.5rem minmax(0, 1fr);
}
.post-list time {
  grid-row: span 3;
  font-size: 0.75rem;
  color: var(--muted);
  padding-top: 0.4rem;
  white-space: nowrap;
}
.pl-title {
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  transition: color 0.15s;
}
.pl-dek {
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.5;
}
.pl-meta {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  margin-top: 0.3rem;
}
.post-list a:hover .pl-title {
  color: var(--accent);
}
@media (max-width: 34rem) {
  .post-list a,
  .post-list.compact a {
    grid-template-columns: minmax(0, 1fr);
  }
  .post-list time {
    grid-row: auto;
    padding: 0;
  }
}

/* open source */
.oss li {
  border-bottom: 1px solid var(--rule);
}
.oss li:first-child {
  border-top: 1px solid var(--rule);
}
.oss a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.3rem 1.5rem;
  padding-block: 1.1rem;
  text-decoration: none;
}
.oss-name {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.oss-name::after {
  content: ' ↗';
  font-size: 0.8em;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s;
}
.oss a:hover .oss-name::after {
  opacity: 1;
  color: var(--accent);
}
.oss-meta {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  align-self: center;
  white-space: nowrap;
}
.oss-text {
  grid-column: 1 / -1;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 44rem;
}
.oss a:hover .oss-name {
  color: var(--accent);
}
@media (max-width: 34rem) {
  .oss a {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* products and lab */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
}
@media (min-width: 48rem) {
  .split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3rem;
  }
}
.plain li {
  padding-block: 0.9rem;
  border-top: 1px solid var(--rule);
}
.plain li > a,
.lab-name {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.lab-name {
  font-style: italic;
}
.plain p {
  margin: 0.25rem 0 0;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.5;
}

/* toolbox */
.tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  border-top: 1px solid var(--rule);
}
@media (min-width: 40rem) {
  .tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2.5rem;
  }
}
.tools > div {
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.tools dt {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.tools dd {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.5;
}
.tools dd span {
  color: var(--muted);
}

/* contact */
.contact-lead {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.35;
  max-width: 34ch;
  margin: 0 0 1.25rem;
  color: var(--ink-2);
}
.contact-mail {
  margin: 0 0 1.25rem;
  font-size: clamp(2.1rem, 6.4vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.035em;
  font-style: italic;
  font-weight: 330;
  overflow-wrap: anywhere;
}
.contact-mail a {
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}
.contact-alt {
  margin: 0;
  color: var(--muted);
}

/* ---------- colophon ---------- */

.colophon {
  margin-top: clamp(3rem, 8vw, 6rem);
  border-top: 1px solid var(--rule-strong);
  padding-block: 1.75rem 3rem;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.7;
}
.colophon-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}
@media (min-width: 60rem) {
  .colophon-grid {
    grid-template-columns: minmax(0, 1.4fr) auto auto;
    gap: 3rem;
    align-items: start;
  }
}
.colophon p {
  margin: 0;
  max-width: 52ch;
}
.colophon-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.colophon-links a {
  text-decoration: none;
  color: var(--ink);
}
.colophon-links a:hover {
  color: var(--accent);
}
.colophon-meta {
  display: flex;
  flex-direction: column;
}

/* ---------- writing: index ---------- */

.page-head {
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2rem, 5vw, 3.5rem);
  max-width: 56rem;
}
.page-head h1,
.nf h1 {
  font-size: clamp(3.2rem, 9.5vw, 7.25rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-weight: 340;
  margin: 0 0 1.75rem -0.04em;
}
.page-head h1 {
  font-style: italic;
}
.dek {
  font-size: clamp(1.2rem, 2.1vw, 1.5rem);
  line-height: 1.38;
  color: var(--ink-2);
  max-width: 38ch;
  margin: 0 0 1.5rem;
}
.page-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}
.year {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding-block: 2rem;
  border-top: 1px solid var(--rule-strong);
}
@media (min-width: 60rem) {
  .year {
    grid-template-columns: var(--label-col) minmax(0, 1fr);
    gap: 3rem;
  }
}
.year h2 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  letter-spacing: -0.04em;
  line-height: 1;
  font-weight: 300;
  color: var(--muted);
  font-variant-numeric: lining-nums;
}
.year .post-list li:first-child {
  border-top: 0;
}
.year .post-list a {
  padding-top: 0.75rem;
}
.archive > .empty {
  border-top: 1px solid var(--rule-strong);
  padding-top: 2rem;
}

.nf {
  padding-block: clamp(4rem, 12vw, 9rem);
}

/* ---------- writing: post ---------- */

.post {
  --toc-col: 13rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.post-head,
.post-grid,
.post-foot,
.draft-flag {
  width: 100%;
}
@media (min-width: 64rem) {
  .post {
    grid-template-columns: var(--toc-col) minmax(0, var(--measure)) minmax(0, 1fr);
    column-gap: 3.5rem;
  }
  .post-head,
  .post-foot,
  .draft-flag {
    grid-column: 2 / 4;
  }
  .post-grid {
    display: contents;
  }
  .toc {
    grid-column: 1;
  }
  .prose {
    grid-column: 2;
  }
}
.draft-flag {
  margin: 1.5rem 0 0;
  padding: 0.6rem 0.9rem;
  border: 1px dashed var(--accent);
  color: var(--accent);
  font: 0.75rem var(--mono);
}
.post-head {
  padding-block: clamp(2.75rem, 8vw, 5.5rem) clamp(2rem, 4vw, 3rem);
  max-width: 50rem;
}
.post-head h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.035em;
  font-weight: 360;
  margin: 0 0 1.5rem -0.03em;
}
.byline {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.byline a {
  color: var(--ink);
  text-decoration: none;
}

.toc {
  font-size: 0.9rem;
  margin-bottom: 2rem;
  padding: 1rem 0;
  border-block: 1px solid var(--rule);
}
@media (min-width: 64rem) {
  .toc {
    position: sticky;
    top: 2rem;
    align-self: start;
    max-height: calc(100vh - 4rem);
    overflow: auto;
    border-bottom: 0;
    padding-top: 0.75rem;
    margin: 0;
  }
}
.toc-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc li {
  margin: 0.15rem 0;
  line-height: 1.35;
}
.toc li.d3 {
  padding-left: 0.9rem;
  font-size: 0.85rem;
}
.toc a {
  display: block;
  padding: 0.2rem 0 0.2rem 0.75rem;
  margin-left: -0.75rem;
  border-left: 1px solid transparent;
  text-decoration: none;
  color: var(--ink-2);
}
.toc a:hover,
.toc a[aria-current='true'] {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* prose */
.prose {
  font-size: 1.15rem;
  line-height: 1.68;
  min-width: 0;
}
@media (min-width: 60rem) {
  .prose {
    font-size: 1.25rem;
  }
}
.prose > * {
  margin-block: 0 1.15em;
}
.prose > :first-child {
  margin-top: 0;
}
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  scroll-margin-top: 1.5rem;
}
.prose h2 {
  font-size: 1.65em;
  letter-spacing: -0.02em;
  margin-top: 2.2em;
  margin-bottom: 0.6em;
}
.prose h3 {
  font-size: 1.25em;
  letter-spacing: -0.01em;
  margin-top: 1.9em;
  margin-bottom: 0.5em;
  font-style: italic;
}
.prose h4 {
  font: 500 0.72em var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2em;
}
.anchor {
  position: absolute;
  left: -1.1em;
  top: 0.05em;
  color: var(--accent);
  text-decoration: none;
  opacity: 0;
  font-style: normal;
  transition: opacity 0.15s;
}
.prose :is(h2, h3, h4):hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}
.prose strong {
  font-weight: 600;
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
}
.prose li {
  margin-bottom: 0.35em;
}
.prose li::marker {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8em;
}
.prose hr {
  border: 0;
  margin-block: 2.5em;
  text-align: center;
}
.prose hr::before {
  content: '⁂';
  color: var(--muted);
  font-size: 1.2em;
}
.prose blockquote {
  margin-inline: 0;
  padding-left: 1.2em;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--ink-2);
}
.prose blockquote > :last-child,
.callout > :last-child {
  margin-bottom: 0;
}
.callout {
  background: var(--paper-2);
  border-left: 2px solid var(--accent);
  padding: 1em 1.2em;
  font-size: 0.92em;
}
.callout > * {
  margin-block: 0 0.75em;
}
.callout-label {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem !important;
}
.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.8em;
  font-variant-ligatures: none;
  font-feature-settings: 'liga' 0, 'calt' 0;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  padding: 0.08em 0.32em;
  border-radius: 2px;
  overflow-wrap: break-word;
}
.prose a code {
  color: inherit;
}
.prose img {
  margin-inline: auto;
}
.figure {
  margin-inline: 0;
}
.figure figcaption,
.code figcaption {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.figure figcaption {
  margin-top: 0.7rem;
}
.figure figcaption::before {
  content: 'Fig. ';
  color: var(--accent);
}

/* code */
.code {
  margin-inline: 0;
  border: 1px solid var(--rule);
  background: var(--code-bg);
  font-size: 1rem;
}
@media (min-width: 72rem) {
  .post .code {
    margin-right: -6rem;
  }
}
.code figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  text-transform: lowercase;
}
.copy {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0.1rem 0;
}
.copy:hover {
  color: var(--accent);
}
.code pre {
  margin: 0;
  padding: 1rem 1.1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
  tab-size: 2;
  font-variant-ligatures: none;
  font-feature-settings: 'liga' 0, 'calt' 0;
}
.code code {
  font: inherit;
}

/* syntax: restrained, ink with one warm and one cool note */
.hljs-comment,
.hljs-quote {
  color: var(--muted);
  font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-meta .hljs-keyword,
.hljs-doctag,
.hljs-section {
  color: var(--accent);
}
.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attribute,
.hljs-meta .hljs-string {
  color: #4f6b2c;
}
.hljs-number,
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-variable.language_ {
  color: #2f5d7c;
}
.hljs-title,
.hljs-title.function_,
.hljs-title.class_ {
  font-weight: 600;
}
.hljs-built_in,
.hljs-type,
.hljs-attr,
.hljs-name,
.hljs-tag,
.hljs-selector-class,
.hljs-selector-id {
  color: var(--ink-2);
}
.hljs-deletion {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.hljs-addition {
  background: color-mix(in srgb, #4f6b2c 10%, transparent);
}
.hljs-meta {
  color: var(--muted);
}
:root[data-theme='dark'] .hljs-string,
:root[data-theme='dark'] .hljs-regexp,
:root[data-theme='dark'] .hljs-addition,
:root[data-theme='dark'] .hljs-attribute {
  color: #b5c98a;
}
:root[data-theme='dark'] .hljs-number,
:root[data-theme='dark'] .hljs-literal,
:root[data-theme='dark'] .hljs-symbol,
:root[data-theme='dark'] .hljs-bullet {
  color: #8fb8d6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) :is(.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute) {
    color: #b5c98a;
  }
  :root:not([data-theme='light']) :is(.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet) {
    color: #8fb8d6;
  }
}

/* tables */
.table {
  overflow-x: auto;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  font-variant-numeric: lining-nums tabular-nums;
}
.prose th {
  font: 500 0.7rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--rule-strong);
  padding: 0.5rem 0.75rem 0.5rem 0;
}
.prose td {
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0.75rem 0.55rem 0;
  vertical-align: top;
}
.prose .align-right {
  text-align: right;
}
.prose .align-center {
  text-align: center;
}

/* post footer */
.post-foot {
  margin-top: clamp(3rem, 7vw, 5rem);
  max-width: var(--measure);
}
.author-card {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  padding-block: 1.5rem;
  border-block: 1px solid var(--rule-strong);
}
.author-card img {
  width: 4rem;
  height: 4rem;
  object-fit: cover;
  object-position: 38% 45%;
  filter: grayscale(1);
  border-radius: 50%;
}
.author-card p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-2);
}
.author-card strong {
  color: var(--ink);
  font-weight: 500;
}
.prevnext {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  padding-block: 1.5rem;
}
.prevnext a {
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1.3;
}
.prevnext span {
  display: block;
  font: 0.7rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.pn-next {
  text-align: right;
  grid-column: 2;
}

/* ---------- print: the home page doubles as a one-page CV ---------- */

@media print {
  :root {
    --paper: #fff;
    --paper-2: #f3f3f3;
    --ink: #000;
    --ink-2: #222;
    --muted: #555;
    --rule: #ccc;
    --rule-strong: #000;
    --accent: #000;
  }
  body {
    font-size: 10.5pt;
  }
  .masthead nav,
  .theme,
  .skip,
  .toc,
  .copy,
  .pulse,
  .portrait figcaption,
  .prevnext,
  .colophon-links,
  #writing {
    display: none !important;
  }
  .hero {
    padding-block: 1rem;
  }
  .name {
    font-size: 36pt;
  }
  .portrait {
    max-width: 9rem;
  }
  .portrait-frame::before {
    display: none;
  }
  .sec {
    padding-block: 1rem;
    break-inside: avoid-page;
  }
  .sec-head {
    position: static;
  }
  a {
    text-decoration: none;
  }
  .oss a::after,
  .prose a[href^='http']::after {
    content: ' (' attr(href) ')';
    font: 7.5pt var(--mono);
    color: var(--muted);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

.figures + .sec {
  border-top: 0;
  padding-top: clamp(1rem, 3vw, 2rem);
}

/* Code must show the characters typed: no programming ligatures (|= would render as ⊨). */
code,
kbd,
samp,
pre {
  font-variant-ligatures: none;
  font-feature-settings: 'liga' 0, 'calt' 0;
}

@media (max-width: 40rem) {
  .masthead ul {
    gap: 0.9rem;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
  }
  .masthead li {
    white-space: nowrap;
  }
  .masthead li:nth-child(3) {
    display: none;
  }
  .portrait {
    max-width: 12.5rem;
  }
  .hero {
    gap: 2.25rem;
  }
}
