/* ============================================================
   ClearedRx — Blog Content Design System
   DR-advertorial-style readability components for /blog/* posts.
   Variables (--rose, --sage, etc) inherited from main.css.
   Loaded AFTER main.css so utility classes here can override.
   ============================================================ */

/* ── Article body container ───────────────────────────────── */
.article-body {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--charcoal-mid);
}
.article-body p {
  margin: 0 0 var(--space-md);
}
.article-body h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 2.6vw, 2.05rem);
  line-height: 1.25;
  color: var(--charcoal);
  margin: var(--space-xl) 0 var(--space-sm);
  scroll-margin-top: 80px; /* compensates for sticky header on TOC anchor jumps */
}
.article-body h3 {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--charcoal);
  margin: var(--space-lg) 0 var(--space-xs);
}
.article-body ul, .article-body ol {
  margin: 0 0 var(--space-md);
  padding-left: var(--space-lg);
}
.article-body li {
  margin-bottom: 6px;
}
.article-body strong {
  color: var(--charcoal);
  font-weight: 600;
}
.article-body a:not(.btn):not(.cta-card a):not(.inline-cta a) {
  color: var(--rose-dark);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: var(--transition);
}
.article-body a:not(.btn):hover {
  color: var(--rose);
}

/* ── Inline article images ────────────────────────────────── */
.article-inline-img {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  border-radius: var(--border-radius);
  margin: var(--space-lg) auto var(--space-xs);
  box-shadow: var(--shadow-md);
}
.article-inline-img-caption,
.image-caption {
  display: block;
  max-width: 720px;
  margin: 0 auto var(--space-lg);
  font-size: 0.875rem;
  color: var(--charcoal-light);
  font-style: italic;
  text-align: center;
  line-height: 1.5;
}

/* Image pair (two side-by-side) */
.image-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}
.image-pair img {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-sm);
}
@media (max-width: 700px) {
  .image-pair { grid-template-columns: 1fr; }
}

/* ── Pull quote ───────────────────────────────────────────── */
.pull-quote {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  line-height: 1.35;
  color: var(--charcoal);
  font-weight: 400;
  font-style: italic;
  text-align: left;
  margin: var(--space-xl) 0;
  padding: var(--space-md) 0 var(--space-md) var(--space-lg);
  border-left: 4px solid var(--rose);
  background: linear-gradient(90deg, rgba(196, 130, 106, 0.04) 0%, transparent 100%);
}
.pull-quote-attr {
  display: block;
  margin-top: var(--space-sm);
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.875rem;
  color: var(--charcoal-light);
  font-weight: 500;
}

/* ── Callout boxes ────────────────────────────────────────── */
.callout {
  position: relative;
  margin: var(--space-xl) 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--cream-dark);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--sage);
  font-size: 1rem;
}
.callout strong:first-child,
.callout > p:first-child strong:first-child {
  color: var(--sage-dark);
  display: inline-block;
  margin-bottom: 4px;
}
.callout p:last-child { margin-bottom: 0; }

.callout-warning {
  border-left-color: var(--rose);
  background: rgba(232, 196, 180, 0.18);
}
.callout-warning strong:first-child,
.callout-warning > p:first-child strong:first-child {
  color: var(--rose-dark);
}

.callout-fact {
  border-left-color: var(--sage-dark);
  background: rgba(181, 204, 186, 0.20);
}
.callout-fact strong:first-child,
.callout-fact > p:first-child strong:first-child {
  color: var(--sage-dark);
}

.callout-key {
  border-left-color: var(--charcoal);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

/* Callout label chip */
.callout-label {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--rose-dark);
  margin-bottom: var(--space-xs);
}

/* ── Stat block (story beat numeric callout) ───────────────── */
.stat-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: var(--space-xl) 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--white);
  border-radius: var(--border-radius);
  border-top: 3px solid var(--rose);
  box-shadow: var(--shadow-sm);
}
.stat-block .stat-number {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  line-height: 1;
  color: var(--rose-dark);
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-block .stat-label {
  font-size: 0.95rem;
  color: var(--charcoal-mid);
  line-height: 1.45;
  max-width: 480px;
}

/* Stat row — multiple stats in a horizontal grid */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}
.stat-row .stat-block {
  margin: 0;
}

/* ── Mid-article inline CTA ───────────────────────────────── */
.inline-cta {
  margin: var(--space-2xl) 0;
  padding: var(--space-lg) var(--space-lg);
  background: linear-gradient(135deg, var(--cream-dark) 0%, rgba(232, 196, 180, 0.25) 100%);
  border-radius: var(--border-radius);
  border: 1px solid var(--taupe);
  text-align: center;
}
.inline-cta h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.6vw, 1.65rem);
  color: var(--charcoal);
  margin: 0 0 var(--space-xs);
  font-weight: 500;
}
.inline-cta p {
  margin: 0 0 var(--space-md);
  color: var(--charcoal-mid);
  font-size: 1rem;
}
.inline-cta .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.inline-cta .cta-microcopy {
  margin-top: var(--space-sm);
  font-size: 0.825rem;
  color: var(--charcoal-light);
}

/* ── Comparison table ─────────────────────────────────────── */
.compare-table,
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--space-lg) 0;
  font-size: 0.95rem;
  background: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.compare-table thead th,
.data-table thead th {
  background: var(--charcoal);
  color: var(--white);
  text-align: left;
  font-weight: 600;
  padding: 12px 14px;
  font-size: 0.875rem;
  letter-spacing: 0.3px;
}
.compare-table tbody td,
.data-table tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--cream-dark);
  vertical-align: top;
  line-height: 1.5;
}
.compare-table tbody tr:nth-child(even),
.data-table tbody tr:nth-child(even) {
  background: var(--cream);
}
.compare-table tbody td:first-child,
.data-table tbody td:first-child {
  font-weight: 600;
  color: var(--charcoal);
}

/* Table on mobile — horizontal scroll wrapper recommended */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-lg) 0;
}
.table-scroll .compare-table,
.table-scroll .data-table {
  margin: 0;
  min-width: 540px;
}

/* ── Comparison card grid (alternative to tables) ─────────── */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}
.comparison-card {
  padding: var(--space-md);
  background: var(--white);
  border-radius: var(--border-radius);
  border: 1px solid var(--taupe);
  font-size: 0.95rem;
}
.comparison-card h4 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--charcoal);
  margin: 0 0 var(--space-xs);
  font-weight: 500;
}
.comparison-card .price {
  display: block;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--rose-dark);
  margin-bottom: var(--space-xs);
}
.comparison-card ul {
  padding-left: 18px;
  margin: 0;
}
.comparison-card li {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

/* ── FAQ accordion (Common Questions section) ─────────────── */
.faq-list .faq-item {
  border-top: 1px solid var(--taupe);
  padding: var(--space-md) 0;
}
.faq-list .faq-item:last-child {
  border-bottom: 1px solid var(--taupe);
}
.faq-list summary,
.faq-list .faq-q {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--charcoal);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  position: relative;
  padding-right: 28px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after,
.faq-list .faq-q::after {
  content: '+';
  position: absolute;
  right: 0;
  top: -2px;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--rose-dark);
  transition: transform 0.2s ease;
}
.faq-list details[open] summary::after { content: '−'; }
.faq-list .faq-a {
  margin-top: var(--space-xs);
  color: var(--charcoal-mid);
  line-height: 1.7;
}
.faq-list .faq-a p:last-child { margin-bottom: 0; }

/* ── Section divider (visual rhythm between H2 sections) ───── */
.section-divider {
  display: block;
  width: 60px;
  height: 2px;
  background: var(--rose);
  border: 0;
  margin: var(--space-xl) 0 var(--space-lg);
}

/* ── DR-advertorial strong opener ─────────────────────────── */
.lead-paragraph,
.article-body > p:first-of-type {
  font-size: 1.18rem;
  line-height: 1.6;
  color: var(--charcoal);
  margin-bottom: var(--space-lg);
}

/* ── First-letter drop cap (optional, restrained) ─────────── */
.dropcap::first-letter {
  font-family: var(--font-serif);
  float: left;
  font-size: 3.4rem;
  line-height: 1;
  padding: 4px 12px 0 0;
  color: var(--rose-dark);
  font-weight: 500;
}

/* ── Trust strip (small badge row inline in body) ─────────── */
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--cream-dark);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
}
.trust-strip .trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--charcoal-mid);
}
.trust-strip .trust-item svg,
.trust-strip .trust-item .icon {
  flex-shrink: 0;
  color: var(--sage-dark);
}

/* ── Reader retention helpers ─────────────────────────────── */
.read-time-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.825rem;
  color: var(--charcoal-light);
  margin-bottom: var(--space-md);
}
.read-time-strip .dot { color: var(--taupe); }

/* ── Mobile refinements ───────────────────────────────────── */
@media (max-width: 700px) {
  .article-body { font-size: 1rem; }
  .pull-quote { padding: var(--space-md); }
  .inline-cta { padding: var(--space-md); }
  .article-inline-img,
  .article-inline-img-caption,
  .image-caption { max-width: 100%; }
}

/* ── AI-citation Quick Answer capsule (Speakable target) ──── */
/* Per Princeton GEO study (2024): adding a quotable answer capsule
   above the fold drives +30-41% AI-search citation lift. CSS selector
   targeted by Speakable schema across the site. */
.quick-answer {
  background: linear-gradient(135deg, #FBF7F4 0%, #F5EFE8 100%);
  border-left: 4px solid var(--rose, #C4826A);
  border-radius: var(--border-radius, 8px);
  padding: var(--space-md, 16px) var(--space-lg, 24px);
  margin: var(--space-md, 16px) 0 var(--space-lg, 32px);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--charcoal, #2A2925);
}
.quick-answer p { margin: 0 0 8px; }
.quick-answer p:last-child { margin-bottom: 0; }
.quick-answer strong { color: var(--rose-dark, #A33A2D); letter-spacing: 0.02em; }
.quick-answer cite { font-style: normal; color: var(--charcoal-light, #6E6A60); font-size: 0.95rem; }
.quick-answer a { color: var(--rose-dark, #A33A2D); text-decoration: underline; text-underline-offset: 2px; }
.quick-answer-source { font-size: 0.85rem; color: var(--charcoal-light, #6E6A60); margin-top: 8px !important; }
@media (max-width: 700px) { .quick-answer { padding: var(--space-sm, 12px) var(--space-md, 16px); font-size: 0.98rem; } }

/* ── Embed-block (calculator/widget embed share) ──────────── */
.embed-block {
  background: #F5EFE8;
  border-radius: var(--border-radius, 8px);
  padding: var(--space-md, 16px);
  margin: var(--space-lg, 32px) 0;
}
.embed-block textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  border: 1px solid #D6C9BD;
  border-radius: 6px;
  resize: vertical;
  background: #FBF7F4;
}

/* ============================================================
   P1-MOBILE-OVERFLOW: Universal article-table scroll safety net
   2026-05-09 — fixes bare compare-table / data-table / stage-table
   overflow on 375-420px viewports across 11 blog articles.
   Tables ignore overflow-x when display:table — switching to block
   makes them horizontally scrollable when content is wider than
   viewport. body{overflow-x:hidden} elsewhere clips overflow without
   this rule, so users see truncated tables with no scroll affordance.
   ============================================================ */
.article-body table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

@media (max-width: 480px) {
  .article-body table td,
  .article-body table th {
    word-break: break-word;
    hyphens: auto;
  }
}

/* ── Word-break safety for long inline text + grid-child overflow guard
   2026-05-10 audit finding: older blog posts use `grid-template-columns: 1fr 320px`
   without `minmax(0, 1fr)`, causing children to render at content's intrinsic
   width (e.g. 540px tables) on 380px viewports. min-width:0 here forces the
   article-body grid child to size by viewport, not content. Defense in depth
   alongside the per-page minmax fix. ────────────────────────────────────────── */
.article-body {
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
  max-width: 100%;
}

/* ── Vertical-space efficiency on mobile (user feedback 2026-05-09):
   Reduce H2 section top-margin from 64px to 40px at <=480px so
   sections don't sprawl below the fold. ─────────────────────── */
@media (max-width: 480px) {
  .article-body h2 {
    margin-top: 40px;
  }
}

/* ── Article H1 mobile size guard (2026-05-10 audit finding):
   6 older blog posts have <h1 style="margin-bottom:..."> with NO inline
   font-size clamp, so their H1 fell back to main.css base ~2.5rem (~38px)
   on 380px viewports, while newer posts with inline clamp(2rem, 4vw, 3rem)
   plus a media-query override rendered at ~24px. Visually inconsistent.
   This globally clamps any article H1 below 480px so older posts match. */
@media (max-width: 480px) {
  .article-body h1,
  article.article-body > h1,
  .article-body article > h1 {
    font-size: clamp(1.5rem, 6.5vw, 1.95rem) !important;
    line-height: 1.22 !important;
  }
}

/* ── FAQ summary tap target — ensure 44px minimum tap height ── */
.faq-list summary,
.faq-list .faq-q {
  min-height: 44px;
}

/* ============================================================
   .data-table--stack — responsive comparison table.
   Wrapped in .table-scroll-wrap so the universal article-table
   `display:block; overflow-x:auto` rule above doesn't apply
   (we want true table-layout, not a forced block-scroll, and
   then a real card stack below 720px).
   ============================================================ */
.article-body .table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-lg) 0;
}
.article-body .table-scroll-wrap > .data-table--stack {
  display: table;
  width: 100%;
  min-width: 0;
  margin: 0;
  table-layout: fixed;
}
.article-body .data-table--stack thead th {
  font-size: 0.78rem;
  padding: 10px 12px;
  line-height: 1.3;
  word-break: normal;
  hyphens: auto;
}
.article-body .data-table--stack tbody td {
  font-size: 0.9rem;
  padding: 12px;
  word-break: normal;
  overflow-wrap: anywhere;
}
.article-body .data-table--stack tbody td .yes,
.article-body .data-table--stack tbody td .no,
.article-body .data-table--stack tbody td .limited {
  display: inline-block;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.5;
}
.article-body .data-table--stack tbody td .yes {
  background: #DCEAD7;
  color: #2E5D24;
}
.article-body .data-table--stack tbody td .no {
  background: #F1E1DC;
  color: #803A30;
}
.article-body .data-table--stack tbody td .limited {
  background: #F6E6C9;
  color: #7A5512;
}

@media (max-width: 720px) {
  .article-body .table-scroll-wrap {
    overflow: visible;
    margin: var(--space-md) 0;
  }
  .article-body .data-table--stack,
  .article-body .data-table--stack thead,
  .article-body .data-table--stack tbody,
  .article-body .data-table--stack tr,
  .article-body .data-table--stack td {
    display: block;
    width: 100%;
  }
  .article-body .data-table--stack {
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    table-layout: auto;
  }
  .article-body .data-table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .article-body .data-table--stack tbody tr {
    background: var(--white);
    border: 1px solid var(--taupe);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
    padding: 6px 0 4px;
    overflow: hidden;
  }
  .article-body .data-table--stack tbody tr:nth-child(even) {
    background: var(--white);
  }
  .article-body .data-table--stack tbody td {
    border-top: 0;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .article-body .data-table--stack tbody td + td {
    border-top: 1px solid var(--cream-dark);
  }
  .article-body .data-table--stack tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--charcoal-light);
    margin-bottom: 2px;
  }
  .article-body .data-table--stack tbody td:first-child {
    background: var(--charcoal);
    color: var(--white);
    padding: 12px 14px;
    border-top: 0;
  }
  .article-body .data-table--stack tbody td:first-child::before {
    color: rgba(255,255,255,0.65);
  }
  .article-body .data-table--stack tbody td:first-child strong {
    font-size: 1.05rem;
    color: var(--white);
  }
}
