@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&family=Source+Serif+4:ital,wght@0,400;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --ink: #111111;
  --ink-soft: #2a2a2a;
  --muted: #6b6b6b;
  --rule: #dcdcdc;
  --rule-soft: #ececec;
  --paper: #ffffff;
  --paper-warm: #faf9f6;
  --accent: #b3232c;
  --accent-dark: #8a1a1a;
  --accent-soft: #f5e8e8;
  --code-bg: #f5f4f0;
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dark-mode counterparts — Quarto adds data-bs-theme="dark" to <html> when
   the reader toggles theme. We scope to `body.quarto-dark` (NOT
   the unqualified `[data-bs-theme="dark"]`) because Quarto also stamps
   data-bs-theme="dark" on the navbar element regardless of page scheme,
   which would otherwise cause the navbar to permanently use dark colours
   even in light mode. */
body.quarto-dark {
  --ink: #ece9e0;
  --ink-soft: #c9c5bd;
  --muted: #8e8e8e;
  --rule: #2c2f34;
  --rule-soft: #1f2126;
  --paper: #14161a;
  --paper-warm: #1a1d22;
  --accent: #e85d65;
  --accent-dark: #b3232c;
  --accent-soft: #2a1518;
  --code-bg: #1e2126;
}

body.quarto-dark body {
  background: var(--paper);
  color: var(--ink);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.72;
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ NAVBAR ============ */
.navbar {
  background: var(--paper) !important;
  border-bottom: 1px solid var(--rule);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  box-shadow: none;
}

.navbar-brand,
.navbar .nav-link,
.navbar .bi {
  color: var(--ink) !important;
}

.navbar-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.04rem;
  letter-spacing: 0.01em;
}

.navbar .nav-link {
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.5rem 0.85rem !important;
  color: var(--ink-soft) !important;
  transition: color 120ms ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--accent) !important;
}

.navbar .nav-item.compact .nav-link {
  font-size: 1.05rem;
  padding: 0.4rem 0.6rem !important;
}

.navbar .nav-item.compact .bi {
  font-size: 1.15rem;
  vertical-align: -2px;
}

/* Mobile hamburger — Bootstrap's default toggler icon is white-on-dark; we run
   light-on-light, so override the SVG with an ink-coloured one and give the
   button a visible border. */
.navbar-toggler {
  border: 1px solid var(--rule);
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  background: var(--paper);
}

.navbar-toggler:hover,
.navbar-toggler:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23111111' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
  width: 1.3rem;
  height: 1.3rem;
}

/* Collapsed nav drawer — once the hamburger is tapped, stack items
   vertically in a panel under the navbar. */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: var(--paper);
    border-top: 1px solid var(--rule);
    margin-top: 0.65rem;
    padding: 0.5rem 0.25rem 0.75rem;
  }
  .navbar .nav-link {
    padding: 0.65rem 0.5rem !important;
  }
  .navbar .navbar-nav.ms-auto {
    margin-left: 0 !important;
    border-top: 1px solid var(--rule-soft);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
}

/* ============ LAYOUT ============ */
#quarto-content {
  padding-top: 1.5rem;
}

main.content,
#quarto-document-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* On posts with sidebar, let Quarto's grid handle column placement */
.page-layout-article main.content {
  margin-left: 0;
  margin-right: 0;
}

/* ============ TITLE BLOCK ============ */
#title-block-header.quarto-title-block.default {
  position: relative;
  margin: 0 0 2.5rem 0;
  padding: 1.5rem 0 1.75rem 0;
  border-bottom: 1px solid var(--rule);
}

/* Hide the empty meta block on pages without a Published date so it doesn't add whitespace. */
#title-block-header.quarto-title-block.default:not(:has(.quarto-title-meta-heading)) .quarto-title-meta {
  display: none;
}

h1.title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(1.85rem, 3.4vw, 2.55rem);
  line-height: 1.14;
  letter-spacing: -0.015em;
  margin: 0 0 0.85rem 0;
  color: var(--ink);
}

.subtitle {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1.08rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 1rem 0;
}

.quarto-title-meta,
.quarto-title-meta-heading,
.quarto-title-meta-contents {
  font-family: var(--sans);
}

/* Specificity must match Quarto bootstrap's `#title-block-header.quarto-title-block.default .quarto-title-meta`
   rule to override its `display: grid; grid-template-columns: repeat(2, 1fr)`. */
#title-block-header.quarto-title-block.default .quarto-title-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 0.9rem;
}

.quarto-title-meta-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.quarto-title-meta-contents {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0;
}

.quarto-title-meta-contents p {
  margin: 0;
}

/* The first meta block is the Author. Hide it entirely on post pages —
   the byline is redundant with the About-page authorship signal and the
   reader doesn't need to be reminded under every post. */
.quarto-title-meta > div:first-child {
  display: none;
}

/* Subsequent meta rows (Published, etc.) render inline: LABEL · value */
.quarto-title-meta > div:not(:first-child) {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.quarto-title-meta > div:not(:first-child) .quarto-title-meta-heading::after {
  content: "·";
  display: inline-block;
  margin-left: 0.4rem;
  color: var(--rule);
}

.quarto-title-meta > div:not(:first-child) .quarto-title-meta-contents,
.quarto-title-meta > div:not(:first-child) .quarto-title-meta-contents p {
  font-size: inherit;
  color: var(--muted);
}

/* ============ HEADINGS ============ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--sans);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

h2 {
  font-size: 1.42rem;
  margin: 2.6rem 0 0.9rem;
  padding-top: 0.4rem;
  position: relative;
}

h2::before {
  content: "";
  position: absolute;
  top: -0.4rem;
  left: 0;
  width: 2.2rem;
  height: 2px;
  background: var(--accent);
}

h3 {
  font-size: 1.14rem;
  font-weight: 600;
  margin: 2rem 0 0.7rem;
  color: var(--ink-soft);
}

h4 {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin: 1.8rem 0 0.6rem;
}

/* ============ BODY ELEMENTS ============ */
p,
li {
  font-size: 1.04rem;
}

p {
  margin: 0 0 1.05rem;
}

ul, ol {
  padding-left: 1.4rem;
  margin: 0 0 1.1rem;
}

li {
  margin-bottom: 0.35rem;
}

strong {
  font-weight: 700;
  color: var(--ink);
}

em {
  font-style: italic;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent-dark);
}

hr {
  border: 0;
  height: 1.6rem;
  background-image: linear-gradient(90deg, var(--rule), var(--rule));
  background-size: 100% 1px;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  margin: 3rem auto;
  overflow: visible;
}

hr::after {
  content: "\25C6";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent);
  font-size: 0.85rem;
  background: var(--paper);
  padding: 0 0.85rem;
  line-height: 1;
}

blockquote {
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}

/* ============ CODE ============ */
code,
pre,
.sourceCode {
  font-family: var(--mono);
  font-size: 0.88em;
}

p code,
li code,
td code,
h1 code,
h2 code,
h3 code,
h4 code {
  background: var(--code-bg);
  padding: 0.1em 0.38em;
  border-radius: 3px;
  border: 1px solid var(--rule-soft);
  color: var(--accent-dark);
}

pre,
div.sourceCode {
  background: var(--code-bg);
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--ink-soft);
  padding: 0.9rem 1rem;
  border-radius: 2px;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 1.3rem 0;
}

pre code,
div.sourceCode code {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink);
}

kbd {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 0.1em 0.45em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--paper-warm);
  color: var(--ink);
}

/* ============ TABLES ============ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-family: var(--sans);
  font-size: 0.94rem;
}

thead {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

tbody {
  border-bottom: 2px solid var(--ink);
}

th, td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

tbody tr + tr {
  border-top: 1px solid var(--rule-soft);
}

caption {
  caption-side: bottom;
  font-size: 0.86rem;
  color: var(--muted);
  padding-top: 0.6rem;
  font-style: italic;
  text-align: left;
}

/* ============ FIGURES ============ */
figure,
.figure {
  margin: 1.8rem 0;
}

figure img,
.figure img,
p img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

figcaption,
.figure-caption {
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 0.6rem;
  text-align: left;
}

figcaption::before,
.figure-caption::before {
  content: "Figure. ";
  font-weight: 700;
  color: var(--ink);
}

/* ============ MATH (KaTeX/MathJax) ============ */
.math.display,
mjx-container[display="true"] {
  margin: 1.4rem 0;
}

mjx-container {
  font-size: 1.02em !important;
}

/* ============ TOC (right rail — journal "Contents") ============ */
#quarto-margin-sidebar {
  font-family: var(--sans);
}

nav#TOC {
  position: sticky;
  top: 5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--rule);
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
}

nav#TOC #toc-title,
nav#TOC h2 {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.85rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

nav#TOC ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav#TOC ul ul {
  padding-left: 0.85rem;
  margin-top: 0.2rem;
  border-left: 1px solid var(--rule-soft);
}

nav#TOC li {
  margin: 0;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.4;
}

nav#TOC .nav-link {
  display: block;
  padding: 0.32rem 0 0.32rem 0.55rem;
  margin-left: -0.55rem;
  color: var(--muted) !important;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
}

nav#TOC .nav-link:hover {
  color: var(--ink) !important;
  border-left-color: var(--rule);
}

nav#TOC .nav-link.active {
  color: var(--accent) !important;
  border-left-color: var(--accent);
  font-weight: 600;
}

/* Scrollbar in TOC */
nav#TOC::-webkit-scrollbar {
  width: 4px;
}
nav#TOC::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 2px;
}

/* ============ HOME / BLOG LIST ============ */
main.content > h2:first-of-type {
  margin-top: 1.2rem;
}

main.content > h2 a {
  text-decoration: none;
}

main.content > h2 a:hover {
  color: var(--accent);
}

/* "Date" italic lines in home post previews */
main.content > p > em:only-child {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============ ABOUT PAGE ============ */
main.content img[alt*="Portrait"],
main.content img[fig-alt*="Portrait"] {
  border-radius: 50%;
  margin: 0 auto 1.4rem;
  display: block;
  border: 1px solid var(--rule);
}

/* ============ FEEDBACK SECTION (matches journal styling) ============ */
.post-feedback {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 3px solid var(--ink);
}

.post-feedback__intro {
  margin-bottom: 1.4rem;
}

.post-feedback__eyebrow {
  margin: 0 0 0.35rem 0;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.post-feedback__title {
  font-family: var(--sans);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.55rem;
  letter-spacing: -0.005em;
}

.post-feedback__title::before {
  display: none;
}

.post-feedback__copy {
  max-width: 38rem;
  font-size: 1rem;
  color: var(--ink-soft);
  margin-bottom: 0;
}

.post-feedback__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
  align-items: center;
  margin: 1.4rem 0 2rem;
}

.post-feedback__github-star {
  display: inline-block;
  vertical-align: middle;
  border: 0;
  overflow: hidden;
  color-scheme: light;
}

.post-feedback__bookmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.95rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.post-feedback__bookmark:hover,
.post-feedback__bookmark:focus-visible {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
  outline: none;
}

.post-feedback__bookmark-icon {
  font-size: 1rem;
  line-height: 1;
}

.post-feedback__status {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--muted);
  flex-basis: 100%;
}

.post-feedback__status kbd {
  margin: 0 0.15em;
}

.post-feedback__comments {
  margin-top: 1.75rem;
}

.post-feedback__fallback {
  margin-top: 0.85rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}

/* Giscus iframe spacing */
.giscus,
.giscus-frame {
  margin-top: 1rem;
  width: 100%;
  border: 0;
}

/* ============ FOCUS RING ============ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============ PRINT ============ */
@media print {
  .navbar,
  .post-feedback,
  #quarto-margin-sidebar {
    display: none;
  }
  main.content {
    max-width: 100%;
  }
  a {
    text-decoration: none;
  }
}

/* ============ "RECENT POSTS" TOP BANNER ON HOME ============
   build_home.py emits a `:::{.recent-posts-banner}` block at the top of
   index.qmd, just under the title block. It renders as a responsive grid
   of post cards spanning the main content column — a proper banner rather
   than a thin margin strip. */
.recent-posts-banner {
  margin: 0 0 2.5rem;
}

.recent-posts-banner-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

.recent-posts-banner ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.recent-posts-banner li {
  margin: 0;
  padding: 0.85rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 120ms ease, background-color 120ms ease,
    transform 120ms ease;
}

.recent-posts-banner li:hover {
  border-color: var(--ink);
  background: var(--paper-warm);
  transform: translateX(2px);
}

.recent-posts-banner a {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.005em;
  flex: 1;
}

.recent-posts-banner li:hover a {
  color: var(--accent);
}

.recent-posts-banner em {
  font-style: normal;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .recent-posts-banner li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

/* ============ POSTS LISTING (blog.qmd) ============
   Quarto renders blog.qmd's `listing:` config with .quarto-listing-default
   and .listing-item-* classes. The bootstrap defaults set flex-basis 45/20
   percentages that leave huge empty columns, so we re-define the layout
   to stack: title row, then a compact uppercase metadata row beneath.
   Selectors are crafted with the same specificity as Quarto's bootstrap
   rules to win the cascade. */
.quarto-listing {
  margin-top: 0.5rem;
}

div.list.quarto-listing-default div.quarto-post {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.35rem;
  padding: 1.3rem 0;
  margin: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 0;
}

div.list.quarto-listing-default div.quarto-post:last-child {
  border-bottom: 1px solid var(--rule);
}

div.list.quarto-listing-default div.quarto-post .body {
  flex-basis: auto !important;
  flex-grow: 1;
  order: 1;
}

div.list.quarto-listing-default div.quarto-post .metadata {
  flex-basis: auto !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  order: 2;
  gap: 0.4rem 1.4rem;
  padding-bottom: 0;
  margin: 0;
}

div.list.quarto-listing-default div.quarto-post .body h3.listing-title {
  font-family: var(--sans) !important;
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: 0;
}

div.list.quarto-listing-default div.quarto-post .body h3.listing-title a {
  color: var(--ink) !important;
  text-decoration: none;
}

div.list.quarto-listing-default div.quarto-post .body h3.listing-title a:hover {
  color: var(--accent) !important;
}

div.list.quarto-listing-default div.quarto-post .metadata,
div.list.quarto-listing-default div.quarto-post .metadata a {
  font-family: var(--sans) !important;
  font-size: 0.76rem !important;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted) !important;
}

div.list.quarto-listing-default div.quarto-post .body .listing-description {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0.4rem 0 0;
}

/* ============ NARROW SCREENS ============ */
@media (max-width: 768px) {
  nav#TOC {
    border-left: 0;
    padding-left: 0;
    position: static;
  }
  #title-block-header.quarto-title-block.default::before {
    font-size: 0.72rem;
  }
  .navbar .nav-link {
    font-size: 0.85rem;
  }
  main.content,
  #quarto-document-content {
    max-width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
    overflow-wrap: break-word;
  }
  body {
    overflow-x: hidden;
  }
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  pre,
  div.sourceCode {
    overflow-x: auto;
  }
}

/* ============ CATEGORIES (post tags) ============
   Quarto wraps post `categories:` in .quarto-categories within the title
   block. We hide that copy (we want tags at the bottom of the post, not
   the top), then clone the chips into a .post-tags-bottom block via the
   include-after-body script. */
#title-block-header .quarto-categories {
  display: none;
}

.quarto-categories,
.post-tags-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0 0;
}

.post-tags-bottom {
  margin: 3rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  align-items: center;
}

.post-tags-bottom::before {
  content: "Tags";
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: 0.6rem;
}

/* ============ CITE BUTTON + MODAL ============
   The "Cite" link sits at the end of the "Published · date" meta row,
   styled to match the date itself exactly — same sans-serif font, same
   muted colour, same regular weight, no uppercase, no tracking. A
   dashed underline distinguishes it as a control without colouring it. */
.post-cite-button {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: none;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  line-height: inherit;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

.post-cite-button::before {
  content: "·";
  display: inline-block;
  margin: 0 0.45rem 0 0.1rem;
  color: var(--rule);
  text-decoration: none;
}

.post-cite-button:hover,
.post-cite-button:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
  outline: none;
}

.post-cite-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-cite-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.post-cite-modal__dialog {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  width: min(700px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.8rem 1.9rem 1.5rem;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.18);
}

.post-cite-modal__x {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 2px;
}

.post-cite-modal__x:hover {
  color: var(--ink);
  background: var(--paper-warm);
}

.post-cite-modal__eyebrow {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}

.post-cite-modal__title {
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule);
}

.post-cite-modal__bib {
  background: var(--code-bg);
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--ink-soft);
  padding: 0.95rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
  overflow-x: auto;
  margin: 0 0 1.1rem;
  white-space: pre;
  user-select: all;
}

.post-cite-modal__bib code {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink);
}

.post-cite-modal__actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.post-cite-modal__copy {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  border-radius: 2px;
  transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease;
}

.post-cite-modal__copy:hover {
  opacity: 0.88;
}

.post-cite-modal__copy--ghost {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--rule);
  margin-top: 0.55rem;
}

.post-cite-modal__copy--ghost:hover {
  border-color: var(--ink);
}

.post-cite-modal__status {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}

.post-cite-modal__apa {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-soft);
}

.post-cite-modal__apa > summary {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  outline: none;
}

.post-cite-modal__apa > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--accent);
  transition: transform 120ms ease;
}

.post-cite-modal__apa[open] > summary::before {
  transform: rotate(90deg);
}

.post-cite-modal__apa-text {
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0.7rem 0 0.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--paper-warm);
  border: 1px solid var(--rule-soft);
}

@media (max-width: 600px) {
  .post-cite-modal__dialog {
    padding: 1.4rem 1.2rem 1.1rem;
  }
  .post-cite-modal__bib {
    font-size: 0.78rem;
    padding: 0.75rem 0.85rem;
  }
}

.quarto-category {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  border-radius: 2px;
  text-decoration: none;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.quarto-category:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--paper);
}

/* Categories on the Posts listing (filter strip on top + per-item chips) */
.quarto-listing-category {
  font-family: var(--sans);
}

.quarto-listing-category .category {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}

.quarto-listing-category .category:hover,
.quarto-listing-category .category.active {
  border-color: var(--accent);
  color: var(--accent);
}

div.list.quarto-listing-default div.quarto-post .listing-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

div.list.quarto-listing-default div.quarto-post .listing-categories .listing-category {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  color: var(--muted);
  border-radius: 2px;
  text-decoration: none;
}

/* ============ QUARTO CALLOUTS ============
   Quarto emits .callout with .callout-note / .callout-tip / .callout-warning
   / .callout-important / .callout-caution variants. Restyle to the Nature
   Methods palette: subdued borders, sans-serif eyebrow, type-coded accent
   colour on the left rail. */
.callout {
  margin: 1.6rem 0;
  padding: 0;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  background: var(--paper);
  border-radius: 0;
}

.callout-header {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.55rem 1rem 0.35rem;
  background: transparent;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.callout-body,
.callout-body-container {
  padding: 0.75rem 1rem 0.85rem;
  font-family: var(--serif);
}

.callout-body > p:last-child {
  margin-bottom: 0;
}

.callout-note { border-left-color: #2e6cb6; }
.callout-note .callout-header { color: #2e6cb6; }
.callout-tip { border-left-color: #1f8a4c; }
.callout-tip .callout-header { color: #1f8a4c; }
.callout-warning { border-left-color: #c97a0d; }
.callout-warning .callout-header { color: #c97a0d; }
.callout-important { border-left-color: var(--accent); }
.callout-important .callout-header { color: var(--accent); }
.callout-caution { border-left-color: #7a3aa6; }
.callout-caution .callout-header { color: #7a3aa6; }

/* ============ TABSETS ============
   .panel-tabset / .nav-tabs from Quarto. Plain, journal-style: a thin
   bottom rule with the active tab marked in accent. */
.panel-tabset .nav-tabs {
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1rem;
  display: flex;
  gap: 0;
}

.panel-tabset .nav-tabs .nav-link {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  border-radius: 0;
}

.panel-tabset .nav-tabs .nav-link:hover {
  color: var(--ink);
  border-bottom-color: var(--rule);
}

.panel-tabset .nav-tabs .nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

/* ============ MERMAID / GRAPHVIZ DIAGRAMS ============ */
.cell-output-display .mermaid,
div.mermaid,
pre.mermaid {
  margin: 1.6rem auto;
  text-align: center;
  background: transparent;
  border: 0;
}

div.cell-output-display svg {
  max-width: 100%;
  height: auto;
}

figure.figure[id^="fig-"] {
  margin: 1.8rem 0;
}

/* ============ LIGHTBOX (Quarto's GLightbox-based image zoom) ============ */
.glightbox-clean .gslide-title,
.glightbox-clean .gslide-description {
  font-family: var(--sans);
  color: var(--ink);
}

.glightbox-container .gprev,
.glightbox-container .gnext,
.glightbox-container .gclose {
  filter: invert(0.05);
}

body.quarto-dark .glightbox-container .gprev,
body.quarto-dark .glightbox-container .gnext,
body.quarto-dark .glightbox-container .gclose {
  filter: invert(0.95);
}

/* ============ SEARCH OVERLAY ============
   Quarto's algolia-style search popup. Restyle the input + result rows. */
.aa-DetachedSearchButton {
  background: transparent;
  border: 0;
  color: var(--ink);
}

.aa-DetachedFormContainer,
.aa-Form {
  border: 1px solid var(--rule);
  background: var(--paper);
}

.aa-Input {
  font-family: var(--sans);
  color: var(--ink);
}

.aa-Item {
  font-family: var(--sans);
}

.aa-ItemContent {
  color: var(--ink);
}

mark,
.aa-ItemContent mark {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0 0.15em;
  border-radius: 2px;
}

/* ============ THEME TOGGLE ============
   Quarto adds .quarto-color-scheme-toggle to the navbar when theme.light +
   theme.dark are configured. */
.quarto-color-scheme-toggle .bi {
  font-size: 1.1rem;
  vertical-align: -2px;
  color: var(--ink-soft);
}

.quarto-color-scheme-toggle:hover .bi {
  color: var(--accent);
}

/* ============ READING-TIME BADGE ON POST PAGES ============
   Surfaced via `format.html.reading-time: true`. Quarto renders it inside
   .quarto-title-meta. Style consistent with the byline. */
.reading-time,
.quarto-title-meta .reading-time {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}

/* ============ DATE-MODIFIED ============ */
.quarto-title-meta-contents .last-updated,
.quarto-title-meta-contents time.date-modified {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}

/* ============ CSL / BIBTEX BIBLIOGRAPHY ============
   Quarto's citeproc renders the bibliography inside #refs > .csl-bib-body. */
#refs {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

#refs h2,
#refs h3 {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.csl-bib-body {
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.5;
}

.csl-entry {
  margin-bottom: 0.8rem;
  padding-left: 2rem;
  text-indent: -2rem;
}

/* In-text citation links (hover preview on by default via citations-hover) */
a.citation,
a[role="doc-biblioref"] {
  color: var(--accent-dark);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

a.citation:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

/* ============ CROSS-REFERENCE LINKS ============ */
a[role="doc-biblioref"],
.quarto-xref {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.quarto-xref:hover {
  text-decoration: underline;
}

/* ============ DARK-MODE OVERRIDES ============
   Most things inherit from CSS vars defined at the top, but a few hard-coded
   greys, the code highlighter, and Bootstrap defaults need explicit dark
   counterparts. */
body.quarto-dark {
  color-scheme: dark;
}

body.quarto-dark .navbar {
  background: var(--paper) !important;
  border-bottom-color: var(--rule);
}

body.quarto-dark .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ece9e0' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

body.quarto-dark p code,
body.quarto-dark li code,
body.quarto-dark td code,
body.quarto-dark h1 code,
body.quarto-dark h2 code,
body.quarto-dark h3 code,
body.quarto-dark h4 code {
  background: var(--code-bg);
  color: var(--accent);
  border-color: var(--rule);
}

body.quarto-dark pre,
body.quarto-dark div.sourceCode {
  background: var(--code-bg);
  border-color: var(--rule);
  border-left-color: var(--ink-soft);
}

body.quarto-dark kbd {
  background: var(--paper-warm);
  border-color: var(--rule);
  color: var(--ink);
}

body.quarto-dark thead {
  border-top-color: var(--ink-soft);
  border-bottom-color: var(--ink-soft);
}

body.quarto-dark tbody {
  border-bottom-color: var(--ink-soft);
}

body.quarto-dark tbody tr + tr {
  border-top-color: var(--rule);
}

body.quarto-dark hr {
  background-image: linear-gradient(90deg, var(--rule), var(--rule));
}

body.quarto-dark hr::after {
  background: var(--paper);
}

body.quarto-dark blockquote {
  color: var(--ink-soft);
}

body.quarto-dark main.content img,
body.quarto-dark main.content figure img {
  filter: brightness(0.92);
}

body.quarto-dark .callout {
  background: var(--paper-warm);
  border-color: var(--rule);
}

body.quarto-dark .callout-header {
  border-bottom-color: var(--rule);
}

body.quarto-dark .recent-posts-banner li,
body.quarto-dark div.list.quarto-listing-default div.quarto-post {
  background: var(--paper);
  border-color: var(--rule);
}

body.quarto-dark .quarto-category,
body.quarto-dark .quarto-listing-category .category,
body.quarto-dark div.list.quarto-listing-default div.quarto-post .listing-categories .listing-category {
  background: var(--paper-warm);
  border-color: var(--rule);
  color: var(--ink-soft);
}

/* GHbtns star iframe in the feedback section has a light-only background;
   in dark mode it bleeds white. Wrap it in a clipping/inverted container. */
body.quarto-dark .post-feedback__github-star {
  filter: invert(0.92) hue-rotate(180deg);
}
