/* O2O智慧 — 个人博客样式 */

:root {
  --bg: #f4f6fa;
  --bg-subtle: linear-gradient(165deg, #eef2ff 0%, #f4f6fa 42%, #f8fafc 100%);
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-light: #6366f1;
  --accent-soft: #eef2ff;
  --accent-glow: rgba(79, 70, 229, 0.12);
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --tag-bg: #eef2ff;
  --tag-text: #4338ca;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --inline-code-bg: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max-width: 760px;
  --header-height: 64px;
  --font-sans: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-light);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.header-inner {
  max-width: calc(var(--max-width) + 64px);
  margin: 0 auto;
  padding: 0 28px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.site-title:hover {
  text-decoration: none;
  color: var(--text);
}

.site-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px var(--accent-glow);
  flex-shrink: 0;
}

.site-name {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.site-name em {
  font-style: normal;
  font-weight: 500;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--text-secondary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nav-toggle:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

/* Main */
.site-main {
  flex: 1;
  max-width: calc(var(--max-width) + 64px);
  margin: 0 auto;
  padding: 40px 28px 64px;
  width: 100%;
}

/* Hero (homepage) */
.hero {
  position: relative;
  margin-bottom: 48px;
  padding: 36px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light), #818cf8);
}

.hero-label {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--tag-text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
}

.hero-name-note {
  padding: 14px 18px;
  margin-bottom: 18px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
}

.hero-name-note strong {
  color: var(--text);
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 18px;
  line-height: 1.35;
}

.hero p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.9875rem;
  max-width: 62ch;
}

.hero p:last-child {
  margin-bottom: 0;
}

/* Section title */
.section-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Articles toolbar & year groups */
.articles-toolbar {
  margin-bottom: 28px;
}

.articles-toolbar .section-title {
  margin-bottom: 0;
}

.articles-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 16px;
}

.article-count {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.year-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.year-filter {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.year-filter:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.article-list-root {
  min-height: 120px;
}

.articles-loading,
.articles-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  padding: 32px 16px;
}

.year-group {
  margin-bottom: 36px;
}

.year-group:last-child {
  margin-bottom: 0;
}

.year-heading {
  position: sticky;
  top: var(--header-height);
  z-index: 10;
  margin: 0 0 16px;
  padding: 10px 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  background: linear-gradient(to bottom, rgba(244, 246, 250, 0.98) 70%, transparent);
  backdrop-filter: blur(4px);
}

/* Article list (legacy block kept for nested lists) */
.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.article-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background 0.2s ease;
}

.article-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: var(--shadow-lg);
}

.article-card:hover::before {
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
}

.article-card h2 {
  margin: 0 0 10px;
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.45;
}

.article-card h2 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}

.article-card h2 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.article-meta time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
}

.article-card p {
  margin: 0 0 16px;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.read-more:hover {
  gap: 8px;
  text-decoration: none;
}

/* Article page */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  padding: 6px 14px 6px 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.back-link:hover {
  color: var(--accent);
  border-color: #c7d2fe;
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.article-header {
  margin-bottom: 36px;
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.article-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 16px;
  line-height: 1.35;
}

.article-body {
  padding: 0 4px;
}

.article-body h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.article-body h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 10px;
}

.article-body p {
  margin: 0 0 18px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 18px;
  padding-left: 1.4em;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body li::marker {
  color: var(--accent-light);
}

.article-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
  margin: 0 0 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.article-body p code,
.article-body li code {
  background: var(--inline-code-bg);
  color: #be185d;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.85em;
}

.article-disclaimer {
  margin-top: 48px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* About & page headers */
.page-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 8px;
}

.page-subtitle {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.about-section {
  margin-bottom: 20px;
  padding: 24px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.about-section h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.about-section h2::before {
  content: "";
  width: 4px;
  height: 1em;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
  flex-shrink: 0;
}

.about-section p,
.about-section li {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.about-section p {
  margin: 0 0 12px;
}

.about-section p:last-child {
  margin-bottom: 0;
}

.about-section ul {
  margin: 0;
  padding-left: 1.25em;
}

.about-section li {
  margin-bottom: 10px;
  line-height: 1.65;
}

.about-section li:last-child {
  margin-bottom: 0;
}

.contact-email {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-weight: 500;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 28px 24px;
}

.footer-inner {
  max-width: calc(var(--max-width) + 64px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-brand {
  font-weight: 500;
  color: var(--text-secondary);
}

.site-footer a {
  color: var(--text-muted);
  transition: color 0.15s;
}

.site-footer a:hover {
  color: var(--accent);
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: #c7d2fe;
  color: var(--accent);
  box-shadow: var(--shadow-lg);
}

/* Responsive */
@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px 16px;
    box-shadow: var(--shadow-md);
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    border-radius: var(--radius-sm);
  }

  .header-inner {
    position: relative;
    padding: 0 20px;
  }

  .site-main {
    padding: 28px 20px 48px;
  }

  .hero {
    padding: 28px 22px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .article-card {
    padding: 20px 22px;
  }

  .article-header {
    padding: 24px 22px;
  }

  .article-header h1 {
    font-size: 1.4375rem;
  }

  .about-section {
    padding: 20px 22px;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
  }
}
