@charset "UTF-8";
/* Design tokens as CSS variables (light mode by default) */
:root {
  --bg-body: #f3f4f6;
  --bg-card: #fcfcfd;
  --bg-header: rgba(248, 250, 252, 0.9);
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --primary: #4b5563;
  --primary-dark: #111827;
  --accent: #9ca3af;
  /* TOC toggle background for light mode: slightly lighter than primary */
  --toc-toggle-bg: #657386;
  /* TOC toggle sizing (easy to adjust) */
  --toc-toggle-size: 26px; /* 3/5 of original 44px (~26.4px) */
  --toc-toggle-bottom: 12px; /* offset from bottom */
  --toc-toggle-right: 18px; /* offset from right */
}

/* Dark mode variables: applied when body[data-theme="dark"] */
body[data-theme=dark] {
  --bg-body: #050816;
  --bg-card: #0b1120;
  --bg-header: rgba(15, 23, 42, 0.9);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  --primary: #9ca3af;
  --primary-dark: #e5e7eb;
  --accent: #4b5563;
  /* TOC toggle background in dark mode: slightly lighter than primary-dark (improve visibility) */
  --toc-toggle-bg: #1d2943;
}

/* 暗色模式下项目卡片头部使用不同明暗度的深色渐变，覆盖亮色炫彩 */
body[data-theme=dark] .portfolio-grid .project-card:nth-child(1)::before {
  /* 最浅：左上有一点刷痕，但整体仍然偏暗 */
  background: radial-gradient(circle at 0% 0%, rgba(55, 65, 81, 0.4) 0, rgba(17, 24, 39, 0.5) 30%, transparent 55%), linear-gradient(135deg, #020617 0%, #020617 100%);
}

body[data-theme=dark] .portfolio-grid .project-card:nth-child(2)::before {
  /* 中等：右上有一条更细微的斜刷痕 */
  background: radial-gradient(circle at 100% 0%, rgba(31, 41, 55, 0.3) 0, rgba(15, 23, 42, 0.45) 28%, transparent 55%), linear-gradient(135deg, #020617 0%, #020617 100%);
}

body[data-theme=dark] .portfolio-grid .project-card:nth-child(3)::before {
  /* 最暗：整体最暗，左下刷痕也更轻微 */
  background: radial-gradient(circle at 0% 100%, rgba(31, 41, 55, 0.22) 0, rgba(15, 23, 42, 0.4) 26%, transparent 52%), linear-gradient(135deg, #020617 0%, #020617 100%);
}

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

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-body);
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

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

/* Layout */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1rem;
}

main {
  padding: 2rem 0;
  min-height: 80vh;
}

/* Header */
.site-header {
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header .site-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.site-header .site-title:hover {
  color: #4b5563;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Theme toggle button */
.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  margin-right: 0.75rem;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.theme-toggle::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px #e5e7eb;
  background: #e5e7eb; /* 灰色小圆 */
}

body[data-theme=dark] .theme-toggle::before {
  box-shadow: 0 0 0 2px #e5e7eb;
  background: radial-gradient(circle at 30% 30%, #e5e7eb 0, #e5e7eb 55%, transparent 56%), radial-gradient(circle at 80% 20%, #020617 0, #020617 55%, transparent 56%);
}

/* Navigation */
.site-nav {
  /* Top level menu */
  /* Dropdown Menu */
  /* Top level links */
}
.site-nav > ul {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.site-nav li {
  position: relative;
  /* Show dropdown on hover */
}
.site-nav li:hover > .dropdown-menu {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  visibility: visible;
}
.site-nav .dropdown-menu {
  display: none; /* Hidden by default */
  visibility: hidden;
  flex-direction: column;
  gap: 0;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-card);
  min-width: 80px;
  padding: 0.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.15);
  z-index: 1000;
  opacity: 0;
  transition: all 0.2s ease;
  list-style: none; /* Remove bullets */
  /* Arrow */
}
.site-nav .dropdown-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--bg-card);
}
.site-nav .dropdown-menu li {
  width: 100%;
  margin: 0;
}
.site-nav .dropdown-menu a {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
}
.site-nav .dropdown-menu a::after {
  display: none;
}
.site-nav .dropdown-menu a:hover, .site-nav .dropdown-menu a.active {
  background: rgba(148, 163, 184, 0.1);
  color: var(--primary);
}
.site-nav > ul > li > a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.5rem 0;
}
.site-nav > ul > li > a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
  border-radius: 2px;
}
.site-nav > ul > li > a:hover, .site-nav > ul > li > a.active {
  color: var(--primary);
}
.site-nav > ul > li > a:hover::after, .site-nav > ul > li > a.active::after {
  width: 100%;
}

#nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
#nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--primary);
  margin: 5px 0;
  transition: all 0.3s;
}

@media (max-width: 768px) {
  #nav-toggle {
    display: block;
  }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    /* Mobile Dropdown Override */
  }
  .site-nav.open {
    display: block;
    animation: fadeIn 0.3s ease;
  }
  .site-nav ul {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  .site-nav .dropdown-menu {
    display: flex;
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    opacity: 1;
    min-width: auto;
    margin-top: 0.2rem;
    gap: 0.2rem;
  }
  .site-nav .dropdown-menu::before {
    display: none;
  }
  .site-nav .dropdown-menu a {
    padding: 0.6rem;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
  }
  .site-nav .dropdown-menu a:hover {
    background: rgba(0, 0, 0, 0.06);
  }
  .site-nav a {
    display: block;
    padding: 0.8rem;
    background: var(--bg-body);
    border-radius: 8px;
  }
  .site-nav a:hover, .site-nav a.active {
    background: rgba(75, 85, 99, 0.08);
  }
  .site-nav a:hover::after, .site-nav a.active::after {
    display: none;
  }
  .header-left {
    gap: 0.4rem;
  }
}
/* Top-level dark-mode overrides */
body[data-theme=dark] .post-content hr {
  background: rgba(255, 255, 255, 0.12) !important; /* brighter */
  height: 1px; /* ensure consistent thickness */
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset; /* subtle highlight */
}

body[data-theme=dark] .post-content table th,
body[data-theme=dark] .post-content table td {
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: var(--text-main) !important;
}

body[data-theme=dark] .post-content table thead th {
  background: rgba(255, 255, 255, 0.02) !important;
}

/* Hero Section */
.hero {
  text-align: left;
  padding: 5rem 0 3rem;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}
.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(148, 163, 184, 0.5) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.25;
  z-index: 0;
}
.hero .hero-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2.5rem;
}
.hero .avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
}
.hero .avatar:hover {
  transform: scale(1.05) rotate(3deg);
}
.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  color: var(--text-main);
}
.hero .tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 0 1.5rem;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.quick-links {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.quick-links .card {
  background: transparent;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  box-shadow: none;
  color: var(--text-muted);
  font-weight: 500;
  border: 1px solid transparent;
}
.quick-links .card:hover {
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.9);
  color: var(--text-main);
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2rem;
  margin-top: 4rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 1rem;
}
.section-header h2 {
  margin: 0;
  font-size: 1.8rem;
}
.section-header h2::after {
  display: none;
}
.section-header .view-all {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Portfolio Grid & Cards */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.project-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-card {
  background: rgba(15, 23, 42, 0.02);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Gradient Header */
}
.project-card::before {
  content: "";
  display: block;
  height: 120px;
  /* 亮色模式下默认使用炫彩渐变，暗色模式可通过 --card-bg 覆盖 */
  background: var(--card-bg, linear-gradient(135deg, #38bdf8 0%, #a855f7 40%, #f97316 80%, #facc15 100%));
  transition: height 0.3s ease;
}
.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.project-card:hover::before {
  height: 140px;
}
.project-card .card-content {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  margin-top: -20px;
  border-radius: 16px 16px 0 0;
  position: relative;
  overflow: hidden;
}
.project-card .card-content::before {
  content: "";
  position: absolute;
  inset: -1px;
  background-image: radial-gradient(rgba(148, 163, 184, 0.3) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}
.project-card .card-content > * {
  position: relative;
  z-index: 1;
}
.project-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  color: var(--text-main);
}
.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex-grow: 1;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.project-card .tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.project-card .tags span {
  background: rgba(15, 23, 42, 0.03);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Post Grid (New) */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.post-card {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.25);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-color: rgba(148, 163, 184, 0.5);
}
.post-card .post-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.8rem;
  font-family: "Fira Code", monospace;
}
.post-card h3 {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  line-height: 1.4;
}
.post-card h3 a {
  color: var(--text-main);
}
.post-card h3 a:hover {
  color: var(--primary);
}
.post-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}
.post-card .read-more {
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
}
.post-card .read-more::after {
  content: "→";
  margin-left: 4px;
  transition: transform 0.2s;
}
.post-card .read-more:hover::after {
  transform: translateX(4px);
}

.comments-desc {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.comments-list {
  margin-bottom: 1.8rem;
  max-height: 380px;
  overflow-y: auto;
}

.comment-item {
  padding: 0.9rem 0;
  font-size: 0.98rem;
}

.comment-item + .comment-item {
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.comment-name {
  font-weight: 600;
  color: var(--text-main);
}

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

.comment-message {
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.comments-form .form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.comments-form .form-group {
  margin-bottom: 1rem;
}

.comments-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--text-main);
}

.comments-form input,
.comments-form textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-family: inherit;
  font-size: 0.98rem;
  background: rgba(15, 23, 42, 0.01);
  color: var(--text-main);
}
.comments-form input:focus,
.comments-form textarea:focus {
  outline: none;
  border-color: #4b5563;
}

.comments-form button.btn {
  width: auto;
  padding-inline: 1.6rem;
}

.comments-row {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 1.5rem;
}

.comments-col-right {
  display: flex;
  align-items: flex-start;
  margin-top: 50px;
}

.comments-col-left,
.comments-col-middle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.comments-form textarea#c-message {
  min-height: 130px;
}

.comments-col-right .btn {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding-inline: 0.45rem;
  padding-block: 1.6rem;
  /* 让发送键的风格类似首页 quick-links，但更明显 */
  background: transparent;
  color: var(--text-muted);
  border-radius: 12px; /* 圆角矩形 */
  box-shadow: none;
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 1.1rem; /* 发送两个字大一点 */
  font-weight: 600;
}

.comments-col-right .btn:hover {
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.9);
  color: var(--text-main);
  background: transparent;
  box-shadow: none;
}

@media (max-width: 768px) {
  .comments-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .comments-col-right {
    justify-content: flex-start;
  }
}
/* Contact Page Styling */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 4rem;
  margin-top: 2rem;
}
@media (max-width: 768px) {
  .contact-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.contact-info p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
}
.contact-info .contact-links {
  list-style: none;
  padding: 0;
}
.contact-info .contact-links li {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}
.contact-info .contact-links li .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b8bdc6;
  margin-bottom: 0.2rem;
  font-weight: 700;
}
.contact-info .contact-links li a {
  font-size: 1.2rem;
  color: #192339;
  font-weight: 500;
}
.contact-info .contact-links li a:hover {
  color: #4b5563;
}

.contact-form {
  background: white;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.contact-form .form-group {
  margin-bottom: 1.5rem;
}
.contact-form .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #111827;
}
.contact-form .form-group input, .contact-form .form-group textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}
.contact-form .form-group input:focus, .contact-form .form-group textarea:focus {
  outline: none;
  border-color: #4b5563;
}
.contact-form button {
  width: 100%;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

/* Intro Text */
.intro-text {
  font-size: 1.2rem;
  color: #6b7280;
  max-width: 700px;
  margin-bottom: 3rem;
  line-height: 1.7;
}

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding: 3rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--text-muted);
}
.site-footer nav ul {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin-top: 1rem;
}
.site-footer nav ul a {
  color: var(--text-muted);
}
.site-footer nav ul a:hover {
  color: var(--primary);
}

/* Global mobile tweaks */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  .container {
    padding: 0 0.25rem;
  }
  main {
    padding: 1.5rem 0 2.5rem;
  }
  .hero {
    padding: 3.5rem 0 2.5rem;
  }
  .hero .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero h1 {
    font-size: 2.1rem;
  }
  .hero .tagline {
    font-size: 0.98rem;
    max-width: none;
  }
  .hero .avatar {
    width: 110px;
    height: 110px;
  }
  /* 首页四个词：关于 / 项目 / 博客 / 友链 在一行且缩小字号 */
  .quick-links {
    justify-content: flex-start;
  }
  .quick-links .card {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }
  .portfolio-grid,
  .post-grid,
  .friends-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .post-content {
    padding: 1.6rem 2rem;
  }
  .site-footer {
    padding: 2rem 0 2.5rem;
  }
  .site-footer nav ul {
    flex-direction: column;
    gap: 0.75rem;
  }
}
/* Friends page */
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.friend-card {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 2.5rem 1.9rem;
  display: flex;
  align-items: center;
  gap: 1.3rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  color: inherit;
}
.friend-card:hover {
  transform: translateY(-3px);
  border-color: rgba(148, 163, 184, 0.6);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  background-color: rgba(15, 23, 42, 0.02);
}

.friend-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.7);
}

.friend-body {
  flex: 1;
}

.friend-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 1.15rem;
}

.friend-desc {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* Article / Post Content */
.post-content {
  position: relative;
  background: var(--bg-card);
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-size: 1.1rem;
  line-height: 1.8;
  overflow: hidden;
  /* 亮色模式下的轻微纹理背景 */
  /* Headings: ensure consistent sizes, weight and spacing across the post */
  /* Hierarchy sizes: keep consistent intervals but balanced */
  /* Keep headings left-aligned even when inside lists or blockquotes for visual consistency */
  /* Make inline code readable in dark mode (avoid using the compiled $primary-dark which is near-black)
     This rule ensures inline `<code>` elements have a light color & soft background in dark mode. */
  /* Stronger override for inline code with language/rouge classes to ensure visibility in dark mode */
  /* Dark mode: hr should be light so it's visible against dark bg */
  /* Base table styling */
  /* dark mode table overrides (moved to top-level) */
}
.post-content::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(148, 163, 184, 0.35) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}
.post-content > * {
  position: relative;
  z-index: 1;
}
.post-content h1, .post-content h2, .post-content h3, .post-content h4 {
  color: var(--text-main);
  margin-top: 2rem; /* consistent top spacing */
  margin-bottom: 0.75rem; /* consistent bottom spacing */
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.post-content h1 {
  font-size: 2.4rem;
}
.post-content h2 {
  font-size: 1.8rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 0.5rem;
}
.post-content h3 {
  font-size: 1.3rem;
}
.post-content h4 {
  font-size: 1.05rem;
  font-weight: 700;
}
.post-content p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}
.post-content ul, .post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  color: var(--text-muted);
}
.post-content ul li, .post-content ol li {
  margin-bottom: 0.5rem;
}
.post-content li h2, .post-content li h3, .post-content li h4, .post-content blockquote h2, .post-content blockquote h3, .post-content blockquote h4 {
  margin-left: 0;
  padding-left: 0;
}
.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.post-content code {
  background: rgba(75, 85, 99, 0.1);
  color: #111827;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: "Fira Code", monospace;
  font-size: 0.9em;
}
.post-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2rem 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
.post-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.9rem;
}
body[data-theme=dark] .post-content code {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
body[data-theme=dark] .post-content code.language-plaintext,
body[data-theme=dark] .post-content code.highlighter-rouge,
body[data-theme=dark] .post-content code[class*=language-] {
  color: var(--text-main) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
}
.post-content blockquote {
  border-left: 4px solid #4b5563;
  background: rgba(75, 85, 99, 0.04);
  margin: 2rem 0;
  padding: 1.5rem;
  border-radius: 0 8px 8px 0;
  color: #111827;
  font-style: italic;
  font-family: "Noto Serif SC", serif;
}
.post-content blockquote p:last-child {
  margin-bottom: 0;
}
.post-content img {
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin: 2rem auto;
}
.post-content hr {
  border: 0;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
  margin: 3rem 0;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.post-content th, .post-content td {
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.6rem 0.8rem;
  text-align: left;
  color: var(--text-main);
  vertical-align: top;
}
.post-content thead th {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 700;
}

/* Post layout with right sidebar TOC */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 2rem;
  align-items: start;
}

.post-body {
  min-width: 0; /* for text truncation */
}

.post-toc {
  background: transparent;
  position: sticky;
  top: 86px; /* below header */
  align-self: start;
  padding-left: 0.6rem; /* space for bullet */
}

/* By default hide drawer & toggle, show only when needed on small screens */
.post-toc-drawer {
  display: none;
}

.toc-toggle {
  display: none;
}

.post-toc .toc-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text-main);
}

.post-toc .toc-list, .post-toc .toc-sublist {
  list-style: none;
  margin: 0;
  padding: 0 0 0 28px; /* leave space for the vertical line and bullets */
  position: relative;
}

.post-toc .toc-item {
  margin-bottom: 0.45rem;
  position: relative;
}

.post-toc a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-block;
  padding: 0.12rem 0.25rem;
  border-radius: 6px;
}

.post-toc a.active {
  color: var(--primary);
  font-weight: 600;
}

.post-toc .toc-item::before {
  /* hide the leading dot that could overlap content; keep markup for future use */
  display: none;
}

.post-toc .toc-list::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 2px;
  background: rgba(75, 85, 99, 0.08);
  border-radius: 2px;
}

/* active dot removed */
.post-toc a:hover {
  color: var(--primary);
  background: rgba(148, 163, 184, 0.06);
}

.post-toc .toc-sublist {
  margin-left: 0.6rem;
}

/* Hide TOC on small screens */
@media (max-width: 1024px) {
  .post-layout {
    grid-template-columns: 1fr;
  }
  .post-toc {
    display: none;
  }
}
/* Drawer and Floating Toggle for mobile: show toggle at small viewports and allow open/close */
@media (max-width: 1024px) {
  .toc-toggle[data-has-toc=true] {
    position: fixed;
    right: var(--toc-toggle-right, 18px);
    bottom: var(--toc-toggle-bottom, 18px);
    width: var(--toc-toggle-size, 44px);
    height: var(--toc-toggle-size, 44px);
    border-radius: 50%;
    background: var(--toc-toggle-bg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 1200;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.16);
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  }
  /* No inner dot or numeric badge — keep button minimal */
  .post-toc-drawer {
    display: none;
  }
  .post-toc-drawer.open {
    display: block;
  }
  .post-toc-drawer {
    position: fixed;
    inset: 0;
    z-index: 1190;
  }
  .post-toc-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
  }
  .post-toc-drawer-panel {
    position: absolute;
    right: 12px;
    top: 10vh;
    bottom: 10vh;
    width: 86%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
    overflow: auto;
    padding: 1rem 1rem 2rem 1rem;
  }
  .post-toc-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }
  .post-toc-drawer .toc-title {
    font-size: 1rem;
    margin: 0;
  }
  .post-toc-drawer .toc-list {
    padding-left: 18px;
  }
  .post-toc-drawer .toc-item {
    margin-bottom: 0.6rem;
  }
  .post-toc-drawer .post-toc-drawer-close {
    background: none;
    border: 0;
    font-size: 1.05rem;
    cursor: pointer;
  }
  .post-toc-drawer a {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-block;
    padding: 0.15rem 0.25rem;
    border-radius: 6px;
  }
  .post-toc-drawer a:hover {
    color: var(--primary);
    background: rgba(148, 163, 184, 0.06);
  }
  .post-toc-drawer a.active {
    color: var(--primary);
    font-weight: 600;
  }
}
/* Ensure toggle is hidden on larger screens */
@media (min-width: 1025px) {
  .toc-toggle {
    display: none;
  }
}
/* Small/compact style for the floating toggle, dark/light theme variation */
.toc-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.22);
}

.toc-toggle:active {
  transform: translateY(-1px);
}

/* no numeric badge for the toggle (appearance: only a small dot) */
/* Light/dark theme: use var(--primary) or primary-dark but keep a subtle transparency */
/* Ensure `--toc-toggle-bg` is used everywhere and shown only when has-toc */
.toc-toggle[data-has-toc=true] {
  background: var(--toc-toggle-bg);
}

body[data-theme=dark] .toc-toggle[data-has-toc=true] {
  background: var(--toc-toggle-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.post-header {
  text-align: center;
  margin-bottom: 3rem;
}
.post-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.post-header .post-meta {
  color: #6b7280;
}

/* Timeline */
.timeline {
  border-left: 2px solid rgba(75, 85, 99, 0.2);
  padding-left: 2rem;
  margin: 2rem 0 2rem 1rem;
}
.timeline .timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
}
.timeline .timeline-item::before {
  content: "";
  position: absolute;
  left: -2.4rem;
  top: 0.4rem;
  width: 0.8rem;
  height: 0.8rem;
  background: #fcfcfd;
  border: 2px solid #4b5563;
  border-radius: 50%;
  z-index: 1;
}
.timeline .timeline-item h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  color: #111827;
}
.timeline .timeline-item .date {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4b5563;
  background: rgba(75, 85, 99, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  margin-bottom: 0.5rem;
}
.timeline .timeline-item p {
  margin: 0;
  color: #6b7280;
}

/* Notes List (Professional & Serious) */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 2px solid rgba(148, 163, 184, 0.2);
  padding-top: 1.5rem;
}

/* Grouped notes */
.note-group {
  margin-bottom: 1.6rem;
  padding: 0 0.2rem;
}

.note-group-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.6rem;
}

/* slight indentation for grouped items */
.note-group .note-item {
  padding-left: 0.6rem;
}

.note-item {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  transition: background-color 0.2s;
}
.note-item:hover {
  background-color: rgba(148, 163, 184, 0.05);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 4px;
  border-bottom-color: transparent;
}

.note-date {
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  color: var(--text-light);
  white-space: nowrap;
  min-width: 100px;
}

.note-title {
  font-family: "Noto Serif SC", serif; /* Serif font for seriousness */
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
}
.note-title:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background: #4b5563;
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn:hover {
  background: #111827;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  color: white;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 3rem;
}
.pagination a, .pagination span {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
  transition: all 0.2s;
}
.pagination a:hover, .pagination span:hover {
  border-color: rgba(148, 163, 184, 0.6);
  color: var(--text-main);
}
.pagination .current {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
main, .hero {
  animation: fadeIn 0.6s ease-out forwards;
}

.post-list li, .project-card {
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

.post-list li:nth-child(1),
.project-card:nth-child(1) {
  animation-delay: 0.1s;
}

.post-list li:nth-child(2),
.project-card:nth-child(2) {
  animation-delay: 0.2s;
}

.post-list li:nth-child(3),
.project-card:nth-child(3) {
  animation-delay: 0.3s;
}

.post-list li:nth-child(4),
.project-card:nth-child(4) {
  animation-delay: 0.4s;
}

.post-list li:nth-child(5),
.project-card:nth-child(5) {
  animation-delay: 0.5s;
}

.post-list li:nth-child(6),
.project-card:nth-child(6) {
  animation-delay: 0.6s;
}

.post-list li:nth-child(7),
.project-card:nth-child(7) {
  animation-delay: 0.7s;
}

.post-list li:nth-child(8),
.project-card:nth-child(8) {
  animation-delay: 0.8s;
}

.post-list li:nth-child(9),
.project-card:nth-child(9) {
  animation-delay: 0.9s;
}

.post-list li:nth-child(10),
.project-card:nth-child(10) {
  animation-delay: 1s;
}

/* Code Block Styling & Copy Button */
.code-wrapper {
  position: relative;
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  /* Ensure the pre block inside doesn't have its own huge margins that mess up the wrapper */
}
.code-wrapper pre {
  margin: 0 !important;
  border-radius: 0 !important;
  padding: 1.5rem !important;
  padding-top: 2.5rem !important; /* Space for the button/header */
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
  font-family: var(--font-sans);
}
.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}
.copy-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

/* Syntax Highlighting (GitHub Dark) */
.highlight table td {
  padding: 5px;
}

.highlight table pre {
  margin: 0;
}

.highlight, .highlight .w {
  color: #c9d1d9;
  /* background-color: #0d1117;  Removed to keep existing card bg */
}

.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .kv {
  color: #ff7b72;
}

.highlight .gr {
  color: #f0f6fc;
}

.highlight .gd {
  color: #ffdcd7;
  background-color: #67060c;
}

.highlight .nb {
  color: #ffa657;
}

.highlight .nc {
  color: #ffa657;
}

.highlight .no {
  color: #ffa657;
}

.highlight .nn {
  color: #ffa657;
}

.highlight .sr {
  color: #7ee787;
}

.highlight .na {
  color: #7ee787;
}

.highlight .nt {
  color: #7ee787;
}

.highlight .gi {
  color: #aff5b4;
  background-color: #033a16;
}

.highlight .ges {
  font-weight: bold;
  font-style: italic;
}

.highlight .kc {
  color: #79c0ff;
}

.highlight .l, .highlight .ld, .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx {
  color: #79c0ff;
}

.highlight .sb {
  color: #79c0ff;
}

.highlight .bp {
  color: #79c0ff;
}

.highlight .ne {
  color: #79c0ff;
}

.highlight .nl {
  color: #79c0ff;
}

.highlight .py {
  color: #79c0ff;
}

.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm {
  color: #79c0ff;
}

.highlight .o, .highlight .ow {
  color: #79c0ff;
}

.highlight .gh {
  color: #1f6feb;
  font-weight: bold;
}

.highlight .gu {
  color: #1f6feb;
  font-weight: bold;
}

.highlight .s, .highlight .sa, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .sx, .highlight .s1, .highlight .ss {
  color: #a5d6ff;
}

.highlight .nd {
  color: #d2a8ff;
}

.highlight .nf, .highlight .fm {
  color: #d2a8ff;
}

.highlight .err {
  color: #f0f6fc;
  background-color: #8e1519;
}

.highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cp, .highlight .cpf, .highlight .c1, .highlight .cs {
  color: #8b949e;
}

.highlight .gl {
  color: #8b949e;
}

.highlight .gt {
  color: #8b949e;
}

.highlight .ni {
  color: #c9d1d9;
}

.highlight .si {
  color: #c9d1d9;
}

.highlight .ge {
  color: #c9d1d9;
  font-style: italic;
}

.highlight .gs {
  color: #c9d1d9;
  font-weight: bold;
}

/*# sourceMappingURL=main.css.map */