/* Modern Professional Engineering Blog Styles */

/* CSS Variables & Theme Colors */
:root {
  /* Light theme colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #1a1a1a;
  --text-secondary: #4a5568;
  --text-tertiary: #718096;
  --border-color: #e2e8f0;
  --link-color: #2563eb;
  --link-hover: #1d4ed8;
  --code-bg: #f7fafc;
  --code-border: #cbd5e0;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --header-bg: rgba(255,255,255,0.95);
}

[data-theme="dark"] {
  /* Dark theme colors */
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --bg-tertiary: #374151;
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --text-tertiary: #cbd5e0;
  --border-color: #4a5568;
  --link-color: #60a5fa;
  --link-hover: #93c5fd;
  --code-bg: #2d3748;
  --code-border: #4a5568;
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
  --header-bg: rgba(26,32,44,0.95);
}

/* Base Styles */
*, *::after, *::before {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

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

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

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

code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 0.9em;
  background-color: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--code-border);
  color: var(--text-primary);
}

pre {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
}

blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 1.5rem;
  margin-left: 0;
  margin-right: 0;
  font-style: italic;
  color: var(--text-tertiary);
}

/* Header & Navigation */
.site-header {
  background-color: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text-primary);
}

.sun-icon {
  display: block;
}

.moon-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: block;
}

/* Mobile Menu */
.nav-trigger {
  display: none;
}

.menu-icon {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-icon span {
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  transition: all 0.3s ease;
}

/* Main Content */
.main-content {
  min-height: calc(100vh - 400px);
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Homepage Hero */
.blog-hero {
  text-align: center;
  padding: 4rem 2rem 3rem;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border-color);
}

.hero-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--link-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Post Cards (Homepage) */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
}

.post-card {
  background-color: var(--bg-primary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--border-color);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.post-card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card-image a:hover img {
  transform: scale(1.05);
}

.post-card-content {
  padding: 1.5rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

.post-reading-time::before {
  content: '•';
  margin-right: 0.5rem;
}

.post-card-title {
  font-size: 1.5rem;
  margin: 0 0 1rem 0;
}

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

.post-card-title a:hover {
  color: var(--link-color);
}

.post-card-excerpt {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-badge {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tag-badge:hover {
  background-color: var(--accent-color);
  color: white;
}

/* Post Article Page */
.post-article {
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--bg-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.post-header {
  padding: 3rem 3rem 2rem;
  border-bottom: 1px solid var(--border-color);
}

.post-title {
  font-size: 2.5rem;
  margin: 0 0 1rem 0;
  line-height: 1.2;
}

.post-meta-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-tertiary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.meta-separator {
  color: var(--text-tertiary);
}

.post-tags-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-featured-image {
  width: 100%;
  max-height: 500px;
  overflow: hidden;
}

.post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-content {
  padding: 3rem;
  font-size: 1.125rem;
  line-height: 1.8;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.post-content h2 {
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.post-content li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.post-content img {
  margin: 2rem auto;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.post-footer {
  padding: 2rem 3rem 3rem;
  border-top: 1px solid var(--border-color);
}

.share-label {
  display: block;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.share-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.share-button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.share-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.share-button.twitter:hover {
  background-color: #1da1f2;
  color: white;
  border-color: #1da1f2;
}

.share-button.linkedin:hover {
  background-color: #0077b5;
  color: white;
  border-color: #0077b5;
}

.share-button.hackernews:hover {
  background-color: #ff6600;
  color: white;
  border-color: #ff6600;
}

/* Tags Page */
.tags-page {
  max-width: 1000px;
  margin: 0 auto;
}

.tags-header {
  text-align: center;
  padding: 3rem 2rem 2rem;
}

.tags-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.tags-header p {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2rem;
  background-color: var(--bg-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  margin-bottom: 3rem;
}

.tag-cloud-item {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tag-count {
  background-color: var(--accent-color);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

.tag-cloud-item:hover {
  background-color: var(--accent-color);
  color: white;
  transform: translateY(-2px);
}

.tag-cloud-item:hover .tag-count {
  background-color: white;
  color: var(--accent-color);
}

.tag-section {
  margin-bottom: 3rem;
}

.tag-title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}

.tag-posts {
  background-color: var(--bg-primary);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

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

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

.tag-post-item h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
}

.tag-post-item a {
  color: var(--text-primary);
}

.tag-post-item a:hover {
  color: var(--link-color);
}

.tag-post-item time {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* About Page */
.about-page {
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--bg-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.about-header {
  text-align: center;
  padding: 3rem 2rem 2rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border-color);
}

.about-avatar {
  width: 150px;
  height: 150px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--accent-color);
  box-shadow: var(--shadow-md);
}

.about-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-tagline {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.about-content {
  padding: 3rem;
}

.about-section {
  margin-bottom: 3rem;
}

.about-section:last-child {
  margin-bottom: 0;
}

.about-section h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.about-section p {
  margin-bottom: 1rem;
}

.topics-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.topics-list li {
  background-color: var(--bg-tertiary);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  transition: all 0.2s ease;
}

.topics-list li:hover {
  background-color: var(--accent-color);
  color: white;
  transform: translateY(-2px);
}

.social-links-about {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.social-link {
  padding: 0.75rem 1.5rem;
  background-color: var(--bg-tertiary);
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.social-link i {
  margin-right: 0.5rem;
}

.social-link:hover {
  background-color: var(--accent-color);
  color: white;
  transform: translateY(-2px);
}

/* Footer */
.site-footer {
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  margin-top: 4rem;
  padding: 3rem 0 1rem;
}

.footer-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
  margin-bottom: 2rem;
}

.footer-about h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.footer-about p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.footer-links h4 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  border-radius: 50%;
  transition: all 0.2s ease;
}

.social-links a:hover {
  background-color: var(--accent-color);
  color: white;
  transform: translateY(-2px);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.footer-bottom p {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  margin: 0;
}

/* Pagination */
.pagination {
  margin: 3rem 0;
}

.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-primary);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.pagination-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--bg-tertiary);
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.pagination-link:hover {
  background-color: var(--accent-color);
  color: white;
}

.pagination-link.newer:hover {
  transform: translateX(-4px);
}

.pagination-link.older:hover {
  transform: translateX(4px);
}

.pagination-link.disabled {
  opacity: 0;
  pointer-events: none;
}

.pagination-info {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-wrapper {
    padding: 1rem;
  }

  .menu-icon {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    height: 100vh;
    background-color: var(--bg-primary);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    box-shadow: var(--shadow-lg);
    transition: right 0.3s ease;
    align-items: flex-start;
  }

  .nav-trigger:checked ~ .nav-links {
    right: 0;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .post-article {
    border-radius: 0;
  }

  .post-header,
  .post-content,
  .post-footer {
    padding: 2rem 1.5rem;
  }

  .post-title {
    font-size: 2rem;
  }

  .post-content {
    font-size: 1rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .pagination-wrapper {
    flex-direction: column;
    gap: 1rem;
  }

  .content-wrapper {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .post-title {
    font-size: 1.75rem;
  }

  .about-content {
    padding: 2rem 1.5rem;
  }
}
