/* blog.css — modified to remove mobile gutters, prevent horizontal overflow,
   ensure footer background is full-bleed while content stays constrained. */

/* ---------- variables ---------- */
:root{
  --bg: #ffffff;
  --card: #f9f9f9;
  --muted: #666;
  --accent: #000;
  --border: rgba(0,0,0,0.08);
  --container: 1200px;
  --text: #111;
}

/* ---------- global reset & safety ---------- */
/* reset default margins that cause visible gutters on mobile */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
}

/* ensure children inherit box-sizing */
*, *::before, *::after {
  box-sizing: inherit;
}

/* avoid accidental horizontal scroll (useful during debugging too) */
html, body {
  overflow-x: hidden;
}

/* images and media should never overflow */
img, picture, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------- scope page-level body styles to blog only ---------- */
.blog-root .cg-body{
  margin:0;
  padding: 0; /* explicit */
  font-family:'Poppins',system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial;
  background:var(--bg);
  color:var(--text);
  line-height:1.6;
}

/* ---------- container (constrained content) ---------- */
/* keep content centered but allow full-bleed backgrounds (footer/header etc) */
.blog-root .container{
  max-width:var(--container);
  margin:0 auto;
  padding:0 20px; /* inner gutters for content */
}

/* for any site-level components rendered inside #footer, ensure consistent container behavior */
#footer .container,
.blog-root #footer .container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 20px;
}

/* ---------- Header ---------- */
.blog-root .blog-header{
  padding:96px 0 28px;
  text-align:center;
}
.blog-root .blog-header.small{padding:18px 0}
.blog-root .brand{
  font-family:'Cinzel',serif;
  font-size:20px;
  letter-spacing:1px;
  margin:95px 0 4px;
  color:var(--text);
}
.blog-root .tagline{
  color:var(--muted);
  margin:0 0 6px;
  font-size:0.8rem;
}

/* ---------- Controls ---------- */
.blog-root .controls{
  display:flex;
  gap:12px;
  align-items:center;
  margin:18px 0 12px;
  justify-content:flex-end;
}
.blog-root #search, .blog-root #categoryFilter{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  color:var(--text);
  background:#fff;
  font-size:0.95rem;
}
.blog-root #search::placeholder{color:#aaa}

/* ---------- Grid ---------- */
.blog-root .blog-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(300px,1fr));
  gap:24px;
  margin-bottom:48px;
  /* ensure the grid never causes horizontal overflow on small devices */
  width: 100%;
  box-sizing: border-box;
}

/* ---------- Card ---------- */
.blog-root .blog-card{
  background:var(--card);
  border-radius:14px;
  overflow:hidden;
  transition:transform .25s ease, box-shadow .25s ease;
  border:1px solid var(--border);
}
.blog-root .blog-card:hover{
  transform:translateY(-5px);
  box-shadow:0 10px 25px rgba(0,0,0,0.08);
}
.blog-root .card-link{
  display:flex;
  flex-direction:column;
  color:inherit;
  text-decoration:none;
  height:100%;
}

.blog-root .card-media img{
  width:100%;
  height:220px;
  object-fit:cover;
  display:block;
}

/* ---------- content ---------- */
.blog-root .blog-content{
  padding:18px 20px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.blog-root .blog-content h2{
  font-family:'Cinzel',serif;
  margin:0;
  font-size:1.25rem;
  color:var(--text);
}
.blog-root .meta{
  color:var(--muted);
  font-size:0.9rem;
}
.blog-root .excerpt{
  color:#444;
  margin:6px 0 10px;
  font-size:0.95rem;
  line-height:1.6;
}
.blog-root .read-more{
  margin-top:auto;
  color:var(--accent);
  font-weight:500;
}

/* ---------- badges ---------- */
.blog-root .badges{
  display:flex;
  gap:8px;
  margin-bottom:6px;
}
.blog-root .badge{
  background:#fff;
  border-radius:999px;
  padding:6px 10px;
  font-size:0.78rem;
  color:var(--muted);
  border:1px solid var(--border);
}

/* ---------- post page ---------- */
.blog-root .post-article{
  max-width:900px;
  margin:28px auto 80px;
  padding:0 10px;
  box-sizing: border-box;
}
.blog-root .post-hero img{
  width:100%;
  height:420px;
  object-fit:cover;
  border-radius:12px;
}
.blog-root .post-title{
  font-family:'Cinzel',serif;
  font-size:2rem;
  margin:18px 0 8px;
  color:var(--text);
}
.blog-root .post-meta{
  color:var(--muted);
  margin-bottom:12px;
}
.blog-root .post-cats{
  margin-bottom:10px;
}
.blog-root .post-body{
  color:#333;
  font-size:1rem;
  line-height:1.8;
}
.blog-root .post-body h3{
  font-family:'Cinzel',serif;
  margin-top:18px;
  margin-bottom:8px;
  color:var(--text);
}
.blog-root .post-body p{margin:0 0 14px}

/* ---------- share ---------- */
.blog-root .post-share{
  margin-top:24px;
  color:var(--muted);
  display:flex;
  gap:12px;
  align-items:center;
}
.blog-root .post-share a{
  color:var(--accent);
  text-decoration:none;
}
.blog-root .post-share a:hover{text-decoration:underline}

/* ---------- small helpers ---------- */
.blog-root .loading, .blog-root .error, .blog-root .empty{
  padding:32px;
  text-align:center;
  color:var(--muted);
  background:transparent;
  border-radius:10px;
}

/* ---------- blog-local footer (if you keep a blog-specific footer) ---------- */
/* This is for any blog-specific footer inside .blog-root */
.blog-root .blog-footer{
  border-top:1px solid var(--border);
  padding:28px 0;
  text-align:center;
  color:var(--muted);
  margin-top:40px;
}

/* ---------- global #footer styling (component-rendered footer) ---------- */
/* Make the footer background full-bleed while keeping inner content constrained */
#footer {
  width: 100%;
  box-sizing: border-box;
  background: #000;          /* change to your footer bg color */
  color: #fff;               /* change to your footer text color */
  padding: 18px 0;
}

/* ensure inner footer content follows the same .container rules */
#footer .footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* example elements inside footer */
#footer a { color: inherit; text-decoration: none; }
#footer a:hover { text-decoration: underline; }

/* ---------- responsive tweaks ---------- */
@media (max-width: 720px) {
  .blog-root .blog-header{padding:106px 0 20px}
  .blog-root .card-media img{height:180px}
  .blog-root .post-hero img{height:260px}
  .blog-root .controls{flex-direction:column;align-items:stretch}

  /* reduce container padding a little on very small screens so nothing hangs off */
  .blog-root .container,
  #footer .container,
  #footer .footer-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* ensure cards have comfortable spacing on very narrow screens */
  .blog-root .blog-grid {
    gap: 16px;
  }

  .blog-root .brand { margin: 48px 0 6px; font-size: 18px; }
}

/* ---------- debug helper (comment out in production) ---------- */
/* If you still see overflow, uncomment to inspect which element is overflowing. */
/*
* { outline: 1px solid rgba(255,0,0,0.06); }
*/
