:root {
  --page: #f2f1ed;
  --paper: #fffefa;
  --paper-soft: #f8f7f3;
  --ink: #2c2d2a;
  --ink-soft: #555751;
  --muted: #6f716b;
  --line: #deddd7;
  --line-soft: #ebe9e3;
  --accent: #47736c;
  --accent-soft: #e8efec;
  --warm: #98584c;
  --shadow: 0 12px 34px rgba(46, 45, 40, 0.055);
  --radius: 12px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body.search-is-open { overflow: hidden; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover, a:focus { color: #315c56; }
button, input, select { font: inherit; }
button { color: inherit; }
img { max-width: 100%; height: auto; }
::selection { background: #cfdfda; color: var(--ink); }

.sr-only,
.skip-link:not(:focus) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  z-index: 3000;
  left: 18px;
  top: 18px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
}
:focus-visible { outline: 3px solid rgba(71, 115, 108, 0.34); outline-offset: 3px; }

.site-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 880px);
  gap: 34px;
  width: min(1190px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 72px;
  align-items: start;
}
.site-stage { min-width: 0; }
#main-content { outline: none; }

/* Quiet, personal navigation rail */
.site-rail {
  position: sticky;
  top: 28px;
  z-index: 50;
  min-width: 0;
}
.rail-topbar,
.rail-panel {
  border: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.94);
  box-shadow: var(--shadow);
}
.rail-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.rail-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  text-decoration: none;
}
.rail-brand:hover { color: var(--ink); text-decoration: none; }
.rail-brand__mark {
  display: inline-grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid #b9c8c4;
  border-radius: 50%;
  color: var(--accent);
  font-size: 14px;
  font-family: var(--serif);
}
.rail-topbar__actions { display: flex; gap: 6px; }
.rail-search,
.rail-menu {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.rail-search { display: none; font-size: 25px; line-height: 1; }
.rail-menu { display: none; padding: 12px 9px; }
.rail-menu > span:not(.sr-only) { display: block; height: 1px; margin: 5px 0; background: var(--ink); }
.rail-panel {
  margin-top: -1px;
  padding: 24px 20px 18px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.rail-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
}
.rail-profile:hover { color: var(--ink); text-decoration: none; }
.rail-profile img {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--paper-soft);
  box-shadow: 0 0 0 1px var(--line);
}
.rail-profile__name { margin-top: 12px; font-weight: 650; }
.rail-profile__note { margin-top: 2px; color: var(--muted); font-family: var(--serif); font-size: 13px; }
.rail-links { margin-top: 24px; border-top: 1px solid var(--line-soft); }
.rail-links a,
.rail-links button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
  transition: color .16s ease, padding .16s ease;
}
.rail-links a:hover,
.rail-links button:hover,
.rail-links a[aria-current="page"] { padding-left: 12px; color: var(--accent); text-decoration: none; }
.rail-links small { color: var(--muted); font-size: 11px; font-weight: 400; }
.rail-github { display: inline-block; margin-left: 8px; color: var(--ink-soft); font-size: 12px; text-decoration: none; }
.rail-friends { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 6px; }
.rail-friends__label { display: block; width: 100%; font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.rail-friends__link { display: inline-block; font-size: 12px; color: var(--ink-soft); text-decoration: none; padding: 2px 8px; border: 1px solid var(--line-soft); border-radius: 4px; transition: color .16s ease, border-color .16s ease; }
.rail-friends__link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* Main paper */
.paper {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.page-paper,
.archive-paper,
.post-paper { overflow: visible; }
.page-header,
.post-header {
  margin: 0;
  padding: 48px 58px 36px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent !important;
  color: var(--ink);
  text-align: left;
}
.page-header__eyebrow {
  margin: 0 0 10px;
  color: var(--warm) !important;
  font-size: 11px !important;
  font-weight: 650;
  letter-spacing: .14em;
}
.page-header h1,
.post-header h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -.025em;
}
.page-header > p:last-child {
  max-width: 630px;
  margin: 13px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.85;
}
.page-header--short { padding-bottom: 30px; }
.page-content { padding: 10px 58px 54px; }

/* Home article list: one sheet, not a wall of cards */
.post-list { display: block; }
.post-preview {
  margin: 0 !important;
  padding: 34px 0 36px;
  border-bottom: 1px dashed #d6d4cd;
}
.post-preview:last-child { border-bottom: 0; }
.post-preview__meta {
  display: flex;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .035em;
}
.post-preview__meta span::before { content: "·"; margin-right: 10px; }
.post-preview__link,
.post-preview__link:hover { display: block; color: inherit; text-decoration: none; }
.post-preview h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(23px, 3vw, 29px);
  font-weight: 600;
  line-height: 1.45;
}
.post-preview__link:hover h2 { color: var(--accent); }
.post-preview__subtitle { margin: 8px 0 0; color: var(--ink-soft); font-size: 15px; }
.post-preview__excerpt {
  display: -webkit-box;
  max-width: 650px;
  margin: 12px 0 0;
  overflow: hidden;
  color: #686963;
  font-size: 14px;
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.post-preview__more { display: inline-block; margin-top: 13px; color: var(--accent); font-size: 13px; }
.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  padding-top: 24px;
  color: var(--muted);
  font-size: 13px;
}
.pagination a:last-child { text-align: right; }

/* Long-form reading */
.post-header { padding-bottom: 32px; }
.post-header__tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.post-header__tags a {
  padding: 3px 7px;
  border: 1px solid #cedad6;
  border-radius: 4px;
  color: var(--accent);
  font-size: 11px;
  text-decoration: none;
}
.post-header__subtitle { margin: 13px 0 0; color: var(--ink-soft); font-family: var(--serif); font-size: 17px; }
.post-header__meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; color: var(--muted); font-size: 12px; }
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  gap: 42px;
  padding: 42px 38px 58px 58px;
}
.post-container {
  min-width: 0;
  color: #353632;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.9;
}
.post-container > :first-child { margin-top: 0; }
.post-container p { margin: 0 0 1.45em; }
.post-container h1,
.post-container h2,
.post-container h3,
.post-container h4 {
  position: relative;
  margin: 2.2em 0 .85em;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.5;
}
.post-container h2 { font-size: 1.55em; padding-bottom: .42em; border-bottom: 1px solid var(--line-soft); }
.post-container h3 { font-size: 1.28em; }
.post-container h4 { font-size: 1.08em; }
.post-container blockquote {
  margin: 1.7em 0;
  padding: 1px 0 1px 20px;
  border-left: 3px solid #a6bdb7;
  color: #656660;
  font-family: var(--serif);
  font-size: .96em;
}
.post-container code {
  padding: .16em .35em;
  border: 1px solid #e0dfd9;
  border-radius: 4px;
  background: #f3f2ee;
  color: #8c4c42;
  font-size: .88em;
}
.post-container pre {
  max-width: 100%;
  margin: 1.7em 0;
  padding: 18px 20px;
  overflow: auto;
  border: 1px solid #dddcd5;
  border-radius: 7px;
  background: #f4f3ef;
  color: #333631;
  font-size: 13px;
  line-height: 1.7;
  box-shadow: none;
}
.post-container pre code { padding: 0; border: 0; background: transparent; color: inherit; }
.post-container .highlighter-rouge {
  margin: 1.7em 0;
  overflow: hidden;
  border: 1px solid #dfddd5;
  border-radius: 10px;
  background: #f7f6f1;
  box-shadow: none;
}
.post-container .highlighter-rouge .highlight {
  margin: 0;
  background: transparent;
}
.post-container .highlighter-rouge .highlight pre {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #333631;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.65;
  word-wrap: normal;
  overflow-wrap: normal;
}
.post-container .highlighter-rouge .highlight .rouge-table {
  width: 100%;
  border-collapse: collapse;
}
.post-container .highlighter-rouge .highlight table > tbody > tr > td {
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: top;
}
.post-container .highlighter-rouge .highlight td.rouge-gutter {
  width: auto;
  min-width: 5ch;
  white-space: nowrap;
  background: transparent;
  border-right: 1px solid #e1ddd3;
}
.post-container .highlighter-rouge .highlight td.rouge-code {
  width: 100%;
}
.post-container .highlighter-rouge .highlight td.rouge-gutter pre {
  padding: 16px 8px 16px 0;
  color: #979189;
  text-align: right;
  user-select: none;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: 0;
}
.post-container .highlighter-rouge .highlight td.rouge-code pre {
  padding: 16px 18px 16px 14px;
  overflow-x: auto;
  scrollbar-color: #a49d93 #f0ede6;
}
.post-container .highlighter-rouge .highlight td.rouge-code pre::-webkit-scrollbar {
  height: 12px;
}
.post-container .highlighter-rouge .highlight td.rouge-code pre::-webkit-scrollbar-track {
  background: #f0ede6;
}
.post-container .highlighter-rouge .highlight td.rouge-code pre::-webkit-scrollbar-thumb {
  background: #a49d93;
  border: 3px solid #f0ede6;
  border-radius: 999px;
}
.post-container .highlighter-rouge .lineno {
  color: #979189;
}
.highlight .c, .highlight .cm, .highlight .c1 { color: #7f857d; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn { color: #6b4f8a; font-weight: 600; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #9a5b49; }
.highlight .nf, .highlight .nb { color: #306f7e; }
.highlight .mi, .highlight .mf { color: #a05f35; }
.post-container table { display: block; width: 100%; max-width: 100%; margin: 1.7em 0; overflow-x: auto; border-collapse: collapse; font-size: 14px; }
.post-container th, .post-container td { padding: 9px 12px; border: 1px solid var(--line); white-space: nowrap; }
.post-container th { background: var(--paper-soft); }
.post-container img { display: block; margin: 1.8em auto; border-radius: 7px; }
.post-container hr { margin: 2.6em 0; border: 0; border-top: 1px dashed #cfcdc6; }
.post-container li { margin-bottom: .35em; }
.post-container .note-part-index {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 1.4em 0 0;
}
.post-container .note-part-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  padding: 18px 18px 17px 22px;
  border: 1px solid #d9dee6;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,249,251,.98));
  border-left: 5px solid #d9d4ca;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(46, 45, 40, 0.04);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.post-container .note-part-card:hover {
  color: var(--ink);
  text-decoration: none;
  transform: translateY(-2px);
  border-color: #c8d2dc;
  border-left-color: #c8c1b5;
  background: linear-gradient(180deg, #fff, #f4f7fa);
  box-shadow: 0 14px 28px rgba(46, 45, 40, 0.08);
}
.post-container .note-part-number {
  display: inline-block;
  align-self: flex-start;
  padding: 0;
  color: var(--warm);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
}
.post-container .note-part-card strong {
  min-width: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
}
.post-container .note-part-card span {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}
.post-container .note-part-card strong,
.post-container .note-part-card span { overflow-wrap: anywhere; }
.catalog-container { min-width: 0; }
.side-catalog { position: sticky; top: 36px; padding-left: 14px; border-left: 1px solid var(--line); }
.side-catalog h2 { margin: 0 0 12px; color: var(--muted); font-family: var(--sans); font-size: 11px; font-weight: 650; letter-spacing: .12em; }
.catalog-body { max-height: calc(100vh - 110px); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.catalog-body li { margin: 0; line-height: 1.4; }
.catalog-body a { display: block; padding: 5px 0; color: #898a84; font-size: 12px; text-decoration: none; }
.catalog-body .h3_nav a { padding-left: 10px; font-size: 11px; }
.catalog-body li.active a,
.catalog-body a:hover { color: var(--accent); }
.post-neighbors { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 58px; padding-top: 24px; border-top: 1px dashed var(--line); }
.post-neighbors a { color: var(--ink); text-decoration: none; }
.post-neighbors small, .post-neighbors span { display: block; }
.post-neighbors small { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.post-neighbors span { font-family: var(--serif); font-size: 14px; }
.post-neighbors__next { text-align: right; }
.comment { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.comment h2 { margin: 0 0 14px; font-size: 21px; }

/* General page content */
.page-content:not(.page-content--home) {
  color: #353632;
  font-size: 16px;
  line-height: 1.9;
}
.page-content:not(.page-content--home) h1,
.page-content:not(.page-content--home) h2,
.page-content:not(.page-content--home) h3 { color: var(--ink); font-family: var(--serif); }
.page-content .post-container { width: auto; }
.page-content select { min-height: 42px; padding: 0 36px 0 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
.language-select { display: inline-flex; align-items: center; gap: 10px; margin: 4px 0 26px; color: var(--muted); font-size: 12px; }
.en { display: none; }

/* Archive */
.archive-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 28px 58px; border-bottom: 1px solid var(--line-soft); }
.archive-tags button {
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}
.archive-tags button:hover,
.archive-tags button.focus { border-color: #9eb7b1; background: var(--accent-soft); color: var(--accent); }
.archive-tags sup { color: var(--muted); }
.archive-list { padding: 30px 58px 54px; }
.archive-year { display: grid; grid-template-columns: 74px 1fr; align-items: start; }
.archive-year + .archive-year { margin-top: 24px; }
.archive-year > h2 { position: sticky; top: 30px; margin: 5px 0 0; color: var(--warm); font-family: var(--serif); font-size: 18px; font-weight: 500; }
.archive-year__items { min-width: 0; }
.archive-item { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 9px 0; border: 0; }
.archive-item time { color: var(--muted); font-size: 11px; }
.archive-item a { color: var(--ink); font-family: var(--serif); font-size: 15px; text-decoration: none; }
.archive-item a:hover { color: var(--accent); }
.d-none { display: none !important; }

/* Search */
.search-dialog[hidden] { display: none; }
.search-dialog { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: start center; padding: 11vh 18px 30px; }
.search-dialog__backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(43, 44, 41, .42); cursor: default; }
.search-dialog__panel { position: relative; width: min(620px, 100%); max-height: 74vh; overflow: auto; padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 24px 70px rgba(35, 35, 32, .18); }
.search-dialog__head { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.search-dialog__head p { margin: 0 0 3px; color: var(--muted); font-size: 11px; }
.search-dialog__head h2 { margin: 0; font-family: var(--serif); font-size: 25px; font-weight: 600; }
.search-dialog__head button { width: 42px; height: 42px; border: 0; background: transparent; color: var(--muted); font-size: 28px; cursor: pointer; }
.search-field { display: block; margin-top: 24px; }
.search-field input { width: 100%; height: 50px; padding: 0 14px; border: 1px solid #c9c8c1; border-radius: 6px; background: #fff; color: var(--ink); }
.search-field input:focus { border-color: var(--accent); outline: 3px solid rgba(71,115,108,.14); }
.search-results { margin-top: 14px; }
.search-results a { display: flex; justify-content: space-between; gap: 20px; padding: 13px 3px; border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.search-results a:hover strong { color: var(--accent); }
.search-results strong { font-family: var(--serif); font-weight: 500; }
.search-results span, .search-hint { color: var(--muted); font-size: 12px; }

.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px 8px 0; color: #8b8b85; font-size: 11px; }
.site-footer p { margin: 0; }

.not-found { padding: 72px 58px; text-align: center; }
.not-found__code { margin: 0; color: var(--warm); font-family: var(--serif); font-size: 18px; letter-spacing: .18em; }
.not-found h1 { margin: 14px 0 8px; font-family: var(--serif); font-size: clamp(29px, 5vw, 42px); font-weight: 600; }
.not-found > p:not(.not-found__code) { max-width: 500px; margin: 0 auto 24px; color: var(--muted); }
.not-found > a { display: inline-block; padding-bottom: 2px; border-bottom: 1px solid #9ab1ab; text-decoration: none; }

@media (max-width: 980px) {
  .site-shell { grid-template-columns: 218px minmax(0, 1fr); gap: 24px; width: min(100% - 32px, 1040px); }
  .page-header, .post-header { padding: 40px 42px 30px; }
  .page-content { padding: 8px 42px 46px; }
  .post-layout { grid-template-columns: minmax(0,1fr); padding: 38px 42px 50px; }
  .catalog-container { display: none; }
  .archive-tags { padding: 24px 42px; }
  .archive-list { padding: 28px 42px 48px; }
  .post-container .highlighter-rouge .highlight td.rouge-gutter pre { padding: 14px 7px 14px 0; }
  .post-container .highlighter-rouge .highlight td.rouge-code pre { padding: 14px 14px 14px 12px; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .site-shell { display: block; width: auto; margin: 0; padding: 0 12px 56px; }
  .site-rail { top: 0; margin: 0 -12px 14px; padding: 10px 12px 0; background: var(--page); }
  .rail-topbar { min-height: 58px; padding: 0 14px; border-radius: 10px; }
  .rail-brand { font-size: 17px; }
  .rail-brand__mark { width: 28px; height: 28px; }
  .rail-search, .rail-menu { display: block; width: 44px; height: 44px; }
  .rail-panel { position: absolute; left: 12px; right: 12px; top: 68px; margin: 0; padding: 8px 16px 14px; border-radius: 10px; box-shadow: 0 16px 44px rgba(43,43,39,.14); }
  .rail-panel:not(.is-open) { display: none; }
  	  .rail-profile, .rail-status, .rail-github, .rail-friends { display: none; }
  .rail-links { margin: 0; border-top: 0; }
  .rail-links a, .rail-links button { min-height: 46px; }
  .paper { border-radius: 10px; }
  .page-header, .post-header { padding: 30px 24px 25px; }
  .page-header h1, .post-header h1 { font-size: 29px; }
  .page-header > p:last-child { font-size: 14px; }
  .page-content { padding: 2px 24px 36px; }
  .post-preview { padding: 27px 0 29px; }
  .post-preview h2 { font-size: 23px; }
  .post-preview__excerpt { font-size: 13px; -webkit-line-clamp: 3; }
  .post-layout { padding: 30px 24px 42px; }
  .post-container { font-size: 16px; line-height: 1.86; }
  .post-container pre { margin-left: -8px; margin-right: -8px; padding: 15px; }
  .post-container .highlighter-rouge .highlight td.rouge-gutter pre { padding: 14px 6px 14px 0; }
  .post-container .highlighter-rouge .highlight td.rouge-code pre { padding: 14px 12px 14px 12px; }
  .post-container .note-part-index { grid-template-columns: 1fr; gap: 12px; }
  .post-container .note-part-card { padding: 16px; }
  .post-neighbors { grid-template-columns: 1fr; }
  .post-neighbors__next { text-align: left; }
  .archive-tags { gap: 6px; padding: 20px 24px; }
  .archive-tags button { min-height: 40px; }
  .archive-list { padding: 24px 24px 38px; }
  .archive-year { display: block; }
  .archive-year > h2 { position: static; margin: 14px 0 7px; }
  .archive-item { grid-template-columns: 48px minmax(0, 1fr); }
  .search-dialog { padding-top: 9vh; }
  .search-dialog__panel { padding: 22px 18px; }
  .search-results a { display: block; }
  .search-results span { display: block; margin-top: 4px; }
  .site-footer { padding: 20px 4px 0; }
  .not-found { padding: 58px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================================
   Dark mode — toggle via [data-theme="dark"] on <html>
   ========================================================================= */
[data-theme="dark"] {
  --page: #1c1c1a;
  --paper: #232321;
  --paper-soft: #282826;
  --ink: #dedcd4;
  --ink-soft: #9e9c94;
  --muted: #7d7b74;
  --line: #3a3a36;
  --line-soft: #31312e;
  --accent: #5cb4a7;
  --accent-soft: #1d2f2c;
  --warm: #d68878;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}
[data-theme="dark"] a:hover,
[data-theme="dark"] a:focus { color: #7fcbc0; }
[data-theme="dark"] ::selection { background: #2f4944; color: #dedcd4; }
[data-theme="dark"] .rail-topbar,
[data-theme="dark"] .rail-panel { background: rgba(35, 35, 33, 0.94); }
[data-theme="dark"] .rail-brand__mark { border-color: #4f635e; }
[data-theme="dark"] .rail-links a,
[data-theme="dark"] .rail-links button { border-bottom-color: var(--line-soft); }
[data-theme="dark"] .site-footer { color: #6e6c65; }
[data-theme="dark"] .post-container { color: #d6d4cc; }
[data-theme="dark"] .post-container blockquote {
  border-left-color: #4a635e;
  color: #95938b;
}
[data-theme="dark"] .post-container code {
  border-color: #3e3d39;
  background: #2b2b28;
  color: #d49488;
}
[data-theme="dark"] .post-container pre {
  border-color: #3a3935;
  background: #252523;
  color: #cac8c0;
}
[data-theme="dark"] .post-container .highlighter-rouge {
  border-color: #3a3a36;
  background: #1f1f1e;
}
[data-theme="dark"] .post-container .highlighter-rouge .highlight pre {
  color: #d6d4cc;
}
[data-theme="dark"] .post-container .highlighter-rouge .highlight td.rouge-gutter {
  border-right-color: #3a3a36;
}
[data-theme="dark"] .post-container .highlighter-rouge .highlight td.rouge-gutter pre,
[data-theme="dark"] .post-container .highlighter-rouge .lineno {
  color: #6d6b64;
}
[data-theme="dark"] .post-container .highlighter-rouge .highlight td.rouge-code pre {
  scrollbar-color: #4a4944 #2a2a27;
}
[data-theme="dark"] .post-container .highlighter-rouge .highlight td.rouge-code pre::-webkit-scrollbar-track { background: #2a2a27; }
[data-theme="dark"] .post-container .highlighter-rouge .highlight td.rouge-code pre::-webkit-scrollbar-thumb { background: #4a4944; border-color: #2a2a27; }
[data-theme="dark"] .highlight .c, [data-theme="dark"] .highlight .cm, [data-theme="dark"] .highlight .c1 { color: #7a8777; }
[data-theme="dark"] .highlight .k, [data-theme="dark"] .highlight .kd, [data-theme="dark"] .highlight .kn { color: #b794d0; }
[data-theme="dark"] .highlight .s, [data-theme="dark"] .highlight .s1, [data-theme="dark"] .highlight .s2 { color: #d9a28a; }
[data-theme="dark"] .highlight .nf, [data-theme="dark"] .highlight .nb { color: #6fbfd0; }
[data-theme="dark"] .highlight .mi, [data-theme="dark"] .highlight .mf { color: #d6a071; }
[data-theme="dark"] .post-container hr { border-top-color: #393834; }
[data-theme="dark"] .post-container .note-part-card {
  border-color: #353531;
  background: linear-gradient(180deg, rgba(40,40,37,.98), rgba(35,35,33,.98));
  border-left-color: #3e3c37;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
}
[data-theme="dark"] .post-container .note-part-card:hover {
  border-color: #44433e;
  border-left-color: #5a5851;
  background: linear-gradient(180deg, #2a2a27, #252522);
  box-shadow: 0 14px 28px rgba(0,0,0,0.35);
}
[data-theme="dark"] .post-header__tags a { border-color: #354540; }
[data-theme="dark"] .post-preview { border-bottom-color: #33322e; }
[data-theme="dark"] .post-preview__excerpt { color: #96958d; }
[data-theme="dark"] .post-container .page-content:not(.page-content--home) { color: #d6d4cc; }
[data-theme="dark"] .catalog-body a { color: #7a7972; }
[data-theme="dark"] .search-dialog__backdrop { background: rgba(0, 0, 0, 0.55); }
[data-theme="dark"] .search-field input {
  border-color: #3c3b37;
  background: #1c1c1a;
}
[data-theme="dark"] .search-field input:focus { outline-color: rgba(92, 180, 167, 0.2); }
[data-theme="dark"] .archive-tags button { border-color: var(--line); background: var(--paper); }
[data-theme="dark"] .archive-tags button:hover,
[data-theme="dark"] .archive-tags button.focus { border-color: #47736c; }
[data-theme="dark"] .not-found > a { border-bottom-color: #3d5450; }
[data-theme="dark"] .search-dialog__panel { box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); }
[data-theme="dark"] .fab-btn { background: rgba(45, 45, 42, 0.92); border-color: #3a3a36; color: #b5b3ab; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
[data-theme="dark"] .fab-btn:hover { background: rgba(55, 55, 50, 0.96); color: #dedcd4; }
[data-theme="dark"] .fab-btn.is-visible { transform: translateY(0) scale(1); }
[data-theme="dark"] .fab-sun { opacity: 0; }
[data-theme="dark"] .fab-moon { opacity: 1; }
@media (max-width: 760px) {
  [data-theme="dark"] .rail-panel { box-shadow: 0 16px 44px rgba(0,0,0,.4); }
}

/* =========================================================================
   Floating action buttons (theme toggle + back to top)
   ========================================================================= */
.fab-container {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fab-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid #d6d4cd;
  border-radius: 50%;
  background: rgba(255, 254, 250, 0.92);
  color: #6f716b;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(46, 45, 40, 0.1);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, color .2s ease, opacity .25s ease;
  transform: translateY(0) scale(1);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.fab-btn:hover {
  background: rgba(255, 254, 250, 0.98);
  color: #47736c;
  box-shadow: 0 6px 24px rgba(46, 45, 40, 0.14);
  transform: translateY(-2px) scale(1.04);
}
.fab-btn:active {
  transform: translateY(0) scale(.94);
}
.fab-btn:focus-visible {
  outline: 3px solid rgba(71, 115, 108, 0.34);
  outline-offset: 3px;
}
.fab-icon {
  width: 20px;
  height: 20px;
  display: block;
}
.fab-sun,
.fab-moon {
  position: absolute;
  transition: opacity .25s ease, transform .3s ease;
}
.fab-sun { opacity: 1; }
.fab-moon { opacity: 0; }
.fab-btn[data-scroll-top] {
  opacity: 0;
  transform: translateY(12px) scale(.88);
  pointer-events: none;
}
.fab-btn[data-scroll-top].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.fab-container {
  transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .22s ease;
}
.fab-container.is-hidden {
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}
/* Page transition */
#pjax-root {
  transition: opacity .28s ease, transform .28s ease;
  will-change: opacity, transform;
}
#pjax-root[aria-busy="true"] {
  opacity: 0;
  transform: translateY(8px);
}
