/* Blog singles only (enqueued on is_singular('blog')), 12 Nov 2026.
   Every consecutive WHITE section after the article forms one continuous
   white card with the article: no mid-page notches, no inner rounding.
   Dark vs white is decided by the module (wrapper is #fff on FAQ /
   faces_smiles / spacers even when a `dark` HTML attribute is present).
   A genuine dark band is section.blogs-guide (no white wrapper) or the
   footer. Radius 40px desktop, 2.777…vw mid, 24px at ≤767.98px,
   matching theme spacer caps. The article's existing top radius is left
   as the theme sets it (40px even on mobile). A lone article with no
   following white sections is also left as the theme sets it.

   No content / ACF edits. Do not enqueue on non-blog templates.
*/

:root {
  --db-blog-card-radius: 40px;
}

/* White run members: .blog-main, .before-after-block (faces_smiles),
   .faqs-accordion, .spacer (top / bottom / no). */

/* Flatten the bottom of a white card when the next sibling is also white. */
section.blog-main:has(+ section:is(.before-after-block, .faqs-accordion, .spacer)) > .container > .wrapper,
section:is(.before-after-block, .faqs-accordion, .spacer):has(+ section:is(.before-after-block, .faqs-accordion, .spacer)) > .container > .wrapper {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Flatten the top of a white card that follows another white card,
   including spacer.top's theme 40px 40px 0 0 (an inner join). */
section.blog-main + section:is(.before-after-block, .faqs-accordion, .spacer) > .container > .wrapper,
section:is(.before-after-block, .faqs-accordion, .spacer) + section:is(.before-after-block, .faqs-accordion, .spacer) > .container > .wrapper {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Cap the bottom of the last white section in the run (the one whose
   next sibling is not another white card — typically blogs-guide).
   Do not retouch a lone .blog-main; the theme already rounds it. */
section:is(.before-after-block, .faqs-accordion, .spacer):not(:has(+ section:is(.before-after-block, .faqs-accordion, .spacer))) > .container > .wrapper {
  border-bottom-left-radius: var(--db-blog-card-radius);
  border-bottom-right-radius: var(--db-blog-card-radius);
}

/* Trailing spacer.no is the missing bottom cap; strip padding so only
   the radius shows, same visual as spacer.bottom. */
section.spacer.no:not(:has(+ section:is(.before-after-block, .faqs-accordion, .spacer))) > .container > .wrapper {
  padding-bottom: 0;
  margin-bottom: 0;
}

@media (max-width: 1439.98px) {
  :root {
    --db-blog-card-radius: 2.7777777778vw;
  }
}

@media (max-width: 767.98px) {
  :root {
    --db-blog-card-radius: 24px;
  }
}
