/* ========================================
   AI Blog Engine - Main Stylesheet
   Modern, Clean, Fast, Mobile-First Design
   ======================================== */

/* CSS Variables */
:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #3b82f6;
  --color-secondary: #7c3aed;
  --color-accent: #f59e0b;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #06b6d4;
  
  --color-bg: #ffffff;
  --color-bg-secondary: #f8fafc;
  --color-bg-tertiary: #f1f5f9;
  --color-surface: #ffffff;
  --color-surface-hover: #f8fafc;
  
  --color-text: #0f172a;
  --color-text-secondary: #475569;
  --color-text-tertiary: #94a3b8;
  --color-text-inverse: #ffffff;
  
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  
  --color-header-bg: rgba(255, 255, 255, 0.95);
  --color-card-bg: #ffffff;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  --max-width: 1200px;
  --content-width: 720px;
  --header-height: 64px;
  
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* Dark Mode */
[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-bg-tertiary: #334155;
  --color-surface: #1e293b;
  --color-surface-hover: #334155;
  
  --color-text: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-tertiary: #64748b;
  
  --color-border: #334155;
  --color-border-light: #1e293b;
  
  --color-header-bg: rgba(15, 23, 42, 0.95);
  --color-card-bg: #1e293b;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

/* 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);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 1000;
  background: transparent;
}

.reading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  width: 0%;
  transition: width 0.1s linear;
}

/* Header / Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.logo:hover {
  color: var(--color-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
}

/* Navigation Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-text);
  background: var(--color-bg-tertiary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: white;
}

.btn-secondary {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-border);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

/* Search */
.search-container {
  position: relative;
}

.search-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-secondary);
  color: var(--color-text-tertiary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 200px;
}

.search-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-text-secondary);
}

.search-toggle kbd {
  margin-left: auto;
  padding: 2px 6px;
  background: var(--color-bg-tertiary);
  border-radius: 4px;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
}

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  backdrop-filter: blur(4px);
}

.search-overlay.active {
  display: flex;
}

.search-modal {
  width: 100%;
  max-width: 640px;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.125rem;
  color: var(--color-text);
  outline: none;
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.search-result-item:hover {
  background: var(--color-bg-secondary);
}

.search-result-title {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.search-result-excerpt {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hero Section */
.hero {
  padding: 60px 20px;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

/* Featured Posts */
.featured-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  max-width: var(--max-width);
  margin: 0 auto 40px;
  padding: 0 20px;
}

.featured-main {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/10;
  background: var(--color-bg-tertiary);
}

.featured-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.featured-main:hover img {
  transform: scale(1.03);
}

.featured-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 24px 24px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.featured-overlay .category-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--color-primary);
  color: white;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.featured-overlay h2 {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.featured-overlay .meta {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8125rem;
  margin-top: 8px;
}

.featured-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.featured-side-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: all var(--transition);
}

.featured-side-item:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.featured-side-item .rank {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
  opacity: 0.3;
  line-height: 1;
  flex-shrink: 0;
}

.featured-side-item h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

.featured-side-item .meta {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  margin-top: 4px;
}

/* Section */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Post Grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.post-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.post-card-image {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-bg-tertiary);
  flex-shrink: 0;
}

.post-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.post-card-body {
  padding: 20px;
  flex: 1;
}

.post-card-category {
  display: inline-block;
  padding: 3px 8px;
  background: var(--color-bg-tertiary);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.post-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
}

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

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

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.post-card-date {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  margin-top: 12px;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
}

.post-card-meta .author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

/* Single Post */
.post-article {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 40px 20px;
}

.post-header {
  margin-bottom: 32px;
}

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

.post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-info img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.author-info .author-name {
  font-weight: 600;
  color: var(--color-text);
}

.post-featured-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  aspect-ratio: 16/9;
  background: var(--color-bg-tertiary);
}

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

/* Post Content */
.post-content {
  font-size: 1.125rem;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 1.625rem;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.post-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 12px;
}

.post-content p {
  margin-bottom: 20px;
  color: var(--color-text);
}

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

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

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

.post-content blockquote p {
  margin-bottom: 0;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 2px 6px;
  background: var(--color-bg-tertiary);
  border-radius: 4px;
}

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

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content img {
  border-radius: var(--radius-md);
  margin: 24px 0;
}

.post-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 24px 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.post-content th {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.post-content th:not(:last-child) {
  border-right: 1px solid rgba(255,255,255,0.15);
}

.post-content td {
  border-right: 1px solid var(--color-border);
}

.post-content td:last-child {
  border-right: none;
}

.post-content tr:last-child td {
  border-bottom: none;
}

.post-content tbody tr:nth-child(even) {
  background: var(--color-bg-secondary);
}

.post-content tbody tr:hover {
  background: rgba(99,102,241,0.05);
}

@media (max-width: 768px) {
  .post-content table {
    font-size: 0.875rem;
  }
  .post-content th, .post-content td {
    padding: 8px 10px;
  }
}

/* Table of Contents */
.toc {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.toc h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 12px;
  margin-top: 0;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 6px;
}

.toc a {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  padding: 4px 0;
  display: block;
}

.toc a:hover {
  color: var(--color-primary);
}

.toc .toc-h2 { padding-left: 0; }
.toc .toc-h3 { padding-left: 16px; }

/* Tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

.post-tag {
  display: inline-block;
  padding: 6px 12px;
  background: var(--color-bg-tertiary);
  border-radius: 20px;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}

.post-tag:hover {
  background: var(--color-primary);
  color: white;
}

/* Share */
.share-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
  border-top: 1px solid var(--color-border);
  margin-top: 32px;
}

.share-label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-right: 8px;
}

.share-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-tertiary);
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.share-btn:hover {
  background: var(--color-primary);
  color: white;
}

/* Author Box */
.author-box {
  display: flex;
  gap: 20px;
  padding: 24px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  margin: 32px 0;
}

.author-box img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-box h4 {
  font-weight: 700;
  margin-bottom: 4px;
}

.author-box p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 0;
}

/* Related Posts */
.related-posts h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.related-card {
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.related-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}

.related-card h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

.related-card h4 a {
  color: var(--color-text);
}

.related-card .meta {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  margin-top: 8px;
}

/* Comments */
.comments-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.comments-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.comment {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.comment-name {
  font-weight: 600;
  font-size: 0.875rem;
}

.comment-date {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
}

.comment-content {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 8px;
}

.comment-reply {
  font-size: 0.8125rem;
  color: var(--color-primary);
  cursor: pointer;
  border: none;
  background: none;
  font-weight: 500;
}

.comment-reply:hover {
  text-decoration: underline;
}

.comment-form {
  margin-top: 24px;
  padding: 24px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-text);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Newsletter */
.newsletter-section {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  padding: 60px 20px;
  text-align: center;
  color: white;
  margin-top: 60px;
}

.newsletter-inner {
  max-width: 480px;
  margin: 0 auto;
}

.newsletter-section h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.newsletter-section p {
  opacity: 0.9;
  margin-bottom: 24px;
  font-size: 0.9375rem;
}

.newsletter-form {
  display: flex;
  gap: 8px;
}

.newsletter-form input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
}

.newsletter-form button {
  padding: 12px 24px;
  background: var(--color-accent);
  color: var(--color-text);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}

.newsletter-form button:hover {
  opacity: 0.9;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 0;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}

.pagination a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pagination .active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.pagination .disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Footer */
.site-footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 40px 20px 24px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}

.footer-brand h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.footer-brand p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.footer-col h4 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  margin-bottom: 12px;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-col a {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.footer-col a:hover {
  color: var(--color-primary);
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
}

/* Auth Pages */
.auth-page {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.auth-card p {
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

/* Flash Messages */
.flash-messages {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash-message {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.flash-success { background: var(--color-success); color: white; }
.flash-error { background: var(--color-danger); color: white; }
.flash-info { background: var(--color-info); color: white; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
  .featured-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .search-toggle {
    min-width: auto;
    padding: 8px;
  }
  
  .search-toggle span {
    display: none;
  }
  
  .hero {
    padding: 40px 20px;
  }
  
  .post-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .author-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .newsletter-form {
    flex-direction: column;
  }
}

/* Utility */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Mega Menu */
.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  display: none;
  padding: 24px;
  z-index: 50;
}

.mega-menu.open {
  display: block;
}

.mega-menu-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.mega-menu-col h4 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  margin-bottom: 12px;
}

.mega-menu-col a {
  display: block;
  padding: 6px 0;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg-tertiary) 25%, var(--color-bg-secondary) 50%, var(--color-bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========================================
   Premium Animations & Effects
   ======================================== */

/* Fade In Up */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Slide In Left */
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Slide In Right */
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Scale In */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Float Animation */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Pulse Glow */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(37, 99, 235, 0); }
}

/* Gradient Shift */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Typing Cursor Blink */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Apply Animations to Elements */

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

.animate-fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.animate-scale-in {
  animation: scaleIn 0.4s ease forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: pulseGlow 2s infinite;
}

/* Stagger children animations */
.stagger-children > * {
  animation: fadeInUp 0.5s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }

/* Hero Section Animations */
.hero h1 {
  animation: fadeInUp 0.6s ease forwards;
}

.hero p {
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.2s forwards;
}

.hero .btn {
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.4s forwards;
}

/* Section Animations */
.section {
  animation: fadeInUp 0.7s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  .hero h1,
  .hero p,
  .hero .btn,
  .animate-fade-in-up,
  .animate-fade-in,
  .animate-scale-in,
  .stagger-children > * {
    opacity: 1;
    animation: none;
  }
}

/* Card Hover Effects */
.post-card {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  will-change: transform;
}

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

/* Button Hover Effects */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
}

/* Smooth link hover */
a:not(.btn):not(.post-card):not(.logo) {
  transition: color 0.2s ease, opacity 0.2s ease;
}

/* Image hover zoom */
.post-card-image img,
.featured-main img {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Smooth page transitions */
main {
  animation: fadeIn 0.3s ease;
}

/* Reading progress bar animation */
.reading-progress-bar {
  transition: width 0.1s linear;
}

/* Header blur on scroll effect */
.site-header {
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Featured card hover */
.featured-main {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.featured-main:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Featured side items */
.featured-side-item {
  transition: transform 0.3s ease, background 0.3s ease;
}

.featured-side-item:hover {
  transform: translateX(4px);
  background: var(--color-bg-tertiary);
}

/* Category tag hover */
.category-tag {
  transition: all 0.3s ease;
}

.category-tag:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Post card category badge */
.post-card-category {
  transition: all 0.3s ease;
}

.post-card-category:hover {
  background: var(--color-primary);
  color: white;
}

/* Admin sidebar navigation items */
.admin-nav-item {
  transition: all 0.2s ease;
  border-radius: var(--radius-md);
}

/* Smooth scroll for the whole page */
html {
  scroll-behavior: smooth;
}

/* Newsletter section animation */
.newsletter-section {
  opacity: 0;
  animation: fadeInUp 0.7s ease 0.3s forwards;
}

/* Footer link hover */
.site-footer a {
  transition: color 0.2s ease;
}

/* Pagination hover */
.pagination a {
  transition: all 0.2s ease;
}

.pagination a:hover {
  transform: translateY(-1px);
}

/* Loading spinner for async operations */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
