/* =========================================================================
   字节暗面 · The Dark Side of the Byte
   Refined dark editorial theme — Ayu-inspired ink + amber glow + cyan.
   ========================================================================= */

:root {
  --font-display: "Bricolage Grotesque", "IBM Plex Sans SC", ui-sans-serif, sans-serif;
  --font-body: "IBM Plex Sans", "IBM Plex Sans SC", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --bg: #0b0e14;
  --bg-2: #0e121b;
  --surface: #11151f;
  --surface-2: #161b27;
  --surface-3: #1b2231;
  --border: #232a39;
  --border-strong: #2f3849;

  --text: #e6e9f0;
  --text-soft: #c2c9d6;
  --muted: #7c8699;
  --muted-dim: #5b6577;

  --accent: #ffb454;
  --accent-soft: #ffd089;
  --accent-2: #5ccfe6;
  --accent-2-dim: #3a8fa3;
  --danger: #f07178;

  --shadow: 0 12px 32px -14px rgba(0, 0, 0, .65);
  --shadow-lg: 0 28px 64px -22px rgba(0, 0, 0, .75);

  --r: 14px;
  --r-sm: 9px;
  --sidebar-w: 292px;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;  /* 禁止 iOS 横屏放大字号 */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;          /* 兜底防止任何元素撑出横向滚动 */
  overflow-wrap: break-word;   /* 长单词/URL 自动换行 */
}

/* --- background atmosphere ---------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(1000px 560px at 10% -8%, rgba(255, 180, 84, .12), transparent 58%),
    radial-gradient(760px 620px at 102% 104%, rgba(92, 207, 230, .07), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(255, 180, 84, .26); color: #fff; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3c465a; }

a { color: var(--accent-2); text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--accent-soft); }

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

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: fixed;
  inset: 0 auto 0 0;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(22, 27, 39, .6), rgba(11, 14, 20, .35));
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  z-index: 50;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 1.7rem;
  padding: 2.2rem 1.6rem 1.4rem;
  height: 100%;
  overflow-y: auto;
}

.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 3.4rem 2.2rem 2rem;
  flex: 1 0 auto;
}

/* =========================================================================
   Two-column page layout + sidebar widgets
   ========================================================================= */
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.6rem;
  align-items: start;
}
/* min-width:0 让栅格列能收缩，避免内部宽元素（代码块/表格）撑破屏幕 */
.page-main { min-width: 0; }
.page-aside {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  position: sticky;
  top: 2.4rem;
}

.widget {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.4rem 1.4rem 1.5rem;
}
.widget-title {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.06rem;
  color: var(--text);
  margin: 0 0 1.05rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--border);
}
.widget-title svg { width: 17px; height: 17px; color: var(--accent); }
.widget-empty { color: var(--muted); font-family: var(--font-mono); font-size: .82rem; margin: 0; }

.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-item { padding: .72rem 0; border-bottom: 1px solid var(--border); }
.recent-item:first-child { padding-top: 0; }
.recent-item:last-child { padding-bottom: 0; border-bottom: 0; }
.recent-link {
  display: block;
  color: var(--text-soft);
  font-weight: 500;
  line-height: 1.45;
  transition: color .16s var(--ease), transform .16s var(--ease);
}
.recent-link:hover { color: var(--accent); transform: translateX(3px); }
.recent-date {
  display: block;
  margin-top: .3rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
}
.widget .tag-cloud { gap: .5rem; }
.widget .tag-pill { font-size: .82rem; padding: .35rem .8rem; }

/* table of contents */
.toc { display: flex; flex-direction: column; gap: .12rem; }
.toc a {
  display: block;
  padding: .32rem .6rem;
  border-left: 2px solid var(--border);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
  transition: color .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.toc a:hover { color: var(--text); background: var(--surface-2); }
.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface-2);
}
.toc a.lvl-3 { padding-left: 1.4rem; font-size: .82rem; }

@media (max-width: 1080px) {
  .page-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .page-aside { position: static; }
}

/* =========================================================================
   Brand + eclipse mark
   ========================================================================= */
.brand { display: flex; align-items: center; gap: .85rem; color: var(--text); }
.brand:hover { color: var(--text); }

.eclipse { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 0 10px var(--accent)); }
.eclipse .lit { fill: var(--accent); }
.eclipse .dark { fill: var(--bg-2); }

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: .01em;
  line-height: 1.05;
  display: block;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-top: .35rem;
}

/* =========================================================================
   Sidebar nav
   ========================================================================= */
.nav-menu { display: flex; flex-direction: column; gap: .15rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .62rem .8rem;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-weight: 500;
  position: relative;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .7; transition: opacity .16s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.nav-link:hover svg { opacity: 1; }
.nav-link.active { background: var(--surface-3); color: var(--accent-soft); }
.nav-link.active svg { opacity: 1; color: var(--accent); }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -1.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

/* search */
.search { position: relative; }
.search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .88rem;
  padding: .58rem 2.6rem .58rem 1rem;
  transition: border-color .18s, box-shadow .18s;
}
.search input::placeholder { color: var(--muted-dim); }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 180, 84, .14);
}
.search button {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: .35rem .55rem;
  display: grid;
  place-items: center;
}
.search button:hover { color: var(--accent); }
.search button svg { width: 17px; height: 17px; }

.sidebar-spacer { flex: 1 1 auto; }

.sidebar-share { display: flex; flex-direction: column; gap: .7rem; }
.sidebar-share-label {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.sidebar-share .share-row { gap: .5rem; }
.sidebar-share .share-btn { width: 36px; height: 36px; }
.sidebar-share .share-btn svg { width: 16px; height: 16px; }

.sidebar-footer {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--muted-dim);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 1.1rem;
}

/* =========================================================================
   Mobile topbar
   ========================================================================= */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, .85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .brand-title { font-size: 1.15rem; }
.hamburger {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  width: 42px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.hamburger svg { width: 20px; height: 20px; }
.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, .6);
  backdrop-filter: blur(2px);
  z-index: 45;
}

/* =========================================================================
   Page heading
   ========================================================================= */
.page-head { margin: 0 0 2.2rem; }
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: .55rem;
}
.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -.01em;
  margin: 0;
}
.page-title .hl { color: var(--accent); }
.page-sub {
  margin: .8rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 42ch;
}

/* =========================================================================
   Post list cards
   ========================================================================= */
.post-card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.15rem;
  overflow: hidden;
  transition: transform .22s var(--ease), border-color .22s var(--ease), box-shadow .22s var(--ease);
}
.post-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .26s var(--ease);
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.post-card:hover::before { transform: scaleY(1); }

.post-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.32rem;
  line-height: 1.3;
  margin: 0 0 .55rem;
}
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); }
.post-summary { color: var(--text-soft); margin: 0 0 1rem; }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
}
.meta-date {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.meta-date svg { width: 14px; height: 14px; opacity: .7; }

/* chips ------------------------------------------------------------------ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .76rem;
  font-weight: 500;
  padding: .2rem .65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all .16s var(--ease);
  line-height: 1.5;
}
.chip-cat {
  color: #0b0e14;
  background: var(--accent);
  font-weight: 600;
}
.chip-cat:hover { color: #0b0e14; background: var(--accent-soft); }
.chip-tag {
  color: var(--accent-2);
  background: rgba(92, 207, 230, .08);
  border-color: rgba(92, 207, 230, .22);
  font-family: var(--font-mono);
}
.chip-tag:hover { background: rgba(92, 207, 230, .16); color: var(--accent-soft); border-color: var(--accent-2); }

/* =========================================================================
   Category grid + tag cloud
   ========================================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.1rem;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.4rem 1.4rem 1.5rem;
  color: var(--text);
  transition: transform .22s var(--ease), border-color .22s var(--ease), box-shadow .22s var(--ease);
}
.cat-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); color: var(--text); }
.cat-card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.cat-card-name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; }
.cat-card-desc { color: var(--muted); font-size: .9rem; margin: 0; }
.count-badge {
  font-family: var(--font-mono);
  font-size: .76rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(255, 180, 84, .1);
  border: 1px solid rgba(255, 180, 84, .25);
  border-radius: 999px;
  padding: .1rem .6rem;
  flex: none;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: .7rem; }
.tag-pill {
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  font-family: var(--font-mono);
  font-size: .92rem;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .5rem 1rem;
  transition: all .18s var(--ease);
}
.tag-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -10px rgba(255, 180, 84, .5);
}
.tag-pill .n { color: var(--muted); font-size: .75rem; }
.tag-pill:hover .n { color: var(--accent-soft); }

/* =========================================================================
   Breadcrumb
   ========================================================================= */
.crumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.crumb .sep { color: var(--muted-dim); }
.crumb .here { color: var(--text-soft); }

/* =========================================================================
   Pagination
   ========================================================================= */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: 2.4rem;
}
.pager a, .pager span {
  font-family: var(--font-mono);
  font-size: .85rem;
  padding: .45rem .75rem;
  min-width: 2.4rem;
  text-align: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.pager a { color: var(--text-soft); background: var(--surface-2); transition: all .16s var(--ease); }
.pager a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.pager .current { color: #0b0e14; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.pager .gap { color: var(--muted); border-color: transparent; background: transparent; min-width: auto; padding: .45rem .25rem; }
.pager .disabled { color: var(--muted-dim); opacity: .5; }

.pager-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--muted);
}
.pager-jump input {
  width: 4.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .85rem;
  padding: .4rem .6rem;
  text-align: center;
}
.pager-jump input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 180, 84, .14);
}
.pager-jump button {
  font-family: var(--font-mono);
  font-size: .8rem;
  padding: .42rem .95rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  transition: all .16s var(--ease);
}
.pager-jump button:hover { border-color: var(--accent); color: var(--accent); }

/* =========================================================================
   Surface panel (about / article)
   ========================================================================= */
.panel {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 2.4rem 2.4rem 2.6rem;
  box-shadow: var(--shadow);
}

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  padding: 2.5rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .9rem;
}

/* =========================================================================
   Prose (article body + about)
   ========================================================================= */
.prose { color: var(--text-soft); font-size: 1.04rem; }
.prose > *:first-child { margin-top: 0; }
.prose pre { max-width: 100%; overflow-x: auto; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.25;
  margin: 2.2rem 0 .9rem;
  font-weight: 700;
  scroll-margin-top: 90px;
}
.prose h2 { font-size: 1.6rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.3rem; }
.prose h4 { font-size: 1.1rem; }
.prose p { margin: 0 0 1.15rem; }
.prose a { border-bottom: 1px solid rgba(92, 207, 230, .35); }
.prose a:hover { border-color: var(--accent-soft); }
.prose strong { color: var(--text); font-weight: 600; }
/* 加粗默认提亮，但当文字设了自定义颜色时（无论先加粗还是先上色，
   TinyMCE 会生成 <span style="color"><strong> 或 <strong style="color">），
   让 strong 让位继承该颜色，避免颜色被上面的规则覆盖成白色。 */
.prose [style*="color"] strong,
.prose strong[style*="color"] { color: inherit; }
.prose ul, .prose ol { margin: 0 0 1.15rem; padding-left: 1.4rem; }
.prose li { margin: .35rem 0; }
.prose li::marker { color: var(--accent); }
.prose img { max-width: 100%; height: auto; border-radius: var(--r-sm); border: 1px solid var(--border); }
.prose blockquote {
  margin: 1.4rem 0;
  padding: .6rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-soft);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0;
  font-size: .95rem;
}
.prose th, .prose td { border: 1px solid var(--border); padding: .55rem .8rem; text-align: left; }
.prose th { background: var(--surface-3); color: var(--text); font-weight: 600; }
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: .87em;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .12em .4em;
  color: var(--accent-soft);
}

/* =========================================================================
   Article header
   ========================================================================= */
.article-head { margin-bottom: 1.8rem; }
.article-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -.015em;
  margin: .4rem 0 1rem;
}
.article-divider { border: 0; border-top: 1px solid var(--border); margin: 1.6rem 0 2rem; }

/* =========================================================================
   Article footer: tags · share · prev/next · recommended
   ========================================================================= */
.post-footer {
  margin-top: 2.8rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}
.footer-block { display: flex; flex-direction: column; gap: .9rem; }
.section-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
}
.footer-tags { display: flex; flex-wrap: wrap; gap: .55rem; }

/* share buttons */
.share-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.share-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  position: relative;
  transition: transform .18s var(--ease), color .18s var(--ease),
    border-color .18s var(--ease), background .18s var(--ease);
}
.share-btn svg { width: 19px; height: 19px; }
.share-btn:hover { transform: translateY(-3px); color: #fff; }
.share-btn.s-x:hover { background: #000; border-color: #000; }
.share-btn.s-fb:hover { background: #1877f2; border-color: #1877f2; }
.share-btn.s-tg:hover { background: #229ed9; border-color: #229ed9; }
.share-btn.s-wb:hover { background: #e6162d; border-color: #e6162d; }
.share-btn.s-link:hover { background: var(--accent); border-color: var(--accent); color: #0b0e14; }
.share-btn.s-link.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0e14;
}
.share-btn.s-link.copied::after {
  content: "已复制";
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--accent);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: .15rem .5rem;
  border-radius: 6px;
  white-space: nowrap;
}

/* prev / next navigation */
.post-nav { display: flex; gap: 1rem; }
.post-nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.05rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
}
.post-nav-item.next { text-align: right; }
a.post-nav-item:hover { border-color: var(--accent); transform: translateY(-2px); background: var(--surface-3); }
.post-nav-dir { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); }
a.post-nav-item:hover .post-nav-dir { color: var(--accent); }
.post-nav-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--text);
}

/* recommended cards */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .9rem;
}
.rec-card {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.rec-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.rec-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--text);
}
.rec-card:hover .rec-title { color: var(--accent); }
.rec-meta { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); }

@media (max-width: 560px) {
  .post-nav { flex-direction: column; }
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-top: 2.4rem;
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--text-soft);
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: .55rem 1.1rem;
  transition: all .18s var(--ease);
}
.btn-back:hover { color: var(--accent); border-color: var(--accent); transform: translateX(-3px); }

/* =========================================================================
   Back-to-top floating button
   ========================================================================= */
.to-top {
  position: fixed;
  right: 1.8rem;
  bottom: 1.8rem;
  z-index: 40;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity .25s var(--ease), transform .25s var(--ease),
    visibility .25s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover {
  background: var(--accent);
  color: #0b0e14;
  border-color: var(--accent);
}
.to-top svg { width: 20px; height: 20px; }

@media (max-width: 560px) {
  .to-top { right: 1.1rem; bottom: 1.1rem; }
}

/* =========================================================================
   Footer
   ========================================================================= */
.content-footer {
  flex: none;
  text-align: center;
  padding: 2rem;
  color: var(--muted-dim);
  font-family: var(--font-mono);
  font-size: .72rem;
  border-top: 1px solid var(--border);
}

/* =========================================================================
   Motion
   ========================================================================= */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { animation: rise .6s var(--ease) both; }
.content > .reveal:nth-child(1) { animation-delay: .02s; }
.content > .reveal:nth-child(2) { animation-delay: .09s; }
.content > .reveal:nth-child(3) { animation-delay: .16s; }
.post-card.reveal:nth-child(1) { animation-delay: .12s; }
.post-card.reveal:nth-child(2) { animation-delay: .19s; }
.post-card.reveal:nth-child(3) { animation-delay: .26s; }
.post-card.reveal:nth-child(4) { animation-delay: .33s; }
.post-card.reveal:nth-child(5) { animation-delay: .40s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 900px) {
  .sidebar {
    width: min(300px, 86vw);   /* 小屏侧栏不占满，露出遮罩便于点击关闭 */
    transform: translateX(-100%);
    transition: transform .3s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .topbar { display: flex; }
  body.nav-open { overflow: hidden; }   /* 侧栏打开时锁定背景滚动 */
  body.nav-open .backdrop { display: block; }
  .content { padding: 2.2rem 1.3rem 1.5rem; }
  .panel { padding: 1.6rem 1.4rem 1.8rem; }
  /* 移动端不展示右栏（最近更新 / 热门标签 / 目录） */
  .page-aside { display: none; }
}

/* 手机竖屏：进一步收紧间距与字号 */
@media (max-width: 600px) {
  .content { padding: 1.8rem 1.05rem 1.4rem; }
  .page-head { margin-bottom: 1.6rem; }
  .page-grid { gap: 1.6rem; }

  .post-card { padding: 1.2rem 1.15rem; }
  .post-card-title { font-size: 1.18rem; }
  .article-title { font-size: 1.65rem; }

  .panel { padding: 1.3rem 1.15rem 1.5rem; }
  .widget { padding: 1.2rem 1.15rem 1.3rem; }
  .rec-grid { grid-template-columns: 1fr; }

  /* 宽表格改为横向滚动，避免撑破布局 */
  .prose table { display: block; width: 100%; overflow-x: auto; }

  /* 分享按钮略缩小，单行更易排布 */
  .share-btn { width: 40px; height: 40px; }
}

/* 超小屏 */
@media (max-width: 380px) {
  .content { padding: 1.6rem .85rem 1.2rem; }
  .pager a, .pager span { min-width: 2.1rem; padding: .4rem .55rem; }
}
