/* ==========================================
   黄博的博客 — 杂志/书页排版 + 暗色模式
   ========================================== */

/* ----- 1. 自定义属性 ----- */
:root {
  --bg:            #f9f7f3;
  --card:          #fffefc;
  --ink:           #2b2b2b;
  --ink-strong:    #171717;
  --muted:         #8c8c8c;
  --line:          #e5e0d6;
  --accent:        #b45f3c;
  --accent-hover:  #99492c;
  --accent-soft:   color-mix(in srgb, var(--accent) 9%, transparent);
  --code-bg:       #f4f1eb;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.04);
  --shadow-md:     0 4px 20px rgba(0,0,0,.07);
  --radius:        8px;

  --font-ui:    -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-body:  "Noto Serif SC", "Source Han Serif SC", "STSong", "Songti SC",
                "Noto Serif", Georgia, "Times New Roman", "SimSun", serif;
  --font-mono:  "SF Mono", "Fira Code", "Cascadia Code", "JetBrains Mono",
                "Consolas", "Source Code Pro", "Menlo", monospace;
}

[data-theme="dark"] {
  --bg:            #1a1a1c;
  --card:          #242426;
  --ink:           #d4d0c8;
  --ink-strong:    #e8e4dc;
  --muted:         #7a7a7c;
  --line:          #363638;
  --accent:        #7aa2d4;
  --accent-hover:  #8ab2e4;
  --accent-soft:   color-mix(in srgb, var(--accent) 12%, transparent);
  --flash:         rgba(184, 160, 144, 0.12);
  --code-bg:       #2c2c2e;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.2);
  --shadow-md:     0 4px 20px rgba(0,0,0,.35);
}

/* 无 JS 时的系统偏好回退 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #1a1a1c;
    --card:          #242426;
    --ink:           #d4d0c8;
    --ink-strong:    #e8e4dc;
    --muted:         #7a7a7c;
    --line:          #363638;
    --accent:        #7aa2d4;
    --accent-hover:  #8ab2e4;
    --accent-soft:   color-mix(in srgb, var(--accent) 12%, transparent);
    --code-bg:       #2c2c2e;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.2);
    --shadow-md:     0 4px 20px rgba(0,0,0,.35);
  }
}

/* ----- 2. 基础重置 ----- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.8;
  letter-spacing: 0.01em;
  transition: background-color .35s ease, color .35s ease;
}

::selection { background: var(--accent-soft); color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

[id] { scroll-margin-top: 76px; }

[hidden] { display: none !important; }

/* 细滚动条（仅精细指针设备） */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 5px;
    border: 2px solid var(--bg);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
}

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ----- 3. 布局 ----- */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ----- 4. 头部 ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  transition: border-color .35s ease;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: var(--bg); }
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--ink-strong);
  letter-spacing: 0.02em;
  flex: 1 1 auto;
  min-width: 0;
}
.brand #brand-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.brand.is-long #brand-text {
  -webkit-mask-image: linear-gradient(to right, black 0%, black 82%, transparent 100%);
  mask-image: linear-gradient(to right, black 0%, black 82%, transparent 100%);
}
.brand::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform .25s ease;
}
.brand:hover::before { transform: rotate(225deg); }
.site-header nav { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.site-header nav a {
  font-family: var(--font-ui);
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
}
.site-header nav a.active { color: var(--accent); }
.site-header .nav-link { font-family: var(--font-ui); color: var(--muted); text-decoration: none; font-size: .9rem; }
.site-header .nav-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--muted);
  text-decoration: none;
  background: transparent; cursor: pointer;
  padding: 0;
}
.site-header .nav-icon:hover { color: var(--text); border-color: var(--muted); }
.site-header .nav-icon svg { width: 18px; height: 18px; }
/* 已登录：图标用强调色 + 实心描边，与未登录的灰色轮廓区分 */
.site-header .nav-icon.is-logged-in { color: var(--accent); border-color: var(--accent); }
.site-header .nav-icon.is-logged-in:hover { color: var(--accent); border-color: var(--accent); opacity: .8; }

/* 用户悬浮菜单 */
.site-header .user-menu { position: relative; }
.user-menu-pop {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 180px; padding: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 50;
}
.user-menu-pop[hidden] { display: none; }
.user-menu-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px;
  font-family: var(--font-ui);
}
.user-menu-name { font-size: .95rem; color: var(--text); }
.user-menu-role {
  font-size: .72rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px;
}
.user-menu-logout {
  display: block; padding: 8px; border-radius: 8px;
  font-family: var(--font-ui); font-size: .9rem; color: var(--muted);
  text-decoration: none;
}
.user-menu-logout:hover { background: var(--line); color: var(--text); }

/* 登录 / 注册 */
.auth { max-width: 360px; margin: 48px auto; }
.auth-title { font-family: var(--font-ui); font-size: 1.4rem; margin-bottom: 20px; }
.auth-error { color: #c0392b; font-size: .9rem; margin-bottom: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-ui); font-size: .85rem; color: var(--muted); }
.auth-form input { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.auth-submit { font-family: var(--font-ui); margin-top: 4px; padding: 10px; border: none; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }

/* 暗色切换按钮 */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: all .25s ease;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.theme-toggle svg { width: 17px; height: 17px; }
.icon-sun  { display: block; }
.icon-moon { display: none;  }
[data-theme="dark"] .icon-sun  { display: none;  }
[data-theme="dark"] .icon-moon { display: block; }

/* ----- 5. 筛选区 ----- */
.filters { padding: 40px 0 22px; }
.filter-group {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-group:last-child { margin-bottom: 0; }
.filter-label {
  font-family: var(--font-ui);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .12em;
  width: 34px;
  flex-shrink: 0;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 6px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: .8rem;
  color: var(--ink);
  transition: all .18s ease;
}
.chip:hover:not([data-active]) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.chip[data-active] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.14);
}
.result-count {
  font-family: var(--font-ui);
  color: var(--muted);
  font-size: .78rem;
  margin: 18px 0 0;
}

/* ----- 6. 文章列表（编辑式清单） ----- */
.post-list { padding: 6px 0 56px; }
.post-card {
  border-bottom: 1px solid var(--line);
  padding: 30px 0;
  animation: rise .5s ease both;
}
.post-card:first-child { border-top: 1px solid var(--line); }
.post-card:nth-child(2) { animation-delay: .04s; }
.post-card:nth-child(3) { animation-delay: .08s; }
.post-card:nth-child(4) { animation-delay: .12s; }
.post-card:nth-child(5) { animation-delay: .16s; }
.post-card:nth-child(6) { animation-delay: .20s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.post-link { display: block; color: inherit; text-decoration: none; }

.post-meta-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .6em;
  font-family: var(--font-ui);
  font-size: .78rem;
}
.post-meta-line > * + *::before {
  content: "·";
  margin-right: .6em;
  color: var(--muted);
  opacity: .6;
}
.meta-genre { color: var(--accent); font-weight: 600; letter-spacing: .02em; }
.meta-theme { color: var(--ink); }
.post-meta-line time { color: var(--muted); }

.post-title {
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1.4;
  margin: 12px 0 10px;
  transition: color .2s ease;
}
.post-link:hover .post-title { color: var(--accent); }
.post-title .post-access {
  display: inline-block;
  vertical-align: .18em;
  margin-left: 8px;
  padding: 0 6px;
  font-family: var(--font-ui);
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .04em;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 4px;
  opacity: .85;
}
.post-title .post-access.is-member {
  color: var(--muted);
  font-weight: 500;
}

.post-summary {
  font-size: .92rem;
  color: #606060;
  line-height: 1.75;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
[data-theme="dark"] .post-summary { color: #b0b0b0; }

.post-tags { margin-top: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.post-tag {
  font-family: var(--font-ui);
  font-size: .76rem;
  color: var(--muted);
}
.post-tag::before {
  content: "#";
  color: var(--accent);
  margin-right: 1px;
}

/* ----- 7. 徽章（文字标签式） ----- */
.badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
}
.badge.genre { color: var(--accent); }
.badge.theme { color: var(--ink); }

/* ----- 8. 空状态 ----- */
.empty-msg {
  font-family: var(--font-ui);
  color: var(--muted);
  text-align: center;
  padding: 56px 0;
  font-size: .95rem;
}

/* ----- 9. 文章详情页 ----- */
.article { padding-top: 44px; padding-bottom: 72px; }

.post-heading {
  font-family: var(--font-body);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1.35;
  margin: 0 0 16px;
  letter-spacing: 0.01em;
  text-align: center;
}

.post-meta {
  margin-bottom: 28px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: center;
}
.post-meta .badge { margin-right: 16px; }
.post-meta .badge:last-child { margin-right: 0; }
.post-date-line {
  font-family: var(--font-ui);
  color: var(--muted);
  font-size: .84rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.post-date-line svg {
  width: 14px;
  height: 14px;
  opacity: .8;
}
.post-views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .8rem;
}
.post-views svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: .8;
}
.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: all .25s ease;
}
.back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.back-link svg { width: 17px; height: 17px; }

.article-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 48px 44px;
  transition: background-color .35s ease, border-color .35s ease;
}

/* 杂志排版 — 首字下沉 */
.article-body > p:first-of-type::first-letter {
  float: left;
  font-size: 3.2em;
  line-height: .75;
  margin: 4px 8px 0 -2px;
  color: var(--accent);
  font-weight: 600;
}

/* 文章内排版：标题用黑体分层次，正文衬线 */
.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  font-family: var(--font-ui);
  color: var(--ink-strong);
  line-height: 1.35;
  margin: 1.6em 0 .5em;
}
.article-body h1 { font-size: 1.5rem; }
.article-body h2 {
  font-size: 1.25rem;
  padding-bottom: .35em;
  border-bottom: 1px solid var(--line);
}
.article-body h3 { font-size: 1.1rem; }
.article-body h1:first-child { margin-top: 0; }

.article-body p {
  margin: 0 0 1em;
  hanging-punctuation: first allow-end;
}

.article-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  transition: border-color .2s;
}
.article-body a:hover { border-bottom-color: var(--accent); }

.article-body blockquote {
  margin: 1.2em 0;
  padding: 6px 0 6px 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.article-body ul, .article-body ol {
  padding-left: 1.5em;
  margin: .8em 0;
}

.article-body li { margin-bottom: .3em; }

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

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.article-body iframe { max-width: 100%; }

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: .92rem;
}
.article-body th,
.article-body td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}
.article-body th {
  font-family: var(--font-ui);
  font-weight: 600;
  background: var(--code-bg);
}

/* 代码块 */
.article-body pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  padding: 16px 20px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: .85rem;
  line-height: 1.6;
  margin: 1.2em 0;
  transition: background-color .35s ease;
}
.article-body code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .88em;
  transition: background-color .35s ease;
}
.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* 目录 */
.toc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 8px;
  margin: 0 0 28px;
  transition: background-color .35s ease, border-color .35s ease;
}
.toc summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .08em;
  color: var(--accent);
  padding: 10px 14px;
  user-select: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before { content: "▾ "; }
.toc details:not([open]) summary::before { content: "▸ "; }
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0 0 12px;
}
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 4px 10px;
  font-family: var(--font-ui);
  font-size: .85rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
  transition: all .15s ease;
}
.toc a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.toc ul ul a { padding-left: 26px; font-size: .8rem; }
.toc ul ul ul a { padding-left: 42px; font-size: .78rem; }

/* 头部"目录"按钮（呼出悬浮 TOC） */
.toc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: all .25s ease;
}
.toc-btn:hover,
.toc-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.toc-btn svg { width: 17px; height: 17px; }

/* 悬浮 TOC 面板 */
.toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.toc-panel {
  position: fixed;
  z-index: 41;
  top: 76px;
  right: 16px;
  width: 280px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: toc-in .22s ease both;
  transition: background-color .35s ease, border-color .35s ease;
}
@keyframes toc-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}
.toc-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .08em;
  color: var(--ink-strong);
}
.toc-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  transition: all .15s ease;
}
.toc-panel-close:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.toc-panel-body {
  overflow-y: auto;
  padding: 12px 8px 14px;
}
.toc-panel-body ul { list-style: none; margin: 0; padding: 0; }
.toc-panel-body li { margin: 0; }
.toc-panel-body a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: .85rem;
  color: var(--ink);
  text-decoration: none;
  transition: all .15s ease;
}
.toc-panel-body a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.toc-panel-body a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.toc-panel-body ul ul a { padding-left: 24px; font-size: .8rem; }
.toc-panel-body ul ul ul a { padding-left: 38px; font-size: .78rem; }

@media (min-width: 601px) {
  .toc-backdrop { display: none; }
}

/* 移动端：底部抽屉式 */
@media (max-width: 600px) {
  body.toc-open { overflow: hidden; }
  .toc-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    max-height: 74vh;
    border-radius: 16px 16px 0 0;
    animation-name: toc-up;
  }
  @keyframes toc-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: none; }
  }
}

/* 上下篇导航（面板式） */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 36px;
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  text-decoration: none;
  transition: all .2s ease;
}
.pager a:hover { border-color: var(--accent); }
.pager a:only-child { grid-column: 1 / -1; }
.pager-dir {
  font-family: var(--font-ui);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--muted);
}
.pager-title {
  font-family: var(--font-body);
  font-size: .95rem;
  color: var(--ink-strong);
  line-height: 1.45;
}
.pager a:hover .pager-title { color: var(--accent); }
.pager .next { text-align: right; }
.pager a.next:only-child { text-align: left; }

/* ----- 10. 页脚 ----- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 0;
  text-align: center;
  transition: border-color .35s ease;
}
.site-footer p {
  font-family: var(--font-ui);
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .04em;
  margin: 0;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.site-footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ----- 11. 数学公式 ----- */
.article-body .arithmatex,
.article-body .equation {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}
a.eqref {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}
a.eqref:hover { border-bottom-style: solid; }

/* 引用跳转：已在视口内时不高亮滚动，仅让公式编号快速翻转提醒 */
.equation.eq-flash .tag {
  display: inline-block;
  color: var(--accent);
  animation: eq-flip 1.4s cubic-bezier(.5, .05, .4, 1);
}
@keyframes eq-flip {
  0%   { transform: perspective(480px) rotateY(0deg)    rotateX(0deg); }
  50%  { transform: perspective(480px) rotateY(720deg)  rotateX(0deg); }
  75%  { transform: perspective(480px) rotateY(720deg)  rotateX(360deg); }
  100% { transform: perspective(480px) rotateY(720deg)  rotateX(720deg); color: var(--ink); }
}

/* KaTeX 暗色适配 */
[data-theme="dark"] .katex { color: var(--ink); }
[data-theme="dark"] .katex .delimsizing,
[data-theme="dark"] .katex .mord,
[data-theme="dark"] .katex .mbin,
[data-theme="dark"] .katex .mrel,
[data-theme="dark"] .katex .mopen,
[data-theme="dark"] .katex .mclose,
[data-theme="dark"] .katex .mpunct { color: inherit; }

/* ----- 12. 响应式 ----- */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { height: 54px; }
  .filters { padding: 28px 0 18px; }
  .filter-label { width: auto; }
  .post-card { padding: 24px 0; }
  .post-title { font-size: 1.2rem; }
  .post-list { padding-bottom: 40px; }
  .article { padding-top: 32px; padding-bottom: 56px; }
  .post-heading { font-size: 1.5rem; }
  .article-body { padding: 28px 20px; }
  .article-body > p:first-of-type::first-letter {
    font-size: 2.6em;
    margin: 2px 6px 0 -1px;
  }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .pager a:only-child { text-align: left; }
}

/* ----- 13. 点赞按钮 ----- */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 0.2s ease;
  vertical-align: baseline;
}

.like-btn:hover,
.like-btn.liked {
  color: var(--accent);
}

.like-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .like-btn {
    font-size: 0.8rem;
  }
}

/* ----- 14. 点赞 consent 弹窗 ----- */
.consent-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 100;
}
.consent-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow-md);
  text-align: center;
  transition: background-color .35s ease, border-color .35s ease;
}
.consent-dialog p {
  font-family: var(--font-body);
  font-size: .92rem;
  color: var(--ink);
  margin: 0 0 20px;
  line-height: 1.7;
}
.consent-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.consent-btn {
  font-family: var(--font-ui);
  font-size: .85rem;
  padding: 7px 22px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  transition: all .15s ease;
}
.consent-btn:hover {
  border-color: var(--accent);
}
.consent-confirm {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.consent-confirm:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}