/* css/blog.css — blog-specific styles for HealthCalc India */
/* Loaded only on blog/index.html and blog post pages alongside style.css */
/* All values use CSS variables from style.css — no new colours or spacing values */

/* ─────────────────────────────────────────────────────────────
   1. BLOG LISTING PAGE
   ───────────────────────────────────────────────────────────── */

.blog-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
}

.blog-hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
  margin-bottom: var(--space-md);
}

.blog-hero__desc {
  font-size: 1.0625rem;
  color: rgba(255,255,255,0.80);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.65;
}

/* Category filter pills */
.category-filters {
  position: sticky;
  top: 60px;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: var(--space-sm) 0;
}

.category-filters__inner {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px var(--space-md);
}

.category-filters__inner::-webkit-scrollbar { display: none; }

.category-filters__pill {
  display: inline-block;
  padding: 6px var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-body);
  white-space: nowrap;
  text-decoration: none;
  border: 1.5px solid var(--border);
  color: var(--subtext);
  background: var(--card);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-height: 44px;
  line-height: 30px;
}

.category-filters__pill:hover,
.category-filters__pill--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Blog card grid */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  padding: var(--space-2xl) 0 var(--space-3xl);
}

@media (min-width: 640px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Post card styles live in style.css — available to all pages */

/* Ad slot in listing grid */
.blog-ad-slot {
  background: var(--ad-bg);
  border: 1px solid var(--ad-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

@media (min-width: 1024px) {
  .blog-ad-slot { grid-column: span 2; }
}

/* ─────────────────────────────────────────────────────────────
   2. BLOG POST PAGE
   ───────────────────────────────────────────────────────────── */

/* Two-column layout: sidebar TOC + article */
.post-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-3xl);
  align-items: start;
}

@media (min-width: 1024px) {
  .post-layout {
    grid-template-columns: 220px 1fr;
    gap: var(--space-3xl);
  }
}

/* Sidebar TOC — desktop only */
.post-sidebar { display: none; }

@media (min-width: 1024px) {
  .post-sidebar {
    display: block;
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
}

.post-toc {
  background: var(--neutral);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-md);
}

.post-toc__title {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--space-md);
}

.post-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-toc__item { margin-bottom: var(--space-xs); }

.post-toc__link {
  display: block;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--subtext);
  text-decoration: none;
  padding: 3px var(--space-sm);
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.post-toc__link:hover { color: var(--primary); border-left-color: var(--primary); }

/* Mobile TOC — collapsible <details>, hidden on desktop */
.post-toc-mobile { display: block; margin-bottom: var(--space-xl); }

@media (min-width: 1024px) { .post-toc-mobile { display: none; } }

.post-toc-mobile > details {
  background: var(--neutral);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow: hidden;
}

.post-toc-mobile summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
  min-height: 44px;
  user-select: none;
}

.post-toc-mobile summary::-webkit-details-marker { display: none; }
.post-toc-mobile summary::after { content: '▾'; font-size: 1rem; transition: transform 0.2s; }
.post-toc-mobile details[open] summary::after { transform: rotate(180deg); }

.post-toc-mobile ol {
  padding: 0 var(--space-md) var(--space-md) var(--space-xl);
  margin: 0;
}

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

.post-toc-mobile a {
  color: var(--subtext);
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1.5;
}

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

/* Post article container */
.post-article { min-width: 0; }

/* Post header */
.post-header { margin-bottom: var(--space-2xl); }

.post-header__badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-md);
}

.post-header__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: var(--space-md);
}

.post-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  align-items: center;
  font-size: 0.875rem;
  color: var(--subtext);
  margin-bottom: var(--space-lg);
}

.post-header__meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* "Based on ICMR Guidelines" — factually accurate E-E-A-T signal, not a false "Medically Reviewed" claim */
.post-standards {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0,51,88,0.15);
}

/* Compact disclaimer at top of each post */
.post-disclaimer {
  border-left: 3px solid var(--warning);
  background: #FFFBEB;
  padding: var(--space-sm) var(--space-md);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  color: #78350F;
  line-height: 1.55;
}

/* Post body typography */
.post-body {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text);
}

.post-body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: var(--space-3xl) 0 var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  scroll-margin-top: 100px;
}

.post-body h3 {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--text);
  margin: var(--space-xl) 0 var(--space-sm);
  scroll-margin-top: 100px;
}

.post-body p { margin-bottom: var(--space-md); }

.post-body ul,
.post-body ol {
  padding-left: var(--space-xl);
  margin-bottom: var(--space-md);
}

.post-body li {
  margin-bottom: var(--space-xs);
  line-height: 1.7;
}

.post-body strong { font-weight: 700; color: var(--text); }

/* Comparison tables */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-xl) 0;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.post-body th {
  background: var(--primary);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 700;
  font-size: 0.875rem;
}

.post-body td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.post-body tr:nth-child(even) td { background: var(--neutral); }
.post-body tr:last-child td { border-bottom: none; }

/* Scrollable table wrapper for mobile */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-xl) 0;
  border-radius: var(--radius-md);
}

.table-wrap table { margin: 0; }

/* Inline CTA — mid-article calculator link */
.inline-cta {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-2xl) 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .inline-cta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.inline-cta__title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.4;
}

.inline-cta__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 10px var(--space-lg);
  border-radius: var(--radius-full);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 44px;
  transition: opacity 0.15s;
}

.inline-cta__link:hover { opacity: 0.90; }

/* Mid-article ad slot */
.mid-article-ad {
  margin: var(--space-2xl) 0;
  background: var(--ad-bg);
  border: 1px solid var(--ad-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

/* FAQ accordion — HTML <details>/<summary>, no JS required */
.faq { margin: var(--space-2xl) 0; }

.faq__item { border-bottom: 1px solid var(--border); }
.faq__item:first-child { border-top: 1px solid var(--border); }

.faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  gap: var(--space-md);
  min-height: 44px;
  user-select: none;
}

.faq__question::-webkit-details-marker { display: none; }

.faq__question::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.faq__item[open] .faq__question::after { content: '\2212'; }

.faq__answer {
  padding: 0 0 var(--space-md);
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--subtext);
}

.faq__answer p { margin-bottom: var(--space-sm); }
.faq__answer p:last-child { margin-bottom: 0; }

/* Sources / citations */
.post-sources {
  border-top: 2px solid var(--border);
  padding-top: var(--space-lg);
  margin-top: var(--space-3xl);
}

.post-sources__heading {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

.post-sources ol {
  padding-left: var(--space-xl);
  margin: 0;
}

.post-sources li {
  font-size: 0.875rem;
  color: var(--subtext);
  line-height: 1.65;
  margin-bottom: var(--space-sm);
}

/* End CTA — full-width navy gradient block */
.post-end-cta {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  margin: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
}

.post-end-cta__heading {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: var(--space-sm);
}

.post-end-cta__sub {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.80);
  margin-bottom: var(--space-lg);
  line-height: 1.55;
}

.post-end-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: #fff;
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px var(--space-2xl);
  border-radius: var(--radius-full);
  text-decoration: none;
  min-height: 52px;
  transition: opacity 0.15s;
}

.post-end-cta__btn:hover { opacity: 0.92; }

/* Related posts grid */
.related-posts { margin-top: var(--space-2xl); }

.related-posts__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-xl);
}

.related-posts__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 640px) {
  .related-posts__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .related-posts__grid { grid-template-columns: repeat(3, 1fr); }
}

/* related-articles styles live in style.css — available to all pages */

/* ─────────────────────────────────────────────────────────────
   3. MOBILE OVERRIDES
   ───────────────────────────────────────────────────────────── */

@media (max-width: 639px) {
  .blog-hero { padding: var(--space-2xl) 0 var(--space-xl); }

  .post-body h2  { font-size: 1.25rem; }
  .post-body h3  { font-size: 1.0625rem; }
  .post-body     { font-size: 1rem; }

  .post-body th,
  .post-body td  { padding: var(--space-xs) var(--space-sm); font-size: 0.875rem; }

  .inline-cta    { padding: var(--space-lg); }

  .post-end-cta  { padding: var(--space-xl) var(--space-lg); }
  .post-end-cta__btn { padding: 12px var(--space-xl); font-size: 0.9375rem; }
}
