/* ==========================================================================
   Academic Blue Theme — Pure CSS
   Personal academic homepage stylesheet
   ========================================================================== */

/* ── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
  /* Simplified Academic Blue Palette */
  --c-primary: #2563eb;
  --c-primary-dark: #1e40af;
  --c-primary-light: #3b82f6;
  --c-text: #1f2937;
  --c-text-light: #6b7280;
  --c-bg: #f9fafb;
  --c-border: #e5e7eb;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-left-margin: 40px;
  --page-right-margin: 40px;
  --navbar-height: 60px;
  --content-max: 960px;
}

/* Dark theme variables */
[data-theme="dark"] {
  --c-primary: #3b82f6;
  --c-primary-dark: #60a5fa;
  --c-primary-light: #2563eb;
  --c-text: #f3f4f6;
  --c-text-light: #9ca3af;
  --c-bg: #1f2937;
  --c-border: #374151;
}

[data-theme="dark"] body {
  background: #111827;
}

[data-theme="dark"] .site-navbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 60%, #2563eb 100%);
  border-bottom-color: #374151;
}

[data-theme="dark"] .site-sidebar {
  background: #1f2937;
  border-right-color: #374151;
}

[data-theme="dark"] .page {
  background: #1f2937;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3), 0 0 1px rgba(0,0,0,0.2);
}

[data-theme="dark"] .toc-container {
  background: #1f2937;
  border-color: #374151;
}

[data-theme="dark"] .search-input {
  background: rgba(0,0,0,0.3);
  border-color: rgba(255,255,255,0.2);
  color: #e8f1f8;
}

[data-theme="dark"] .search-input::placeholder {
  color: rgba(255,255,255,0.5);
}

[data-theme="dark"] .search-input:focus {
  background: rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.3);
}

[data-theme="dark"] .search-results {
  background: #1a2332;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

[data-theme="dark"] .search-result-item {
  border-bottom-color: #2c3e50;
}

[data-theme="dark"] .search-result-item:hover {
  background: #212d3f;
}

[data-theme="dark"] .search-result-snippet mark {
  background: #3d5a80;
  color: #e8f1f8;
}

[data-theme="dark"] .sidebar-links li {
  border-bottom-color: #2c3e50;
}

[data-theme="dark"] code,
[data-theme="dark"] pre {
  background: #0f1419;
  border-color: #2c3e50;
}

[data-theme="dark"] .pub-item,
[data-theme="dark"] .news-item,
[data-theme="dark"] .tool-card {
  background: #1f2937;
  border-color: #374151;
}

[data-theme="dark"] .tool-card:hover {
  background: #212d3f;
  border-color: var(--c-primary);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: #f4f7fb;
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--c-primary-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--c-text); }

img { max-width: 100%; height: auto; }

/* ── Navbar ────────────────────────────────────────────────────────────── */
.site-navbar {
  position: fixed;
  top: 0;
  left: 5%;
  right: 5%;
  height: var(--navbar-height);
  background: linear-gradient(135deg, var(--c-primary-dark) 0%, var(--c-primary) 60%, var(--c-primary-light) 100%);
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
  z-index: 1000;
  border-radius: 0 0 12px 12px;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  margin-left: 0;
  margin-right: 0;
  padding: 0 2.5em;
}

.site-nav-brand {
  color: #fff !important;
  font-weight: 700;
  font-size: 1.1em;
  letter-spacing: 0.02em;
  text-decoration: none !important;
  white-space: nowrap;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.15em;
}

.nav-links a {
  color: rgba(255,255,255,0.85) !important;
  font-weight: 500;
  font-size: 0.92em;
  padding: 0.4em 0.9em;
  border-radius: 4px;
  text-decoration: none !important;
  transition: background 0.2s, color 0.2s;
  position: relative;
  letter-spacing: 0.01em;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.15);
  color: #fff !important;
}

.nav-links a.active {
  background: rgba(255,255,255,0.2);
  color: #fff !important;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 25%; right: 25%;
  height: 2px;
  background: rgba(255,255,255,0.8);
  border-radius: 1px;
}

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: 12px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 5px 0;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Nav Tools (Search + Theme Toggle) */
.nav-tools {
  display: flex;
  align-items: center;
  gap: 1em;
  margin-left: 1.5em;
}

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

.search-input {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 0.4em 2.2em 0.4em 1em;
  color: #fff;
  font-size: 0.85em;
  width: 200px;
  transition: all 0.3s;
}

.search-input::placeholder {
  color: rgba(255,255,255,0.6);
}

.search-input:focus {
  outline: none;
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
  width: 250px;
}

.search-icon {
  position: absolute;
  right: 0.8em;
  color: rgba(255,255,255,0.7);
  font-size: 0.85em;
  pointer-events: none;
}

.theme-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  color: #fff;
  font-size: 0.9em;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
  transform: rotate(15deg);
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(var(--navbar-height) + 5px);
  right: 5%;
  width: 500px;
  max-height: 70vh;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  overflow-y: auto;
  z-index: 999;
  display: none;
}

.search-results.active {
  display: block;
}

.search-results-header {
  padding: 1em 1.2em;
  border-bottom: 1px solid var(--c-border);
  font-weight: 600;
  color: var(--c-text);
  font-size: 0.9em;
}

.search-result-item {
  padding: 1em 1.2em;
  border-bottom: 1px solid #f0f5fb;
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: #f8fbff;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 0.3em;
  font-size: 0.95em;
}

.search-result-snippet {
  color: var(--c-text-light);
  font-size: 0.85em;
  line-height: 1.5;
}

.search-result-snippet mark {
  background: #fff3cd;
  color: var(--c-text);
  padding: 0 0.2em;
  border-radius: 2px;
}

.search-no-results {
  padding: 2em;
  text-align: center;
  color: var(--c-text-light);
  font-size: 0.9em;
}

/* ── Page Layout ───────────────────────────────────────────────────────── */
.page-wrapper {
  display: flex;
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
}

.page-content {
  flex: 1;
  margin-left: calc(var(--sidebar-width) + 5%);
  margin-right: 5%;
  padding: 2.5em 3em 3em;
  display: flex;
  justify-content: center;
}

.page-content.has-toc {
  display: grid;
  grid-template-columns: minmax(0, var(--content-max)) 240px;
  gap: 2em;
  justify-content: center;
}

.page-content.has-toc > .page {
  min-width: 0;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.site-sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 5%;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  background: #fff;
  border-right: 1px solid var(--c-border);
  box-shadow: 2px 0 12px rgba(26,74,122,0.06);
  padding: 2.5em 1.5em 1.5em;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 0 8px 8px 0;
}

.sidebar-avatar {
  display: block;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid var(--c-primary);
  box-shadow: 0 3px 12px rgba(26,111,168,0.2);
  margin-bottom: 0.8em;
  object-fit: cover;
}

.sidebar-name {
  text-align: center;
  color: var(--c-text);
  font-weight: 700;
  font-size: 1em;
  margin-bottom: 0.2em;
}

.sidebar-bio {
  text-align: center;
  color: var(--c-text-light);
  font-size: 0.78em;
  line-height: 1.5;
  margin-bottom: 0.8em;
  padding-bottom: 0.8em;
  border-bottom: 1px solid var(--c-border);
  width: 100%;
}

.sidebar-links {
  list-style: none;
  width: 100%;
}

.sidebar-links li {
  border-bottom: 1px solid #f0f5fb;
}

.sidebar-links li:last-child { border-bottom: none; }

.sidebar-links a,
.sidebar-links span {
  color: var(--c-primary-light) !important;
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  text-decoration: none !important;
  transition: color 0.15s;
}

.sidebar-links a:hover {
  color: var(--c-text) !important;
}

.sidebar-links .fa-solid,
.sidebar-links .fa-brands,
.sidebar-links .fa-regular {
  width: 16px;
  text-align: center;
  color: var(--c-text-light);
  font-size: 0.82em;
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 0.75em;
  font-weight: 600;
  color: var(--c-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1.2em;
  margin-bottom: 0.4em;
  padding: 0.3em 0;
  border-bottom: 2px solid var(--c-primary);
}

.sidebar-section-title:first-child {
  margin-top: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1em;
  border-top: 1px solid var(--c-border);
  text-align: center;
  font-size: 0.72em;
  color: var(--c-text-light);
  line-height: 1.6;
  width: 100%;
}

.sidebar-footer a {
  color: var(--c-text-light);
  transition: color 0.2s;
}

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

/* ── Main Content Card ─────────────────────────────────────────────────── */
.page {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 20px rgba(26,74,122,0.08), 0 0 1px rgba(26,74,122,0.1);
  padding: 3em 3.5em;
  margin-bottom: 2em;
  width: 100%;
  max-width: var(--content-max);
}

.page__title {
  color: var(--c-text);
  font-size: 1.8em;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-bottom: 3px solid var(--c-primary);
  padding-bottom: 0.45em;
  margin-bottom: 1.3em;
}

/* ── Typography ────────────────────────────────────────────────────────── */
.page h2 {
  color: var(--c-text);
  font-size: 1.2em;
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.7em;
  padding-left: 0.7em;
  border-left: 4px solid var(--c-primary);
}

.page h3 { color: var(--c-primary-dark); font-size: 1.05em; font-weight: 600; margin-top: 1.3em; }
.page h4 { color: var(--c-primary); font-weight: 600; }

.page a {
  color: var(--c-primary-light);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}
.page a:hover { color: var(--c-text); border-bottom-color: var(--c-primary-light); }

.page hr { border: none; border-top: 1px solid var(--c-border); margin: 1.8em 0; }

.page p { margin-bottom: 0.9em; }

.page ul, .page ol {
  margin: 0.5em 0 1em 1.5em;
}

.page li { margin-bottom: 0.35em; line-height: 1.7; }

.page ul li::marker,
.page ol li::marker { color: var(--c-primary); }

.page blockquote {
  border-left: 4px solid var(--c-primary);
  background: var(--c-bg);
  padding: 0.8em 1.2em;
  border-radius: 0 6px 6px 0;
  color: #3a5a7a;
  font-style: normal;
  margin: 1.4em 0;
  font-size: 0.95em;
}

.page strong { font-weight: 700; }
.page em { font-style: italic; }

.page code {
  background: #e8f4fd;
  border: 1px solid #b8d9f5;
  color: #1a4a7a;
  border-radius: 3px;
  font-size: 0.84em;
  padding: 0.1em 0.35em;
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, monospace;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
.page table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.92em;
  border: 1px solid #c0c4cc;
}

.page table thead th {
  background: color-mix(in srgb, var(--c-primary) 15%, var(--c-bg));
  color: var(--c-text);
  border: 1px solid #c0c4cc;
  border-bottom: 2px solid var(--c-primary);
  padding: 0.55em 1em;
  font-weight: 600;
  text-align: left;
  font-size: 0.95em;
}

.page table tbody td {
  padding: 0.5em 1em;
  border: 1px solid #c0c4cc;
  vertical-align: top;
}

.page table tbody tr:nth-child(even) td { background: var(--c-bg); }
.page table tbody tr:hover td { background: #ddeefa; }

/* ── News Items ────────────────────────────────────────────────────────── */
.news-item {
  display: flex;
  gap: 1em;
  padding: 0.6em 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.92em;
  align-items: baseline;
}

.news-item:last-child { border-bottom: none; }

.news-date {
  flex-shrink: 0;
  color: var(--c-text-light);
  font-size: 0.84em;
  min-width: 70px;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
}

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.12em 0.45em;
  font-size: 0.68em;
  font-weight: 700;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
  margin-left: 4px;
}

.badge-new   { background: #e8f5e9; color: #2e7d32; }
.badge-paper { background: #e3f2fd; color: #1565c0; }
.badge-award { background: #fff8e1; color: #f57f17; }

/* ── Publications / Archive List ───────────────────────────────────────── */
.archive__item {
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 1em;
  margin-bottom: 1em;
}

.archive__item:last-child { border-bottom: none; }

.archive__item-title {
  font-size: 1em;
  font-weight: 600;
  margin-bottom: 0.25em;
  line-height: 1.5;
}

.archive__item-title a {
  color: var(--c-text) !important;
  text-decoration: none;
  border-bottom: none;
}

.archive__item-title a:hover {
  color: var(--c-primary) !important;
  border-bottom: 1px solid var(--c-primary);
}

.archive__item-meta {
  color: var(--c-text-light);
  font-size: 0.86em;
  margin-bottom: 0.25em;
}

.archive__item-excerpt {
  color: var(--c-text-light);
  font-size: 0.86em;
  margin: 0;
}

/* ── Blog Year Headers ─────────────────────────────────────────────────── */
.archive-year {
  color: var(--c-text);
  font-size: 1.25em;
  font-weight: 700;
  border-bottom: 2px solid var(--c-border);
  padding-bottom: 0.2em;
  margin-top: 1.5em;
  margin-bottom: 0.8em;
}

.archive-post {
  display: flex;
  align-items: baseline;
  gap: 1em;
  padding: 0.4em 0;
}

.archive-post-date {
  flex-shrink: 0;
  color: var(--c-text-light);
  font-size: 0.86em;
  min-width: 85px;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
}

.archive-post-title a {
  color: var(--c-text);
  font-weight: 500;
  border-bottom: none;
}

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

/* ── Tools Grid ────────────────────────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1em;
  margin: 1em 0;
}

.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
  padding: 1.2em 0.8em;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  text-decoration: none !important;
  transition: all 0.2s;
}

.tool-card:hover {
  background: var(--c-bg);
  border-color: var(--c-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.tool-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--c-bg);
  border-radius: 8px;
}

.tool-icon i {
  color: var(--c-primary);
  font-size: 1.3em;
}

.tool-card:hover .tool-icon {
  background: var(--c-primary);
}

.tool-card:hover .tool-icon i {
  color: #fff;
}

.tool-title {
  color: var(--c-text) !important;
  font-size: 0.85em;
  font-weight: 600;
  margin: 0;
  text-align: center;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  background: transparent;
  color: var(--c-text-light);
  font-size: 0.86em;
  min-height: 60px;
}

.footer-inner {
  margin-left: 5%;
  margin-right: 5%;
  padding: 1.5em 2.5em;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-footer a { color: var(--c-text-light); transition: color 0.2s; }
.site-footer a:hover { color: var(--c-primary); text-decoration: none; }

.footer-social {
  display: flex;
  justify-content: center;
  gap: 1.2em;
  margin-bottom: 0.5em;
}

.footer-social a {
  font-size: 1.1em;
}

.footer-copyright {
  color: #7aaac8;
  font-size: 0.82em;
  letter-spacing: 0.01em;
}

/* ── Publications ──────────────────────────────────────────────────────── */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 0.6em;
}

.pub-item {
  display: flex;
  gap: 1.2em;
  padding: 0.8em 0;
  border-bottom: 1px solid var(--c-border);
  align-items: flex-start;
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-thumb {
  flex-shrink: 0;
  width: 140px;
  height: 90px;
  overflow: hidden;
  border-radius: 5px;
  border: 1px solid var(--c-border);
  background: var(--c-bg);
}

.pub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pub-info {
  flex: 1;
  min-width: 0;
}

.pub-title {
  font-size: 0.95em;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.2em;
}

.pub-title a {
  color: var(--c-text);
  text-decoration: none;
  transition: color 0.2s;
}

.pub-title a:hover {
  color: var(--c-primary);
}

.pub-authors {
  font-size: 0.85em;
  color: var(--c-text);
  margin-bottom: 0.15em;
  line-height: 1.5;
}

.pub-venue {
  font-size: 0.82em;
  color: var(--c-text-light);
  margin-bottom: 0.2em;
}

.pub-links {
  font-size: 0.82em;
}

.pub-links a {
  color: var(--c-primary-light);
  text-decoration: none;
  transition: color 0.2s;
}

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

.pub-links i {
  margin-right: 2px;
}

.pub-hint {
  margin-top: 1.5em;
  font-size: 0.88em;
  color: var(--c-text-light);
}

/* ── Markdown Post Content ────────────────────────────────────────────── */
.post-meta {
  color: var(--c-text-light);
  font-size: 0.85em;
  margin-bottom: 1.5em;
}

.post-meta i {
  margin-right: 4px;
}

.post-body h1 {
  color: var(--c-text);
  font-size: 1.4em;
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--c-border);
}

.post-body h2 {
  color: var(--c-text);
  font-size: 1.2em;
  font-weight: 700;
  margin-top: 1.8em;
  margin-bottom: 0.5em;
  padding-left: 0.6em;
  border-left: 4px solid var(--c-primary);
}

.post-body h3 {
  color: var(--c-primary-dark);
  font-size: 1.05em;
  font-weight: 600;
  margin-top: 1.3em;
  margin-bottom: 0.4em;
}

.post-body h4 {
  color: var(--c-primary);
  font-weight: 600;
}

.post-body a {
  color: var(--c-primary-light);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.post-body a:hover {
  color: var(--c-text);
  border-bottom-color: var(--c-primary-light);
}

.post-body ul, .post-body ol {
  margin: 0.5em 0 1em 1.5em;
}

.post-body li {
  margin-bottom: 0.25em;
  line-height: 1.7;
}

.post-body li::marker {
  color: var(--c-primary);
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.88em;
  border: 1px solid #c0c4cc;
}

.post-body table th {
  background: color-mix(in srgb, var(--c-primary) 15%, var(--c-bg));
  color: var(--c-text);
  border: 1px solid #c0c4cc;
  border-bottom: 2px solid var(--c-primary);
  padding: 0.5em 0.8em;
  font-weight: 600;
  text-align: left;
  font-size: 0.92em;
}

.post-body table td {
  padding: 0.45em 0.8em;
  border: 1px solid #c0c4cc;
  vertical-align: top;
}

.post-body table tr:nth-child(even) td {
  background: var(--c-bg);
}

.post-body table tr:hover td {
  background: #ddeefa;
}

.post-body blockquote {
  border-left: 4px solid var(--c-primary);
  background: var(--c-bg);
  padding: 0.8em 1.2em;
  border-radius: 0 6px 6px 0;
  color: #3a5a7a;
  font-style: normal;
  margin: 1.2em 0;
  font-size: 0.92em;
}

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

.post-body strong {
  font-weight: 700;
}

.post-body code {
  background: #e8f4fd;
  border: 1px solid #b8d9f5;
  color: #1a4a7a;
  border-radius: 3px;
  font-size: 0.84em;
  padding: 0.1em 0.35em;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
}

.post-body kbd {
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.1em 0.4em;
  font-size: 0.84em;
  font-family: inherit;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 1.8em 0;
}

.post-body p {
  margin-bottom: 0.8em;
}

/* Dark theme for post content */
[data-theme="dark"] .post-body blockquote {
  background: #0f1419;
  color: #a8c8e8;
}

[data-theme="dark"] .page table,
[data-theme="dark"] .post-body table {
  border-color: #4b5563;
}

[data-theme="dark"] .page table thead th,
[data-theme="dark"] .page table tbody td,
[data-theme="dark"] .post-body table th,
[data-theme="dark"] .post-body table td {
  border-color: #4b5563;
}

[data-theme="dark"] .page table tbody tr:hover td,
[data-theme="dark"] .post-body table tr:hover td {
  background: #1e3a5a;
}

[data-theme="dark"] .post-body kbd {
  background: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

/* ── Table of Contents (TOC) ───────────────────────────────────────────── */
.toc-container {
  position: sticky;
  top: calc(var(--navbar-height) + 1em);
  align-self: start;
  width: 240px;
  max-height: calc(100vh - var(--navbar-height) - 2em);
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(26,74,122,0.08);
  overflow-y: auto;
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.8em 1em;
  background: linear-gradient(135deg, var(--c-primary-dark), var(--c-primary));
  color: #fff;
  font-weight: 600;
  font-size: 0.85em;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid var(--c-primary);
}

.toc-header i {
  font-size: 0.9em;
}

.toc-nav {
  padding: 0.5em 0;
}

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

.toc-item {
  margin: 0;
}

.toc-link {
  display: block;
  padding: 0.4em 1em;
  color: var(--c-primary-light);
  text-decoration: none;
  font-size: 0.8em;
  line-height: 1.4;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.toc-link:hover {
  background: var(--c-bg);
  color: var(--c-text);
  border-left-color: var(--c-primary);
}

.toc-link.active {
  background: #e8f4fd;
  color: var(--c-text);
  font-weight: 600;
  border-left-color: var(--c-primary);
}

.toc-h1 .toc-link {
  font-weight: 600;
  padding-left: 1em;
}

.toc-h2 .toc-link {
  padding-left: 1.5em;
  font-size: 0.78em;
}

.toc-h3 .toc-link {
  padding-left: 2em;
  font-size: 0.75em;
  color: var(--c-text-light);
}

/* ── 404 Page ──────────────────────────────────────────────────────────── */
.page-404 {
  text-align: center;
  padding: 4em 2em;
}

.page-404 h1 {
  font-size: 5em;
  color: var(--c-primary);
  font-weight: 700;
  margin-bottom: 0.2em;
  opacity: 0.7;
}

.page-404 p {
  color: var(--c-text-light);
  font-size: 1.1em;
  margin-bottom: 1.5em;
}

/* ── Back to Top ───────────────────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 2em;
  right: 2em;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  font-size: 1em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 900;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.back-to-top:hover {
  background: var(--c-primary-dark);
  transform: translateY(-2px);
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media screen and (max-width: 1024px) {
  .site-sidebar { display: none; }
  .navbar-inner { margin-left: 0; margin-right: 0; }
  .page-content,
  .page-content.has-toc { margin-left: 0; margin-right: 0; display: flex; }
  .footer-inner { margin-left: 0; margin-right: 0; padding: 2em; }
  .toc-container { display: none; }
  .hamburger { display: block; }
  .publication-item { flex-direction: column; }
  .publication-image { width: 100%; height: 200px; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--navbar-height);
    left: 0; right: 0;
    background: linear-gradient(135deg, #0f2b50 0%, var(--c-primary-dark) 100%);
    flex-direction: column;
    padding: 0.5em 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  }

  .nav-links.open { display: flex; }

  .nav-links a {
    padding: 0.65em 1.5em;
    display: block;
    width: 100%;
    border-radius: 0;
  }

  .nav-links a.active::after { display: none; }
}

@media screen and (max-width: 768px) {
  .navbar-inner { padding: 0 1.2em; }
  .page-content { padding: 1.5em 1em; }
  .page { padding: 1.8em 1.5em; border-radius: 6px; }
  .page__title { font-size: 1.4em; }
  .page h2 { font-size: 1.1em; }
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
}

@media screen and (max-width: 600px) {
  .page { padding: 1.2em 1em; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
