:root {
  --c-bg: #ffffff;
  --c-fg: #1f2328;
  --c-muted: #656d76;
  --c-accent: #2563eb;
  --c-border: #e5e7eb;
  --c-code-bg: #f6f8fa;
  --c-inline-code-bg: #eef1f5;
  --c-inline-code-border: #d8dee6;
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

/* Default link styling: themed accent colour, no underline until hover. */
a {
  color: var(--c-accent);
  text-decoration: none;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
/* Underline-on-hover only inside body content; nav controls keep their
 * existing background-based affordance without a sudden underline. */
.main a:hover,
.main a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--c-fg, var(--c-fg2, #333));
  line-height: 1.65;
  background: var(--c-bg);
}

.container { max-width: 820px; margin: 0 auto; padding: 0 16px; }

.site-header {
  background: #0f172a;
  color: #fff;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(0,0,0,.1);
}
.site-header .header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1200px;
}
.brand {
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: 0;
}
.brand-name { letter-spacing: .2px; }

.primary-nav {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 2px;
  flex-wrap: wrap;
  min-width: 0;
  /* No explicit align-items: keep the default `stretch` so the row's
     cross-axis height is shared between bare `.nav-link` items and the
     `.nav-item` wrappers around dropdown triggers. Centering per item
     instead of stretching makes items with different intrinsic heights
     appear at different vertical offsets — the visible "stair-step" bug. */
}
.nav-link {
  color: #cbd5e1;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: .92rem;
  white-space: nowrap;
  /* Use flex on the link itself so the caret (`.has-caret::after`) and
     the text label share one line, vertically centered. Avoids the old
     `vertical-align: 2px` magic number that drifted when an item was
     rendered as `<button>` vs `<a>`. */
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: color .15s ease, background-color .15s ease;
}
/* Reset UA defaults so <button class="nav-link"> matches <a class="nav-link">. */
button.nav-link {
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}
/* Non-clickable nav entries (custom nav items configured without a url) are
   rendered as spans; avoid the pointer cursor (nothing to click), but keep
   the hover tint so hovering still gives visual feedback. */
span.nav-link,
.cat-link:not(a) {
  cursor: default;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.is-active {
  color: #fff;
  background: rgba(255,255,255,.10);
}

.nav-item {
  position: relative;
  /* Stay a plain wrapper — no `display: flex` here. Adding it would make
     the wrapper's box different from a bare `.nav-link` and re-introduce
     the staircase alignment between wrapped and unwrapped items. */
}
.has-caret::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  /* vertical-align handled by the parent .nav-link's flex centering. */
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: .7;
}
.dropdown {
  position: absolute;
  top: calc(100% + 0px);
  left: 0;
  min-width: 100%;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #0f172a;            /* same as .site-header */
  border-radius: 0 0 8px 8px;
  box-shadow: 0 10px 20px rgba(0,0,0,.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
  transform: translateY(-4px);
  z-index: 60;
}
.nav-item:hover > .dropdown,
.nav-item:focus-within > .dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.dropdown li { margin: 0; }
.dropdown a {
  display: block;
  padding: 6px 12px;              /* match .nav-link */
  color: #cbd5e1;
  text-decoration: none;
  font-size: .92rem;              /* match .nav-link */
  border-radius: 6px;             /* match .nav-link */
  white-space: nowrap;
  transition: color .15s ease, background-color .15s ease;
}
.dropdown a:hover {
  color: #fff;
  background: rgba(255,255,255,.10);  /* match .nav-link:hover */
}
/* Non-clickable group headers inside dropdowns are spans, not <a>, so they
   miss `.dropdown a`'s light color and would inherit the dark body `--c-fg`
   from `.cat-link` — invisible on the dark dropdown. Match the link color,
   and keep a hover highlight so hovering the group header still gives visual
   feedback even though it has no url. */
.dropdown .cat-link:not(a) {
  color: #cbd5e1;
}
.dropdown .cat-link:not(a):hover {
  color: #fff;
  background: rgba(255,255,255,.10);
}
.dropdown a.is-active {
  color: #fff;
  background: rgba(255,255,255,.14);  /* slightly stronger than :hover for the same item */
}
.dropdown-wide {
  min-width: 240px;
}
.dropdown-wide ul {
  position: static;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  margin: 2px 0 2px 0;
  padding: 0;
  min-width: 0;
}
.dropdown-wide ul li { margin: 0; }
.dropdown-wide ul a {
  padding-left: 24px;             /* consistent child indent */
  color: #94a3b8;                 /* slightly muted for children */
  font-size: .88rem;
}
.dropdown-wide ul a:hover,
.dropdown-wide ul a.is-active {
  background: rgba(255,255,255,.06);
  color: #fff;
}

/* Fly-out sub-menu (level 2): appears on hover of a parent item with children. */
.dropdown-item { position: relative; }
.dropdown-item > .cat-link { display: flex; align-items: center; justify-content: space-between; }
.sub-caret { font-size: .9em; opacity: .6; margin-left: 8px; }
.dropdown-sub {
  position: absolute;
  top: -4px;
  left: 100%;
  margin: 0;
  padding: 4px;
  width: max-content;
  min-width: 0;
  list-style: none;
  background: #0f172a;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0,0,0,.32);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-4px);
  transition: opacity .14s ease, transform .14s ease;
  z-index: 70;
}
.dropdown-item.has-sub:hover > .dropdown-sub,
.dropdown-item.has-sub:focus-within > .dropdown-sub {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}
.dropdown-sub li { margin: 0; }
.dropdown-sub .cat-link { color: #cbd5e1; font-size: .9rem; }
.dropdown-sub .cat-link:hover,
.dropdown-sub .cat-link.is-active {
  background: rgba(255,255,255,.10);
  color: #fff;
}

/* Hamburger toggle: hidden on desktop, shown on mobile. */
.nav-toggle, .nav-toggle-btn { display: none; }

.langs {
  display: inline-flex;
  gap: 2px;
  white-space: nowrap;
}
.lang-link {
  color: #cbd5e1;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: .85rem;
  transition: color .15s ease, background-color .15s ease;
}
.lang-link:hover { color: #fff; }
.lang-link.is-active {
  color: #0f172a;
  background: #fff;
}

@media (max-width: 760px) {
  .site-header { padding: 10px 0; }
  .site-header .header-inner {
    flex-wrap: wrap;
    gap: 10px;
    row-gap: 8px;
  }

  /* Mobile nav collapses into a hamburger button; the primary-nav only
     appears as an off-canvas panel when the button is clicked. */
  .nav-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }
  .nav-toggle-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    margin-left: auto;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-toggle-btn .bar {
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
  }
  .nav-toggle-btn:hover { background: rgba(255,255,255,.06); }
  .nav-toggle:checked ~ .nav-toggle-btn .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-toggle-btn .bar:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-toggle-btn .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .primary-nav { display: none; }

  #nav-toggle:checked ~ .primary-nav {
    display: flex;
    position: absolute;
    top: calc(100% + 10px);
    left: 10px;
    right: 10px;
    z-index: 60;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px;
    background: #0f172a;
    border-radius: 10px;
    box-shadow: 0 14px 30px rgba(0,0,0,.32);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Inside the panel the dropdowns expand downward in normal flow instead of
     flying out to the side (left: 100%), so multi-level trees stack down the
     screen and are never clipped by a scroller. */
  #nav-toggle:checked ~ .primary-nav .dropdown,
  #nav-toggle:checked ~ .primary-nav .dropdown-sub {
    position: static;
    width: 100%;
    min-width: 0;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    border-top: 1px solid rgba(255,255,255,.08);
    display: none;
    transition: none;
  }
  #nav-toggle:checked ~ .primary-nav .nav-item:hover > .dropdown,
  #nav-toggle:checked ~ .primary-nav .nav-item:focus-within > .dropdown,
  #nav-toggle:checked ~ .primary-nav .dropdown-item.has-sub:hover > .dropdown-sub,
  #nav-toggle:checked ~ .primary-nav .dropdown-item.has-sub:focus-within > .dropdown-sub {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }
  #nav-toggle:checked ~ .primary-nav .dropdown-sub {
    width: auto;
    margin-left: 14px;
    border-left: 2px solid rgba(255,255,255,.08);
    border-top: 0;
    border-radius: 0 6px 6px 6px;
  }
  #nav-toggle:checked ~ .primary-nav .nav-item .nav-link {
    width: 100%;
    text-align: left;
  }
  #nav-toggle:checked ~ .primary-nav .nav-link,
  #nav-toggle:checked ~ .primary-nav .dropdown a { white-space: normal; }

  .langs { margin-left: 0; }
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 32px;
}

.sidebar { order: 1; }
.main { order: 2; min-width: 0; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .main { order: 1; }
}

.search-nav { margin-bottom: 24px; }
.search-nav h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}
.side-search-input {
  display: block;
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  font-size: .9rem;
  color: var(--c-fg);
  background: var(--c-code-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.side-search-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
  background: #fff;
}
.side-search-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 360px;
  overflow-y: auto;
}
.side-search-results li { margin: 0; }
.side-search-result {
  display: block;
  padding: 6px 10px;
  color: var(--c-fg);
  text-decoration: none;
  border-radius: 6px;
  font-size: .9rem;
  transition: background-color .15s ease, color .15s ease;
}
.side-search-result:hover {
  background: #f1f5f9;
  color: var(--c-accent);
}
.side-search-title { display: block; font-weight: 600; line-height: 1.35; }
.side-search-summary {
  display: block;
  margin-top: 2px;
  font-size: .8rem;
  color: var(--c-muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.side-search-empty {
  margin: 8px 0 0;
  color: var(--c-muted);
  font-size: .85rem;
}
.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: .82rem;
  color: var(--c-muted);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .15s ease;
}
.rss-link:hover { color: var(--c-accent); }

.recent-nav h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}
.recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.recent-list li {
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--c-border);
}
.recent-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.recent-link {
  display: block;
  color: var(--c-fg);
  text-decoration: none;
  font-size: .9rem;
  line-height: 1.4;
  margin-bottom: 3px;
  transition: color .15s ease;
}
.recent-link:hover { color: var(--c-accent); }

.pagination {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--c-muted, #888);
  font-size: .9rem;
}
.pagination-status { font-variant-numeric: tabular-nums; }

.breadcrumb {
  font-size: .85rem;
  color: var(--c-muted, #888);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.breadcrumb a { color: var(--c-muted, #888); }
.breadcrumb a:hover { color: var(--c-accent); }
.breadcrumb .separator { opacity: .5; }
.pagination a {
  padding: 4px 10px;
  border: 1px solid var(--c-border, #e5e7eb);
  border-radius: 6px;
}
.recent-date {
  display: block;
  font-size: .76rem;
  color: var(--c-muted);
}
.recent-empty {
  margin: 0;
  color: var(--c-muted);
  font-size: .9rem;
}

.friend-links-nav { margin-top: 28px; }
.friend-links-nav h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}
.friend-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.friend-links-list li { margin: 1px 0; }
.friend-link {
  display: block;
  padding: 5px 10px;
  color: var(--c-fg);
  text-decoration: none;
  font-size: .9rem;
  border-radius: 6px;
  transition: background-color .15s ease, color .15s ease;
}
.friend-link::after {
  content: " ↗";
  font-size: .75em;
  color: var(--c-muted);
  opacity: .7;
  margin-left: 2px;
}
.friend-link:hover {
  background: #f1f5f9;
  color: var(--c-accent);
}

.category-nav { margin-top: 28px; }
.category-nav h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}
.cat-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}
.cat-item { margin: 0; }
.cat-item details { margin: 0; }
.cat-item > details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: .92rem;
  color: var(--c-fg);
  transition: background-color .15s ease, color .15s ease;
}
.cat-item > details > summary::-webkit-details-marker { display: none; }
.cat-item > details > summary:hover { background: #f1f5f9; color: var(--c-accent); }
.cat-item > details > summary.is-active {
  background: #eff6ff;
  color: var(--c-accent);
  font-weight: 600;
}
.cat-caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 6px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--c-muted);
  transition: transform .15s ease;
  flex-shrink: 0;
}
.cat-item > details[open] > summary .cat-caret { transform: rotate(90deg); }
.cat-item > details[open] > summary { margin-bottom: 0; }
.cat-title {
  display: inline;
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}
.cat-children {
  list-style: none;
  padding: 2px 0 2px 20px;
  margin: 0;
  border-left: 1px solid var(--c-border);
  margin-left: 14px;
}
.cat-link {
  display: block;
  padding: 6px 10px;
  color: var(--c-fg);
  text-decoration: none;
  font-size: .92rem;
  border-radius: 6px;
  transition: background-color .15s ease, color .15s ease;
}
.cat-link:hover {
  background: #f1f5f9;
  color: var(--c-accent);
}
.cat-link.is-active {
  background: #eff6ff;
  color: var(--c-accent);
  font-weight: 600;
}

.article-list { margin-top: 8px; }

.card {
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: #fff;
}
.card-title { margin: 0 0 6px; font-size: 1.25rem; }
.card-title a { color: #0f172a; text-decoration: none; }
.card-title a:hover { color: var(--c-accent); }
.card-meta { color: var(--c-muted, #888); font-size: .85rem; margin-bottom: 6px; }
.card-summary { margin: 4px 0; color: #444; }
.tags, .translations { margin-top: 8px; }
.tag {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 1px 10px;
  font-size: .75rem;
  margin-right: 6px;
}
/* Tags rendered as links (article pages, cards, cloud): keep the pill look
 * without the default underline, and darken on hover for affordance. */
a.tag-link {
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
a.tag-link:hover {
  background: #e0e7ff;
  color: #1e1b4b;
}
a.tag-link:visited {
  color: #3730a3;
}

.tag-cloud-nav { margin-top: 28px; }
.tag-cloud-nav h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}
.tag-cloud {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tag-cloud li {
  display: inline-block;
  margin: 0 4px 6px 0;
}
.tag-cloud .tag-link {
  display: inline-block;
}
.tag-count {
  font-size: .68rem;
  color: var(--c-muted);
  margin-left: 2px;
}
.tag-cloud-empty {
  margin: 0;
  color: var(--c-muted);
  font-size: .9rem;
}

.post { max-width: 760px; }
.post-title { margin: 0 0 10px; }
.post-meta { color: var(--c-muted, #888); font-size: .88rem; margin-bottom: 12px; }
.post-meta span { margin-right: 16px; }
.page-child-date { color: var(--c-muted, #888); font-size: .85rem; margin-left: 8px; }
.page-child-summary { color: #444; font-size: .88rem; margin: 4px 0 0; }
.reading-time { color: var(--c-muted, #888); font-size: .88rem; margin: 0 0 12px; }
.post-content h2 { margin-top: 1.6em; }
.post-content blockquote {
  border-left: 3px solid var(--c-accent);
  margin: 0 0 1em;
  padding: 2px 16px;
  color: #555;
  background: #f8fafc;
}
/* GitHub-style alerts (`> [!NOTE]`, `> [!TIP]`, `> [!WARNING]`, …).
 * Per-type colours are exposed as CSS variables so hosts can retheme without
 * forking the class set; all pairs meet WCAG AA contrast. */
.post-content .admonition {
  --admonition-bg: #f0f7ff;
  --admonition-border: #c5e1ff;
  --admonition-color: #0b66c3;
  border: 1px solid var(--admonition-border);
  border-left: 4px solid var(--admonition-color);
  border-radius: 8px;
  background: var(--admonition-bg);
  padding: 10px 16px 12px;
  margin: 0 0 1em;
}
.post-content .admonition.note {
  --admonition-bg: #f0f7ff;
  --admonition-border: #c5e1ff;
  --admonition-color: #0b66c3;
}
.post-content .admonition.tip,
.post-content .admonition.success {
  --admonition-bg: #f2fdf3;
  --admonition-border: #bfe6c6;
  --admonition-color: #1a7f37;
}
.post-content .admonition.important,
.post-content .admonition.info {
  --admonition-bg: #f6f4ff;
  --admonition-border: #d8ccff;
  --admonition-color: #6f42c1;
}
.post-content .admonition.warning,
.post-content .admonition.caution,
.post-content .admonition.danger {
  --admonition-bg: #fff7f0;
  --admonition-border: #ffd7b5;
  --admonition-color: #8a3b00;
}
.post-content .admonition-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--admonition-color);
}
.post-content .admonition-title svg {
  width: 1em;
  height: 1em;
  flex: none;
}
.post-content .admonition > *:last-child {
  margin-bottom: 0;
}
.post-content .admonition > *:first-child {
  margin-top: 0;
}
/* `[[TOC]]` table-of-contents block. The renderer emits a `<p class="toc-title">`
 * (only when the user passes a title attribute) immediately followed by
 * `<nav class="toc"><ul>…</ul></nav>`. Wrap it as a single card so the
 * nav doesn't blur into the surrounding prose, and indent child levels
 * so the depth hierarchy reads at a glance. */
.post-content .toc-title {
  margin: 0 0 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8em;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.post-content nav.toc {
  background: var(--c-code-bg);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 14px 18px 14px 14px;
  margin: 0 0 1.4em;
  /* generous line-height so nested rows breathe */
  font-size: .95em;
}
.post-content nav.toc ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.post-content nav.toc > ul { padding-left: 0; }
.post-content nav.toc ul ul {
  padding-left: 1.2em;
  margin: 4px 0 2px;
  border-left: 1px dashed var(--c-border);
}
.post-content nav.toc li { margin: 3px 0; }
.post-content nav.toc li > a {
  display: inline-block;
  padding: 1px 0;
  border-radius: 4px;
  transition: color .12s ease, background .12s ease;
}
.post-content nav.toc li > a:hover {
  color: var(--c-accent);
  background: rgba(37, 99, 235, .08);
}
.post-content pre {
  background: var(--c-code-bg);
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
}
.post-content code {
  background: var(--c-inline-code-bg);
  border: 1px solid var(--c-inline-code-border);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: .9em;
}
.post-content pre code { background: none; border: none; padding: 0; }
.post-content .math {
  margin: 1.2em 0;
  overflow-x: auto;
  overflow-y: clip;
  text-align: center;
  line-height: 1.4;
}
.post-content .math svg {
  display: inline-block;
  max-width: 100%;
  height: auto;
}
.post-content .drawing {
  display: block;
  margin: 1.2em auto;
  text-align: center;
  overflow-x: auto;
}
.post-content .drawing svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.post-content math {
  font-family: "STIX Two Math", "Latin Modern Math", "Noto Sans Math",
    "XITS Math", "DejaVu Sans", serif;
}
.post-content img { max-width: 100%; border-radius: 8px; }
.post-content table { border-collapse: collapse; }
.post-content th, .post-content td { border: 1px solid var(--c-border); padding: 6px 12px; }

.translations { margin: 18px 0; font-size: .9rem; }
.translations a { color: var(--c-accent); text-decoration: none; margin-left: 6px; }

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--c-border);
}
.post-nav a { color: var(--c-accent); text-decoration: none; }

.site-footer {
  border-top: 1px solid var(--c-border);
  padding: 18px 0;
  margin-top: 48px;
  color: var(--c-muted, #888);
  font-size: .85rem;
  text-align: center;
}

/* Sidebar search form: hides inline results; submitting sends the user
 * to /search?q=... for a full page of matches. */
.side-search-form { margin: 0; }

.search-page { max-width: 760px; }
.search-title { margin: 0 0 14px; font-size: 1.4rem; }
.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.search-form-input {
  flex: 1;
  padding: 9px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--c-fg);
  background: var(--c-code-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-form-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
  background: #fff;
}
.search-form-submit {
  padding: 9px 16px;
  font: inherit;
  font-size: .95rem;
  color: #fff;
  background: var(--c-accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color .15s ease;
}
.search-form-submit:hover { background: #1d4ed8; }

.search-summary {
  margin: 0 0 14px;
  font-size: .9rem;
  color: var(--c-muted);
}
.search-count { font-weight: 700; color: var(--c-fg); }
.search-summary q { font-style: italic; }

.search-results { list-style: none; margin: 0; padding: 0; }
.search-result { margin-bottom: 14px; }
.search-result-link {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.search-result-link:hover {
  border-color: var(--c-accent);
  box-shadow: 0 4px 14px rgba(37, 99, 235, .10);
}
.search-result-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--c-fg);
}
.search-result-link:hover .search-result-title { color: var(--c-accent); }
.search-result-date {
  display: block;
  font-size: .78rem;
  color: var(--c-muted);
  margin-bottom: 6px;
}
.search-result-summary {
  margin: 4px 0 8px;
  color: #444;
  font-size: .92rem;
}
.search-result-tags { margin-top: 6px; }
.search-result-lang {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--c-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.search-empty {
  margin: 14px 0;
  color: var(--c-muted);
  font-size: .95rem;
}