/* === CSS Variables === */
:root {
  /* Dark Theme Colors */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  
  --accent-primary: #58a6ff;
  --accent-secondary: #1f6feb;
  --accent-green: #3fb950;
  --accent-red: #f85149;
  --accent-yellow: #d29922;
  --accent-purple: #a371f7;
  
  --border-color: #30363d;
  --border-subtle: #21262d;
  
  --code-bg: #161b22;
  --inline-code-bg: rgba(110, 118, 129, 0.2);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  
  /* Sizing */
  --max-width: 900px;
  --header-height: 64px;
  --border-radius: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

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

/* === Container === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  height: var(--header-height);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

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

.logo-icon {
  font-size: 1.5rem;
}

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

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

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

.social-link {
  display: flex;
  align-items: center;
}

.nav-toggle {
  display: none;
}

/* === Main Content === */
.main-content {
  flex: 1;
  padding: 48px 0;
}

/* === Home Page === */
.home-hero {
  text-align: center;
  padding: 64px 0;
}

.home-hero h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

/* === Post List === */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  transition: all 0.2s ease;
}

.post-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.post-card h3 {
  margin-bottom: 8px;
}

.post-card h3 a {
  color: var(--text-primary);
}

.post-card h3 a:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

.post-card .post-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.post-card .post-excerpt {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* === Single Post === */
.post-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.post-title {
  font-size: 2.25rem;
  line-height: 1.3;
  margin-bottom: 16px;
}

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

.post-tags, .post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag, .category {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 20px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.tag {
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
}

.category {
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
}

/* === Post Content === */
.post-content {
  line-height: 1.8;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 32px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.post-content h2 {
  font-size: 1.75rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.post-content h3 {
  font-size: 1.35rem;
}

.post-content p {
  margin-bottom: 16px;
}

.post-content ul, .post-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content blockquote {
  margin: 24px 0;
  padding: 16px 24px;
  border-left: 4px solid var(--accent-primary);
  background: var(--bg-secondary);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* === Code Blocks === */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.post-content p code,
.post-content li code {
  background: var(--inline-code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-primary);
}

.post-content pre {
  margin: 24px 0;
  padding: 20px;
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow-x: auto;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Syntax Highlighting (Rouge - GitHub Dark) */
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs { color: #8b949e; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #ff7b72; }
.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .s1, .highlight .ss { color: #a5d6ff; }
.highlight .n, .highlight .na, .highlight .nb, .highlight .nc, .highlight .no, .highlight .nd, .highlight .ni, .highlight .ne, .highlight .nf, .highlight .nl, .highlight .nn, .highlight .nx, .highlight .py { color: #d2a8ff; }
.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo { color: #79c0ff; }
.highlight .o, .highlight .ow { color: #ff7b72; }
.highlight .p { color: var(--text-primary); }
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: #ffa657; }

/* === Tables === */
.post-content table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.post-content th, .post-content td {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.post-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}

.post-content tr:hover {
  background: var(--bg-secondary);
}

/* === Post Footer Navigation === */
.post-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.post-nav {
  flex: 1;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.post-nav:hover {
  border-color: var(--accent-primary);
  text-decoration: none;
}

.post-nav .nav-title {
  display: block;
  color: var(--text-primary);
  font-weight: 500;
  margin-top: 4px;
}

.post-nav.next {
  text-align: right;
}

/* === Footer === */
.site-footer {
  margin-top: auto;
  padding: 32px 0;
  border-top: 1px solid var(--border-color);
}

.footer-content {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links {
  margin-top: 8px;
}

.footer-links .separator {
  margin: 0 8px;
  color: var(--border-color);
}

/* === About Page === */
.about-content {
  max-width: 700px;
}

.about-content h1 {
  margin-bottom: 24px;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.skill-badge {
  padding: 6px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* === Responsive === */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
  }
  
  .nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
  }
  
  .nav-links {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    gap: 0;
    display: none;
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .nav-links li {
    width: 100%;
  }
  
  .nav-links a {
    display: block;
    padding: 12px 0;
    border-bottom: none;
  }
  
  .home-hero h1 {
    font-size: 2rem;
  }
  
  .post-title {
    font-size: 1.75rem;
  }
  
  .post-footer {
    flex-direction: column;
  }
}
