/* ============================================================
   Aurora theme — 研究报告美学
   米白 + 琥珀 + 宋体衬线（对齐 investment.walkerdu.com）

   1. Tokens          9. Code blocks
   2. Reset / base    10. Comments
   3. Nav             11. Taxonomy / archives
   4. Layout          12. 404 / footer
   5. Post list       13. Utilities
   6. Sidebar         14. Dark mode
   7. Article layout  15. Responsive
   8. Article type
   ============================================================ */

/* ------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------ */
:root {
  --bg:            #F7F5F3;
  --bg-secondary:  #FFFFFF;
  --bg-card:       #FFFFFF;
  --bg-elevated:   #FAFAF9;
  --bg-warm:       #F5F2EE;
  --bg-code:       #EFECE8;

  --text:          #2D2926;
  --text-secondary:#5C5652;
  --text-muted:    #8A8480;
  --text-light:    #A8A29E;

  --accent:        #D97706;
  --accent-soft:   #FEF3C7;
  --accent-hover:  #B45309;

  --border:        #E5E2DE;
  --border-light:  #F0EEEC;
  --border-strong: #D6D2CC;

  --red:   #DC2626;
  --green: #059669;

  --shadow-sm: 0 1px 2px rgba(45,41,38,.04), 0 1px 3px rgba(45,41,38,.06);
  --shadow-md: 0 4px 16px rgba(45,41,38,.06), 0 2px 6px rgba(45,41,38,.04);
  --shadow-lg: 0 12px 40px rgba(217,119,6,.10), 0 4px 12px rgba(45,41,38,.05);

  --radius:    14px;
  --radius-sm: 10px;

  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', Georgia, serif;
  --font-sans:  'Inter', -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  --font-mono:  'SF Mono', 'Fira Code', Menlo, Consolas, monospace;

  --nav-h:  64px;
  --maxw:         1180px;   /* list pages: content + sidebar */
  --maxw-article: 1480px;   /* article pages: toc + content + sidebar */
  --toc-w:  220px;
  --side-w: 300px;
  --col-gap: 44px;
  --gutter: 32px;
}

/* ------------------------------------------------------------
   2. Reset / base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s ease, color .25s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: inherit; font-weight: 600;
  letter-spacing: .01em; line-height: 1.3;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--accent-soft); color: var(--accent-hover); }

/* ------------------------------------------------------------
   3. Nav
   ------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-light);
}

.site-header .container {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}

.site-logo {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--text); font-weight: 600; font-size: 1.02rem; min-width: 0;
}
.site-logo:hover { color: var(--accent); text-decoration: none; }
.site-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent); color: #fff; font-size: .95rem; font-weight: 700;
  box-shadow: 0 2px 8px rgba(217,119,6,.35);
}
.site-logo-text {
  letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav-right { display: flex; align-items: center; gap: 10px; }
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
  padding: 7px 13px; border-radius: 999px;
  color: var(--text-secondary); font-size: .9rem; font-weight: 500;
  transition: background .15s, color .15s; white-space: nowrap;
}
.header-nav a:hover {
  background: var(--accent-soft); color: var(--accent-hover); text-decoration: none;
}

.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-secondary); transition: all .15s; font-size: .9rem;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.menu-toggle {
  display: none;
  width: 36px; height: 36px; border-radius: 8px;
  align-items: center; justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--border); background: var(--bg-elevated);
}

/* ------------------------------------------------------------
   4. Layout
   ------------------------------------------------------------ */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* article pages need room for three columns */
.container--wide { max-width: var(--maxw-article); }

/* list pages: content + right sidebar */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-w);
  gap: var(--col-gap);
  align-items: start;
  padding: 36px 0 72px;
}

/* ------------------------------------------------------------
   5. Post list
   ------------------------------------------------------------ */
.post-list { list-style: none; }

.post-card {
  position: relative; overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.post-card + .post-card { margin-top: 16px; }
.post-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent);
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.post-card__meta {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 7px;
}

.post-date {
  font-family: var(--font-sans);
  font-size: .78rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.post-cat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans);
  font-size: .76rem; font-weight: 600; letter-spacing: .06em;
  color: var(--accent);
}
.post-cat-pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.post-cat-pill:hover { color: var(--accent-hover); text-decoration: none; }

.post-card__title { font-size: 1.2rem; font-weight: 600; line-height: 1.42; margin-bottom: 7px; }
.post-card__title a { color: var(--text); transition: color .15s; }
.post-card__title a:hover { color: var(--accent); text-decoration: none; }

.post-card__summary {
  font-size: .91rem; color: var(--text-secondary); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.post-card__footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 13px;
}

.post-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-tag {
  font-family: var(--font-sans);
  font-size: .74rem; padding: 3px 9px; border-radius: 6px;
  background: var(--bg-warm); color: var(--text-muted);
  border: 1px solid var(--border-light); transition: all .15s;
}
.post-tag:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); text-decoration: none;
}

.post-pv {
  font-family: var(--font-sans);
  font-size: .74rem; color: var(--text-light); white-space: nowrap;
}

/* pagination */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 36px 0 4px; font-family: var(--font-sans);
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 38px; padding: 0 16px;
  border-radius: 999px; font-size: .88rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg-card);
}
.pagination a { color: var(--text-secondary); transition: all .15s; }
.pagination a:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ------------------------------------------------------------
   6. Sidebar
   ------------------------------------------------------------ */
/* Sidebar flows with the page — no sticky, no inner scrollbar.
   Every section is laid out in full. */
.sidebar {
  min-width: 0;
}

.sidebar-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px 19px;
  box-shadow: var(--shadow-sm);
}
.sidebar-section + .sidebar-section { margin-top: 16px; }

.sidebar-title {
  font-family: var(--font-sans);
  font-size: .74rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 13px;
}

/* search */
.sidebar-search {
  position: relative; display: flex; align-items: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 13px; height: 37px;
  transition: border-color .15s, box-shadow .15s;
}
.sidebar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sidebar-search-icon { color: var(--text-muted); flex-shrink: 0; }
.sidebar-search input {
  border: none; background: none; outline: none; color: var(--text);
  width: 100%; height: 100%; padding: 0 9px; font-size: .9rem; min-width: 0;
}
.sidebar-search input::placeholder { color: var(--text-muted); }

.search-results { margin-top: 11px; display: none; }
.search-results.active { display: block; }
.search-result-item { padding: 7px 0; border-bottom: 1px solid var(--border-light); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item a { color: var(--text); font-size: .89rem; font-weight: 500; line-height: 1.45; display: block; }
.search-result-item a:hover { color: var(--accent); text-decoration: none; }
.search-result-date { font-family: var(--font-sans); font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.search-empty { font-size: .87rem; color: var(--text-muted); padding: 5px 0; }

/* category / archive lists */
.cat-list, .archive-list { list-style: none; }
.cat-list li + li, .archive-list li + li { margin-top: 2px; }
.cat-list a, .archive-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: .89rem;
  transition: background .15s, color .15s;
}
.cat-list a:hover, .archive-list a:hover {
  background: var(--accent-soft); color: var(--accent-hover); text-decoration: none;
}
.cat-count {
  font-family: var(--font-sans); font-size: .74rem; color: var(--text-light);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}

/* tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud a {
  font-family: var(--font-sans);
  font-size: .76rem; padding: 4px 11px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); transition: all .15s;
}
.tag-cloud a:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); text-decoration: none;
}

/* recent */
.recent-list { list-style: none; }
.recent-list li + li { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border-light); }
.recent-list a { color: var(--text); font-size: .89rem; line-height: 1.45; display: block; font-weight: 500; }
.recent-list a:hover { color: var(--accent); text-decoration: none; }
.recent-date { font-family: var(--font-sans); font-size: .72rem; color: var(--text-muted); margin-top: 3px; }

.sidebar-about { font-size: .89rem; color: var(--text-secondary); line-height: 1.7; }
.sidebar-meta { font-family: var(--font-sans); font-size: .76rem; color: var(--text-muted); margin-top: 9px; }
.sidebar-meta a { color: var(--text-muted); }
.sidebar-meta a:hover { color: var(--accent); }

/* ------------------------------------------------------------
   7. Article layout — LEFT toc + content + RIGHT sidebar
   ------------------------------------------------------------ */
.article-layout {
  display: grid;
  grid-template-columns: var(--toc-w) minmax(0, 1fr) var(--side-w);
  gap: var(--col-gap);
  align-items: start;
  padding: 36px 0 72px;
}

/* TOC column stays pinned while reading; the right sidebar flows.
   align-self:start keeps the sticky box tied to the top of its row. */
.article-aside {
  position: sticky; top: calc(var(--nav-h) + 20px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 40px);
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
  min-width: 0;
}
.article-aside::-webkit-scrollbar { width: 4px; }
.article-aside::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.article-main { min-width: 0; }

/* TOC */
.toc { border-left: 2px solid var(--border); }
.toc-title {
  font-family: var(--font-sans);
  font-size: .72rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 11px; padding-left: 14px;
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc ul ul { padding-left: 13px; }
.toc li { margin: 0; }
.toc a {
  display: block; color: var(--text-muted);
  font-size: .83rem; line-height: 1.5;
  padding: 4px 0 4px 14px;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color .15s, border-color .15s;
}
.toc a:hover { color: var(--accent); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* mobile TOC (collapsible) */
.toc-mobile {
  display: none;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 22px;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.toc-mobile summary {
  padding: 12px 17px; cursor: pointer; font-weight: 600; font-size: .91rem;
  display: flex; align-items: center; gap: 8px; list-style: none;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::before { content: "☰"; color: var(--accent); font-size: .88rem; }
.toc-mobile[open] summary { border-bottom: 1px solid var(--border-light); }
.toc-mobile .toc { border-left: none; padding: 12px 17px 16px; }
.toc-mobile .toc-title { display: none; }
.toc-mobile .toc a { padding-left: 10px; }

/* reading progress */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 2px;
  background: var(--accent); z-index: 200; transition: width 100ms linear;
}

/* ------------------------------------------------------------
   8. Article typography
   ------------------------------------------------------------ */
.post-header {
  padding-bottom: 22px; border-bottom: 1px solid var(--border); margin-bottom: 30px;
}
.post-header__meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 13px;
}
.post-header__title {
  font-size: clamp(1.55rem, 3.2vw, 2rem);
  font-weight: 700; line-height: 1.28; color: var(--text);
}

/* Width is governed by the grid column, not a ch-based cap, so the
   article fills the wider three-column layout. */
.post-body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
}

.post-body h1, .post-body h2, .post-body h3,
.post-body h4, .post-body h5, .post-body h6 {
  margin: 1.85em 0 .68em; color: var(--text);
  scroll-margin-top: calc(var(--nav-h) + 20px);
}
.post-body h1 { font-size: 1.55rem; }
.post-body h2 { font-size: 1.32rem; padding-bottom: .34em; border-bottom: 1px solid var(--border); }
.post-body h3 { font-size: 1.14rem; }
.post-body h4 { font-size: 1.01rem; }

.post-body p { margin: 1.1em 0; }
.post-body p:first-child { margin-top: 0; }

.post-body a {
  color: var(--accent); text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px; transition: text-decoration-color .15s;
}
.post-body a:hover { text-decoration-color: var(--accent); }

.post-body ul, .post-body ol { padding-left: 1.45em; margin: 1em 0; }
.post-body li { margin: .32em 0; }
.post-body li > ul, .post-body li > ol { margin: .18em 0; }

.post-body blockquote {
  border-left: 3px solid var(--accent); background: var(--bg-warm);
  margin: 1.5em 0; padding: 13px 19px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.post-body blockquote p { margin: .4em 0; }
.post-body blockquote p:only-child { margin: 0; }

.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2.1em 0; }

.post-body :not(pre) > code {
  font-family: var(--font-mono); font-size: .86em;
  padding: .12em .4em; background: var(--bg-code);
  border-radius: 5px; color: #9A3412; word-break: break-word;
}

.post-body img {
  border-radius: var(--radius-sm); margin: 1.55em auto;
  border: 1px solid var(--border-light); cursor: zoom-in;
  background: var(--bg-secondary);
}

/* wide media may exceed the text measure */
.post-body img, .table-wrap, .code-block { max-width: 100%; }

/* tables: horizontal scroll instead of blowing out layout */
.table-wrap {
  overflow-x: auto; margin: 1.55em 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); -webkit-overflow-scrolling: touch;
}
.post-body table {
  border-collapse: collapse; width: 100%;
  font-size: .87rem; font-family: var(--font-sans);
}
.post-body th, .post-body td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  text-align: left; vertical-align: top;
}
.post-body th:last-child, .post-body td:last-child { border-right: none; }
.post-body tbody tr:last-child td { border-bottom: none; }
.post-body thead th { background: var(--bg-warm); font-weight: 600; white-space: nowrap; color: var(--text); }
.post-body tbody tr:hover { background: var(--bg-elevated); }

.post-body .task-list-item { list-style: none; margin-left: -1.45em; }
.post-body .task-list-item input { margin-right: .5em; }

.post-footer {
  margin-top: 38px; padding-top: 20px; border-top: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 13px; flex-wrap: wrap;
}
.post-footer__label {
  font-family: var(--font-sans); font-size: .77rem; font-weight: 600;
  color: var(--text-muted); letter-spacing: .08em; white-space: nowrap; padding-top: 4px;
}

/* ------------------------------------------------------------
   9. Code blocks
   ------------------------------------------------------------ */
.code-block {
  margin: 1.55em 0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-code);
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 13px; background: var(--bg-warm); border-bottom: 1px solid var(--border);
}
.code-lang { font-family: var(--font-mono); font-size: .72rem; color: var(--text-muted); font-weight: 600; }
.copy-btn {
  font-family: var(--font-sans); font-size: .72rem; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 9px; background: var(--bg-card); transition: all .15s;
}
.copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.copy-btn.copied { background: var(--green); color: #fff; border-color: var(--green); }

.code-block pre.highlight {
  margin: 0; padding: 13px 16px; overflow-x: auto;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.7;
  background: var(--bg-code); -webkit-overflow-scrolling: touch;
}
.code-block pre.highlight code {
  font-family: inherit; font-size: inherit; background: none;
  border: none; padding: 0; color: inherit; word-break: normal; white-space: pre;
}

/* ---- prev / next post navigation ---- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 36px;
}
.post-nav__item {
  display: flex; flex-direction: column; gap: 5px;
  padding: 15px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  min-width: 0;
}
a.post-nav__item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
  text-decoration: none;
}
.post-nav__item--empty {
  background: none; border: none; box-shadow: none; padding: 0;
}
.post-nav__item--next { text-align: right; }
.post-nav__label {
  font-family: var(--font-sans);
  font-size: .76rem; font-weight: 600; letter-spacing: .06em;
  color: var(--accent);
}
.post-nav__title {
  font-size: .96rem; font-weight: 600; color: var(--text); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
a.post-nav__item:hover .post-nav__title { color: var(--accent); }
.post-nav__date {
  font-family: var(--font-sans); font-size: .74rem; color: var(--text-muted);
}

/* ---- floating scroll to top / bottom ---- */
.scroll-nav {
  position: fixed;
  right: 22px; bottom: 28px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 90;
  opacity: 0; visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s var(--ease, ease), transform .2s, visibility .2s;
}
.scroll-nav.visible { opacity: 1; visibility: visible; transform: none; }
.scroll-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  transition: background .15s, color .15s, border-color .15s;
}
.scroll-btn:hover {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.scroll-btn:disabled { opacity: .35; pointer-events: none; }

/* ------------------------------------------------------------
   10. Comments
   ------------------------------------------------------------ */
.comments-section {
  margin-top: 46px; padding-top: 26px; border-top: 1px solid var(--border);
}
.comments-title { font-size: 1.12rem; font-weight: 600; margin-bottom: 18px; }
#disqus_thread { min-height: 160px; }

/* ------------------------------------------------------------
   11. Taxonomy / archives
   ------------------------------------------------------------ */
.page-header { padding: 4px 0 24px; }
.page-header__label {
  font-family: var(--font-sans); font-size: .77rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin-bottom: 9px;
}
.page-header__title { font-size: clamp(1.45rem, 2.8vw, 1.9rem); font-weight: 700; }
.page-header__count {
  font-family: var(--font-sans); font-size: .85rem; color: var(--text-muted); margin-top: 7px;
}

.archive-year-group + .archive-year-group { margin-top: 30px; }
.archive-year-heading {
  font-size: 1.26rem; font-weight: 700; margin-bottom: 13px;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 11px;
}
.archive-year-heading .year-count {
  font-family: var(--font-sans); font-size: .81rem; font-weight: 400; color: var(--text-muted);
}

.archive-post-list {
  list-style: none; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.archive-post-item {
  display: flex; align-items: baseline; gap: 15px; padding: 11px 19px;
  border-bottom: 1px solid var(--border-light); transition: background .15s;
}
.archive-post-item:last-child { border-bottom: none; }
.archive-post-item:hover { background: var(--bg-elevated); }
.archive-post-date {
  font-family: var(--font-sans); font-size: .78rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 3.4em; flex-shrink: 0;
}
.archive-post-title { font-size: .94rem; color: var(--text); font-weight: 500; min-width: 0; }
.archive-post-title:hover { color: var(--accent); text-decoration: none; }

.cats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 15px; margin-top: 6px;
}
.cat-card {
  position: relative; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px 19px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 5px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.cat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent);
}
.cat-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
  border-color: var(--border-strong); text-decoration: none;
}
.cat-card__name { font-weight: 600; color: var(--text); font-size: 1.02rem; }
.cat-card:hover .cat-card__name { color: var(--accent); }
.cat-card__count { font-family: var(--font-sans); font-size: .79rem; color: var(--text-muted); }

/* ------------------------------------------------------------
   12. 404 / footer
   ------------------------------------------------------------ */
.not-found {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 86px 22px; gap: 13px;
}
.not-found__code {
  font-family: var(--font-sans); font-size: 4.8rem; font-weight: 700;
  color: var(--border-strong); line-height: 1;
}
.not-found__title { font-size: 1.38rem; font-weight: 600; }
.not-found__desc { color: var(--text-muted); max-width: 40ch; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 22px; border-radius: 999px; font-size: .91rem; font-weight: 600;
  background: var(--accent); color: #fff; transition: background .15s; margin-top: 7px;
}
.btn:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }

.site-footer { border-top: 1px solid var(--border); background: var(--bg-elevated); padding: 26px 0; }
.site-footer .container {
  display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-wrap: wrap;
}
.footer-copy { font-size: .85rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 17px; }
.footer-links a { font-size: .85rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------
   13. Utilities
   ------------------------------------------------------------ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(45,41,38,.88);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; opacity: 0; pointer-events: none; transition: opacity .18s; padding: 22px;
}
.lightbox-overlay.active { opacity: 1; pointer-events: auto; }
.lightbox-overlay img {
  max-width: 92vw; max-height: 90vh; border-radius: var(--radius-sm);
  border: none; cursor: default; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

/* ------------------------------------------------------------
   14. Dark mode
   ------------------------------------------------------------ */
[data-theme="dark"] {
  --bg:            #1C1917;
  --bg-secondary:  #292524;
  --bg-card:       #292524;
  --bg-elevated:   #1F1B17;
  --bg-warm:       #2A2520;
  --bg-code:       #2A2520;

  --text:          #F5F5F4;
  --text-secondary:#D6D3D1;
  --text-muted:    #A8A29E;
  --text-light:    #78716C;

  --accent:        #F59E0B;
  --accent-soft:   #422006;
  --accent-hover:  #FBBF24;

  --border:        #44403C;
  --border-light:  #292524;
  --border-strong: #57534E;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.45);
}
[data-theme="dark"] .post-body :not(pre) > code { color: #FDBA74; }
[data-theme="dark"] .site-logo-mark { box-shadow: 0 2px 8px rgba(245,158,11,.3); }

/* ------------------------------------------------------------
   15. Responsive
   ------------------------------------------------------------ */

/* ≤1300px: article drops the right sidebar below the content.
   It must stay in column 2 — spanning back into column 1 would collide
   with the sticky TOC once the page is scrolled down. */
@media (max-width: 1300px) {
  .article-layout { grid-template-columns: var(--toc-w) minmax(0, 1fr); }
  .article-layout > .sidebar {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px; align-items: start;
    margin-top: 36px;
  }
  .article-layout > .sidebar .sidebar-section + .sidebar-section { margin-top: 0; }
}

/* ≤1100px: list sidebar drops below; article TOC collapses to the top */
@media (max-width: 1100px) {
  :root { --gutter: 24px; --col-gap: 32px; }

  .main-layout { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .main-layout > .sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px; align-items: start;
  }
  .main-layout > .sidebar .sidebar-section + .sidebar-section { margin-top: 0; }

  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .article-aside { display: none; }
  .toc-mobile { display: block; }
  /* TOC column is gone, so the sidebar returns to the single column */
  .article-layout > .sidebar { grid-column: 1; margin-top: 30px; }
}

/* ≤760px: single column, hamburger nav */
@media (max-width: 760px) {
  :root { --gutter: 18px; --nav-h: 56px; }

  body { font-size: 15px; }

  .site-logo-text { display: none; }
  .header-nav {
    display: none;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    padding: 11px var(--gutter); gap: 2px;
    box-shadow: var(--shadow-md); z-index: 99;
  }
  .header-nav.open { display: flex; }
  .header-nav a { padding: 10px 12px; border-radius: var(--radius-sm); }
  .menu-toggle { display: inline-flex; }

  .main-layout, .article-layout { padding: 22px 0 46px; }

  .post-card { padding: 17px 19px; }
  .post-card__title { font-size: 1.09rem; }

  .main-layout > .sidebar,
  .article-layout > .sidebar { grid-template-columns: 1fr; }

  .post-body h1 { font-size: 1.38rem; }
  .post-body h2 { font-size: 1.2rem; }
  .post-body h3 { font-size: 1.07rem; }

  .archive-post-item { gap: 11px; padding: 10px 15px; }
  .pagination a, .pagination span { padding: 0 12px; min-width: 36px; height: 36px; }

  .post-nav { grid-template-columns: 1fr; }
  .post-nav__item--next { text-align: left; }
  .post-nav__item--empty { display: none; }

  .scroll-nav { right: 14px; bottom: 18px; }
  .scroll-btn { width: 34px; height: 34px; }

  .site-footer .container { flex-direction: column; text-align: center; gap: 9px; }
}

@media (max-width: 460px) {
  .post-header__title { font-size: 1.32rem; }
  .not-found__code { font-size: 3.5rem; }
  .cats-grid { grid-template-columns: 1fr; }
}

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

/* print */
@media print {
  .site-header, .sidebar, .article-aside, .toc-mobile,
  .comments-section, .site-footer, .reading-progress, .copy-btn,
  .scroll-nav, .post-nav { display: none !important; }
  .article-layout, .main-layout { grid-template-columns: 1fr; padding: 0; }
  body { background: #fff; font-size: 11pt; }
  .post-body { max-width: none; }
}
