/* rinoc.org — one hand-written stylesheet, no build step.
 *
 *  1. Fonts
 *  2. Palette (light / dark) and syntax colours
 *  3. Base
 *  4. Site header and footer
 *  5. Post list (home, section and tag pages)
 *  6. Post page (header, table of contents, neighbours)
 *  7. Prose (everything rendered from markdown)
 *  8. Code blocks and syntax highlighting
 *  9. Small screens
 */

/* ---------- 1. Fonts ---------- */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: italic;
  font-weight: 100 700;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin-wght-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Mononoki";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/mononoki-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Mononoki";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/mononoki-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Mononoki";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/mononoki-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Mononoki";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/mononoki-latin-700-italic.woff2") format("woff2");
}

/* ---------- 2. Palette ---------- */

:root {
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Mononoki", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --paper: #f6f4ea;    /* page background */
  --ink: #33322c;      /* body text */
  --muted: #6d6a5e;    /* secondary text */
  --faint: #d8d3c2;    /* borders, rules */
  --surface: #fdfbf3;  /* raised panels, hover */
  --accent: #306d99;
  --selection: rgba(48, 109, 153, 0.18);

  --ok: #4f7333;
  --warn: #96601a;
  --bad: #a8372f;
  --important: #7a4f86;

  /* syntax tokens */
  --tk-fg: #2c2a30;
  --tk-comment: #8d8892;
  --tk-comment-doc: #a09ba6;
  --tk-string: #35704f;
  --tk-escape: #8a5a2c;
  --tk-number: #9c4a86;
  --tk-constant: #a63d61;
  --tk-constant-builtin: #8a5a2c;
  --tk-keyword: #6a4f9c;
  --tk-operator: #8a5a2c;
  --tk-function: #3a5486;
  --tk-macro: #a63d61;
  --tk-type: #8a5a2c;
  --tk-module: #2f6d74;
  --tk-property: #4a4550;
  --tk-attribute: #a63d61;

  --column: 46rem;     /* reading column */
  --wide: 72rem;       /* header and footer */
  --header-height: 4rem;

  color-scheme: light;
}

.dark {
  --paper: #151515;
  --ink: #e8e8d3;
  --muted: #8f8f8f;
  --faint: #2e2e2e;
  --surface: #1c1c1c;
  --accent: #97bedc;
  --selection: rgba(151, 190, 220, 0.24);

  --ok: #94b979;
  --warn: #ffba7b;
  --bad: #e27373;
  --important: #b294bb;

  --tk-fg: #c9c7cd;
  --tk-comment: #8b8693;
  --tk-comment-doc: #6c6874;
  --tk-string: #90b99f;
  --tk-escape: #e6b99d;
  --tk-number: #e29eca;
  --tk-constant: #ea83a5;
  --tk-constant-builtin: #e6b99d;
  --tk-keyword: #aca1cf;
  --tk-operator: #e6b99d;
  --tk-function: #92a2d5;
  --tk-macro: #ea83a5;
  --tk-type: #e6b99d;
  --tk-module: #85b5ba;
  --tk-property: #b4b1ba;
  --tk-attribute: #ea83a5;

  color-scheme: dark;
}

/* ---------- 3. Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.5;
  tab-size: 4;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 450;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--selection);
}

/* Anchored headings must clear the sticky header. */
[id] {
  scroll-margin-top: 5rem;
}

h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img, svg {
  max-width: 100%;
}

.icon {
  display: block;
  flex: none;
  width: 1em;
  height: 1em;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--faint);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
a.tag {
  transition: border-color 0.15s, color 0.15s;
}
a.tag:hover {
  border-color: var(--muted);
  color: var(--ink);
}
/* Marks unpublished posts; only ever rendered when building with drafts. */
.tag.draft-badge {
  border-color: color-mix(in oklab, var(--warn) 50%, transparent);
  background: color-mix(in oklab, var(--warn) 12%, transparent);
  color: var(--warn);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- 4. Site header and footer ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-height);
  border-bottom: 1px solid color-mix(in oklab, var(--faint) 70%, transparent);
  background: color-mix(in oklab, var(--paper) 85%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--wide);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  font-size: 0.875rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
}
.site-logo-tile {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 600;
  transition: background-color 0.15s;
}
.site-logo:hover .site-logo-tile {
  background: var(--accent);
}
.site-logo-name {
  font-weight: 500;
  letter-spacing: -0.025em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.site-nav a,
.theme-toggle {
  border-radius: 0.375rem;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.site-nav a {
  padding: 0.375rem 0.625rem;
  line-height: 1.25rem;
}
.site-nav a:hover,
.theme-toggle:hover {
  background: var(--surface);
  color: var(--ink);
}
.site-nav a[aria-current="page"] {
  color: var(--ink);
}
.site-nav .icon {
  width: 1rem;
  height: 1.25rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
}
.theme-toggle .icon {
  width: 1rem;
  height: 1rem;
}
/* Light mode offers the moon, dark mode offers the sun. */
.theme-toggle .icon-sun,
.dark .theme-toggle .icon-moon {
  display: none;
}
.dark .theme-toggle .icon-sun {
  display: block;
}

.site-main {
  flex: 1;
  width: 100%;
  padding: 2rem 0 4rem;
}

.column {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  color: var(--muted);
  font-size: 0.75rem;
}
.site-footer nav {
  display: flex;
  gap: 1rem;
}
.site-footer a {
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 2px;
}
.site-footer a:hover {
  color: var(--ink);
}

/* ---------- 5. Post list ---------- */

.list-header {
  margin-bottom: 2.5rem;
}
.list-title {
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.list-header .prose {
  margin-top: 1rem;
  color: var(--muted);
}
.list-header .prose > :last-child {
  margin-bottom: 0;
}
.list-empty {
  color: var(--muted);
}

/* River: the start of each post, one after another */
.river-item {
  padding-bottom: 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--faint);
}
.river-item:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}
.river-header {
  margin-bottom: 1.75rem;
}
.river-title {
  font-size: 1.875rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  overflow-wrap: break-word;
}
.river-title a {
  transition: color 0.15s;
}
.river-title a:hover {
  color: var(--accent);
}
.river-header .post-meta {
  margin-top: 0.875rem;
}
.river-item .prose > :last-child {
  margin-bottom: 0;
}
.read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 1.5rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}
.read-more:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.section-link {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s;
}
.section-link:hover {
  color: var(--accent);
}

/* Newer / older pages */
.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--faint);
  color: var(--muted);
  font-size: 0.8rem;
}
.pager-count {
  grid-column: 2;
  font-variant-numeric: tabular-nums;
}
.pager-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  justify-self: start;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--faint);
  border-radius: 0.5rem;
  color: var(--ink);
  transition: border-color 0.15s, background-color 0.15s;
}
.pager-link:hover {
  border-color: var(--muted);
  background: var(--surface);
}
.pager-older {
  grid-column: 3;
  justify-self: end;
}

/* Tag overview (/tags/) */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}
.tag-cloud .tag {
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
}
.tag-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

/* ---------- 6. Post page ---------- */

.post-layout {
  width: 100%;
  padding: 0 1.5rem;
}
.post {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
}
.post-toc-rail {
  display: none;
}

/* Wide screens: article centred, table of contents in the right margin. */
@media (min-width: 80rem) {
  .post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--column)) minmax(0, 1fr);
    column-gap: 2rem;
  }
  .post {
    grid-column: 2;
  }
  .post-toc-rail {
    display: block;
    grid-column: 3;
    min-width: 0;
    padding-left: 2.5rem;
  }
  .post-toc-rail > div {
    position: sticky;
    top: 6rem;
    max-width: 15rem;
  }
  .toc-mobile {
    display: none;
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1rem;
  transition: color 0.15s;
}
.back-link:hover {
  color: var(--ink);
}
.back-link .icon {
  font-size: 0.875rem;
}

.post-header {
  margin: 1.25rem 0 2.5rem;
}
.post-title {
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  overflow-wrap: break-word;
}
.post-summary {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.625;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1rem;
}
.post-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.post-meta .icon {
  font-size: 0.875rem;
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0;
  list-style: none;
}

/* Table of contents */
.toc {
  max-height: calc(100dvh - 8rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  font-size: 0.8rem;
}
.toc::-webkit-scrollbar {
  display: none;
}
.toc ul,
.toc-mobile ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.toc-label,
.toc-mobile > summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.toc-label .icon,
.toc-mobile > summary .icon {
  font-size: 0.875rem;
}
.toc-track {
  position: relative;
  border-left: 1px solid var(--faint);
}
/* The accent bar that follows the active section (positioned by site.js). */
.toc-thumb {
  position: absolute;
  left: -1px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  transition: top 0.2s, height 0.2s, opacity 0.2s;
}
.toc-link {
  display: block;
  padding: 0.3rem 0.5rem 0.3rem 0.75rem;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
  transition: color 0.15s;
}
.toc-link.toc-h3 {
  padding-left: 1.5rem;
}
.toc-link:hover {
  color: var(--ink);
}
.toc-link.active {
  color: var(--ink);
  -webkit-text-stroke: 0.3px currentColor;
}

.toc-mobile {
  margin-bottom: 2.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--faint);
  border-radius: 0.5rem;
  background: var(--surface);
  font-size: 0.85rem;
}
.toc-mobile > summary {
  margin: 0;
  cursor: pointer;
  list-style: none;
}
.toc-mobile > summary::-webkit-details-marker {
  display: none;
}
.toc-mobile[open] > summary {
  margin-bottom: 0.5rem;
}
.toc-mobile .toc-link {
  padding-left: 0;
}
.toc-mobile .toc-link.toc-h3 {
  padding-left: 0.75rem;
}

/* Older / newer cards */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--faint);
  font-size: 0.875rem;
}
.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--faint);
  border-radius: 0.5rem;
  transition: border-color 0.15s, background-color 0.15s;
}
.post-nav-link:hover {
  border-color: var(--muted);
  background: var(--surface);
}
.post-nav-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
}
.post-nav-title {
  color: var(--ink);
  font-size: 1rem;
}
.post-nav-newer {
  grid-column: 2;
  align-items: flex-end;
  text-align: right;
}

/* 404 */
.not-found {
  padding: 4rem 0;
  text-align: center;
}
.not-found-code {
  color: var(--faint);
  font-size: 6rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}
.not-found p {
  margin: 1rem 0 1.5rem;
  color: var(--muted);
}
.not-found a {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.18em;
}

/* ---------- 7. Prose ---------- */

.prose {
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}
.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.prose h2 {
  margin: 2.75rem 0 1rem;
  font-size: 1.5rem;
}
.prose h3 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.2rem;
}
.prose h4,
.prose h5,
.prose h6 {
  margin: 1.75rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Heading permalink, appears on hover. */
.prose .anchor {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4em;
  color: var(--muted);
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.prose .anchor .icon {
  width: 0.8em;
  height: 0.8em;
}
.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose h4:hover .anchor,
.prose .anchor:focus-visible {
  opacity: 1;
}
.prose .anchor:hover {
  color: var(--accent);
}
@media (hover: none) {
  .prose .anchor {
    opacity: 0.5;
  }
}

.prose p {
  margin: 0 0 1.25em;
}

.prose a:not(.anchor) {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklch, var(--accent) 50%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.prose a:not(.anchor):hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.prose strong {
  font-weight: 600;
}

.prose hr {
  width: 4rem;
  margin: 3rem auto;
  border: 0;
  border-top: 1px solid var(--muted);
  opacity: 0.6;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.1rem 0 0.1rem 1.25rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose ul,
.prose ol {
  margin: 0 0 1.25em;
  padding-left: 1.5em;
}
.prose ul {
  list-style: disc outside;
}
.prose ol {
  list-style: decimal;
}
.prose li {
  margin: 0.3em 0;
  padding-left: 0.2em;
}
.prose li::marker {
  color: var(--muted);
}
.prose li > ul,
.prose li > ol {
  margin: 0.3em 0;
}
.prose li p {
  margin-bottom: 0.5em;
}

/* Task lists: - [ ] / - [x] */
.prose ul.task-list {
  padding-left: 0.3em;
  list-style: none;
}
.prose input[type="checkbox"] {
  margin-right: 0.4em;
  vertical-align: -0.1em;
  accent-color: var(--accent);
}

.prose dl {
  margin: 0 0 1.25em;
}
.prose dt {
  font-weight: 600;
}
.prose dd {
  margin: 0 0 0.75em 1.5em;
  color: var(--muted);
}

.prose sup,
.prose sub {
  font-size: 0.7em;
  line-height: 0;
}

.prose mark {
  padding: 0 0.15em;
  border-radius: 0.2em;
  background: var(--selection);
  color: inherit;
}

.prose kbd {
  padding: 0.1em 0.4em;
  border: 1px solid var(--faint);
  border-bottom-width: 2px;
  border-radius: 0.3em;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.8em;
}

/* Footnotes */
.prose a.footnote-ref {
  margin-left: 0.1em;
  color: var(--accent);
  text-decoration: none;
}
.prose a.footnote-ref sup {
  font-size: 0.75em;
}
.prose .footnotes {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--faint);
  color: var(--muted);
  font-size: 0.9rem;
}
.prose .footnotes hr {
  display: none;
}
.prose .footnotes ol {
  margin-bottom: 0;
}
.prose .footnotes li {
  margin: 0.5rem 0;
}
.prose .footnotes p {
  margin: 0 0 0.5em;
}
.prose .footnotes a:not(.anchor) {
  color: inherit;
}
.prose a.footnote-back {
  margin-left: 0.3em;
  text-decoration: none;
  /* keep the return arrow a text glyph, not an emoji */
  font-family: var(--font-mono);
}

/* Tables (wrapped in .table-wrap so wide ones scroll sideways) */
.prose .table-wrap {
  margin: 1.5rem 0;
  overflow-x: auto;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}
.prose th,
.prose td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--faint);
  text-align: left;
  vertical-align: top;
}
.prose th {
  border-bottom-color: var(--muted);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.prose td:first-child,
.prose th:first-child {
  padding-left: 0;
}
.prose td:last-child,
.prose th:last-child {
  padding-right: 0;
}
.prose table caption {
  caption-side: bottom;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Images and figures */
.prose img {
  height: auto;
  border-radius: 0.6rem;
}
.prose figure {
  margin: 2rem auto;
}
.prose figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--faint);
  background: var(--surface);
}
.prose figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* Math: typeset by KaTeX (site/katex/); until it runs, the TeX source shows */
.prose .math.display {
  display: block;
  margin: 1.5rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
}
.prose .math.display .katex-display {
  margin: 0;
}
.prose .katex {
  font-size: 1.1em;
}

/* Callouts: a fenced div such as  ::: note … :::  */
.prose .note,
.prose .tip,
.prose .important,
.prose .warning,
.prose .caution {
  --callout: var(--accent);
  margin: 1.5rem 0;
  padding: 0.875rem 1.125rem;
  border: 1px solid color-mix(in oklch, var(--callout) 35%, transparent);
  border-radius: 0.5rem;
  background: color-mix(in oklch, var(--callout) 7%, transparent);
  font-size: 1rem;
}
.prose .tip { --callout: var(--ok); }
.prose .important { --callout: var(--important); }
.prose .warning { --callout: var(--warn); }
.prose .caution { --callout: var(--bad); }
.prose .note::before,
.prose .tip::before,
.prose .important::before,
.prose .warning::before,
.prose .caution::before {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--callout);
  font-size: 0.8rem;
  font-weight: 600;
}
.prose .note::before { content: "Note"; }
.prose .tip::before { content: "Tip"; }
.prose .important::before { content: "Important"; }
.prose .warning::before { content: "Warning"; }
.prose .caution::before { content: "Caution"; }
.prose .note > :last-child,
.prose .tip > :last-child,
.prose .important > :last-child,
.prose .warning > :last-child,
.prose .caution > :last-child {
  margin-bottom: 0;
}

.prose details {
  margin: 1.5rem 0;
  padding: 0.6rem 0.875rem;
  border: 1px solid var(--faint);
  border-radius: 0.5rem;
}
.prose details > summary {
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.prose details[open] > summary {
  margin-bottom: 0.75rem;
}
.prose details > :last-child {
  margin-bottom: 0;
}

/* ---------- 8. Code ---------- */

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}
.prose :not(pre) > code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--faint);
  border-radius: 0.3em;
  background: var(--surface);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.prose .codeblock {
  position: relative;
  margin: 1.5rem 0;
  border: 1px solid var(--faint);
  border-radius: 0.6rem;
  background: var(--surface);
  overflow: hidden;
}
.prose pre {
  margin: 0;
  padding: 1rem 1.25rem;
  color: var(--tk-fg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  tab-size: 4;
  overflow-x: auto;
  -webkit-text-stroke: 0.25px currentColor;
}
.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

.prose .copy-btn {
  position: absolute;
  top: 0.85rem;
  right: 0.6rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: var(--surface);
  color: var(--muted);
  transition: color 0.15s, background-color 0.15s;
}
.prose .copy-btn:hover {
  background: var(--faint);
  color: var(--ink);
}
.prose .copy-btn .icon {
  width: 0.9rem;
  height: 0.9rem;
}
.prose .copy-btn .icon-check {
  display: none;
  color: var(--ok);
}
.prose .copy-btn.copied .icon-copy {
  display: none;
}
.prose .copy-btn.copied .icon-check {
  display: block;
}

/* Pandoc's highlighter classes mapped onto the --tk-* palette.
   https://pandoc.org/MANUAL.html#syntax-highlighting */
.codeblock .kw,                        /* keyword */
.codeblock .cf,                        /* control flow */
.codeblock .im { color: var(--tk-keyword); }           /* import */
.codeblock .dt { color: var(--tk-type); }              /* data type */
.codeblock .dv,                        /* decimal */
.codeblock .bn,                        /* base-n */
.codeblock .fl { color: var(--tk-number); }            /* float */
.codeblock .st,                        /* string */
.codeblock .ch,                        /* char */
.codeblock .vs,                        /* verbatim string */
.codeblock .ss { color: var(--tk-string); }            /* special string */
.codeblock .sc { color: var(--tk-escape); }            /* escape / special char */
.codeblock .co { color: var(--tk-comment); font-style: italic; }
.codeblock .do,                        /* doc comment */
.codeblock .an,                        /* annotation */
.codeblock .cv,                        /* comment variable */
.codeblock .in { color: var(--tk-comment-doc); font-style: italic; }
.codeblock .fu,                        /* function */
.codeblock .ex { color: var(--tk-function); }          /* extension / command */
.codeblock .cn { color: var(--tk-constant); }          /* constant */
.codeblock .bu { color: var(--tk-constant-builtin); }  /* built-in */
.codeblock .op { color: var(--tk-operator); }          /* operator */
.codeblock .pp { color: var(--tk-macro); }             /* preprocessor / macro */
.codeblock .at { color: var(--tk-attribute); }         /* attribute */
.codeblock .va { color: var(--tk-property); }          /* variable */
.codeblock .ot,                        /* other */
.codeblock .re { color: var(--tk-module); }            /* region marker */
.codeblock .wa { color: var(--warn); }                 /* warning */
.codeblock .al,                        /* alert */
.codeblock .er { color: var(--bad); }                  /* error */

/* ---------- 9. Small screens ---------- */

@media (max-width: 40rem) {
  .river-title {
    font-size: 1.5rem;
  }
  .post-title,
  .list-title {
    font-size: 2.25rem;
    line-height: 1.11;
  }
  .post-nav {
    grid-template-columns: 1fr;
  }
  .post-nav-newer {
    grid-column: auto;
  }

  .prose {
    font-size: 1rem;
  }
  .prose h2 {
    font-size: 1.35rem;
  }
  .prose .codeblock,
  .prose img {
    border-radius: 0.5rem;
  }
}

@media (max-width: 26rem) {
  .site-header-inner,
  .site-footer,
  .column,
  .post-layout {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .site-nav a {
    padding: 0.375rem 0.5rem;
  }
  .post-title,
  .list-title {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .post-toc-rail,
  .toc-mobile,
  .post-nav,
  .back-link,
  .copy-btn {
    display: none !important;
  }
  .prose pre {
    white-space: pre-wrap;
  }
}
