/**
 * BabyLoveGrowth / .blg-content — matches Amanah theme + homepage blog cards.
 * Loaded from BLG-generated blog/*.html (see scripts/sync-babylove-articles.mjs).
 */

/* Section rhythm between major headings */
article .blg-content > h2:not(:first-of-type) {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--ink10);
}

/* ── Table of contents: card + in-page links (not default link styling) ── */
article .blg-content h2#table-of-contents + ul,
article .blg-content h2#table-of-contents + ol {
  list-style: none;
  margin: 16px 0 40px;
  padding: 20px 22px;
  background: var(--wht);
  border: 1px solid var(--ink10);
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

article .blg-content h2#table-of-contents + ol {
  padding-left: 22px;
}

article .blg-content h2#table-of-contents + ul li,
article .blg-content h2#table-of-contents + ol li {
  margin: 0 0 6px;
  padding: 0;
}

article .blg-content h2#table-of-contents + ul li:last-child,
article .blg-content h2#table-of-contents + ol li:last-child {
  margin-bottom: 0;
}

article .blg-content h2#table-of-contents + ul a,
article .blg-content h2#table-of-contents + ol a {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  /* High contrast on light card; dark theme overrides below */
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

article .blg-content h2#table-of-contents + ul a::before,
article .blg-content h2#table-of-contents + ol a::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--t500);
  box-shadow: 0 0 0 3px var(--t100);
}

article .blg-content h2#table-of-contents + ul a:hover,
article .blg-content h2#table-of-contents + ol a:hover {
  background: var(--t50);
  border-color: var(--t100);
  color: var(--t800);
}

article .blg-content h2#table-of-contents + ul a:focus-visible,
article .blg-content h2#table-of-contents + ol a:focus-visible {
  outline: 2px solid var(--t500);
  outline-offset: 2px;
}

/* ── All BLG tables (key takeaways, comparison, etc.) ── */
article .blg-content > table,
article .blg-content p + table,
article .blg-content h2 + table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 32px;
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid var(--ink10);
  border-radius: 16px;
  overflow: hidden;
  background: var(--wht);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

article .blg-content table thead th {
  background: linear-gradient(135deg, var(--t800), var(--t700));
  color: #fff;
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

article .blg-content table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink10);
  color: var(--ink70);
  vertical-align: top;
}

article .blg-content table tbody tr:nth-child(even) td {
  /* Light theme: mint stripe. Dark theme overrides — do not use --t50 there (stays pale while text flips to light). */
  background: var(--t50);
}

article .blg-content table tbody tr:nth-child(odd) td {
  background: transparent;
}

article .blg-content table tbody tr:last-child td {
  border-bottom: none;
}

article .blg-content table a {
  color: var(--t700);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--t200);
  text-underline-offset: 3px;
}

article .blg-content table a:hover {
  color: var(--t800);
  text-decoration-color: var(--t500);
}

/* Key takeaways: heading band + seamless table */
article .blg-content h2#key-takeaways {
  margin-bottom: 0;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(15, 69, 64, 0.07), rgba(32, 144, 137, 0.06));
  border: 1px solid var(--ink10);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
}

article .blg-content h2#key-takeaways + table {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Budget-heavy sections: gold accent strip (BLG heading ids) */
article .blg-content h2[id*="practical-tips"],
article .blg-content h2[id*="top-common"],
article .blg-content h2[id*="budgeting-strategy"],
article .blg-content h2[id*="why-pre-funding"] {
  border-left: 4px solid var(--g400);
  padding-left: 16px;
  margin-left: 2px;
}

/* Subsection titles like “Food and groceries” — single-line bold lead */
article .blg-content p > strong:only-child {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--t800);
  margin-top: 24px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

/* ── Recommended — homepage hp-blog-card language ── */
article .blg-content h2#recommended + ul {
  list-style: none;
  margin: 20px 0 40px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

article .blg-content h2#recommended + ul li {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--cream);
  border: 1px solid var(--ink10);
  border-radius: 20px;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

article .blg-content h2#recommended + ul li:hover {
  border-color: var(--t200);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
}

article .blg-content h2#recommended + ul a {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  padding: 20px 20px 22px;
  text-decoration: none;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.35px;
  line-height: 1.35;
}

article .blg-content h2#recommended + ul a::before {
  content: "Guide";
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--t50);
  color: var(--t700);
  border: 1px solid var(--t100);
  margin-bottom: 10px;
}

article .blg-content h2#recommended + ul a:hover {
  color: var(--t800);
}

article .blg-content h2#recommended + ul a::after {
  content: "Read →";
  margin-top: auto;
  padding-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--t700);
}

article .blg-content h2#recommended + ul li:hover a::after {
  color: var(--t800);
}

/* BabyLoveGrowth attribution */
article .blg-content > p:last-child:has(a[href*="babylovegrowth"]) {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--ink10);
  font-size: 12.5px;
  color: var(--ink40);
}

article .blg-content > p:last-child:has(a[href*="babylovegrowth"]) a {
  color: var(--t600);
  font-weight: 500;
}

/*
 * Dark theme: blog pages keep inline :root teal scales (--t50, --t800, …) for light mode only.
 * global-theme.css remaps --ink/--wht/--ink70 but not --t50, so zebra rows stayed pale while
 * body text switched to light — unreadable. TOC links used --t800 on a dark --wht — low contrast.
 */
html[data-theme='dark'] article .blg-content h2#table-of-contents + ul,
html[data-theme='dark'] article .blg-content h2#table-of-contents + ol {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--ink10);
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.28);
}

html[data-theme='dark'] article .blg-content h2#table-of-contents + ul a,
html[data-theme='dark'] article .blg-content h2#table-of-contents + ol a {
  color: var(--ink);
}

html[data-theme='dark'] article .blg-content h2#table-of-contents + ul a::before,
html[data-theme='dark'] article .blg-content h2#table-of-contents + ol a::before {
  background: var(--t300);
  box-shadow: 0 0 0 3px rgba(102, 208, 200, 0.22);
}

html[data-theme='dark'] article .blg-content h2#table-of-contents + ul a:hover,
html[data-theme='dark'] article .blg-content h2#table-of-contents + ol a:hover {
  background: rgba(102, 208, 200, 0.12);
  border-color: rgba(102, 208, 200, 0.28);
  color: #fff;
}

html[data-theme='dark'] article .blg-content table tbody td {
  color: var(--ink70);
}

html[data-theme='dark'] article .blg-content table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink70);
}

html[data-theme='dark'] article .blg-content table tbody tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink70);
}

html[data-theme='dark'] article .blg-content table a {
  color: var(--t300);
  text-decoration-color: rgba(102, 208, 200, 0.45);
}

html[data-theme='dark'] article .blg-content table a:hover {
  color: #d3f2ef;
  text-decoration-color: var(--t300);
}

html[data-theme='dark'] article .blg-content h2#key-takeaways {
  background: linear-gradient(135deg, rgba(102, 208, 200, 0.12), rgba(32, 144, 137, 0.08));
  border-color: var(--ink10);
  color: var(--ink);
}

@media (max-width: 768px) {
  article {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  article .blg-content h2#recommended + ul {
    grid-template-columns: 1fr;
  }

  article .blg-content table {
    font-size: 12.5px;
  }

  article .blg-content table thead th,
  article .blg-content table tbody td {
    padding: 9px 10px;
  }
}
