/* ==================================================
   BLOG LAYOUT – GOOGLE + ADSENSE OPTIMIZED
   Core Web Vitals • Mobile First • CLS Safe • SEO
================================================== */

/* ---------- ROOT VARIABLES ---------- */
:root {
  --primary: #1e40af;          /* Blue */
  --primary-dark: #1e3a8a;     /* Dark Blue */
  --accent: #2563eb;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.06);
}

/* ---------- RESET ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- HERO ---------- */
.blog-hero {
  background: linear-gradient(120deg, #1e40af, #2563eb);
  color: #fff;
  padding: 80px 20px;
  text-align: center;
  border-radius: 0 0 30px 30px;
  margin-bottom: 40px;
}

.blog-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 12px;
}

.blog-hero p {
  font-size: 1.05rem;
  opacity: 0.95;
}

/* ---------- MAIN LAYOUT ---------- */
.blog-layout {
  width: 100%;
  max-width: 1280px;
  margin: auto;
  padding: 0 20px 60px;
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 35px;
}

/* ---------- GRID ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
}

/* ---------- CARD ---------- */
.blog-card {
  background: var(--card);
  padding: 25px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
  will-change: transform;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
}

.blog-meta {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.blog-card h2 {
  font-size: 1.2rem;
  margin: 10px 0;
}

.blog-card h2 a {
  text-decoration: none;
  color: var(--text);
}

.blog-card h2 a:hover {
  color: var(--primary);
}

.blog-excerpt {
  color: #334155;
  line-height: 1.6;
}

.read-more {
  display: inline-block;
  margin-top: 15px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.read-more:hover {
  text-decoration: underline;
}

/* ---------- SIDEBAR ---------- */
.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.sidebar-box {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- ADSENSE SAFE (CLS FIXED) ---------- */
.ad-box,
.in-content-ad {
  width: 100%;
  min-height: 250px; /* Prevent CLS */
  display: block;
  margin: 30px 0;
  overflow: hidden;
}

.sticky {
  position: sticky;
  top: 20px;
}

/* ---------- PAGINATION ---------- */
.pagination {
  margin-top: 50px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination a {
  padding: 8px 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-decoration: none;
  font-weight: 600;
  color: var(--text);
  transition: background .2s ease;
}

.pagination a.active,
.pagination a:hover {
  background: var(--primary);
  color: #fff;
}

/* ---------- SINGLE BLOG ---------- */
.single-blog h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 20px;
}

.single-blog p {
  margin-bottom: 20px;
}

/* ---------- SEARCH ---------- */
.blog-search {
  display: flex;
  gap: 10px;
}

.blog-search input {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.95rem;
}

.blog-search button {
  padding: 12px 18px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease;
}

.blog-search button:hover {
  background: var(--primary-dark);
}

/* ---------- TOP POSTS ---------- */
.top-posts {
  list-style: none;
  padding: 0;
  margin: 0;
}

.top-posts li {
  margin-bottom: 12px;
}

.top-posts a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
}

.top-posts a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 992px) {
  .blog-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-card {
    padding: 20px;
  }

  .blog-hero {
    padding: 60px 20px;
  }
}