/*
 * BST Divi 5 compatibility CSS (child theme: Divi-child/d5-compat.css)
 * Restores Divi 4 rendering where Divi 5 changed CSS selectors/specificity.
 * Each rule notes the Divi 4 behaviour it replaces. Safe to load on Divi 4 too.
 */

/* 1. Blurb title links: Divi 4 applied a blurb's Title Text Color to ".et_pb_module_header a" too.
      Divi 5 colours only the header, so the link fell back to the legacy red colour scheme (#AF2429). */
.et_pb_blurb .et_pb_module_header a { color: inherit; }

/* 2. Buttons text colour: Divi 4 output the Customizer "Buttons > Text Color" (#5e1214) as the rule below
      (copied verbatim from production et-divi-customizer-global.min.css). Divi 5 no longer outputs it, so
      contact-form/custom-HTML buttons fell back to the red scheme (#cd5c5c) and Bloom/newsletter
      "Subscribe" button text went white. Same selector/specificity as Divi 4. */
body.et_pb_button_helper_class .et_pb_button,
body.et_pb_button_helper_class .et_pb_module.et_pb_button { color: #5e1214; }

/* 3. Theme Options custom CSS targets ".et_pb_row_0" (first row of page content, 90% wide on phones).
      Divi 5 numbers rows site-wide (header rows first), so the first content row is no longer et_pb_row_0. */
@media only screen and (max-width: 767px) {
	.et-l--post > .et_builder_inner_content > .et_pb_section:first-child > .et_pb_row:first-of-type,
	.et-l--post > .et_builder_inner_content > .et_pb_section.et_pb_fullwidth_section:first-child + .et_pb_section > .et_pb_row:first-of-type {
		width: 90% !important;
	}
}

/* 4. Fullwidth Header text: Divi 5 lays out ".header-content" as flex with a 20px/30px gap and zeroes the
      title padding; Divi 4 used normal block flow, where only the title's theme 10px bottom padding separated
      the title from the subhead/content. Restore Divi 4 flow spacing (button margins are unchanged). */
.et_pb_fullwidth_header .header-content.et_flex_module { row-gap: 0; }
.et_pb_fullwidth_header .header-content .et_pb_module_header { padding-bottom: 10px; }
/* Divi 4 put the header buttons straight after the content with margin-top:20px; Divi 5 wraps them and relied on the gap. */
.et_pb_fullwidth_header .header-content .et_pb_header_button_wrapper:not(:empty) { margin-top: 20px; }

/* 5. Divi Essential flip boxes (how-to-start page). Under Divi 4 the shortcode text went through wpautop,
      leaving a trailing empty <p>, so the real paragraph was not :last-of-type and kept 1em bottom padding.
      Divi 5 renders clean markup, so the padding collapsed to 0. */
/* (selectors must beat Divi's "p:not(.has-background):last-of-type{padding-bottom:0}") */
.dnxte_flip_box .dnext-flipbox-front-pra p:not(:empty), .dnxte_flip_box .dnext-flipbox-back-pra p:not(:empty) { padding-bottom: 1em; }

/* 6. Divi Essential flip box button: the plugin's Divi 5 stylesheet sets line-height:1 on the readmore link;
      its Divi 4 stylesheet did not, so the link inherited the body line-height (1.6em). */
.dnext-flpb-flibbox-flip-button .dnext-flpb-flibbox-readmore { line-height: 1.6em; }
