/*
 * BAPTO native Divi Canvas interaction adapter.
 *
 * This deliberately owns interaction state and minimum target geometry only.
 * Brand presentation remains in Divi Global Variables, Option Group Presets and
 * Element Presets. All selectors require the stable plugin body hook and the
 * Canvas controller's BAPTO state/data hooks.
 */

body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized [data-bapto-canvas="true"]:not(.bapto-canvas-is-open) {
  display: none !important;
}

body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized [data-bapto-canvas="true"].bapto-canvas-is-open {
  display: block !important;
}

body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized [data-bapto-canvas="true"][data-bapto-mobile="false"] {
  top: var(--bapto-canvas-top, 120px) !important;
  max-height: calc(100vh - var(--bapto-canvas-top, 120px)) !important;
  max-height: calc(100dvh - var(--bapto-canvas-top, 120px)) !important;
}

body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized .bapto-module-is-hidden {
  display: none !important;
}

body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized .bapto-mobile-toggle-is-expanded > .et_pb_toggle_content {
  display: block !important;
}

body.bapto-canvas-menu-initialized.bapto-canvas-scroll-lock {
  overflow: hidden !important;
}

/* Keep the mobile dialog above the WordPress toolbar for signed-in users. */
body.logged-in.bapto-canvas-menu-initialized.bapto-canvas-scroll-lock #page-container,
body.logged-in.bapto-canvas-menu-initialized.bapto-canvas-scroll-lock .et-boc,
body.logged-in.bapto-canvas-menu-initialized.bapto-canvas-scroll-lock .et-l--header {
  position: relative !important;
  z-index: 1000001 !important;
}

/*
 * Documented Divi exception: Toggle content anchors render inline, so their
 * preset line-height alone cannot create the required full-width 44px target.
 */
body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized [data-bapto-canvas="true"][aria-label="BAPTO navigation"] .et_pb_toggle_content a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
}

body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized [data-bapto-canvas="true"][aria-label="BAPTO navigation"] .et_pb_toggle_title {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
}

/* Keep the selected event label from colliding with the Back control. */
body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized [data-bapto-canvas="true"][aria-label="BAPTO navigation"][data-bapto-view="submenu"] .bapto-mobile-toggle-is-expanded > .et_pb_toggle_title {
  display: none !important;
}

body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized [data-bapto-canvas="true"][aria-label="BAPTO navigation"][data-bapto-view="submenu"] .bapto-mobile-toggle-is-expanded > .et_pb_toggle_content {
  margin-top: 44px;
}

/* Fill the governed 44px account row without changing its text styling. */
body.bapto-canvas-menu-enabled.bapto-canvas-menu-initialized [data-bapto-canvas="true"][aria-label="BAPTO navigation"] .bapto-mobile-account-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
