:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-elevated: #ffffff;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --primary-border: rgba(37, 99, 235, 0.22);
  --accent-amber: #d97706;
  --accent-amber-soft: rgba(217, 119, 6, 0.1);
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --code-bg: #0f172a;
  --code-header-bg: #1e293b;
  --code-text: #e2e8f0;
  --inline-code-bg: #f1f5f9;
  --inline-code-text: #0f172a;
  --topbar-bg: rgba(255, 255, 255, 0.84);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.06), 0 1px 3px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 24px -6px rgba(15, 23, 42, 0.08), 0 4px 10px -4px rgba(15, 23, 42, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --max-width: 1140px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-page: #0b1120;
    --bg-surface: #111827;
    --bg-subtle: #1e293b;
    --bg-elevated: #1f2937;
    --text-main: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --primary-color: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-soft: rgba(96, 165, 250, 0.14);
    --primary-border: rgba(96, 165, 250, 0.3);
    --accent-amber: #fbbf24;
    --accent-amber-soft: rgba(251, 191, 36, 0.14);
    --border-color: #1e293b;
    --border-hover: #334155;
    --code-bg: #090d16;
    --code-header-bg: #131c2e;
    --code-text: #e2e8f0;
    --inline-code-bg: #1e293b;
    --inline-code-text: #93c5fd;
    --topbar-bg: rgba(17, 24, 39, 0.84);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  --bg-page: #0b1120;
  --bg-surface: #111827;
  --bg-subtle: #1e293b;
  --bg-elevated: #1f2937;
  --text-main: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --primary-color: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-soft: rgba(96, 165, 250, 0.14);
  --primary-border: rgba(96, 165, 250, 0.3);
  --accent-amber: #fbbf24;
  --accent-amber-soft: rgba(251, 191, 36, 0.14);
  --border-color: #1e293b;
  --border-hover: #334155;
  --code-bg: #090d16;
  --code-header-bg: #131c2e;
  --code-text: #e2e8f0;
  --inline-code-bg: #1e293b;
  --inline-code-text: #93c5fd;
  --topbar-bg: rgba(17, 24, 39, 0.84);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.45);
}

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

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

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

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-color), #38bdf8);
  z-index: 1001;
  transition: width 0.08s linear;
}

/* Sticky Top Navigation Bar */
.site-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-color);
}

.topbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.68rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.brand-logo:hover {
  color: var(--primary-color);
}

.brand-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-color);
  line-height: 1.2;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.38rem 0.58rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
  background: var(--primary-soft);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.search-submit-btn {
  position: absolute;
  left: 0.45rem;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  cursor: pointer;
  z-index: 2;
}

.search-submit-btn:hover {
  color: var(--primary-color);
}

.search-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.search-input {
  padding: 0.38rem 0.75rem 0.38rem 2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.85rem;
  width: 170px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  width: 220px;
  background: var(--bg-surface);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-soft);
}

/* Main 2-Column Layout */
.site-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3.5rem;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 2rem;
  align-items: start;
}

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

/* Post Cards (Home & Archive) */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.65rem;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

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

.post-card.is-sticky {
  border-color: var(--primary-border);
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--bg-surface) 60%);
}

.post-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.post-card-badges {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.badge-sticky {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
}

.badge-cat {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary-color);
}

.badge-cat:hover {
  background: var(--primary-color);
  color: #ffffff;
}

.post-card-meta-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-light);
  font-family: var(--font-mono);
}

.meta-dot,
.meta-sep {
  color: var(--text-light);
  opacity: 0.45;
  font-size: 0.78rem;
}

.post-card-title {
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.65rem;
  letter-spacing: -0.01em;
}

.post-card-title a {
  color: var(--text-main);
}

.post-card-title a:hover {
  color: var(--primary-color);
}

.post-summary {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.72;
  margin-bottom: 1.1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border-color);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-card-footer-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.post-comment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.post-comment-pill:hover {
  color: var(--primary-color);
}

.post-card-tags {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.mini-tag {
  font-size: 0.78rem;
  color: var(--text-light);
  background: var(--bg-subtle);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.mini-tag:hover {
  color: var(--primary-color);
  background: var(--primary-soft);
}

.read-more-link {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.read-more-link .arrow {
  transition: transform 0.15s ease;
}

.read-more-link:hover .arrow {
  transform: translateX(3px);
}

/* Archive Banner */
.archive-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}

.archive-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.archive-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.archive-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.archive-count-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Pagination */
.pagination {
  margin-top: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  box-shadow: var(--shadow-xs);
}

.pagination-info {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
}

.page-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
}

.empty-state-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

/* Single Post Detail Card */
.single-post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-xs);
}

.post-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.83rem;
  color: var(--text-light);
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.post-breadcrumb a {
  color: var(--text-muted);
}

.post-breadcrumb a:hover {
  color: var(--primary-color);
}

.breadcrumb-sep {
  opacity: 0.5;
}

.breadcrumb-current {
  color: var(--text-light);
}

.single-post-header {
  margin-bottom: 1.85rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--border-color);
}

.single-post-title {
  font-size: 1.95rem;
  font-weight: 800;
  line-height: 1.32;
  margin-bottom: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.single-post-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-comment-link {
  color: var(--text-muted);
}

.meta-comment-link:hover {
  color: var(--primary-color);
}

/* Table of Contents */
.toc-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.85rem;
  font-size: 0.9rem;
}

.toc-card summary {
  font-weight: 700;
  cursor: pointer;
  color: var(--text-main);
  user-select: none;
}

.toc-card ul {
  list-style: none;
  margin-top: 0.65rem;
  padding-left: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.toc-card li.toc-h3 {
  padding-left: 1.1rem;
  font-size: 0.86rem;
}

.toc-card a {
  color: var(--text-secondary);
}

.toc-card a:hover {
  color: var(--primary-color);
}

/* Post Body Typography */
.post-body {
  font-size: 1.04rem;
  line-height: 1.85;
  color: var(--text-main);
  overflow-wrap: break-word;
}

.post-body p {
  margin-bottom: 1.35rem;
}

.post-body h2,
.post-body h3,
.post-body h4 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.38;
  margin-top: 2.2rem;
  margin-bottom: 0.9rem;
  scroll-margin-top: 4.5rem;
}

.post-body h2 {
  font-size: 1.45rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.post-body h3 {
  font-size: 1.22rem;
}

.post-body ul,
.post-body ol {
  margin-bottom: 1.35rem;
  padding-left: 1.6rem;
}

.post-body li {
  margin-bottom: 0.4rem;
}

.post-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body blockquote {
  border-left: 4px solid var(--primary-color);
  padding: 0.85rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--bg-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

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

.post-body img,
.post-body picture {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.post-body picture {
  display: block;
  margin: 1.4rem auto;
  text-align: center;
}

.post-body picture img {
  display: inline-block;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.post-body > img,
.post-body p > img,
.post-body figure img {
  display: block;
  margin: 1.4rem auto;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.post-body figure {
  margin: 1.5rem 0;
  text-align: center;
}

.post-body figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
}

/* WordPress Gallery Grid Compatibility */
.post-body .wp-block-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0;
}

.post-body .wp-block-gallery figure,
.post-body .wp-block-gallery picture {
  margin: 0;
  width: 100%;
  height: 100%;
}

.post-body .wp-block-gallery img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  margin: 0;
  display: block;
  background: var(--bg-subtle);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-body .wp-block-gallery img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Tables */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}

.post-body th,
.post-body td {
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  text-align: left;
}

.post-body th {
  background: var(--bg-subtle);
  font-weight: 600;
}

/* Inline Code & Terminal Code Blocks */
.post-body code {
  font-family: var(--font-mono);
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  padding: 0.18rem 0.42rem;
  border-radius: 4px;
  font-size: 0.88em;
}

.code-block-wrapper {
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #1e293b;
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.9rem;
  background: var(--code-header-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.code-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.code-dots span:nth-child(1) { background: #ef4444; }
.code-dots span:nth-child(2) { background: #f59e0b; }
.code-dots span:nth-child(3) { background: #10b981; }

.code-lang {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.65;
  position: relative;
}

.code-block-wrapper pre {
  margin: 0;
  border-radius: 0;
}

.post-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.copy-code-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  padding: 0.18rem 0.55rem;
  font-size: 0.74rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.copy-code-btn.copied {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

/* Post Tags */
.single-post-tags {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tags-label {
  font-size: 0.86rem;
  color: var(--text-muted);
  font-weight: 600;
}

.post-tag-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.83rem;
}

.post-tag-pill:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-soft);
}

/* Prev / Next Post Navigation Grid */
.post-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.2rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.post-nav-card:not(.empty):hover {
  border-color: var(--primary-color);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.post-nav-card.next {
  text-align: right;
}

.post-nav-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.post-nav-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-nav-title.muted {
  color: var(--text-light);
  font-weight: 500;
}

.post-nav-date {
  font-size: 0.76rem;
  color: var(--text-light);
  font-family: var(--font-mono);
}

/* Comments & Guestbook Section */
.comments-section {
  margin-top: 2.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.comments-title {
  font-size: 1.25rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.comments-count-badge {
  background: var(--primary-soft);
  color: var(--primary-color);
  font-size: 0.82rem;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-full);
}

.write-comment-btn {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.write-comment-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin-bottom: 2rem;
}

.comment-item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  scroll-margin-top: 5rem;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  object-fit: cover;
  background: var(--bg-subtle);
}

.comment-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  object-fit: cover;
  background: var(--bg-subtle);
}

.avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), #3b82f6);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  box-shadow: var(--shadow-xs);
}

.avatar-fallback-sm {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

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

.comment-bubble {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 0.85rem 1.1rem;
}

.comment-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}

.comment-author-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.comment-author-name {
  font-size: 0.92rem;
  color: var(--text-main);
}

.author-badge,
.author-badge-xs,
.badge-admin {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.08rem 0.45rem;
  border-radius: 4px;
  background: var(--primary-color);
  color: #ffffff;
  line-height: 1.3;
}

.comment-time {
  font-size: 0.76rem;
  color: var(--text-light);
  font-family: var(--font-mono);
}

.comment-reply-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

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

.comment-content {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--text-main);
  overflow-wrap: break-word;
}

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

.comment-replies {
  margin-top: 0.7rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.comment-reply-item {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  scroll-margin-top: 5rem;
}

.comment-reply-bubble {
  flex: 1;
  min-width: 0;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.95rem;
}

.comments-empty {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Comment Form Card */
.comment-form-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
}

.comment-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.comment-form-header h4 {
  font-size: 1.05rem;
  font-weight: 700;
}

.cancel-reply-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
}

.comment-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

.form-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-field label small {
  font-weight: 400;
  color: var(--text-light);
}

.form-field .req {
  color: #ef4444;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.comment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.comment-form-tip {
  font-size: 0.8rem;
  color: var(--text-light);
}

.comment-submit-btn {
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 0.58rem 1.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.comment-submit-btn:hover {
  background: var(--primary-hover);
}

/* Right Sidebar Cards */
.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-xs);
}

.sidebar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.95rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Profile Card */
.profile-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-color), #1e40af);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}

.profile-tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.profile-bio {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.9rem;
}

.profile-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.profile-pill {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38rem 0.25rem;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.profile-pill:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-soft);
}

/* Category List */
.sidebar-cat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-cat-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.42rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.sidebar-cat-list a:hover {
  background: var(--primary-soft);
  color: var(--primary-color);
}

.cat-count {
  font-size: 0.76rem;
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 0.08rem 0.5rem;
  border-radius: var(--radius-full);
}

/* Recent Comments List */
.sidebar-comment-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-comment-item {
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border-color);
}

.sidebar-comment-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.sidebar-comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.sidebar-comment-author {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sidebar-comment-date {
  font-size: 0.75rem;
  color: var(--text-light);
  font-family: var(--font-mono);
}

.sidebar-comment-excerpt {
  display: block;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.2rem;
}

.sidebar-comment-excerpt:hover {
  color: var(--primary-color);
}

.sidebar-comment-post {
  font-size: 0.76rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Tag Cloud */
.sidebar-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  padding: 0.22rem 0.58rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.tag-pill small {
  color: var(--text-light);
  font-size: 0.72rem;
}

.tag-pill:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-soft);
}

/* Friends Links */
.sidebar-links-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.friend-link-item {
  font-size: 0.84rem;
  color: var(--text-secondary);
  padding: 0.38rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-link-item:hover {
  border-color: var(--primary-border);
  color: var(--primary-color);
  background: var(--primary-soft);
}

/* Site Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  padding: 1.75rem 1.5rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.footer-links a {
  color: var(--text-muted);
}

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

/* Back to Top Button */
.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 90;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .brand-subtitle {
    display: none;
  }
}

@media (max-width: 680px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    gap: 0.65rem;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
  }

  .nav-link {
    white-space: nowrap;
    font-size: 0.86rem;
    padding: 0.3rem 0.6rem;
  }

  .search-input {
    width: 130px;
  }

  .search-input:focus {
    width: 165px;
  }

  .site-container {
    padding: 1.25rem 1rem 2.5rem;
  }

  .post-card {
    padding: 1.2rem 1.25rem;
  }

  .single-post-card {
    padding: 1.35rem 1.2rem;
  }

  .single-post-title {
    font-size: 1.5rem;
  }

  .post-nav-grid,
  .comment-form-grid {
    grid-template-columns: 1fr;
  }

  .post-nav-card.next {
    text-align: left;
  }
}
