/* ===== CSS Variables ===== */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --border: #e2e2e2;
  --border-light: #f0f0f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --code-bg: #f5f5f5;
  --code-text: #1a1a1a;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --radius: 8px;
  --radius-sm: 4px;
  --max-width: 720px;
  --nav-height: 56px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", "Fira Code", "Consolas", "Liberation Mono", "Menlo", monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -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);
  text-decoration: underline;
}

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

/* ===== Layout ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== Navigation ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background-color: rgba(255,255,255,0.92);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.site-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
}

/* ===== Main Content ===== */
main {
  min-height: calc(100vh - var(--nav-height) - 120px);
  padding: 2.5rem 0 4rem;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; }
h3 { font-size: 1.2rem; margin-top: 1.75rem; }

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

p strong {
  color: var(--text);
}

ul, ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.5em;
}

/* ===== Home Page ===== */
.hero {
  padding: 2rem 0 1rem;
}

.hero h1 {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

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

/* ===== Post List ===== */
.post-list {
  list-style: none;
  padding: 0;
}

.post-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-light);
}

.post-item:first-child {
  padding-top: 0;
}

.post-item:last-child {
  border-bottom: none;
}

.post-item a {
  display: block;
  text-decoration: none;
}

.post-item a:hover {
  text-decoration: none;
}

.post-item a:hover .post-title {
  color: var(--accent);
}

.post-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
  transition: color 0.15s;
  line-height: 1.4;
}

.post-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-excerpt {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.6;
}

.post-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  text-transform: lowercase;
}

/* ===== Article Page ===== */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.article-title {
  font-size: 1.875rem;
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.article-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.article-content h2 {
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.article-content h3 {
  margin-top: 2rem;
}

.article-content p {
  margin-bottom: 1.25em;
}

.article-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.article-content a:hover {
  text-decoration-thickness: 2px;
}

/* ===== Code Blocks ===== */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25em;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
  color: var(--code-text);
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* ===== Blockquote ===== */
blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== About Page ===== */
.about-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.5rem;
  user-select: none;
}

.about-intro {
  font-size: 1.125rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin-bottom: 2rem;
}

.skills-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
}

/* ===== 404 Page ===== */
.error-page {
  text-align: center;
  padding: 5rem 0;
}

.error-code {
  font-size: 5rem;
  font-weight: 800;
  color: var(--border);
  line-height: 1;
  letter-spacing: -0.05em;
  margin-bottom: 0.5rem;
}

.error-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.error-desc {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: 2rem 0;
  text-align: center;
}

.site-footer p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

/* ===== Back Link ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

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

/* ===== Mobile Menu ===== */
@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
    display: none;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 0.75rem 1.25rem;
    border-bottom: none;
    border-left: 3px solid transparent;
  }

  .nav-links a:hover,
  .nav-links a.active {
    border-bottom: none;
    border-left-color: var(--accent);
    background: var(--accent-light);
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .article-title {
    font-size: 1.5rem;
  }

  .error-code {
    font-size: 4rem;
  }
}

/* ===== Print ===== */
@media print {
  .site-header,
  .site-footer,
  .back-link {
    display: none;
  }

  main {
    padding: 0;
  }
}
