/* ==========================================================================
   OIC Horizon: Divi Builder plugin fixes.
   In plugin mode Divi stretches rows to 100% of the theme's content box, but
   the Horizon page body is full-bleed. These rules give Divi rows the same
   width and side gutters as the header and page hero.
   ========================================================================== */

/* Standard rows: same box as .wrap (1240px max, fluid gutters). */
body.et-db #et-boc .et-l .et_pb_section .et_pb_row {
	width: min(100% - 2 * var(--gutter), var(--wrap));
	max-width: none;
	margin-inline: auto;
}

/* Divi's own "fullwidth" sections keep spanning the screen. */
body.et-db #et-boc .et-l .et_pb_fullwidth_section .et_pb_row { width: 100%; }

/* Keep Horizon fonts and text colour inside Divi modules unless a module sets its own. */
body.et-db #et-boc .et-l { font-family: inherit; color: inherit; }

/* --------------------------------------------------------------------------
   Pages converted with "Use Existing Content": the old Horizon sections end up
   inside one Divi Text module. Let that row span the screen so the sections
   keep their full-width bands. (Their inner styles are re-scoped for Divi in
   inc/divi.php and added after this file.)
   -------------------------------------------------------------------------- */
body.et-db #et-boc .et-l .et_pb_section:has(.hz-section) { padding: 0; }
body.et-db #et-boc .et-l .et_pb_section .et_pb_row:has(.hz-section) { width: 100%; padding: 0; }

/* --------------------------------------------------------------------------
   Pages converted to native modules (oic2-tools/pages-divi.php): the Divi
   section carries the hz-section classes (padding and background come from
   pages.css), rows span it, and each row's column is the flow of modules,
   a grid (hz-grid / hz-people / hz-stats / hz-accordion) or a split column.
   -------------------------------------------------------------------------- */
body.et-db #et-boc .et-l.et-l .et_pb_section.hz-dv > .et_pb_row { width: 100%; max-width: none; margin: 0; padding: 0; }
body.et-db #et-boc .et-l.et-l .et_pb_section.hz-dv > .et_pb_row::after { display: none; }
body.et-db #et-boc .et-l.et-l .et_pb_section.hz-dv > .et_pb_row + .et_pb_row { margin-top: 32px; }
body.et-db #et-boc .et-l.et-l .et_pb_section.hz-dv .et_pb_column { width: auto; margin: 0; float: none; }
@media (max-width: 980px) {
	body.et-db #et-boc .et-l.et-l .et_pb_section.hz-dv .et_pb_column { width: auto !important; margin-bottom: 0; }
}
body.et-db #et-boc .et-l.et-l .hz-dv .et_pb_module { margin-bottom: 0; }

/* Spacing between modules in a flow column: 1em, 32px around headings, notes, images, tables. */
body.et-db #et-boc .et-l.et-l .hz-dv :is(.hz-dv-flow, .hz-dv-col) > .et_pb_module + .et_pb_module { margin-top: 1em; }
body.et-db #et-boc .et-l.et-l .hz-dv :is(.hz-dv-flow, .hz-dv-col) > .et_pb_module:is(:has(> .et_pb_text_inner > :is(.hz-head, .hz-note, .hz-table, .wp-block-buttons, .hz-timeline)), .et_pb_image, .et_pb_code) + .et_pb_module,
body.et-db #et-boc .et-l.et-l .hz-dv :is(.hz-dv-flow, .hz-dv-col) > .et_pb_module + .et_pb_module:is(:has(> .et_pb_text_inner > :is(.hz-note, .hz-table, .wp-block-buttons, .hz-timeline)), .et_pb_image) { margin-top: 32px; }
body.et-db #et-boc .et-l.et-l .hz-dv .et_pb_text_inner > :first-child { margin-top: 0; }
body.et-db #et-boc .et-l.et-l .hz-dv .et_pb_text_inner > :last-child { margin-bottom: 0; }
body.et-db #et-boc .et-l.et-l .hz-dv .hz-toggle + .hz-toggle { margin-top: 10px; }

/* Grid columns: one module per card; the card fills its grid cell. */
body.et-db #et-boc .et-l.et-l .hz-dv-grid > .et_pb_module,
body.et-db #et-boc .et-l.et-l .hz-dv-grid > .et_pb_module > .et_pb_text_inner { display: flex; flex-direction: column; }
body.et-db #et-boc .et-l.et-l .hz-dv-grid > .et_pb_module > .et_pb_text_inner { flex: 1; }
body.et-db #et-boc .et-l.et-l .hz-dv-grid > .et_pb_module > .et_pb_text_inner > * { flex: 1; }
/* Shop filter: hide the whole module of a filtered-out product. */
body.et-db #et-boc .et-l.et-l .hz-dv-grid > .et_pb_module:has(.hz-product.is-hidden) { display: none; }
/* Split rows: CSS grid from pages.css (.hz-split) places the Divi columns. */
body.et-db #et-boc .et-l.et-l .hz-dv .et_pb_row.hz-split > .et_pb_column { min-width: 0; }

/* Image modules keep the block-image look. */
body.et-db #et-boc .et-l.et-l .et_pb_image.wp-block-image .et_pb_image_wrap { display: block; }
body.et-db #et-boc .et-l.et-l .et_pb_image.wp-block-image img { width: 100%; }

/* Toggle modules styled like the Horizon <details> accordions. */
body.et-db #et-boc .et-l.et-l .et_pb_toggle.hz-toggle {
	padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); overflow: hidden;
}
body.et-db #et-boc .et-l.et-l .et_pb_toggle.hz-toggle .et_pb_toggle_title {
	position: relative; margin: 0; padding: 16px 52px 16px 20px; cursor: pointer;
	font-family: var(--font-display); font-size: 1rem; line-height: 1.4; font-weight: 700; color: var(--ink);
}
body.et-db #et-boc .et-l.et-l .et_pb_toggle.hz-toggle .et_pb_toggle_title::before {
	content: ""; font-size: 0; position: absolute; left: auto; right: 20px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
	border-right: 2px solid var(--green-700); border-bottom: 2px solid var(--green-700); transform: rotate(45deg); transition: transform .2s;
}
body.et-db #et-boc .et-l.et-l .et_pb_toggle.hz-toggle.et_pb_toggle_open .et_pb_toggle_title { border-bottom: 1px solid var(--line); }
body.et-db #et-boc .et-l.et-l .et_pb_toggle.hz-toggle.et_pb_toggle_open .et_pb_toggle_title::before { transform: rotate(-135deg); margin-top: -2px; }
body.et-db #et-boc .et-l.et-l .et_pb_toggle.hz-toggle .et_pb_toggle_content { padding: 14px 20px 18px; }
body.et-db #et-boc .et-l.et-l .et_pb_toggle.hz-toggle .et_pb_toggle_content > * + * { margin-top: .8em; }
