/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #020717;
  --secondary-color: #64748b;
  --bg-color: #ffffff;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
  --sidebar-bg: #f8fafc;
  --code-bg: #f1f5f9;
  --accent-color: #350435;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
}

/* Layout */
.container {
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  gap: 0;
}

/* Header */
.header {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  color: white;
  padding: 1.5rem 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  width: 50px;
  height: 50px;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--primary-color);
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s, box-shadow 0.3s;
}

.site-logo:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.site-branding {
  display: flex;
  flex-direction: column;
}

.site-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
}

.site-title a {
  color: white;
  text-decoration: none;
  transition: opacity 0.3s;
}

.site-title a:hover {
  opacity: 0.9;
}

.site-tagline {
  font-size: 0.9rem;
  opacity: 0.95;
  font-weight: 300;
  margin: 0;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.main-nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s, opacity 0.3s;
}

.main-nav a:hover {
  border-bottom-color: white;
  opacity: 0.9;
}

/* Sidebar */
.sidebar {
  background-color: var(--sidebar-bg);
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  font-weight: 600;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

.about-section p {
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.social-links a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s, transform 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.social-links a:hover {
  color: var(--accent-color);
  transform: translateY(-2px);
}

.social-links svg {
  width: 24px;
  height: 24px;
}

.quote-section {
  margin: 2rem 0;
  padding: 1rem;
  background: white;
  border-left: 3px solid var(--accent-color);
  border-radius: 4px;
}

.quote-section blockquote {
  font-style: italic;
  color: var(--secondary-color);
  font-size: 0.9rem;
}

.archives-section,
.tags-section {
  margin: 2rem 0;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  margin-bottom: 0.5rem;
}

.sidebar ul li a {
  color: var(--secondary-color);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.sidebar ul li a:hover {
  color: var(--primary-color);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud .tag {
  background: white;
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.85rem;
  color: var(--primary-color);
  text-decoration: none;
  border: 1px solid var(--border-color);
  transition: all 0.3s;
}

.tag-cloud .tag:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Main Content */
.main-content {
  padding: 3rem;
  max-width: 900px;
}

.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
}

.article-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  line-height: 1.2;
}

.article-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: var(--secondary-color);
  font-size: 0.95rem;
}

.article-meta .date::before {
  content: '📅 ';
}

.article-meta .category::before {
  content: '📁 ';
}

.article-tags {
  margin-top: 0.5rem;
}

.article-tags .tag {
  display: inline-block;
  background: var(--code-bg);
  padding: 0.25rem 0.75rem;
  margin-right: 0.5rem;
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.3s;
}

.article-tags .tag:hover {
  background: var(--primary-color);
  color: white;
}

/* Content Typography */
.article-content {
  font-size: 1.1rem;
  line-height: 1.8;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  font-weight: 600;
}

.article-content h2 {
  font-size: 1.8rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.article-content h3 {
  font-size: 1.4rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.article-content a:hover {
  border-bottom-color: var(--primary-color);
}

.article-content code {
  background: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.article-content pre {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-left: 3px solid var(--primary-color);
}

.article-content pre code {
  background: none;
  padding: 0;
}

.article-content blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: var(--secondary-color);
  font-style: italic;
}

.article-content ul,
.article-content ol {
  margin: 1rem 0 1.5rem 2rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5rem 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Mermaid Diagrams */
.mermaid {
  background: white;
  padding: 2rem;
  border-radius: 6px;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  text-align: center;
}

/* Post List */
.intro {
  font-size: 1.3rem;
  color: var(--secondary-color);
  margin-bottom: 3rem;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.post-preview {
  padding: 1.5rem;
  background: white;
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  transition: all 0.3s;
}

.post-preview:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(53, 4, 53, 0.25);
  transform: translateY(-2px);
}

.post-preview h2 {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
}

.post-preview h2 a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s;
}

.post-preview h2 a:hover {
  color: var(--primary-color);
}

.post-meta {
  display: flex;
  gap: 1rem;
  color: var(--secondary-color);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.post-preview .tags {
  margin-top: 0.75rem;
}

.post-preview .tag {
  display: inline-block;
  background: var(--code-bg);
  padding: 0.2rem 0.6rem;
  margin-right: 0.5rem;
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 968px) {
  .container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .main-content {
    padding: 2rem 1.5rem;
  }
  
  .article-title {
    font-size: 2rem;
  }
  
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .main-nav ul {
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 1rem;
  }
  
  .site-logo {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .site-title {
    font-size: 1.3rem;
  }
  
  .site-tagline {
    font-size: 0.8rem;
  }
  
  .main-nav ul {
    gap: 1rem;
    font-size: 0.9rem;
  }
  
  .main-content {
    padding: 1.5rem 1rem;
  }
  
  .article-title {
    font-size: 1.75rem;
  }
  
  .article-content {
    font-size: 1rem;
  }
}

/* Footer */
.footer {
  grid-column: 1 / -1;
  background-color: var(--sidebar-bg);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer p {
  color: var(--secondary-color);
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.footer-tagline {
  font-style: italic;
  opacity: 0.8;
}
