/* Load Academicons (arXiv, Google Scholar, ORCID, etc.) */
@import url('https://cdnjs.cloudflare.com/ajax/libs/academicons/1.9.4/css/academicons.min.css');

/* ==============================================
   CSS Variables – Light & Dark Themes
   ============================================== */
:root {
  --bg:           #ffffff;
  --bg-alt:       #f8fafc;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-bg:    #eff6ff;
  --nav-bg:       rgba(255, 255, 255, 0.88);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 14px rgba(0,0,0,0.10);
  --radius:       10px;
  --transition:   0.25s ease;
}

[data-theme="dark"] {
  --bg:           #0d1117;
  --bg-alt:       #161b22;
  --surface:      #1c2128;
  --border:       #30363d;
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --text-light:   #6e7681;
  --accent:       #58a6ff;
  --accent-hover: #79b8ff;
  --accent-bg:    #1a2744;
  --nav-bg:       rgba(13, 17, 23, 0.88);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:    0 4px 14px rgba(0,0,0,0.35);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--text); }

/* ==============================================
   Layout Utilities
   ============================================== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section { padding: 5rem 0; }
.section-alt { background: var(--bg-alt); }

.section-title {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.section-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

.section-cta { margin-top: 2.5rem; text-align: center; }

/* ==============================================
   Navbar
   ============================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text) !important;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.nav-brand:hover { color: var(--accent) !important; }

/* Desktop: push menu to the right */
.nav-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted) !important;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--text) !important; background: var(--bg-alt); }
.nav-link.active { color: var(--accent) !important; }

.nav-cv {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  margin-left: 0.4rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent) !important;
  border: 1.5px solid var(--accent);
  transition: background var(--transition), color var(--transition);
}
.nav-cv:hover {
  background: var(--accent);
  color: #fff !important;
}

/* Divider between links and socials */
.nav-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

.nav-socials {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-muted) !important;
  transition: color var(--transition), background var(--transition);
}
.social-icon:hover { color: var(--accent) !important; background: var(--accent-bg); }

/* Dark mode toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
.theme-toggle:hover { color: var(--accent); background: var(--accent-bg); }

/* Mobile controls (theme + hamburger) */
.nav-controls {
  display: none;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

/* Hamburger button */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.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); }

/* Desktop-only theme toggle inside nav-meta */
.theme-toggle-desk { display: inline-flex; }

/* ==============================================
   About Section
   ============================================== */
.about-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 3rem;
  align-items: start;
}

.about-photo-wrap { display: flex; justify-content: center; }

.about-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: var(--text-light);
}

.about-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.about-title {
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.about-affiliation {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.about-bio {
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  font-size: 0.975rem;
  line-height: 1.75;
}

.interests { margin-top: 1.5rem; }
.interests h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.65rem; }

.interest-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.tag {
  padding: 0.3rem 0.7rem;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
}

/* ==============================================
   Research / Papers
   ============================================== */
.paper-list { display: flex; flex-direction: column; gap: 1.25rem; }

.paper-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.paper-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); }

/* Compact card: abstract hidden until toggled */
.paper-card.compact { padding: 1.25rem 1.5rem; }
.paper-card.compact .paper-abstract { display: none; }
.paper-card.compact.expanded .paper-abstract { display: block; }

.toggle-abstract {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color var(--transition);
}
.toggle-abstract:hover { color: var(--accent); }
.toggle-abstract i { font-size: 0.7rem; transition: transform 0.2s; }
.paper-card.expanded .toggle-abstract i { transform: rotate(180deg); }

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

.paper-year { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
}
.badge-preprint { background: #fef3c7; color: #92400e; }
.badge-pub      { background: #d1fae5; color: #065f46; }
.badge-project  { background: #ede9fe; color: #5b21b6; }
[data-theme="dark"] .badge-preprint { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .badge-pub      { background: #022c22; color: #6ee7b7; }
[data-theme="dark"] .badge-project  { background: #2e1065; color: #c4b5fd; }

.paper-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.35rem; }

.paper-authors { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.25rem; }

.paper-venue { font-size: 0.85rem; color: var(--accent); font-style: italic; margin-bottom: 0.75rem; }

.paper-abstract { font-size: 0.9rem; color: var(--text-muted); line-height: 1.65; margin-bottom: 1rem; }

.paper-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.paper-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--text-muted) !important;
  border: 1px solid var(--border);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.paper-link:hover { color: var(--accent) !important; border-color: var(--accent); background: var(--accent-bg); }

/* SciRate inline badge text */
.scirate-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: currentColor;
}

/* ==============================================
   Blog Section
   ============================================== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.blog-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-2px); }

.blog-card-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.blog-date { font-size: 0.8rem; color: var(--text-light); }

.blog-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 99px;
}

.blog-card-title { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.blog-card-title a { color: var(--text) !important; }
.blog-card-title a:hover { color: var(--accent) !important; }

.blog-card-excerpt { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; flex: 1; }

.read-more {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent) !important;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: gap var(--transition);
}
.read-more:hover { gap: 0.55rem; }

/* ==============================================
   Contact Section
   ============================================== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.contact-info { display: flex; flex-direction: column; gap: 1.5rem; }

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.contact-icon {
  font-size: 1.1rem;
  color: var(--accent);
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.contact-item h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.contact-item a { color: var(--text); font-size: 0.95rem; }
.contact-item a:hover { color: var(--accent); }
.contact-item p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

.contact-socials-block h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.social-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.social-link-row {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text) !important;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}
.social-link-row i { width: 16px; text-align: center; color: var(--accent); font-size: 0.95rem; }
.social-link-row:hover { color: var(--accent) !important; border-color: var(--accent); background: var(--accent-bg); transform: translateX(4px); }

/* ==============================================
   Buttons
   ============================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  background: var(--accent);
  color: #fff !important;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
[data-theme="dark"] .btn-primary { box-shadow: 0 2px 8px rgba(88,166,255,0.25); }

/* ==============================================
   Footer
   ============================================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  transition: border-color var(--transition);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer p { font-size: 0.85rem; color: var(--text-muted); }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent); }
.footer-sub { font-size: 0.8rem !important; }

/* ==============================================
   Blog Post Page Styles (used on blog/posts/*.html)
   ============================================== */
.post-hero {
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--border);
}
.post-meta-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.post-date { font-size: 0.875rem; color: var(--text-muted); }
.post-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 99px;
}
.post-hero h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.post-hero .post-excerpt {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 680px;
}

.post-body {
  padding: 3rem 0 5rem;
  max-width: 720px;
  margin: 0 auto;
}

/* Typography inside posts */
.post-body p { margin-bottom: 1.25rem; line-height: 1.8; color: var(--text); }
.post-body h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.post-body h3 { font-size: 1.15rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.post-body ul, .post-body ol { margin: 0 0 1.25rem 1.5rem; line-height: 1.8; color: var(--text); }
.post-body li { margin-bottom: 0.25rem; }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--accent-bg);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-style: italic;
}
.post-body code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--bg-alt);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text);
}
.post-body pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.post-body pre code { background: none; border: none; padding: 0; font-size: 0.9rem; }
.post-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.post-body a:hover { color: var(--accent-hover); }

/* MathJax display equations box */
.post-body .math-display {
  overflow-x: auto;
  padding: 0.5rem 0;
}

/* Back to blog link */
.post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted) !important;
  margin-bottom: 1.5rem;
  transition: color var(--transition);
}
.post-back:hover { color: var(--accent) !important; }

/* ==============================================
   Blog Index Page
   ============================================== */
.blog-hero { padding: 4rem 0 2rem; }
.blog-hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.blog-hero p { color: var(--text-muted); }

.blog-list { display: flex; flex-direction: column; gap: 1.25rem; padding: 2.5rem 0 5rem; }

.blog-list-item {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  align-items: flex-start;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.blog-list-item:hover { box-shadow: var(--shadow-md); border-color: var(--accent); }

.blog-list-date {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
  min-width: 90px;
  margin-top: 0.2rem;
}

.blog-list-content { flex: 1; }
.blog-list-content h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.3rem; }
.blog-list-content h2 a { color: var(--text) !important; }
.blog-list-content h2 a:hover { color: var(--accent) !important; }
.blog-list-content p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; }

/* ==============================================
   Responsive – Mobile
   ============================================== */
@media (max-width: 768px) {
  /* Show mobile controls */
  .nav-controls { display: flex; }

  /* Hide desktop-only theme toggle */
  .theme-toggle-desk { display: none; }

  /* Full-width dropdown menu */
  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.25rem;
    gap: 0.5rem;
  }
  .nav-menu.open { display: flex; }

  /* Make navbar position relative so dropdown is absolute to it */
  .navbar { position: sticky; }
  .nav-container { position: relative; }

  .nav-links { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-link { padding: 0.65rem 0.75rem; font-size: 0.95rem; }
  .nav-cv { margin-left: 0; margin-top: 0.5rem; justify-content: center; }

  .nav-meta {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    justify-content: center;
  }

  /* About */
  .about-grid { grid-template-columns: 1fr; gap: 1.5rem; text-align: center; }
  .about-affiliation { justify-content: center; }
  .interest-tags { justify-content: center; }

  /* Contact */
  .contact-grid { grid-template-columns: 1fr; gap: 2rem; }

  /* Footer */
  .footer-inner { flex-direction: column; text-align: center; }

  /* Blog list */
  .blog-list-item { flex-direction: column; gap: 0.5rem; }
  .blog-list-date { min-width: unset; }
}

@media (max-width: 480px) {
  .section { padding: 3rem 0; }
  .blog-grid { grid-template-columns: 1fr; }
  .about-photo { width: 140px; height: 140px; }
}

/* ==============================================
   Blog Post – Citation System
   ============================================== */

/* Inline superscript: [1] [2,3] */
.cite-sup {
  font-size: 0.72em;
  line-height: 1;
  vertical-align: super;
  font-family: 'Inter', sans-serif;
}
.cite-sup a.cite-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}
.cite-sup a.cite-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* References section */
.post-body .references-section {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.post-body .references-section h2 {
  border-bottom: none;
  margin-top: 0;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

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

.ref-item {
  position: relative;
  padding: 0.35rem 0.5rem 0.35rem 3rem;
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text-muted);
  scroll-margin-top: 80px;
  border-radius: 6px;
  transition: background var(--transition);
}
.ref-item:target { background: var(--accent-bg); }

/* [N] number — absolutely positioned so text flows freely */
.ref-num {
  position: absolute;
  left: 0.5rem;
  top: 0.35rem;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent);
  min-width: 2rem;
  font-family: 'Inter', sans-serif;
}

.ref-content { display: inline; }
.ref-authors { color: var(--text); font-weight: 500; }
.ref-title   { font-style: italic; }
.ref-url {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  margin-left: 0.2rem;
}
.ref-url:hover { text-decoration: underline; }
.ref-note { color: var(--text-light); font-size: 0.82rem; }

/* ==============================================
   Blog Post – Sidebar TOC Layout
   ============================================== */
.post-layout {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 4rem;
  align-items: start;
}

/* The post-body no longer needs its own centering since the grid handles it */
.post-layout .post-body {
  max-width: none;
  margin: 0;
  min-width: 0; /* prevent overflow */
}

.post-toc {
  position: sticky;
  top: 80px;
  padding-top: 3rem;
  padding-bottom: 2rem;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.toc-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-light);
  margin-bottom: 0.6rem;
  padding-left: 0.6rem;
}

#toc-nav {
  display: flex;
  flex-direction: column;
}

.toc-link {
  font-size: 0.81rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-left: 2px solid var(--border);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  border-radius: 0 4px 4px 0;
}
.toc-link:hover { color: var(--text); border-color: var(--text-muted); }
.toc-link.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
  background: var(--accent-bg);
}
.toc-h3 { padding-left: 1.25rem; font-size: 0.77rem; }

@media (max-width: 1024px) {
  .post-layout {
    grid-template-columns: 1fr;
  }
  .post-toc { display: none; }
  .post-layout .post-body {
    max-width: 720px;
    margin: 0 auto;
  }
}
