/*
 * Divi Builder 4 compatibility.
 *
 * The theme's Divi overrides in styles/common/_global.scss and styles/layouts/_responsive.scss
 * target the Divi 2 wrapper "#et_builder_outer_content". Divi 4 renders content inside
 * "#et-boc .et-l" instead (with more specific selectors), so the same rules are repeated here.
 * Loaded after the theme's main.css (see app/setup.php).
 */

body.et-db #et-boc .et-l .et_pb_row {
  max-width: 1170px;
}

body.et-db #et-boc .et-l .et_pb_module h3 {
  padding-bottom: 27px;
}

body.et-db #et-boc .et-l .et_pb_section * {
  letter-spacing: 0.005em;
  line-height: 30px;
}

body.et-db #et-boc .et-l .et_pb_section {
  padding: 0;
}

body.et-db #et-boc .et-l .foto-galerie .et_pb_gallery_image a {
  display: block;
  padding-bottom: 0;
}

body.et-db #et-boc .et-l .et_pb_module a,
body.et-db #et-boc .et-l .foto-galerie .et_overlay::before {
  color: #f0174c;
}

/* Gallery grid: Divi 2 had a bottom gap equal to the column gap and block-level images */
@media (min-width: 981px) {
  /* Divi 4 removes the bottom margin of the last grid row (.on_last_row), Divi 2 kept it */
  body.et-db #et-boc .et-l .et_pb_row .et_pb_column .et_pb_gallery_grid .et_pb_gallery_item.on_last_row {
    margin-bottom: 5.5%;
  }
}

body.et-db #et-boc .et-l .et_pb_gallery_grid .et_pb_gallery_image img {
  display: block;
}

/* Mobile rules of Divi 2 (frontend-builder-plugin-style.css) that Divi 4 changed */
@media (max-width: 980px) {
  /* Divi 4 removes the gap under the last column of every row, Divi 2 only in the section's last row */
  body.et-db #et-boc .et-l .et_pb_row:not(:last-child) .et_pb_column.et-last-child {
    margin-bottom: 30px;
  }

  body.et-db #et-boc .et-l .et_pb_column .et_pb_gallery_grid .et_pb_grid_item:nth-child(n) {
    width: 28.333% !important;
    margin: 0 7.5% 7.5% 0 !important;
    clear: none !important;
    float: left;
  }

  body.et-db #et-boc .et-l .et_pb_column .et_pb_gallery_grid .et_pb_grid_item:nth-child(3n) {
    margin-right: 0 !important;
  }
}

@media (max-width: 767px) {
  body.et-db #et-boc .et-l .et_pb_column .et_pb_gallery_grid .et_pb_grid_item:nth-child(n) {
    width: 45.25% !important;
    margin: 0 9.5% 9.5% 0 !important;
  }

  body.et-db #et-boc .et-l .et_pb_column .et_pb_gallery_grid .et_pb_grid_item:nth-child(2n) {
    margin-right: 0 !important;
  }
}

@media (max-width: 479px) {
  body.et-db #et-boc .et-l .et_pb_column .et_pb_gallery_grid .et_pb_grid_item:nth-child(n) {
    width: 100% !important;
    margin: 0 0 11.5% 0 !important;
  }
}

@media (max-width: 1199px) {
  body.et-db #et-boc .et-l .et_pb_section .et_pb_row {
    padding-left: 15px;
    padding-right: 15px;
  }
}
