/* ============================================
   Warm Modern Docs — 暖调极简文档主题
   设计：暖白基调 · 陶土橙点缀 · 干净张力
   ============================================ */

/* ---------- Design Tokens ---------- */
:root {
  --bg: #faf9f7;
  --bg-card: #ffffff;
  --bg-hover: #f3f1ee;
  --bg-sidebar: #f6f4f1;
  --bg-soft: #f1efec;
  --text: #1a1816;
  --text-secondary: #6b6560;
  --text-tertiary: #9e9792;
  --text-inverse: #ffffff;
  --border: #e5e0db;
  --border-strong: #d6d0ca;
  --accent: #c7512e;
  --accent-hover: #b04425;
  --accent-soft: rgba(199, 81, 46, 0.1);
  --accent-glow: rgba(199, 81, 46, 0.08);
  --shadow-sm: 0 1px 2px rgba(26, 24, 22, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 24, 22, 0.06);
  --shadow-lg: 0 8px 30px rgba(26, 24, 22, 0.08);
  --shadow-xl: 0 20px 60px rgba(26, 24, 22, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-w: 280px;
  --toc-w: 220px;
  --content-w: 1200px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.night-mode {
  --bg: #1a1a1c;
  --bg-card: #222225;
  --bg-hover: #2a2a2d;
  --bg-sidebar: #151517;
  --bg-soft: #2e2e31;
  --text: #c4c4c8;
  --text-secondary: #909096;
  --text-tertiary: #6e6e74;
  --text-inverse: #1a1816;
  --border: #333336;
  --border-strong: #404044;
  --accent: #c97a5a;
  --accent-hover: #d4876a;
  --accent-soft: rgba(201, 122, 90, 0.12);
  --accent-glow: rgba(201, 122, 90, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background .3s ease, color .3s ease;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent-soft); color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: transparent;
  border: none;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: var(--border);
  border: none;
}

.markdown pre::-webkit-scrollbar { height: 6px; }
.markdown pre::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 3px;
}
.markdown pre::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

/* Firefox scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.sidebar-nav { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sidebar-nav:hover { scrollbar-color: var(--border) transparent; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

/* ============ TOP BAR ============ */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 200;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  background: rgba(250, 249, 247, 0.85);
}

.night-mode .topbar {
  background: rgba(28, 26, 24, 0.85);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-logo img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.topbar-logo:hover { color: var(--text); text-decoration: none; }

.menu-btn {
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all .15s ease;
}

.menu-btn:hover { background: var(--bg-hover); color: var(--text); }
.menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 1px; transition: all .3s ease; }
.menu-btn.open span:nth-child(1) { transform: rotate(45deg) translate(2px, 2px); }
.menu-btn.open span:nth-child(2) { opacity: 0; }
.menu-btn.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all .2s ease;
}

.theme-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ============ SIDEBAR ============ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 150;
  transition: transform .4s var(--ease), background .3s ease, border-color .3s ease;
  overflow: hidden;
}

.sidebar-header {
  flex-shrink: 0;
  padding: 28px 20px 16px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all .2s ease;
}

.sidebar-logo:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }
.sidebar-logo img { width: 26px; height: 26px; border-radius: var(--radius-xs); object-fit: contain; }

.sidebar-search {
  flex-shrink: 0;
  padding: 0 16px 14px;
}

.search-wrap { position: relative; }

.search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .85rem;
  font-family: var(--font);
  outline: none;
  transition: all .2s ease;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-wrap input::placeholder { color: var(--text-tertiary); }

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-tertiary);
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
  transition: all .15s ease;
}

.search-clear:hover { background: var(--bg-hover); color: var(--text); }
.search-clear.show { display: flex; }

/* Sidebar nav scroll */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 10px 80px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.sidebar-nav:hover::-webkit-scrollbar-thumb { background: var(--border-strong); }

/* Nav Home */
.nav-home {
  margin-bottom: 4px;
}

.nav-home a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: .9rem;
  border-radius: var(--radius-sm);
  transition: all .15s ease;
}

.nav-home a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-home svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-tertiary); }

/* Category group */
.cat-group { margin-top: 2px; }

.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px 6px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: all .15s ease;
}

.cat-header:hover { color: var(--text); }
.cat-header .arrow { font-size: .5rem; transition: transform .2s ease; color: var(--text-tertiary); }
.cat-group.collapsed .cat-header .arrow { transform: rotate(-90deg); }
.cat-group.collapsed .cat-items { display: none; }

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

.cat-item { margin: 1px 0; }

.cat-item a {
  display: block;
  position: relative;
  padding: 7px 12px 7px 16px;
  color: var(--text-secondary);
  font-size: .87rem;
  border-radius: var(--radius-sm);
  transition: all .15s ease;
  text-decoration: none;
  border-left: 2px solid transparent;
}

.cat-item a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }

/* Current page */
.cat-item a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
  border-left-color: var(--accent);
}

.cat-item a.active:hover { background: var(--accent-soft); }

/* Sidebar theme toggle - bottom */
.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-footer .theme-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.05rem;
  transition: all .2s ease;
}

.sidebar-footer .theme-btn:hover { background: var(--bg-hover); color: var(--text); }

.sidebar-footer-extra {
  font-size: .78rem;
  color: var(--text-tertiary);
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 140;
  opacity: 0;
  transition: opacity .3s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ============ MAIN CONTENT ============ */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  transition: margin-left .4s var(--ease);
}

.content-wrap {
  width: 100%;
  max-width: 1500px;
  padding: 0 48px;
  display: flex;
}

.content-main {
  flex: 1;
  max-width: 1200px;
  min-width: 0;
  padding: 72px 0 120px;
  animation: fadeUp .5s var(--ease);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Right TOC */
.toc-col {
  width: var(--toc-w);
  flex-shrink: 0;
  padding: 80px 0 80px 32px;
  position: sticky;
  top: 0;
  height: fit-content;
  max-height: 100vh;
  overflow-y: auto;
}

.toc-col::-webkit-scrollbar { width: 3px; }
.toc-col::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.toc-col:hover::-webkit-scrollbar-thumb { background: var(--border); }

.toc-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.toc-list { list-style: none; padding: 0; margin: 0; position: relative; }

.toc-list::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.toc-item { margin: 2px 0; position: relative; }

.toc-link {
  display: block;
  padding: 5px 0 5px 16px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: .82rem;
  line-height: 1.45;
  transition: all .15s ease;
  border-left: 1px solid transparent;
  margin-left: -1px;
}

.toc-link:hover { color: var(--text); text-decoration: none; }

.toc-link.active {
  color: var(--text);
  font-weight: 500;
  border-left-color: var(--accent);
}

.toc-h2 { padding-left: 16px; }
.toc-h3 { padding-left: 28px; font-size: .8rem; }
.toc-h4 { padding-left: 40px; font-size: .78rem; }

/* ============ HOMEPAGE HERO ============ */
.hero {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
  color: var(--text);
  margin-bottom: 12px;
}

.hero-icon {
  display: inline-block;
  margin-right: 6px;
  font-size: .9em;
}

.hero-desc {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 600px;
}

/* ============ ARTICLE LIST (Homepage) ============ */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all .2s ease;
  gap: 16px;
}

.article-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}

.article-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.article-card-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.article-card-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-card:hover .article-card-title { color: var(--accent); }

.article-card-arrow {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: all .2s ease;
}

.article-card:hover .article-card-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ============ ARTICLE HEADER ============ */
.article-header {
  margin-bottom: 0px;
  padding-bottom: 32px;
}

.article-title {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.03em;
  color: var(--text);
  margin-bottom: 12px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.article-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .8rem;
  color: var(--text-tertiary);
  padding: 3px 10px;
  background: var(--bg-soft);
  border-radius: 20px;
}

.article-meta-item svg { width: 13px; height: 13px; flex-shrink: 0; }
.article-meta-item a { color: var(--text-secondary); font-weight: 500; }
.article-meta-item a:hover { color: var(--accent); text-decoration: none; }

.edit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .8rem;
  color: var(--text-tertiary);
  padding: 3px 10px;
  background: var(--bg-soft);
  border-radius: 20px;
  transition: all .2s ease;
}

.edit-link:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }

/* ============ MARKDOWN ============ */
.markdown {
  font-size: 1.02rem;
  line-height: 1.85;
  color: var(--text);
  word-break: break-word;
}

.markdown > *:first-child { margin-top: 0 !important; }
.markdown > *:last-child { margin-bottom: 0 !important; }

/* Headings */
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  position: relative;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.02em;
  color: var(--text);
}

.markdown h1 {
  font-size: 2.1rem;
  margin: 3rem 0 1.2rem;
}

.markdown h2 {
  font-size: 1.6rem;
  margin: 2.6rem 0 1rem;
}

.markdown h3 {
  font-size: 1.3rem;
  margin: 2rem 0 .8rem;
}

.markdown h4 {
  font-size: 1.1rem;
  margin: 1.6rem 0 .6rem;
}

.markdown h5 {
  font-size: .95rem;
  font-weight: 600;
  margin: 1.4rem 0 .5rem;
  color: var(--text-secondary);
}

.markdown h6 {
  font-size: .85rem;
  font-weight: 600;
  margin: 1.2rem 0 .5rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Anchor hover on headings */
.markdown h1:hover .anchor-hint,
.markdown h2:hover .anchor-hint,
.markdown h3:hover .anchor-hint { opacity: 1; }

.anchor-hint {
  opacity: 0;
  position: absolute;
  left: -1.1em;
  top: 0;
  color: var(--text-tertiary);
  font-size: .7em;
  font-weight: 400;
  text-decoration: none;
  transition: opacity .2s ease;
}

.anchor-hint:hover { color: var(--accent); text-decoration: none; }

.markdown p { margin: 1.1em 0; }
.markdown strong { font-weight: 600; color: var(--text); }
.markdown em { font-style: italic; }

.markdown a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, color .2s ease;
}

.markdown a:hover { border-bottom-color: var(--accent); text-decoration: none; }

/* Lists */
.markdown ul, .markdown ol { padding-left: 1.6em; margin: 1em 0; }
.markdown li { margin: .3em 0; }
.markdown li::marker { color: var(--text-tertiary); }
.markdown li > ul, .markdown li > ol { margin: .2em 0; }

/* Task list */
.markdown .task-list-item {
  list-style: none;
  margin-left: -1.6em;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.markdown .task-list-item input[type="checkbox"] {
  margin-top: .35em;
  width: 16px; height: 16px;
  accent-color: var(--accent);
  border-radius: 3px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Blockquote */
.markdown blockquote {
  margin: 1.6em 0;
  padding: 16px 20px;
  background: var(--bg-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.markdown blockquote p { margin: .35em 0; }
.markdown blockquote p:first-child { margin-top: 0; }
.markdown blockquote p:last-child { margin-bottom: 0; }

.markdown hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.8em 0;
}

.markdown img {
  margin: 1.5em 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Table */
.markdown table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5em 0;
  font-size: .9rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.markdown thead { background: var(--bg-soft); }

.markdown th {
  font-weight: 600;
  padding: 11px 16px;
  text-align: left;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.markdown td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.markdown tbody tr:last-child td { border-bottom: none; }
.markdown tbody tr:nth-child(even) { background: var(--bg-soft); }

/* Code: inline */
.markdown code {
  font-family: var(--font-mono);
  font-size: .85em;
  padding: .15em .4em;
  background: var(--bg-soft);
  border-radius: var(--radius-xs);
  color: #b04425;
  word-break: break-word;
}

.night-mode .markdown code {
  color: #e07a62;
  background: var(--bg-hover);
}

/* Code: block */
.markdown pre {
  margin: 1.6em 0;
  padding: 20px 24px;
  background: #1a1816;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  position: relative;
  line-height: 1.6;
  border: 1px solid rgba(255,255,255,.06);
}

.night-mode .markdown pre { background: #1c1c1e; }

.markdown pre code {
  padding: 0;
  background: none;
  font-size: .88rem;
  line-height: 1.7;
  tab-size: 2;
}

/* Token colors inherit from .token.* rules below, no color override needed */

/* Code lang label */
.markdown pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: .65rem;
  font-family: var(--font);
  color: rgba(255,255,255,.25);
  text-transform: uppercase;
  letter-spacing: .04em;
  user-select: none;
}

/* Copy button */
.markdown pre .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: .72rem;
  font-family: var(--font);
  color: rgba(255,255,255,.4);
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.06);
  transition: all .2s ease;
  opacity: 0;
  line-height: 1.4;
}

.markdown pre:hover .copy-btn { opacity: 1; }
.markdown pre .copy-btn:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.85); }

/* ------ Prism: warm modern palette ------ */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #7a7a7a;
  font-style: italic;
}
.token.punctuation { color: #b0b0b0; }
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted { color: #d4874a; }
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #8bba7f; }
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string { color: #6ab8b8; }
.token.atrule,
.token.attr-value,
.token.keyword { color: #c795ae; }
.token.function,
.token.class-name { color: #79a8d9; }
.token.regex,
.token.important,
.token.variable { color: #d4874a; }
.token.important,
.token.bold { font-weight: 600; }
.token.italic { font-style: italic; }
.token.entity { cursor: help; }
.token.inserted { color: #8bba7f; }
.token.deleted { color: #d4874a; }

/* ============ ARTICLE FOOTER ============ */
.article-footer {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.article-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: .82rem;
  color: var(--text-tertiary);
}

.article-info a { color: var(--text-tertiary); }
.article-info a:hover { color: var(--accent); }

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-tertiary);
  opacity: .4;
}

.back-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all .15s ease;
  background: none;
  border: none;
  font-family: inherit;
  padding: 4px 0;
}

.back-top:hover { color: var(--accent); }

.back-top svg {
  width: 14px;
  height: 14px;
}

/* Post nav */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 40px;
  padding-top: 32px;
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all .2s ease;
}

.post-nav-link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.post-nav-link--prev { align-items: flex-start; }
.post-nav-link--next { align-items: flex-end; text-align: right; }

.post-nav-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.post-nav-title {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.post-nav-link:hover .post-nav-title { color: var(--accent); }

/* ============ COMMENTS ============ */
.comments-section {
  margin-top: 48px;
  padding-top: 8px;
}

.comments-header {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.comments-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.comment {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-of-type {
  border-bottom: none;
}

.comment-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-soft);
}

.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }

.comment-body { flex: 1; min-width: 0; }

.comment-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.comment-author {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
}

.comment-time {
  font-size: .78rem;
  color: var(--text-tertiary);
}

.comment-text {
  font-size: .92rem;
  line-height: 1.65;
  color: var(--text);
}

.comment-text p { margin: .35em 0; }

.comment-actions { margin-top: 10px; }

.comment-reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all .15s ease;
  background: var(--bg-soft);
  border: none;
  font-family: inherit;
}

.comment-reply-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Nested replies */
.comment-nested {
  margin-left: 50px;
  padding-left: 20px;
  border-left: 2px solid var(--border);
}

.comment-nested .comment {
  padding: 14px 0;
  border-bottom: none;
  margin-bottom: 6px;
}

.comment-nested .comment:last-child { margin-bottom: 0; }

.comment-nested .comment-avatar {
  width: 30px;
  height: 30px;
}

/* Modal styles for captcha */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1050;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-dialog {
  position: relative;
  max-width: 420px;
  width: 90%;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  text-align: center;
}

.modal-header {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.modal-footer {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.lock-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1040;
}

/* Comment form */
.comment-form-wrap {
  margin-top: 28px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.comment-form-title {
  font-size: .92rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.comment-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 110px;
  outline: none;
  transition: all .2s ease;
  margin-bottom: 12px;
}

.comment-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.comment-textarea::placeholder { color: var(--text-tertiary); }

.comment-input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.comment-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .87rem;
  outline: none;
  transition: all .2s ease;
}

.comment-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.comment-input::placeholder { color: var(--text-tertiary); }

.comment-submit-btn {
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  font-size: .87rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s ease;
}

.comment-submit-btn:hover { background: var(--accent-hover); box-shadow: var(--shadow-sm); }
.comment-submit-btn:active { transform: scale(.97); }

.login-hint {
  font-size: .87rem;
  color: var(--text-secondary);
  padding: 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  text-align: center;
}

.login-hint a { color: var(--accent); font-weight: 500; }

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  padding-top: 24px;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  font-size: .83rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all .2s ease;
}

.pagination a:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
  text-decoration: none;
}

.pagination .current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1280px) {
  .toc-col { display: none; }
  .content-wrap { max-width: 1200px; padding: 0 32px; }
}

@media (max-width: 1024px) {
  .content-wrap { padding: 0 28px; }
  .content-main { padding: 56px 0 80px; }
  .article-title { font-size: 2.2rem; }
  .hero-title { font-size: 2.4rem; }
}

@media (max-width: 768px) {
  .topbar { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-header,
  .sidebar-footer { display: none; }

  .sidebar-search { padding-top: 16px; }

  .main { margin-left: 0; padding-top: 56px; }
  .content-wrap { padding: 0 20px; }
  .content-main { padding: 40px 0 60px; }

  .article-title { font-size: 1.7rem; }
  .hero-title { font-size: 1.8rem; }
  .hero-desc { font-size: 1rem; }

  .markdown { font-size: 1rem; }
  .markdown h1 { font-size: 1.5rem; }
  .markdown h2 { font-size: 1.3rem; }
  .markdown h3 { font-size: 1.1rem; }

  .markdown pre {
    margin-left: -20px;
    margin-right: -20px;
    border-radius: 0;
    padding: 16px 20px;
  }

  .post-nav { grid-template-columns: 1fr; }
  .comment-children { margin-left: 36px; padding-left: 12px; }
  .comment-input-row { flex-direction: column; }
  .article-card { padding: 14px 16px; }
}

@media (max-width: 480px) {
  .article-title { font-size: 1.4rem; }
  .hero-title { font-size: 1.5rem; }
  .article-meta { flex-direction: column; gap: 6px; }
  .article-info { flex-direction: column; align-items: flex-start; }
  .comment { flex-direction: column; gap: 8px; }
  .comment-avatar { width: 34px; height: 34px; }
  .comment-children { margin-left: 24px; padding-left: 8px; }
}

/* ============ IMAGE ZOOM ============ */
.markdown img.zoomable {
  cursor: zoom-in;
  transition: transform .2s ease, box-shadow .2s ease;
}

.markdown img.zoomable:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity .3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  transform: scale(.9);
  transition: transform .3s var(--ease);
}

.lightbox.active img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: rgba(255,255,255,.6);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease;
  background: none;
  border: none;
  font-family: inherit;
}

.lightbox-close:hover { color: #fff; }

/* ============ ACCESSIBILITY ============ */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================
   LEGACY BACKWARDS COMPATIBILITY
   ============================================ */
.widget { margin-bottom: 16px; }
.shadow-theme { border-radius: var(--radius-sm); }

.blog-lates a {
  display: block;
  padding: 6px 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .9rem;
}
.blog-lates a:hover { color: var(--text); text-decoration: none; }

.current-article a { color: var(--accent); font-weight: 500; }
.current-category > .category-toggle { color: var(--text); font-weight: 500; }

.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: .9rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: .87rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--accent);
  transition: all .2s ease;
}
.btn:hover { background: var(--accent-hover); }

/* ============================================
   END
   ============================================ */
