/* ============================================
   极客亮色风格 - Geek Light Theme
   ============================================ */

:root {
  --bg: #fafaf7;
  --bg-elevated: #ffffff;
  --bg-code: #f4f4ef;
  --border: #e5e5dc;
  --border-strong: #d0d0c4;
  --text: #1a1a1a;
  --text-muted: #6b6b66;
  --text-subtle: #8a8a82;
  --accent: #2d7a3e;          /* 终端绿 */
  --accent-hover: #1f5a2c;
  --accent-bg: #e8f3eb;
  --highlight: #d97706;       /* 琥珀色高亮 */
  --link: #1565c0;
  --link-hover: #0d47a1;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-hover: 0 2px 4px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);

  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code',
               Menlo, Consolas, 'Liberation Mono', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;

  --radius: 6px;
  --radius-lg: 10px;
  --max-width: 980px;
  --page-gutter: clamp(1rem, 3vw, 2.5rem);
  --section-gap: clamp(2.25rem, 4vw, 3.5rem);
  --hero-gap: clamp(2rem, 4vw, 3rem);
  --content-max: 760px;
  --content-max-wide: 820px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 24px 24px;
  background-attachment: fixed;
}

/* ============================================
   布局 Layout
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-gutter);
}

main {
  padding: 2rem 0 4rem;
  min-height: calc(100vh - 200px);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10000;
  padding: 0.55rem 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-decoration: none;
  box-shadow: var(--shadow-hover);
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-main:focus {
  outline: none;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand::before {
  content: '$';
  color: var(--accent);
  margin-right: 0.1rem;
}

.brand .cursor {
  display: inline-block;
  width: 9px;
  height: 1.05rem;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 1s steps(2) infinite;
  vertical-align: -3px;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ============================================
   Hero / Header
   ============================================ */
.hero {
  padding: var(--hero-gap) 0 calc(var(--hero-gap) - 0.5rem);
  border-bottom: 1px dashed var(--border-strong);
  margin-bottom: var(--section-gap);
}

.hero h1 {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero .prompt {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  display: block;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 640px;
}

.hero .tag-row {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================
   首页品牌入口 Home
   ============================================ */
.home-hero {
  padding-top: 3.4rem;
}

.home-hero p {
  max-width: 760px;
  font-size: 1.08rem;
  line-height: 1.75;
}

.home-hero .home-hero-tagline {
  display: inline-flex;
  max-width: 100%;
  margin: 0.55rem 0 0;
  padding: 0.65rem 0 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}

.home-hero .home-hero-tagline::before {
  content: '//';
  margin-right: 0.55rem;
  color: var(--accent);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.home-section {
  margin: var(--section-gap) 0;
}

.home-section-header {
  max-width: 760px;
  margin-bottom: 1.1rem;
}

.home-section-header h2 {
  margin-bottom: 0.45rem;
}

.home-section-kicker {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--accent);
}

.home-section-lead {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.65;
}

.home-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-garden-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

a.home-card {
  text-decoration: none;
  border-bottom: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

a.home-card:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.home-card h3 {
  margin: 0.55rem 0 0.45rem;
  font-size: 1rem;
  line-height: 1.35;
}

.home-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.home-card-code,
.home-card-meta {
  color: var(--text-subtle);
}

.home-card-meta {
  margin-top: auto;
  padding-top: 0.85rem;
}

.home-focus-grid .home-card {
  background: color-mix(in srgb, var(--bg-elevated) 84%, var(--bg-code));
  border-left: 3px solid var(--border-strong);
}

.home-focus-grid .home-card-code {
  color: var(--accent);
  font-weight: 600;
}

.home-featured-card p {
  margin-bottom: 0.25rem;
}

.home-featured-grid {
  align-items: stretch;
}

.home-featured-card {
  position: relative;
}

.home-featured-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.home-featured-primary {
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, rgba(232, 243, 235, 0.6), rgba(255,255,255,0) 42%),
    var(--bg-elevated);
}

.home-featured-primary h3 {
  font-size: 1.12rem;
}

.home-featured-primary::after {
  border-top: 3px solid var(--accent);
}

.home-project-grid {
  margin-top: 1rem;
}

.home-project-card {
  border-color: var(--border-strong);
}

.home-project-card .project-status {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-placeholder-card {
  border-style: dashed;
  background: var(--bg);
  opacity: 0.72;
}

.home-placeholder-card h3,
.home-placeholder-card p {
  color: var(--text-muted);
}

.home-section-link {
  margin-top: 0.8rem;
}

.home-garden-grid {
  padding: 1rem;
  background:
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    linear-gradient(var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.home-garden-grid .home-link-card {
  background: rgba(255, 255, 255, 0.86);
}

.home-garden-meta {
  margin-top: auto;
  padding-top: 0.8rem;
  color: var(--accent);
}

.home-now-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.35rem 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.home-now-panel h2 {
  margin-top: 0;
}

.home-now-panel p {
  max-width: 680px;
  margin: 0;
  color: var(--text-muted);
}

.home-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.home-contact-section {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px dashed var(--border-strong);
}

.elsewhere-home-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .home-card-grid,
  .home-garden-grid,
  .elsewhere-home-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .home-hero {
    padding-top: 2.4rem;
  }

  .home-actions,
  .home-contact-row {
    flex-direction: column;
    align-items: stretch;
  }

  .home-actions .btn,
  .home-contact-row .btn {
    justify-content: center;
  }

  .home-card-grid,
  .home-garden-grid,
  .home-project-grid,
  .elsewhere-home-list {
    grid-template-columns: 1fr;
  }

  .home-now-panel {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.15rem;
  }
}

/* ============================================
   Elsewhere / 外部发布索引
   ============================================ */
.elsewhere-hero p {
  max-width: 760px;
  line-height: 1.7;
}

.elsewhere-section {
  margin: var(--section-gap) 0;
}

.elsewhere-section-header {
  max-width: 760px;
  margin-bottom: 1rem;
}

.elsewhere-kicker {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--accent);
}

.elsewhere-platforms,
.elsewhere-card-head,
.elsewhere-tags,
.elsewhere-list,
.elsewhere-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.elsewhere-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}

.elsewhere-card,
.elsewhere-empty,
.elsewhere-note {
  padding: 1.1rem 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.elsewhere-card h3 {
  margin: 0.7rem 0 0.45rem;
  font-size: 1.05rem;
}

.elsewhere-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 0.85rem;
  overflow: hidden;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.elsewhere-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.elsewhere-card p,
.elsewhere-empty p,
.elsewhere-note p {
  margin-bottom: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.elsewhere-platform,
.elsewhere-type {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  border: 1px solid var(--border);
  background: var(--bg-code);
  color: var(--text-muted);
}

.elsewhere-type {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: transparent;
}

.elsewhere-mode {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  color: var(--text-subtle);
}

.elsewhere-link {
  display: inline-flex;
  width: max-content;
  margin-top: 0.8rem;
}

.elsewhere-empty,
.elsewhere-note {
  border-style: dashed;
  background: var(--bg);
}

.elsewhere-note h2 {
  margin-top: 0;
}

@media (max-width: 640px) {
  .elsewhere-list {
    grid-template-columns: 1fr;
  }

  .elsewhere-card,
  .elsewhere-empty,
  .elsewhere-note {
    padding: 1rem;
  }
}

/* ============================================
   通用 元素
   ============================================ */
h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

h2 {
  font-size: 1.4rem;
  margin: 2rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

h2::before {
  content: '#';
  color: var(--accent);
  font-weight: 400;
}

h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text);
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted var(--link);
  transition: all 0.15s ease;
}

a:hover {
  color: var(--link-hover);
  border-bottom-style: solid;
}

code {
  font-family: var(--font-mono);
  background: var(--bg-code);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--border);
}

pre {
  max-width: 100%;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 1rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

.post-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  background: var(--accent-bg);
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px dashed var(--border-strong);
  margin: 2rem 0;
}

/* ============================================
   文章列表 Post List (Card Grid)
   ============================================ */
.post-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}

.post-card-wrap {
  list-style: none;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  height: 100%;
}

.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* 封面 */
.post-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--bg-code);
}

.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.post-card:hover .post-cover img {
  transform: scale(1.04);
}

/* 无图时的 fallback */
.post-cover-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-code) 0%, var(--accent-bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.post-cover-fallback::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--accent) 1px, transparent 0);
  background-size: 20px 20px;
  opacity: 0.18;
}

.post-cover-fallback::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: -2px;
  right: -2px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.5;
}

.post-cover-fallback .cover-tag {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-elevated);
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  z-index: 1;
  box-shadow: var(--shadow);
}

.post-cover-fallback .cover-tag::before {
  content: '#';
  opacity: 0.5;
  margin-right: 2px;
}

/* 系列标签徽章（卡片角上） */
.series-pill {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  border-radius: 4px;
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
  z-index: 2;
  font-size: 0.72rem;
}

/* 卡片正文 */
.post-card .post-body {
  padding: 1rem 1.15rem 1.15rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.post-card .post-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-card .post-date::before {
  content: '> ';
  color: var(--accent);
}

.post-card h3 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  margin: 0 0 0.45rem;
  color: var(--text);
  line-height: 1.4;
}

.post-card:hover h3 {
  color: var(--accent);
}

.post-card .excerpt {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.55;
}

/* ============================================
   标签 Tags
   ============================================ */
.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  background: var(--bg-code);
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.tag::before {
  content: '#';
  color: var(--accent);
  margin-right: 1px;
}

.tag:hover, .tag.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

.tag-count {
  margin-left: 0.4rem;
  color: var(--text-subtle);
  font-size: 0.7rem;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ============================================
   项目卡片 Projects
   ============================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.18s ease;
  position: relative;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.project-card .project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.project-card .project-icon {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--accent);
}

.project-card .project-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  background: var(--accent-bg);
  color: var(--accent);
}

.project-card .project-status.archived {
  background: var(--bg-code);
  color: var(--text-subtle);
}

.project-card h3 {
  font-size: 1.1rem;
  margin: 0 0 0.4rem;
}

.project-card .project-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex-grow: 1;
  margin-bottom: 0.8rem;
}

.project-card .project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}

/* ============================================
   Labs / 构建记录
   ============================================ */
.labs-hero p {
  max-width: 760px;
  line-height: 1.7;
}

.labs-section {
  margin: var(--section-gap) 0;
}

.labs-section-header {
  max-width: 760px;
  margin-bottom: 1rem;
}

.labs-kicker {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--accent);
}

.labs-principles,
.labs-status-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.labs-mini-card,
.labs-status-item,
.labs-note,
.labs-contact {
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.labs-mini-card h3 {
  margin: 0.45rem 0 0;
  font-size: 1rem;
  line-height: 1.45;
}

.labs-status-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.labs-status-item {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.project-status.prototype {
  background: rgba(217, 119, 6, 0.14);
  color: var(--highlight);
}

.project-status.learning {
  background: rgba(21, 101, 192, 0.12);
  color: var(--link);
}

.labs-featured-card {
  display: block;
  padding: 1.35rem 1.5rem;
  background:
    linear-gradient(180deg, rgba(232, 243, 235, 0.55), rgba(255,255,255,0) 38%),
    var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.labs-featured-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.labs-featured-card h3 {
  margin-top: 0.4rem;
  font-size: 1.25rem;
}

.labs-featured-card p {
  max-width: 760px;
  color: var(--text-muted);
}

.labs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}

.labs-card {
  min-height: 100%;
}

.labs-card .project-meta {
  flex-wrap: wrap;
}

.labs-project-facts {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--border);
}

.labs-project-facts div {
  display: grid;
  gap: 0.25rem;
}

.labs-project-facts dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.labs-project-facts dd {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.labs-note {
  border-style: dashed;
  background: var(--bg);
}

.labs-note h2,
.labs-contact h2 {
  margin-top: 0;
}

.labs-note p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--text-muted);
}

.labs-contact {
  border-top: 3px solid var(--accent);
}

.labs-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

@media (max-width: 900px) {
  .labs-principles,
  .labs-status-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .labs-principles,
  .labs-status-list,
  .labs-grid {
    grid-template-columns: 1fr;
  }

  .labs-featured-card,
  .labs-note,
  .labs-contact {
    padding: 1.1rem;
  }
}

/* ============================================
   关于我 About
   ============================================ */
.about-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 640px) {
  .about-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .avatar {
    width: 128px;
    height: 128px;
  }
}

.avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;   /* 圆形，比 radius-lg 更"人像"一些 */
  background: linear-gradient(135deg, var(--accent-bg), var(--bg-code));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 3rem;
  color: var(--accent);
  border: 3px solid var(--accent);
  font-weight: 700;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  margin: 0 auto;
}

/* 当 .avatar 里放了 img（即有真实照片）时，让图片填满圆形 */
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* 图片加载失败时 JS 替换出的兜底首字母 */
.avatar-fallback {
  font-family: var(--font-mono);
  font-size: 3rem;
  color: var(--accent);
  font-weight: 700;
}

/* 侧边栏的小头像（每页都显示） */
.sidebar-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  overflow: hidden;
  margin: 0 0 0.75rem 0;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.sidebar-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-bg), var(--bg-code));
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
}

.info-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}

.info-block h3 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}

.timeline {
  list-style: none;
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  margin-top: 0.75rem;
}

.timeline li {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline li::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  left: -1.78rem;
  top: 0.55rem;
  border: 2px solid var(--bg);
}

.timeline .time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.timeline .event {
  display: block;
  margin-top: 0.15rem;
}

/* ============================================
   终端框 Terminal Box
   ============================================ */
.terminal {
  background: #1e1e1e;
  color: #e8e8e8;
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.terminal-head {
  background: #2d2d2d;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.terminal-head .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.terminal-head .dot.r { background: #ff5f56; }
.terminal-head .dot.y { background: #ffbd2e; }
.terminal-head .dot.g { background: #27c93f; }

.terminal-head .title {
  margin-left: 0.5rem;
  color: #999;
  font-size: 0.8rem;
}

.terminal-body {
  padding: 1rem 1.25rem;
  line-height: 1.65;
}

.terminal-body .line { display: block; }
.terminal-body .green { color: #50fa7b; }
.terminal-body .cyan { color: #8be9fd; }
.terminal-body .yellow { color: #f1fa8c; }
.terminal-body .gray { color: #888; }

/* ============================================
   页脚 Footer
   ============================================ */
.footer {
  border-top: 1px dashed var(--border-strong);
  padding: 2rem 0;
  margin-top: 4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-subtle);
  text-align: center;
}

.footer a {
  color: var(--text-muted);
  border-bottom-style: dotted;
  margin: 0 0.4rem;
}

.footer a:hover {
  color: var(--accent);
}

/* ============================================
   文章详情 Post Page
   ============================================ */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--border-strong);
}

.post-header h1 {
  font-family: var(--font-mono);
  font-size: 2rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.post-header .post-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-subtle);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

/* 文章页顶部的封面图 */
.post-detail-cover {
  margin: -0.5rem 0 1.75rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--bg-code);
}

.post-detail-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.post-content {
  font-size: 1.02rem;
  line-height: 1.8;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.25rem 1.5rem;
  color: var(--text);
}

.post-content li {
  margin-bottom: 0.3rem;
}

/* ============================================
   正文媒体：图片 / 视频 / 嵌入
   ============================================ */

/* 正文图片：自适应宽度、圆角、阴影 */
.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--bg-code);
}

/* 图片说明文字：在 Markdown 里用 *斜体* 紧跟在 ![]() 后面会自动生效，
   也可以用 <figure><img><figcaption> 结构 */
.post-content figure {
  margin: 1.5rem 0;
  text-align: center;
}

.post-content figure img {
  margin: 0 auto 0.5rem;
}

.post-content figcaption {
  font-size: 0.9rem;
  color: var(--text-muted, var(--text));
  opacity: 0.75;
  font-style: italic;
}

/* ============================================
   系列横幅 Series Banner
   ============================================ */
.series-banner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 2rem;
}

.series-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.series-head .series-icon {
  font-size: 1.3rem;
}

.series-head .series-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.series-head .series-label {
  letter-spacing: 0.05em;
}

.series-head .series-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text);
}

.series-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  border-top: 1px dashed var(--border);
  padding-top: 0.6rem;
}

.series-item {
  padding: 0.3rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.93rem;
  line-height: 1.5;
}

.series-item .series-num {
  color: var(--text-subtle);
  flex-shrink: 0;
  min-width: 1.5rem;
}

.series-item .series-item-title {
  color: var(--link);
}

.series-item .series-item-title:hover {
  color: var(--link-hover);
}

.series-item.is-current .series-item-title {
  color: var(--accent);
  border-bottom: none;
}

.series-item .series-current-tag {
  color: var(--accent);
  margin-left: 0.4rem;
}

/* ============================================
   文章导航 Post Navigation
   ============================================ */
.post-nav {
  margin-top: 3rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: space-between;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border-strong);
}

.post-end-nav {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============================================
   响应式 Responsive
   ============================================ */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.6rem;
  }
  .container {
    padding: 0 1rem;
  }
  .post-list {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   实用类 Utilities
   ============================================ */
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }
.small { font-size: 0.85rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--accent-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn.secondary:hover {
  background: var(--accent-bg);
}

.search-box {
  width: 100%;
  padding: 0.7rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  margin-bottom: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

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

.search-box::placeholder {
  color: var(--text-subtle);
}

/* 隐藏的过滤项 */
.is-hidden {
  display: none !important;
}

/* ============================================
   Lil'Log 风：正文窄宽 + TOC + 卡片优化
   ============================================ */

/* 文章页正文窄宽容器（720px） */
.post-narrow {
  max-width: 720px;
  margin: 0 auto;
}

/* 卡片摘要：完整段落 + 行数限制 + 阅读时长 */
.post-card .reading-time {
  display: inline-flex;
  align-items: center;
  color: var(--text-subtle);
}

.post-card .excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0;
}

/* ============================================
   TOC 目录（文章顶部内联）
   ============================================ */
.post-toc {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.85rem 1.2rem;
  margin: 0 0 2rem;
}

.post-toc[hidden] {
  display: none !important;
}

.post-toc .toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--border);
}

.post-toc .toc-head .mono {
  letter-spacing: 0.05em;
}

.post-toc .toc-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.post-toc .toc-toggle:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

.post-toc.is-collapsed .toc-list {
  display: none;
}

.post-toc.is-collapsed .toc-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.post-toc .toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.92rem;
}

.post-toc .toc-list li {
  padding: 0.2rem 0;
  line-height: 1.55;
}

.post-toc .toc-h2 {
  font-weight: 500;
}

.post-toc .toc-h3 {
  padding-left: 1.5rem !important;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.post-toc .toc-h3::before {
  content: '└ ';
  color: var(--text-subtle);
  font-family: var(--font-mono);
  margin-right: 0.2rem;
}

.post-toc a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: none;
  overflow-wrap: anywhere;
  transition: color 0.1s ease;
}

.post-toc a:hover {
  color: var(--accent);
}

.post-toc a.is-active {
  color: var(--accent);
  font-weight: 700;
}

.post-toc a.is-active::before {
  content: '▸ ';
  margin-right: 0.1rem;
}

/* heading anchor scroll offset */
.post-content h2,
.post-content h3 {
  scroll-margin-top: 80px;
}

/* ============================================
   代码块行号 Code Line Numbers
   ============================================ */
.highlight {
  border-radius: var(--radius);
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

.highlight pre {
  margin: 0;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.highlight table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
  overflow-y: hidden;
}

.highlight table td {
  padding: 0;
  vertical-align: top;
}

/* 行号列 */
.highlight .gutter,
.highlight .rouge-gutter,
.highlight td.gl {
  width: 2.5rem;
  background: var(--bg-code);
  border-right: 1px solid var(--border);
  user-select: none;
  text-align: right;
}

.highlight .gutter pre,
.highlight .rouge-gutter pre,
.highlight td.gl pre {
  padding: 1rem 0.6rem;
  color: var(--text-subtle);
  font-size: 0.85rem;
  opacity: 0.65;
}

/* 代码列 */
.highlight .code,
.highlight .rouge-code,
.highlight td.gi {
  width: 100%;
}

.highlight .code pre,
.highlight .rouge-code pre,
.highlight td.gi pre {
  padding: 1rem;
  overflow-x: auto;
}

.highlight .lineno {
  color: var(--text-subtle);
  opacity: 0.5;
  padding-right: 0.8rem;
  user-select: none;
}

/* Rouge syntax highlight tokens（亮色主题） */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #6b6b66; font-style: italic; }   /* comment */
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #7c3aed; font-weight: 600; }  /* keyword */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss { color: #15803d; }  /* string */
.highlight .n, .highlight .na, .highlight .nb, .highlight .nc, .highlight .nd, .highlight .ne, .highlight .nf, .highlight .ni, .highlight .nl, .highlight .nn, .highlight .no, .highlight .nx, .highlight .py, .highlight .nt, .highlight .nv { color: #1a1a1a; }  /* name */
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: #d97706; }  /* number */
.highlight .o, .highlight .ow { color: #d97706; }  /* operator */
.highlight .err { color: #dc2626; }

/* ============================================
   KaTeX 样式微调
   ============================================ */
.katex-display {
  max-width: 100%;
  margin: 1.25rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
}

.katex {
  font-size: 1.05em;
}

/* ============================================
   归档页 Archive
   ============================================ */
.archive {
  margin-top: 1rem;
}

.archive-year {
  margin-bottom: 2.5rem;
}

.archive-year-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--border-strong);
  margin: 0 0 0.75rem;
}

.archive-year-head::before {
  content: none !important;
}

.archive-year-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.archive-year-count {
  color: var(--text-subtle);
}

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

.archive-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 1rem;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
  transition: background 0.12s ease;
}

.archive-item:hover {
  background: var(--accent-bg);
  border-radius: 4px;
  padding-left: 0.5rem;
}

.archive-date {
  color: var(--text-subtle);
  letter-spacing: 0.02em;
}

.archive-title {
  color: var(--text);
  text-decoration: none;
  border-bottom: none;
  font-weight: 500;
  line-height: 1.4;
}

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

.archive-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-subtle);
  font-size: 0.78rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.archive-tag {
  padding: 0.05rem 0.4rem;
  background: var(--bg-code);
  border-radius: 3px;
  color: var(--text-muted);
}

.archive-reading {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .archive-item {
    grid-template-columns: 50px 1fr;
  }
  .archive-meta {
    grid-column: 2;
    justify-content: flex-start;
  }
}

/* ============================================
   双栏布局 / Sidebar Layout
   ============================================ */

.site-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  margin: 0;
}

.site-sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  height: 100%;
  overflow-y: auto;
  padding: 2.5rem 1.5rem 1.5rem;
}

.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.sidebar-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: max-content;
  color: var(--text);
  text-decoration: none;
  border: 0;
}

.brand-link:hover {
  color: var(--text);
}

.brand-link:hover .brand-name {
  color: var(--accent);
}

.brand-link .brand-mark {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-link .brand-name {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
  transition: color 0.15s ease;
}

.brand-link .cursor {
  display: inline-block;
  width: 8px;
  height: 0.95rem;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s steps(2) infinite;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 -0.5rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border: 0;
  border-radius: var(--radius);
  transition: background 0.12s ease, color 0.12s ease;
}

.sidebar-nav-link:hover {
  background: var(--accent-bg);
  color: var(--text);
}

.sidebar-nav-link.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav-link .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.75;
}

.sidebar-nav-link:hover .nav-icon,
.sidebar-nav-link.active .nav-icon {
  opacity: 1;
}

.sidebar-connect,
.sidebar-lang {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.sidebar-section-title {
  display: block;
  margin: 0 0 0.75rem;
  letter-spacing: 0.08em;
}

.sidebar-section-title::before {
  content: none;
}

.connect-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.connect-list a {
  display: block;
  padding: 0.25rem 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  text-decoration: none;
  border: 0;
  transition: color 0.12s ease;
}

.connect-list a:hover {
  color: var(--accent);
}

.sidebar-spacer {
  flex: 1 1 auto;
  min-height: 1.5rem;
}

.sidebar-footer {
  padding-top: 1rem;
  color: var(--text-subtle);
  font-size: 0.78rem;
  text-align: left;
  border-top: 1px solid var(--border);
}

.site-main {
  min-width: 0;
  padding: clamp(2rem, 4vw, 3rem) var(--page-gutter) 2rem;
}

.site-main-inner,
body.has-sidebar .footer {
  width: 100%;
  max-width: var(--content-max);
  margin-right: auto;
  margin-left: auto;
}

body.has-sidebar .container {
  max-width: 100%;
  padding: 0;
}

body.has-sidebar main {
  padding: 0;
}

body.has-sidebar .hero {
  padding: 2rem 0;
  margin-bottom: 2rem;
}

body.has-sidebar .footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  text-align: left;
  border-top: 1px dashed var(--border-strong);
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.9rem;
  right: 1rem;
  z-index: 100;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.sidebar-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.sidebar-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.sidebar-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0,0,0,0.35);
}

@media (min-width: 1400px) {
  .site-main-inner,
  body.has-sidebar .footer {
    max-width: var(--content-max-wide);
  }
}

@media (max-width: 900px) {
  .site-layout {
    display: block;
  }

  .site-sidebar {
    position: fixed;
    top: 0;
    left: -270px;
    width: min(260px, calc(100vw - 2rem));
    height: 100vh;
    box-shadow: 2px 0 12px rgba(0,0,0,0.04);
    transition: left 0.25s ease;
  }

  .site-sidebar.is-open {
    left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-backdrop.is-shown {
    display: block;
  }

  body.has-sidebar .site-main {
    padding: 4rem var(--page-gutter) 1.25rem;
  }

  .site-main-inner,
  body.has-sidebar .footer {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  body.has-sidebar .hero {
    padding-top: 2.5rem;
    margin-bottom: 1.5rem;
  }

  .sidebar-toggle {
    top: 0.75rem;
    right: 0.75rem;
  }

  .post-header .post-meta,
  .note-page .note-meta {
    gap: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .post-toc {
    padding: 0.8rem 1rem;
  }

  .post-toc .toc-head {
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ============================================
   i18n 中英文切换 — data-ui-lang 控制界面语言
   ============================================ */

.i18n {
  display: inline;
}

html[data-ui-lang="zh"] .i18n-en,
html[data-ui-lang="en"] .i18n-zh {
  display: none !important;
}

html[data-ui-lang="zh"] .ui-lang-en,
html[data-ui-lang="en"] .ui-lang-zh {
  display: none !important;
}

html[data-ui-lang="zh"] .i18n-zh,
html[data-ui-lang="en"] .i18n-en {
  display: inline;
}

/* 语言切换按钮 */
.sidebar-lang {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 100%;
  transition: all 0.15s ease;
}

.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.lang-toggle .lang-toggle-arrow {
  opacity: 0.5;
  font-size: 0.9em;
}

.lang-toggle .lang-toggle-other {
  color: var(--accent);
  font-weight: 500;
}

/* ============================================
   代码块复制按钮
   ============================================ */
.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  z-index: 5;
}

.highlight:hover .code-copy-btn,
.post-content pre:hover .code-copy-btn,
.code-copy-btn:focus {
  opacity: 1;
}

.code-copy-btn:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent);
}

.code-copy-btn.is-copied {
  opacity: 1 !important;
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent);
}

/* 触屏设备始终显示 */
@media (hover: none) {
  .code-copy-btn {
    opacity: 0.6;
  }
}

/* ============================================
   文章底部分享按钮
   ============================================ */
.post-share {
  margin: 2.5rem 0 0;
  padding: 1.25rem 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.post-share .share-label {
  letter-spacing: 0.08em;
  margin-right: 0.25rem;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
  transform: translateY(-1px);
}

.share-btn.is-copied {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.share-btn svg {
  flex-shrink: 0;
}

/* ============================================
   分享按钮：中英文按 data-ui-lang 切换平台集合
   ============================================ */
.share-set {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  width: 100%;
}

html[data-ui-lang="en"] .share-set-zh,
html[data-ui-lang="zh"] .share-set-en {
  display: none !important;
}

/* 平台特定 hover 色（微博红 / 微信绿 / Twitter 黑等可选） */
.share-btn.share-weibo:hover {
  border-color: #e6162d;
  color: #e6162d;
  background: #fff0f0;
}
.share-btn.share-wechat:hover {
  border-color: #07c160;
  color: #07c160;
  background: #e8f8ef;
}
.share-btn.share-qzone:hover {
  border-color: #f9a825;
  color: #f9a825;
  background: #fff8e1;
}
.share-btn.share-twitter:hover,
.share-btn.share-linkedin:hover,
.share-btn.share-reddit:hover {
  border-color: var(--text);
  color: var(--text);
  background: var(--bg-code);
}

/* ============================================
   品牌 Badge — 中文平台的小圆形首字标
   ============================================ */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}

.brand-mark-weibo  { background: #e6162d; }   /* 微博红 */
.brand-mark-xhs    { background: #ff2442; }   /* 小红书红 */
.brand-mark-wechat { background: #07c160; }   /* 微信绿 */
.brand-mark-mp     { background: #2dad44; }   /* 公众号深绿 */
.brand-mark-zhihu  { background: #0084ff; }   /* 知乎蓝 */
.brand-mark-juejin { background: #1e80ff; }   /* 掘金蓝 */
.brand-mark-csdn   { background: #fc5531; }   /* CSDN 橙红 */

/* hover 时按钮整体边框跟随平台色 */
.share-btn.share-weibo:hover  { border-color: #e6162d; color: #e6162d; background: #fff0f0; }
.share-btn.share-xhs:hover    { border-color: #ff2442; color: #ff2442; background: #fff0f2; }
.share-btn.share-wechat:hover { border-color: #07c160; color: #07c160; background: #e8f8ef; }
.share-btn.share-mp:hover     { border-color: #2dad44; color: #2dad44; background: #e8f5ec; }
.share-btn.share-zhihu:hover  { border-color: #0084ff; color: #0084ff; background: #e8f3ff; }
.share-btn.share-juejin:hover { border-color: #1e80ff; color: #1e80ff; background: #e8f3ff; }
.share-btn.share-csdn:hover   { border-color: #fc5531; color: #fc5531; background: #fff1ec; }

/* 移除旧的 qzone 样式（如果还存在） */
.share-btn.share-qzone { display: none !important; }

/* ============================================
   真双语：语言徽章 + 列表过滤 + 跨语言提示条
   ============================================ */

/* 当前 UI 语言不匹配的列表项隐藏（搜索的 .is-hidden 也共用 display:none） */
.lang-hidden { display: none !important; }

/* 文章/笔记的语言徽章（小标签：ZH / EN） */
.post-lang-badge {
  display: inline-block;
  padding: 0.1rem 0.42rem;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  vertical-align: 1px;
  user-select: none;
}

.post-lang-badge-zh {
  background: rgba(229, 62, 62, 0.12);
  color: #c0392b;
  border: 1px solid rgba(229, 62, 62, 0.25);
}

.post-lang-badge-en {
  background: rgba(56, 139, 253, 0.12);
  color: #1f6feb;
  border: 1px solid rgba(56, 139, 253, 0.25);
}

/* 卡片上的语言徽章绝对定位到右上角 */
.post-cover {
  position: relative;
}

.post-cover .post-lang-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(13, 17, 23, 0.85);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
}

.post-cover .post-lang-badge-en {
  background: rgba(31, 111, 235, 0.92);
  border-color: rgba(255, 255, 255, 0.3);
}

.post-cover .post-lang-badge-zh {
  background: rgba(192, 57, 43, 0.92);
  border-color: rgba(255, 255, 255, 0.3);
}

/* 笔记列表里语言徽章和成熟度并排显示 */
.notes-index-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* 跨语言提示条（page 顶部）：本文有英文版/中文版 */
.translation-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.75rem 0;
  padding: 0.7rem 1rem;
  background: linear-gradient(
    135deg,
    rgba(56, 139, 253, 0.08),
    rgba(56, 139, 253, 0.03)
  );
  border: 1px solid rgba(56, 139, 253, 0.25);
  border-left: 3px solid #388bfd;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.translation-banner-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.translation-banner-text {
  flex: 1;
}

.translation-banner-link {
  font-weight: 600;
  color: #1f6feb;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.translation-banner-link:hover {
  opacity: 0.85;
}

/* ============================================
   Sidenotes（Tufte 风边注）
   桌面端：脚注从底部移到正文右侧空白边距
   移动端：折叠为点击展开
   ============================================ */

/* 让 .post-narrow 在宽屏时可以容纳右侧边注 */
@media (min-width: 1600px) {
  .post-narrow {
    /* 给右侧留出 240px 边注区域 */
    padding-right: 260px;
    max-width: 960px;  /* 720 + 240 */
    position: relative;
  }
}

/* 脚注标记：上标小数字（来自 kramdown） */
.post-content sup.footnote-ref,
.post-content sup[id^="fnref"],
.post-content a.footnote {
  font-size: 0.75em;
  line-height: 1;
  vertical-align: super;
  color: var(--accent, #58a6ff);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0.15em;
}

.post-content sup.footnote-ref:hover,
.post-content a.footnote:hover {
  text-decoration: underline;
}

/* Sidenote 容器（由 JS 注入到 marker 旁边） */
.sidenote {
  display: none;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  opacity: 0.85;
}

.sidenote-number {
  font-weight: 600;
  color: var(--accent, #58a6ff);
  margin-right: 0.25em;
}

/* 桌面端：边注定位到右侧 */
@media (min-width: 1600px) {
  .sidenote {
    display: block;
    position: absolute;
    right: -260px;
    width: 230px;
    margin-top: -0.4em;
    padding: 0.5rem 0.75rem;
    border-left: 2px solid var(--border, rgba(255,255,255,0.1));
    background: var(--bg-elevated, rgba(255,255,255,0.02));
    border-radius: 0 var(--radius) var(--radius) 0;
  }

  /* 桌面端：原来的底部 footnotes 区域隐藏（已经搬到边上了） */
  .post-content .footnotes {
    display: none;
  }
}

/* 移动端：保持 marker 但 sidenote 通过点击展开 */
@media (max-width: 1599px) {
  .sidenote.is-expanded {
    display: block;
    margin: 0.5rem 0;
    padding: 0.6rem 0.8rem;
    border-left: 2px solid var(--accent, #58a6ff);
    background: var(--bg-elevated, rgba(255,255,255,0.04));
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.88rem;
  }

  /* 移动端：底部 footnotes 区域保留（兜底） */
  .post-content .footnotes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border, rgba(255,255,255,0.1));
    font-size: 0.9rem;
  }

  .post-content .footnotes ol {
    padding-left: 1.5rem;
  }

  .post-content .footnotes li {
    margin-bottom: 0.6rem;
  }

  .post-content .footnotes .reversefootnote {
    margin-left: 0.4em;
    text-decoration: none;
    color: var(--accent, #58a6ff);
  }
}

/* 列表空态：当前语言没有文章时显示 */
.lang-empty-state {
  margin: 2rem 0;
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text);
  opacity: 0.75;
}

.lang-empty-state .mono {
  display: block;
  margin-bottom: 0.5rem;
}

/* ============================================
   TIL 索引页
   ============================================ */
.til-index {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1.5rem;
}

.til-month {
  border-left: 2px dashed var(--border, rgba(255,255,255,0.1));
  padding-left: 1rem;
}

.til-month-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
}

.til-month-name {
  font-weight: 700;
  color: var(--accent, #58a6ff);
}

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

.til-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--border, rgba(255,255,255,0.08));
}

.til-item:last-child { border-bottom: 0; }

.til-date {
  color: var(--text);
  opacity: 0.55;
  flex-shrink: 0;
  width: 3.5rem;
}

.til-item-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  text-decoration: none;
  color: var(--text);
}

.til-item-title:hover {
  color: var(--accent, #58a6ff);
}

.til-item-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.til-end-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border, rgba(255,255,255,0.1));
}

.til-page .til-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed var(--border, rgba(255,255,255,0.1));
}

.til-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* ============================================
   404 页面
   ============================================ */
.not-found {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
  text-align: center;
}

.not-found-terminal {
  max-width: 520px;
  margin: 0 auto 2rem;
  text-align: left;
}

.not-found-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0 0.5rem;
  flex-wrap: wrap;
}

.not-found-code {
  font-size: 3rem;
  color: var(--accent, #58a6ff);
}

.not-found-lead {
  color: var(--text);
  opacity: 0.8;
  margin-bottom: 2rem;
}

.not-found-search {
  margin: 2rem 0;
  text-align: left;
}

.not-found-search .post-list {
  margin-top: 1rem;
}

.not-found-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 2rem;
}

/* ============================================
   全局搜索：Pagefind Modal
   ============================================ */
.sidebar-search-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin: 0 0 0.75rem 0;
  background: var(--bg-elevated, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: border-color 0.15s ease;
}

/* 修复：搜索按钮内的 SVG 必须显式约束尺寸，否则会撑满整行 */
.sidebar-search-btn .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-search-btn:hover {
  border-color: var(--accent, #58a6ff);
}

.sidebar-search-kbd {
  margin-left: auto;
  padding: 0.05rem 0.3rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 3px;
  font-size: 0.72rem;
  color: var(--text);
  opacity: 0.7;
}

.pagefind-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 2rem;
}

.pagefind-modal[hidden] { display: none; }

.pagefind-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.pagefind-modal-panel {
  position: relative;
  width: 100%;
  max-width: 680px;
  background: var(--bg-elevated, #161b22);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}

.pagefind-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}

.pagefind-modal-close {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.4rem;
  opacity: 0.7;
}

.pagefind-modal-close:hover { opacity: 1; }

/* Pagefind UI 内部样式微调 */
#pagefind-search {
  padding: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.pagefind-unavailable {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.pagefind-unavailable p {
  margin: 0.55rem 0 0;
  color: var(--text-muted);
}

.pagefind-ui {
  --pagefind-ui-primary: var(--accent, #58a6ff);
  --pagefind-ui-text: var(--text, #c9d1d9);
  --pagefind-ui-background: transparent;
  --pagefind-ui-border: var(--border, rgba(255,255,255,0.12));
  --pagefind-ui-tag: var(--bg-elevated, rgba(255,255,255,0.05));
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 6px;
  --pagefind-ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* ============================================
   笔记系统：Notes / Digital Garden
   ============================================ */

/* ---------- 笔记页面元信息条 ---------- */
.note-page .note-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed var(--border);
}

.note-page .note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
}

.note-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  opacity: 0.85;
}

.note-meta-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* ---------- 成熟度小标签 ---------- */
.note-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  white-space: nowrap;
  user-select: none;
}

.note-status-icon {
  line-height: 1;
}

.note-status-seedling {
  color: #b08900;
  border-color: rgba(176, 137, 0, 0.35);
  background: rgba(176, 137, 0, 0.08);
}

.note-status-growing {
  color: #2c8c3e;
  border-color: rgba(44, 140, 62, 0.35);
  background: rgba(44, 140, 62, 0.08);
}

.note-status-evergreen {
  color: #1e6b8c;
  border-color: rgba(30, 107, 140, 0.35);
  background: rgba(30, 107, 140, 0.08);
}

/* ---------- Wiki 链接（[[xxx]] 渲染出的样式） ---------- */
.wikilink {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  padding: 0 0.05em;
  transition: background 0.15s ease;
}

.wikilink:hover {
  background: var(--bg-code);
}

.wikilink.broken,
.wikilink-broken {
  color: #c0392b;
  border-bottom-style: dotted;
  cursor: help;
  opacity: 0.8;
}

.wikilink.broken::after,
.wikilink-broken::after {
  content: "?";
  font-size: 0.75em;
  vertical-align: super;
  margin-left: 0.1em;
}

/* ---------- Backlinks 面板 ---------- */
.backlinks-panel {
  margin-top: 3rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.backlinks-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem 0;
  letter-spacing: 0.04em;
}

.backlinks-icon {
  font-size: 1.1em;
}

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

.backlinks-item {
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--border);
}

.backlinks-item:last-child {
  border-bottom: 0;
}

.backlinks-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
}

.backlinks-link:hover .backlinks-link-title {
  color: var(--accent);
  text-decoration: underline;
}

.backlinks-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  vertical-align: 2px;
}

.backlinks-badge-post {
  background: rgba(30, 107, 140, 0.15);
  color: #1e6b8c;
}

.backlinks-badge-note {
  background: rgba(44, 140, 62, 0.15);
  color: #2c8c3e;
}

.backlinks-context {
  margin: 0.3rem 0 0 3.1rem;
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0.65;
  font-style: italic;
}

/* ---------- 笔记目录页（/notes/） ---------- */
.notes-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.notes-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.notes-index {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.notes-index-item {
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.notes-index-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.notes-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.notes-index-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.notes-index-title:hover {
  color: var(--accent);
}

.notes-index-desc {
  margin: 0.35rem 0 0.5rem 0;
  color: var(--text);
  opacity: 0.85;
  font-size: 0.92rem;
  line-height: 1.55;
}

.notes-index-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.notes-index-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.notes-index-refs {
  color: var(--accent);
}

.notes-empty {
  margin: 3rem 0;
  padding: 2rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- 笔记页底部导航 ---------- */
.note-end-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}

/* ---------- 响应式：手机上笔记卡更紧凑 ---------- */
@media (max-width: 640px) {
  .notes-index-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .note-page .note-meta {
    gap: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* 尊重系统"减少动态效果"设置 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .post-card:hover,
  .project-card:hover,
  .btn:hover,
  .share-btn:hover {
    transform: none;
  }
}

/* ============================================
   Research studio refresh
   ============================================ */
:root {
  --bg: #0b100d;
  --bg-elevated: #111813;
  --bg-code: #151d17;
  --border: #26332a;
  --border-strong: #405243;
  --text: #f1f5f0;
  --text-muted: #a5b2a8;
  --text-subtle: #78877d;
  --accent: #9adf70;
  --accent-hover: #b5ee8e;
  --accent-bg: #1a2b1b;
  --highlight: #9adf70;
  --link: #b5ee8e;
  --link-hover: #d1ffaf;
  --shadow: 0 1px 1px rgb(0 0 0 / 22%), 0 16px 36px rgb(0 0 0 / 14%);
  --shadow-hover: 0 1px 1px rgb(0 0 0 / 30%), 0 22px 52px rgb(0 0 0 / 28%);
  --radius: 12px;
  --radius-lg: 20px;
  --content-max: 1080px;
  --content-max-wide: 1200px;
  --font-sans: "Segoe UI Variable", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  background:
    radial-gradient(circle at 82% 10%, rgb(103 146 93 / 14%), transparent 24rem),
    radial-gradient(circle at 12% 70%, rgb(68 98 72 / 10%), transparent 28rem),
    var(--bg);
  background-attachment: fixed;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image: linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }

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

.site-sidebar {
  background: rgb(11 16 13 / 92%);
  border-right-color: var(--border);
  backdrop-filter: blur(18px);
}

.sidebar-inner { padding: 2rem 1.35rem 1.35rem; }

.sidebar-avatar {
  width: 62px;
  height: 62px;
  padding: 3px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: #0b100d;
}

.sidebar-avatar img { border-radius: inherit; }

.brand-link .brand-name {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.sidebar-nav { gap: 0.25rem; }

.sidebar-nav-link {
  padding: 0.72rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: border-color .22s ease, background .22s ease, color .22s ease, transform .22s ease;
}

.sidebar-nav-link:hover,
.sidebar-nav-link.active {
  border-color: #36513a;
  background: #17211a;
  color: var(--text);
}

.sidebar-nav-link.active { color: var(--accent); }

.site-main { padding: clamp(1.5rem, 3vw, 3rem) var(--page-gutter) 3rem; }

body.has-sidebar .footer {
  border-top-style: solid;
  border-top-color: var(--border);
}

.hero {
  border-bottom-style: solid;
  border-bottom-color: var(--border);
}

.hero h1,
.home-section h2,
.labs-section h2,
.post-header h1,
.note-page h1 {
  font-family: var(--font-sans);
  font-weight: 720;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.btn {
  min-height: 44px;
  padding: 0.68rem 1.05rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: #081008;
  background: var(--accent);
  box-shadow: none;
  font-weight: 700;
  transition: color .22s ease, background .22s ease, border-color .22s ease, transform .22s ease;
}

.btn:hover {
  color: #081008;
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-2px);
}

.btn:active { transform: translateY(0) scale(.98); }

.btn.secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border-strong);
}

.btn.secondary:hover { color: var(--accent); border-color: var(--accent); background: #17211a; }

/* Homepage */
body.has-sidebar .home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr);
  gap: clamp(2rem, 6vw, 6.5rem);
  align-items: center;
  min-height: min(690px, calc(100dvh - 4rem));
  padding: clamp(2rem, 5vw, 5.5rem) 0 clamp(2.75rem, 5vw, 5.5rem);
  margin-bottom: clamp(2.75rem, 6vw, 5.5rem);
}

.home-hero .prompt {
  margin-bottom: 1.15rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.home-hero h1 {
  max-width: 10ch;
  margin-bottom: 1.25rem;
  color: var(--text);
  font-size: clamp(3rem, 5.4vw, 5.75rem);
  line-height: .98;
}

.home-hero p { max-width: 38rem; color: var(--text-muted); font-size: clamp(1rem, 1.2vw, 1.15rem); line-height: 1.78; }

.home-hero .home-hero-tagline {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top-color: var(--border-strong);
  color: var(--text);
  font-size: .92rem;
  font-weight: 600;
}

.home-hero .home-hero-tagline::before { content: ""; width: 7px; height: 7px; margin: 0 .65rem 0 0; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgb(154 223 112 / 12%); }

.home-actions { gap: .75rem; margin-top: 1.8rem; }

.home-hero__domains {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .9rem;
  margin: 1.65rem 0 0;
  padding: 0;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: .72rem;
  list-style: none;
}

.home-hero__domains li { display: inline-flex; align-items: center; gap: .55rem; }
.home-hero__domains li:not(:last-child)::after { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); content: ""; }

.home-hero__visual {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid #3a4b3c;
  border-radius: var(--radius-lg);
  background: #101711;
  box-shadow: 0 32px 90px rgb(0 0 0 / 38%);
}

.home-hero__visual::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(135deg, rgb(154 223 112 / 10%), transparent 34%, transparent 70%, rgb(0 0 0 / 30%));
}

.home-hero__visual img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

.home-section { margin: clamp(4rem, 8vw, 8rem) 0; }
.home-section-header { max-width: 46rem; margin-bottom: 1.7rem; }
.home-section-header h2 { margin-bottom: .7rem; font-size: clamp(2rem, 3.2vw, 3.25rem); line-height: 1.08; }
.home-section-kicker { margin-bottom: .75rem; color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.home-section-lead { max-width: 42rem; color: var(--text-muted); font-size: 1rem; }

.home-card-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.home-card {
  padding: 1.45rem;
  border-color: var(--border);
  border-radius: var(--radius);
  background: #111813;
  box-shadow: none;
}

a.home-card:hover { border-color: #52745a; color: var(--text); background: #151f17; box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.home-card h3 { margin-top: .85rem; color: var(--text); font-size: 1.1rem; }
.home-card p { color: var(--text-muted); font-size: .95rem; }
.home-card-code, .home-card-meta { color: var(--text-subtle); }

.home-focus-grid .home-card { border-left: 1px solid var(--border); background: #111813; }
.home-focus-grid .home-card:nth-child(1) { grid-column: span 5; }
.home-focus-grid .home-card:nth-child(2) { grid-column: span 4; background: #131c15; }
.home-focus-grid .home-card:nth-child(3) { grid-column: span 3; }
.home-focus-grid .home-card-code { color: var(--accent); }

.home-featured-grid .home-featured-card { grid-column: span 4; }
.home-featured-grid .home-featured-primary { grid-column: span 6; border-color: #49634b; background: linear-gradient(145deg, #1b2b1c, #111813 62%); }
.home-featured-primary::after { border-top: 1px solid var(--accent); }
.home-project-grid .project-card { grid-column: span 6; }

.home-garden-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.home-garden-grid .home-link-card { grid-column: span 3; background: #101711; }
.home-garden-grid .home-link-card:first-child { grid-column: span 6; background: #17251a; }
.home-garden-meta { color: var(--accent); }

.home-now-panel { padding: clamp(1.5rem, 3vw, 2.5rem); border-left: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(110deg, #17231a, #111813); }
.home-contact-section { border-top-style: solid; border-top-color: var(--border); }
.elsewhere-home-list .elsewhere-card { border-color: var(--border); background: #111813; }

/* Project and long-form pages */
.labs-hero { max-width: 54rem; padding-top: clamp(3rem, 6vw, 6rem); }
.labs-hero h1 { font-size: clamp(3rem, 6vw, 5.5rem); line-height: .98; }
.labs-section { margin: clamp(2.75rem, 5vw, 4.75rem) 0; }
.labs-section h2 { font-size: clamp(1.9rem, 3vw, 3rem); line-height: 1.08; }
.labs-kicker { color: var(--accent); letter-spacing: .1em; }
.labs-note { max-width: 50rem; padding: 0; border: 0; background: transparent; }
.labs-note + .labs-note { margin-top: clamp(2.25rem, 4vw, 3.5rem); }
.labs-principles { grid-template-columns: 5fr 4fr 3fr; gap: 1rem; }
.labs-mini-card { padding: 1.4rem; border-color: var(--border); border-radius: var(--radius); background: #111813; }
.labs-mini-card:nth-child(2) { background: #162019; }
.labs-featured-card, .project-card { border-color: var(--border); border-radius: var(--radius); background: #111813; }
.labs-featured-card { padding: clamp(1.5rem, 3.2vw, 3rem); background: linear-gradient(135deg, #19271b, #111813 64%); }
.project-card:hover { border-color: #52745a; background: #151f17; box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.project-card h3, .labs-featured-card h3 { color: var(--text); }
.project-card .project-meta { color: var(--text-subtle); }
.labs-status-list { border-top-color: var(--border); }
.labs-status-item { border-bottom-color: var(--border); }

.post-card, .note-card, .til-item, .elsewhere-card { border-color: var(--border); background: #111813; }
.post-card:hover, .note-card:hover, .til-item:hover { border-color: #52745a; background: #151f17; }

h2::before { content: none; }

@media (max-width: 900px) {
  body.has-sidebar .home-hero { grid-template-columns: 1fr; min-height: auto; gap: 2rem; }
  .home-hero__visual { max-width: 760px; }
  .home-focus-grid .home-card:nth-child(n), .home-featured-grid .home-featured-card, .home-featured-grid .home-featured-primary, .home-project-grid .project-card { grid-column: span 6; }
  .home-garden-grid .home-link-card { grid-column: span 6; }
  .home-garden-grid .home-link-card:first-child { grid-column: span 12; }
  .labs-principles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  body.has-sidebar .home-hero { padding-top: 1.5rem; }
  .home-hero h1 { max-width: 12ch; font-size: clamp(2.7rem, 13vw, 3.8rem); }
  .home-actions { flex-direction: column; align-items: stretch; }
  .home-actions .btn { justify-content: center; }
  .home-hero__domains { gap: .5rem; }
  .home-hero__domains li { width: 100%; }
  .home-hero__domains li::after { display: none; }
  .home-section { margin: 4.5rem 0; }
  .home-focus-grid .home-card:nth-child(n), .home-featured-grid .home-featured-card, .home-featured-grid .home-featured-primary, .home-project-grid .project-card, .home-garden-grid .home-link-card, .home-garden-grid .home-link-card:first-child { grid-column: 1 / -1; }
  .labs-principles { grid-template-columns: 1fr; }
  .sidebar-toggle { border-radius: 10px; background: #111813; border-color: var(--border); }
}
