/* ==========================================================================
   styles.css — hand-written, no framework.
   Light and dark are chosen separately rather than inverted: the dark palette
   is warmer and lower-contrast than a flipped light palette would be.
   Accent is the teal off the jacket in the photo.
   ========================================================================== */

:root {
  --page:        #fbfbf9;
  --surface:     #ffffff;
  --surface-2:   #f4f4f0;
  --ink:         #14171a;
  --ink-2:       #454d54;
  --muted:       #767f86;
  --rule:        #e6e5df;
  --rule-strong: #d3d2ca;
  --accent:      #0e7c70;
  --accent-ink:  #0a6459;
  --accent-soft: #e2f1ee;
  --shadow:      0 1px 2px rgba(20,23,26,.05), 0 6px 18px -10px rgba(20,23,26,.18);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --maxw: 46rem;
  --wide: 64rem;
  --r: 12px;
}

:root[data-theme="dark"] {
  --page:        #101318;
  --surface:     #171b22;
  --surface-2:   #1e232c;
  --ink:         #e9ecf1;
  --ink-2:       #aab3bf;
  --muted:       #7b8592;
  --rule:        #262c36;
  --rule-strong: #39414e;
  --accent:      #4fd1c5;
  --accent-ink:  #5fded1;
  --accent-soft: #16302e;
  --shadow:      0 1px 2px rgba(0,0,0,.35), 0 8px 22px -12px rgba(0,0,0,.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page:        #101318;
    --surface:     #171b22;
    --surface-2:   #1e232c;
    --ink:         #e9ecf1;
    --ink-2:       #aab3bf;
    --muted:       #7b8592;
    --rule:        #262c36;
    --rule-strong: #39414e;
    --accent:      #4fd1c5;
    --accent-ink:  #5fded1;
    --accent-soft: #16302e;
    --shadow:      0 1px 2px rgba(0,0,0,.35), 0 8px 22px -12px rgba(0,0,0,.6);
  }
}

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

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-decoration-color: color-mix(in oklab, var(--accent) 40%, transparent);
    text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); padding: .7rem 1rem; border-radius: 0 0 var(--r) 0;
}
.skip:focus { left: 0; }

h1, h2, h3, h4 { line-height: 1.22; letter-spacing: -.018em; margin: 0; }
p { margin: 0 0 1.1rem; }

.eyebrow {
  font-size: .74rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .55rem;
}
.lede { font-size: 1.12rem; color: var(--ink-2); line-height: 1.6; }
.dot { color: var(--rule-strong); margin: 0 .45rem; }

/* ---------- header -------------------------------------------------------- */

header.site {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.2rem;
  padding: .7rem 1.4rem;
  background: color-mix(in oklab, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-family: var(--mono); font-size: .95rem; font-weight: 600;
  color: var(--ink); text-decoration: none; letter-spacing: -.02em;
}
.wordmark::before { content: "~/"; color: var(--muted); }
.mainnav { display: flex; gap: .3rem; margin-right: auto; }
.mainnav a {
  color: var(--ink-2); text-decoration: none; font-size: .92rem; font-weight: 500;
  padding: .35rem .65rem; border-radius: 8px;
}
.mainnav a:hover { background: var(--surface-2); color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

.hdr-right { display: flex; align-items: center; gap: .15rem; }
.socials { display: flex; gap: .1rem; }
.socials a, .themebtn {
  display: grid; place-items: center; width: 2rem; height: 2rem;
  color: var(--muted); border-radius: 8px; background: none; border: 0; padding: 0; cursor: pointer;
}
.socials a:hover, .themebtn:hover { background: var(--surface-2); color: var(--ink); }
.socials svg, .themebtn svg { width: 1.05rem; height: 1.05rem; }

/* ---------- layout -------------------------------------------------------- */

main { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 3rem 1.4rem 4rem; min-width: 0; }
main.home, main.listing { max-width: var(--wide); }

.band { margin: 3.6rem 0 0; }
.sec {
  font-family: var(--serif); font-size: 1.4rem; font-weight: 600; margin: 0 0 1.1rem;
}
.sec-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.sec-row .sec { margin: 0; }
.more { font-size: .88rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.more:hover { text-decoration: underline; }

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

.hero { display: flex; gap: 2.2rem; align-items: flex-start; }
/* A cut-out illustration, so no frame of any kind: no circle, no border, no
   card behind it. It sits directly on the page and keeps its own proportions. */
.hero-side { flex: none; width: 210px; display: flex; flex-direction: column; gap: 1rem; }

/* identity block under the photo: where I am, and where to find me */
.idlinks { list-style: none; margin: 0; padding: 0; }
.idlinks li {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .2rem 0; font-size: .82rem; line-height: 1.45; color: var(--ink-2);
}
.idlinks svg { width: .95rem; height: .95rem; flex: none; margin-top: .2rem; color: var(--muted); }
.idlinks a { color: var(--ink-2); text-decoration: none; }
.idlinks a:hover { color: var(--accent-ink); text-decoration: underline; }
.idlinks li:hover svg { color: var(--accent); }

.avatar {
  width: 100%; height: auto;
  /* the artwork is cropped mid-jacket, so without this it ends in a hard
     horizontal line. Fading the last sliver lets it dissolve into the page
     in either theme. Delete these two lines to get the straight edge back. */
  -webkit-mask-image: linear-gradient(to bottom, #000 84%, transparent 99%);
  mask-image: linear-gradient(to bottom, #000 84%, transparent 99%);
}
.hero-text { min-width: 0; }
.hero h1 { font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.5rem); margin-bottom: .7rem; }
.hero .intro p { color: var(--ink-2); }
/* the three emphasised phrases in the hero are underlined as well as bold.
   Scoped to .hero so <strong> stays plain everywhere else. */
.hero strong {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklab, var(--accent) 60%, transparent);
}
.hero .intro p:last-child { margin-bottom: 0; }
.hero-cta { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.4rem; }
.btn {
  display: inline-block; padding: .55rem 1.1rem; border-radius: 999px;
  background: var(--accent); color: #fff; text-decoration: none;
  font-size: .92rem; font-weight: 600; border: 1px solid transparent;
}
:root[data-theme="dark"] .btn:not(.ghost) { color: #06241f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost) { color: #06241f; } }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }

/* ---------- cards --------------------------------------------------------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: .9rem; }
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1.1rem 1.2rem 1rem; display: flex; flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--rule-strong); }
.card-link { text-decoration: none; color: inherit; }
.card h3 { font-family: var(--serif); font-size: 1.12rem; margin-bottom: .4rem; }
.card-link:hover h3 { color: var(--accent-ink); }
.card-sum { color: var(--ink-2); font-size: .92rem; margin-bottom: .8rem; }
.card-meta {
  margin-top: auto; display: flex; align-items: center; flex-wrap: wrap; gap: .4rem;
  font-family: var(--mono); font-size: .74rem; color: var(--muted);
}
.card-meta a { text-decoration: none; font-weight: 600; }
.card-meta a:hover { text-decoration: underline; }
.card.proj .chips { margin-bottom: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip {
  font-family: var(--mono); font-size: .7rem; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 5px; padding: .1rem .4rem;
}

.tag {
  font-family: var(--mono); font-size: .72rem; text-decoration: none;
  color: var(--accent-ink); background: var(--accent-soft);
  border-radius: 5px; padding: .12rem .45rem;
}
.tag:hover { filter: brightness(.97); text-decoration: none; }
.tag span { color: var(--muted); }
.tagrow { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; }

/* ---------- empty state -------------------------------------------------- */

.emptystate {
  border: 1px dashed var(--rule-strong); border-radius: var(--r);
  padding: 1.4rem 1.5rem; background: var(--surface-2);
  color: var(--ink-2); font-size: .95rem; max-width: 40rem;
}
.emptystate p { margin: 0; }

/* ---------- natural units converter -------------------------------------- */

.nuc { font-size: .95rem; }
.nuc .small { font-size: .82rem; }
.nuc .mono { font-family: var(--mono); font-size: .85em; }
.nuc-sysrow { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .7rem; }
.nuc-systems { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 10px; overflow: hidden; }
.nuc-systems button {
  border: 0; background: var(--surface); color: var(--ink-2); cursor: pointer;
  padding: .45rem .95rem; font-size: .88rem; font-weight: 600;
}
.nuc-systems button + button { border-left: 1px solid var(--rule); }
.nuc-systems button[aria-pressed="true"] { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .nuc-systems button[aria-pressed="true"] { color: #06241f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nuc-systems button[aria-pressed="true"] { color: #06241f; }
}

.nuc-input {
  width: 100%; border: 1px solid var(--rule-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-family: var(--mono); font-size: 1.05rem; padding: .85rem 1rem;
}
.nuc-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.nuc-input.small { font-size: .9rem; padding: .55rem .8rem; margin-top: .6rem; }
.nuc-input::placeholder { color: var(--muted); }

.nuc-reads {
  display: flex; align-items: center; gap: .7rem; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--rule); border-top: 0;
  border-radius: 0 0 var(--r) var(--r); padding: .5rem 1rem; min-height: 2.4rem;
}
.nuc-reads-label { flex: none; font-size: .66rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); }

.nuc-resultbox {
  margin-top: 1rem; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 1.1rem 1.2rem; min-height: 5rem; box-shadow: var(--shadow);
}
.nuc-value-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.nuc-value { font-size: 1.65rem; color: var(--ink); overflow-x: auto; }
.nuc-info { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin-top: .7rem; padding-top: .55rem;
  border-top: 1px solid var(--rule); font-size: .8rem; color: var(--muted); }
.nuc-conv { color: var(--accent-ink); font-weight: 600; }
.nuc-err { color: var(--critical, #d03b3b); font-family: var(--mono); font-size: .9rem; margin: 0; }

.nuc-copyrow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--rule); font-size: .8rem; color: var(--ink-2); }
.nuc-copyrow label { display: flex; align-items: center; gap: .4rem; font-weight: 600; }
.nuc-copyrow input[type=number] { width: 3.4rem; text-align: center; font-family: var(--mono);
  border: 1px solid var(--rule-strong); border-radius: 7px; background: var(--surface);
  color: var(--ink); padding: .2rem; }
.nuc-copyrow input[type=checkbox] { accent-color: var(--accent); }
.nuc-copyrow code { flex: 1 1 10rem; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: 7px; padding: .3rem .55rem; font-family: var(--mono); }

.nuc-btn {
  border: 1px solid var(--rule-strong); border-radius: 7px; background: none;
  color: var(--ink-2); font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: .25rem .6rem; cursor: pointer; flex: none;
}
.nuc-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.nuc-btn.solid { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .nuc-btn.solid { color: #06241f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nuc-btn.solid { color: #06241f; }
}

.nuc-head { font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .5rem; }
.nuc-usedbox { margin-top: 1rem; background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: var(--r); padding: .9rem 1.2rem; }
.nuc-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .2rem 1rem; padding: .4rem 0; border-bottom: 1px solid var(--rule); font-size: .88rem; }
.nuc-row:last-child { border-bottom: 0; }
.nuc-sym { font-family: var(--mono); font-weight: 700; color: var(--accent-ink);
  background: none; border: 0; padding: 0; }
.nuc-cite { font-size: .72rem; white-space: nowrap; text-decoration-style: dotted; }

.nuc-fold { margin-top: 1rem; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surface); padding: 0 1.2rem; }
.nuc-fold > summary { cursor: pointer; padding: .8rem 0; font-size: .8rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.nuc-fold > :last-child { margin-bottom: 1rem; }
.nuc-histlist { list-style: none; margin: .4rem 0 0; padding: 0; }
.nuc-hist { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; width: 100%;
  text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule);
  padding: .45rem 0; cursor: pointer; color: var(--ink); }
.nuc-hist:hover { background: var(--surface-2); }
.nuc-hist .ok { color: var(--good-text, #0a7a3d); }
.nuc-hist .bad { color: var(--critical, #d03b3b); }
.nuc-tag { font-family: var(--mono); font-size: .62rem; font-weight: 700; color: var(--muted);
  border: 1px solid var(--rule-strong); border-radius: 5px; padding: .05rem .35rem; }

.nuc-lookup { margin-top: 1.6rem; }
.nuc-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .7rem; }
.nuc-chip { border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--surface);
  color: var(--ink-2); font-size: .8rem; padding: .25rem .75rem; cursor: pointer; }
.nuc-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .nuc-chip[aria-pressed="true"] { color: #06241f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nuc-chip[aria-pressed="true"] { color: #06241f; }
}
.nuc-ent { margin-top: .7rem; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surface); padding: .9rem 1.2rem; }
.nuc-ent-head { font-size: 1.02rem; }
.nuc-plabel { flex: 0 0 8rem; }
.nuc-pval { flex: 1; min-width: 8rem; }

.nuc-refcols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; margin-top: 1rem; }
@media (max-width: 720px) { .nuc-refcols { grid-template-columns: 1fr; } }

/* ---------- arxiv watcher ------------------------------------------------ */

.axw-customrow { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .7rem; }
.axw-customrow[hidden] { display: none; }   /* display:flex beats the UA's [hidden] rule */
.axw-customrow label { display: flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--ink-2); }
.axw-customrow .nuc-input { width: 9rem; margin-top: 0; }
.axw-addrow { display: flex; gap: .5rem; align-items: center; }
.axw-addrow .nuc-input { margin-top: 0; flex: 1; }
.axw-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.axw-tag {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 999px; padding: .22rem .4rem .22rem .75rem;
  font-size: .84rem; font-weight: 500;
}
.axw-x {
  border: 0; background: none; cursor: pointer; color: var(--accent-ink);
  font-size: 1rem; line-height: 1; padding: 0 .3rem; border-radius: 50%;
}
.axw-x:hover { background: color-mix(in oklab, var(--accent) 25%, transparent); }
.axw-go { margin-top: 1.4rem; border: 0; cursor: pointer; font-family: var(--sans); }
#axw-status { margin-top: .8rem; }
.axw-paper { padding: .85rem 0; border-bottom: 1px solid var(--rule); }
.axw-paper:last-child { border-bottom: 0; }
.axw-title { margin: 0 0 .2rem; font-size: .98rem; font-weight: 600; line-height: 1.45; }
.axw-title a { color: var(--ink); text-decoration: none; }
.axw-title a:hover { color: var(--accent-ink); text-decoration: underline; }
.axw-meta { margin: 0; font-size: .8rem; color: var(--muted); }
.axw-cat { font-family: var(--mono); font-size: .72rem; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 5px; padding: .05rem .4rem; margin-left: .3rem; }
.axw-when { font-family: var(--mono); font-size: .72rem; margin-left: .3rem; }
.axw-abs { margin-top: .35rem; }
.axw-abs summary { cursor: pointer; font-size: .78rem; color: var(--muted); }
.axw-abs p { font-size: .86rem; color: var(--ink-2); margin: .4rem 0 0; }

/* ---------- boxed section bands (physics page) --------------------------- */

.boxtitle {
  font-family: var(--serif); font-size: 1.45rem; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: var(--r); padding: .75rem 1.2rem; margin: 3rem 0 1.4rem;
  box-shadow: var(--shadow);
}

/* ---------- listing / page heads ------------------------------------------ */

.pagehead { margin-bottom: 2.4rem; }
.pagehead h1 { font-family: var(--serif); font-size: clamp(1.8rem, 4.5vw, 2.3rem); margin-bottom: .6rem; }
.year {
  font-family: var(--mono); font-size: .8rem; color: var(--muted); font-weight: 500;
  margin: 2.2rem 0 .9rem; padding-bottom: .4rem; border-bottom: 1px solid var(--rule);
}

/* ---------- article ------------------------------------------------------- */

.posthead { margin-bottom: 2rem; padding-bottom: 1.6rem; border-bottom: 1px solid var(--rule); }
.posthead h1 { font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.45rem); margin-bottom: .7rem; }

.toc {
  background: var(--surface-2); border-radius: var(--r); padding: 1rem 1.2rem;
  margin-bottom: 2rem; border: 1px solid var(--rule);
}
.toc-h { font-size: .74rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .5rem; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { padding: .12rem 0; font-size: .9rem; }
.toc li.lvl3 { padding-left: 1rem; }
.toc a { text-decoration: none; color: var(--ink-2); }
.toc a:hover { color: var(--accent-ink); text-decoration: underline; }

.prose { font-size: 1.05rem; }
.prose h2 {
  font-family: var(--serif); font-size: 1.55rem; margin: 2.6rem 0 .9rem; scroll-margin-top: 5rem;
}
.prose h3 { font-size: 1.15rem; margin: 2rem 0 .7rem; scroll-margin-top: 5rem; }
.prose > p:first-child { font-size: 1.1rem; color: var(--ink-2); }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.2rem; }
.prose li { margin-bottom: .45rem; }
.prose li > ul, .prose li > ol { margin: .45rem 0 0; }
.prose img { border-radius: var(--r); margin: 1.6rem 0; border: 1px solid var(--rule); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.6rem 0; }

.anchor {
  color: var(--rule-strong); text-decoration: none; margin-left: .45rem;
  opacity: 0; font-weight: 400;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }

.prose blockquote {
  margin: 1.6rem 0; padding: .2rem 0 .2rem 1.2rem;
  border-left: 3px solid var(--accent); color: var(--ink-2);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--mono); font-size: .875em;
  background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: 5px; padding: .08em .32em;
}

.codeblock { position: relative; margin: 1.6rem 0; }
.codeblock pre {
  margin: 0; overflow-x: auto; background: var(--surface-2);
  border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem 1.1rem;
  line-height: 1.6;
}
.codeblock code {
  font-family: var(--mono); font-size: .855rem; background: none; border: 0; padding: 0;
  color: var(--ink);
}
.codelang {
  position: absolute; top: .5rem; right: .7rem; z-index: 1;
  font-family: var(--mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.tok-kw  { color: #9333ea; font-weight: 500; }
.tok-str { color: #0f766e; }
.tok-com { color: var(--muted); font-style: italic; }
.tok-num { color: #b45309; }
:root[data-theme="dark"] .tok-kw  { color: #c99bf5; }
:root[data-theme="dark"] .tok-str { color: #6fd7c4; }
:root[data-theme="dark"] .tok-num { color: #e0a860; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tok-kw  { color: #c99bf5; }
  :root:not([data-theme="light"]) .tok-str { color: #6fd7c4; }
  :root:not([data-theme="light"]) .tok-num { color: #e0a860; }
}

.tablewrap { overflow-x: auto; margin: 1.6rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.postnav {
  display: grid; grid-template-columns: 1fr 1fr; gap: .9rem;
  margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--rule);
}
.pn {
  text-decoration: none; color: var(--ink); font-weight: 500; font-size: .95rem;
  border: 1px solid var(--rule); border-radius: var(--r); padding: .8rem 1rem; background: var(--surface);
}
.pn:hover { border-color: var(--rule-strong); }
.pn span { display: block; font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-bottom: .25rem; }
.pn.next { text-align: right; }

/* ---------- footer -------------------------------------------------------- */

footer.site {
  border-top: 1px solid var(--rule); margin-top: 4rem;
  padding: 2rem 1.4rem 3rem;
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  max-width: var(--wide); margin-inline: auto; flex-wrap: wrap;
}
.foot-name { font-weight: 600; margin: 0 0 .2rem; font-size: .95rem; }
.foot-note { color: var(--muted); font-size: .85rem; margin: 0; }
.foot-links { display: flex; gap: .1rem; }

/* ---------- narrow -------------------------------------------------------- */

@media (max-width: 720px) {
  body { font-size: 16px; }
  header.site { gap: .7rem; padding: .6rem .9rem; flex-wrap: wrap; }
  .mainnav { order: 3; width: 100%; margin: 0; }
  .mainnav a { padding: .3rem .5rem; font-size: .88rem; }
  .hdr-right { margin-left: auto; }
  main { padding: 2rem 1.1rem 3rem; }
  .hero { flex-direction: column; gap: 1.3rem; }
  .hero-side { width: 100%; }
  .avatar { width: 150px; }
  .postnav { grid-template-columns: 1fr; }
  .pn.next { text-align: left; }
  .cards { grid-template-columns: 1fr; }
}

@media print {
  header.site, footer.site, .toc, .postnav, .hero-cta { display: none; }
  body { background: #fff; color: #000; }
  main { max-width: none; }
}
