/* ========================================
   Personal Website - Light & Clean Style
   Inspired by: whythz.github.io
   ======================================== */

:root {
  --sidebar-width: 280px;
  --primary: #5b7cfa;
  --primary-light: #eef1ff;
  --text: #2c2c2c;
  --text-muted: #6b6b6b;
  --text-light: #9ca3af;
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --border: #e8e8ed;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
  --transition: 0.25s ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========== Sidebar ========== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 40px 28px;
  z-index: 100;
  transition: transform var(--transition);
}

.brand {
  text-align: center;
  margin-bottom: 36px;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 3px solid var(--primary-light);
}

.brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.brand p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.nav {
  flex: 1;
}

.nav ul {
  list-style: none;
}

.nav li {
  margin-bottom: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: all var(--transition);
}

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

.nav a .icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.social {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.social a {
  color: var(--text-muted);
  transition: color var(--transition);
}

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

.social svg {
  width: 20px;
  height: 20px;
}

/* ========== Main Content ========== */
.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 36px 42px;
}

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

.overlay.show {
  display: block;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.search-box {
  position: relative;
  width: 260px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card-bg);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}

.menu-toggle:hover {
  background: var(--primary-light);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--text);
}

/* ========== Layout with Widgets ========== */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
}

/* ========== Cards ========== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  margin-bottom: 20px;
}

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

.card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 14px;
}

.card-img:hover {
  opacity: 0.95;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
  display: block;
}

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

.card-excerpt {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.85rem;
  color: var(--text-light);
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-meta svg {
  width: 14px;
  height: 14px;
}

.card-meta a,
.card-meta span {
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
}

.card-meta a:hover {
  background: var(--primary);
  color: #fff;
}

/* ========== Widgets ========== */
.widget {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.widget-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.widget-list {
  list-style: none;
}

.widget-list li {
  margin-bottom: 12px;
}

.widget-list a {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  transition: color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.widget-list .cat-badge,
.widget-list span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.92rem;
  color: var(--text);
}

.widget-list .cat-badge small,
.widget-list span small {
  color: var(--text-light);
}

.widget-list small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud a,
.tag-cloud span {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 5px 12px;
  border-radius: 20px;
  transition: all var(--transition);
}

.tag-cloud a:hover {
  background: var(--primary);
  color: #fff;
}

/* ========== Hero Section ========== */
.hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
  border-radius: var(--radius);
  padding: 36px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.hero h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 10px;
}

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

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tech-stack span {
  background: var(--card-bg);
  color: var(--primary);
  border: 1px solid var(--primary-light);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ========== Project Cards ========== */
.project-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  transition: transform var(--transition), box-shadow var(--transition);
  border-left: 4px solid var(--primary);
}

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

.project-card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.project-card .project-stack {
  font-size: 0.85rem;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 500;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.project-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 14px 0 8px;
}

.project-card ul {
  margin-left: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.project-card ul li {
  margin-bottom: 6px;
}

.project-btns {
  display: flex;
  gap: 12px;
}

.project-btns a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

.project-btns .btn-primary {
  background: var(--primary);
  color: #fff;
}

.project-btns .btn-primary:hover {
  background: #4a6bea;
}

.project-btns .btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.project-btns .btn-secondary:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ========== Archive Timeline ========== */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 22px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.timeline-item h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-item time {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ========== Note Detail Page ========== */
.note-detail {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 30px 34px;
  box-shadow: var(--shadow);
}

.note-detail h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.4;
}

.note-detail .note-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.note-detail .note-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.note-body {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.9;
}

.note-body h2 {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 36px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-light);
}

.note-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 28px 0 14px;
  color: var(--text);
}

.note-body p {
  margin-bottom: 18px;
  color: var(--text-muted);
}

.note-body ul,
.note-body ol {
  margin-left: 22px;
  margin-bottom: 18px;
  color: var(--text-muted);
}

.note-body li {
  margin-bottom: 8px;
}

.note-body code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.note-body pre {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.note-body pre code {
  background: transparent;
  color: var(--text);
  padding: 0;
}

.note-body img {
  display: block;
  width: 100%;
  max-width: 600px;
  margin: 24px auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.note-body blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  padding: 12px 18px;
  margin: 18px 0;
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 20px;
  transition: color var(--transition);
}

.back-link:hover {
  color: #4a6bea;
}

.about-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-light);
  margin-bottom: 20px;
}

.about-content h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.about-content p {
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 40px 0 20px;
  color: var(--text-light);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

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

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

/* ========== Mobile Responsive ========== */
@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
  }

  .widget {
    margin-bottom: 0;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 20px;
  }

  .top-bar {
    flex-wrap: wrap;
    gap: 14px;
  }

  .menu-toggle {
    display: block;
  }

  .search-box {
    width: 100%;
    order: 3;
  }

  .hero {
    padding: 24px 20px;
  }

  .hero h2 {
    font-size: 1.4rem;
  }

  .project-btns {
    flex-wrap: wrap;
  }
}
