/* Emigrid Blog Platform - Main Stylesheet */
/* blogs.emigrid.com */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --navy: #1E3669;
  --navy-dark: #152849;
  --navy-light: #2A4C8F;
  --accent: #4B7BF5;
  --accent-light: #EEF2FF;
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-400: #94A3B8;
  --gray-600: #475569;
  --gray-800: #1E293B;
  --success: #059669;
  --warning: #D97706;
  --text: #1a2332;
  --text-muted: #64748b;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(30,54,105,0.08);
  --card-shadow-hover: 0 8px 32px rgba(30,54,105,0.15);
  --border-radius: 12px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode */
[data-theme="dark"] {
  --white: #0f172a;
  --gray-50: #1e293b;
  --gray-100: #1e2d3d;
  --gray-200: #2d3f55;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--white);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

/* Typography */
h1, h2, h3 { font-family: 'Playfair Display', serif; line-height: 1.3; }
h4, h5, h6 { font-family: 'DM Sans', sans-serif; }

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--accent); }

/* Navbar */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 2rem;
  height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  transition: var(--transition);
}
[data-theme="dark"] .navbar { background: rgba(15,23,42,0.95); }

.navbar-brand { display: flex; align-items: center; gap: 0.75rem; }
.navbar-brand img { height: 38px; }
.navbar-brand span { font-size: 1.1rem; font-weight: 600; color: var(--navy); }
[data-theme="dark"] .navbar-brand span { color: var(--gray-200); }

.navbar-links { display: flex; align-items: center; gap: 2rem; }
.navbar-links a { font-size: 0.95rem; font-weight: 500; color: var(--text-muted); transition: var(--transition); }
.navbar-links a:hover, .navbar-links a.active { color: var(--navy); }
[data-theme="dark"] .navbar-links a:hover { color: var(--accent); }

.navbar-actions { display: flex; align-items: center; gap: 1rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.4rem; border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none; transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--navy); color: #fff;
}
.btn-primary:hover { background: var(--navy-light); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(30,54,105,0.3); }

.btn-outline {
  background: transparent; color: var(--navy);
  border: 2px solid var(--navy);
}
.btn-outline:hover { background: var(--navy); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; border-radius: 10px; }

/* Category Badge */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.25rem 0.75rem; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
  background: var(--accent-light); color: var(--navy);
}
.badge-sm { padding: 0.2rem 0.6rem; font-size: 0.72rem; }

/* Cards */
.card {
  background: var(--white); border-radius: var(--border-radius);
  box-shadow: var(--card-shadow); overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--gray-200);
}
.card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-3px); }

/* Post Card */
.post-card { display: flex; flex-direction: column; }
.post-card-image {
  aspect-ratio: 16/9; overflow: hidden;
  background: var(--gray-100);
}
.post-card-image img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
}
.post-card:hover .post-card-image img { transform: scale(1.05); }
.post-card-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.post-card-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.post-card-meta span { font-size: 0.82rem; color: var(--text-muted); }
.post-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text); line-height: 1.4; }
.post-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; flex: 1; }
.post-card-footer { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }

/* Featured Post Card */
.featured-card {
  position: relative; border-radius: 16px; overflow: hidden;
  min-height: 420px; display: flex; align-items: flex-end;
}
.featured-card-bg {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,0.8) 100%);
  z-index: 1;
}
.featured-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.featured-card-content { position: relative; z-index: 2; padding: 2rem; color: white; width: 100%; }
.featured-card-content h2 { font-size: 1.6rem; margin-bottom: 0.5rem; }

/* Author avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--gray-200); }
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 72px; height: 72px; }

/* Sections */
.section { padding: 4rem 0; }
.section-title { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.section-subtitle { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 2.5rem; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 1.5rem; }

/* Grid */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%); color: white; padding: 5rem 0; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -100px; top: -100px; width: 500px; height: 500px; border-radius: 50%; background: rgba(255,255,255,0.04); }
.hero-title { font-size: 3rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.2; }
.hero-subtitle { font-size: 1.15rem; opacity: 0.85; margin-bottom: 2rem; max-width: 500px; }

/* Search bar */
.search-bar { display: flex; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.15); max-width: 480px; }
.search-bar input { flex: 1; padding: 0.9rem 1.25rem; border: none; outline: none; font-size: 0.95rem; font-family: 'DM Sans', sans-serif; }
.search-bar button { background: var(--navy); color: white; border: none; padding: 0.9rem 1.5rem; cursor: pointer; font-size: 1rem; transition: var(--transition); }
.search-bar button:hover { background: var(--navy-light); }

/* Newsletter section */
.newsletter-section { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%); color: white; border-radius: 20px; padding: 3rem; text-align: center; }
.newsletter-section h2 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.newsletter-section p { opacity: 0.85; margin-bottom: 1.5rem; }
.newsletter-form { display: flex; max-width: 420px; margin: 0 auto; background: rgba(255,255,255,0.15); border-radius: 10px; overflow: hidden; }
.newsletter-form input { flex: 1; padding: 0.85rem 1.2rem; background: transparent; border: none; outline: none; color: white; font-size: 0.9rem; }
.newsletter-form input::placeholder { color: rgba(255,255,255,0.6); }
.newsletter-form button { background: white; color: var(--navy); border: none; padding: 0.85rem 1.5rem; font-weight: 700; cursor: pointer; font-size: 0.9rem; transition: var(--transition); }
.newsletter-form button:hover { background: var(--accent-light); }

/* Footer */
footer { background: var(--navy-dark); color: white; padding: 4rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
.footer-brand img { height: 36px; margin-bottom: 1rem; }
.footer-brand p { font-size: 0.9rem; opacity: 0.7; line-height: 1.7; }
.footer-col h4 { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.5; margin-bottom: 1rem; }
.footer-col a { display: block; font-size: 0.9rem; opacity: 0.8; margin-bottom: 0.6rem; transition: var(--transition); }
.footer-col a:hover { opacity: 1; color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 2rem; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; opacity: 0.6; }

/* Reading time */
.reading-time { display: flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; color: var(--text-muted); }

/* Tag cloud */
.tag { display: inline-flex; padding: 0.3rem 0.8rem; background: var(--gray-100); border-radius: 6px; font-size: 0.82rem; color: var(--text-muted); margin: 0.2rem; transition: var(--transition); }
.tag:hover { background: var(--accent-light); color: var(--navy); }

/* Divider */
.divider { height: 1px; background: var(--gray-200); margin: 2rem 0; }

/* Loading skeleton */
.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%); background-size: 200% 100%; animation: skeleton 1.5s infinite; border-radius: 6px; }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Theme toggle */
.theme-toggle { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--gray-200); background: var(--gray-50); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: var(--transition); }
.theme-toggle:hover { background: var(--gray-100); }

/* Mobile nav */
.mobile-menu-btn { display: none; width: 40px; height: 40px; border: none; background: transparent; cursor: pointer; flex-direction: column; gap: 5px; align-items: center; justify-content: center; }
.mobile-menu-btn span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: var(--transition); }

/* Responsive */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .mobile-menu-btn { display: flex; }
  .hero-title { font-size: 2rem; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
  .newsletter-form { flex-direction: column; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .container { padding: 0 1rem; }
}

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
.animate-fadeInUp { animation: fadeInUp 0.5s ease forwards; }

/* Prose content */
.prose h2 { font-size: 1.7rem; margin: 2rem 0 1rem; }
.prose h3 { font-size: 1.3rem; margin: 1.5rem 0 0.75rem; }
.prose p { margin-bottom: 1.2rem; font-size: 1.05rem; line-height: 1.8; color: var(--text); }
.prose ul, .prose ol { padding-left: 2rem; margin-bottom: 1.2rem; }
.prose li { margin-bottom: 0.5rem; line-height: 1.7; }
.prose blockquote { border-left: 4px solid var(--navy); padding: 1rem 1.5rem; background: var(--accent-light); border-radius: 0 8px 8px 0; margin: 1.5rem 0; font-style: italic; }
.prose img { max-width: 100%; border-radius: 12px; margin: 1.5rem 0; }
.prose code { background: var(--gray-100); padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.9em; }
.prose pre { background: var(--gray-800); color: white; padding: 1.5rem; border-radius: 10px; overflow-x: auto; margin: 1.5rem 0; }

/* Social share */
.share-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: 1.5px solid var(--gray-200); transition: var(--transition); }
.share-btn:hover { transform: translateY(-1px); }
.share-btn.twitter { color: #1DA1F2; border-color: #1DA1F2; }
.share-btn.twitter:hover { background: #1DA1F2; color: white; }
.share-btn.linkedin { color: #0A66C2; border-color: #0A66C2; }
.share-btn.linkedin:hover { background: #0A66C2; color: white; }
.share-btn.copy { color: var(--navy); border-color: var(--navy); }
.share-btn.copy:hover { background: var(--navy); color: white; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 0.5rem; justify-content: center; margin-top: 3rem; }
.page-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; border: 1.5px solid var(--gray-200); cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: var(--transition); }
.page-btn:hover { background: var(--accent-light); border-color: var(--navy); color: var(--navy); }
.page-btn.active { background: var(--navy); color: white; border-color: var(--navy); }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.breadcrumb span { opacity: 0.5; }

/* Alert */
.alert { padding: 1rem 1.25rem; border-radius: 10px; display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.alert-success { background: #D1FAE5; color: #065F46; }
.alert-error { background: #FEE2E2; color: #991B1B; }
