:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f5f2ed;
  --text: #1f1f1f;
  --text-secondary: #5a5a5a;
  --text-tertiary: #8a8a8a;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-hover: #4338ca;
  --border: #ebe7e0;
  --code-bg: #1e1e2e;
  --code-text: #e4e4e7;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 24px;
  --max: 760px;
  --max-wide: 1400px;
  --max-content: 1200px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "Consolas", "SF Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --text: #f5f5f7;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --accent: #818cf8;
    --accent-soft: #2e2f4a;
    --accent-hover: #a5b4fc;
    --border: #2c2c2e;
    --code-bg: #0d0d12;
    --code-text: #e4e4e7;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  }
}

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

html { scroll-behavior: smooth; }

::selection {
  background: var(--accent);
  color: #fff;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: clamp(16px, 1.1vw, 20px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Reading progress */
#progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* Header / Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(18, 18, 18, 0.85);
  }
}

.site-header .wrap {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

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

.site-title:hover { color: var(--accent); }

.site-desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.site-nav a:hover { color: var(--accent); }

/* Hero */
.hero {
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--accent), #9333ea);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-meta {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Main */
main {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

main article {
  max-width: var(--max-content);
  margin: 0 auto;
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 1.25rem;
  font-weight: 700;
}

/* Cards */
.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(79, 70, 229, 0.15);
}

.card-link {
  display: flex;
  align-items: stretch;
  gap: 0;
  color: inherit;
}

.card-link:hover { color: inherit; }

.card-left {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 120px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
}

.card-day {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
}

.card-month {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.card-body {
  flex: 1;
  padding: 1.5rem;
  min-width: 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.01em;
}

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

.card-arrow {
  color: var(--text-tertiary);
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.card:hover .card-arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}

@media (min-width: 768px) {
  .card-left { display: flex; }
  .card-body { padding: 1.75rem; }
  article { padding: 3rem; }
}

.card-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.card-date {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.read-time {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tag-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Article page */
.article-header {
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
  max-width: var(--max-content);
  margin: 0 auto;
}

@media (min-width: 1200px) {
  .article-header { padding: 4rem 1.5rem 3rem; }
}

.article-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.article-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.article-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

/* Article body */
article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 1200px) {
  article { padding: 3.5rem; }
}

article > *:first-child { margin-top: 0; }

article h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  margin: 2.75rem 0 1rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

article h3 {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 650;
  margin: 2.25rem 0 0.75rem;
  color: var(--text);
}

article p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

article strong {
  color: var(--text);
  font-weight: 650;
}

article ul, article ol {
  margin: 0 0 1.5rem 1.5rem;
  color: var(--text-secondary);
}

article li { margin-bottom: 0.5rem; }

article li::marker { color: var(--accent); }

article em {
  font-style: italic;
  color: var(--text);
}

blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
  font-weight: 500;
}

blockquote p { margin: 0; color: inherit; }

/* Code */
pre, code {
  font-family: var(--mono);
  font-size: 0.875rem;
}

code {
  background: var(--surface-2);
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  font-weight: 500;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  line-height: 1.6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-weight: 400;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2.5rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.back-link:hover { color: var(--accent); }

/* Footer */
.site-footer {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--accent); }

/* Empty / utils */
.empty {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-tertiary);
}

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 2.5rem 1.25rem 2rem; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  
  .site-header .wrap { padding: 0.85rem 1.25rem; }
  .brand-logo { width: 32px; height: 32px; font-size: 0.875rem; }
  
  main { padding: 0 1.25rem 3rem; }
  
  .card-title { font-size: 1.15rem; }
  
  article { padding: 1.5rem; border-radius: var(--radius); max-width: 100%; }
  article h2 { font-size: 1.4rem; }
  article h3 { font-size: 1.15rem; }
  .article-header { padding: 2rem 1.25rem 1.5rem; }
  
  .article-header { padding: 2rem 1.25rem 1.5rem; }
  .article-title { font-size: 1.65rem; }
}

/* Print */
@media print {
  .site-header, .site-footer, #progress, .back-link { display: none; }
  article { box-shadow: none; border: none; }
}
