/* HWR Divi Menu Dropdown Image - v1.0.2
   Safer scoping: styles only apply to menus tagged with .hwr-ddi by JS.
   We avoid changing positioning so Divi keeps sub-menus absolutely positioned.
*/

/* Apply grid only on hover/focus open states to avoid layout jumps */
#header .hwr-ddi li.menu-item-has-children:hover > ul.sub-menu.has-right-image,
#header .hwr-ddi li.menu-item-has-children:focus-within > ul.sub-menu.has-right-image {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 320px; /* links | image */
  gap: 0;
  position: absolute; /* keep Divi behavior */
  left: 0; /* let Divi set exact position; this is a fallback */
  width: max-content;
  min-width: 520px; /* enough to fit columns; adjust if needed */
  box-sizing: border-box;
}

/* Vertical divider */
#header .hwr-ddi li.menu-item-has-children:hover > ul.sub-menu.has-right-image::before,
#header .hwr-ddi li.menu-item-has-children:focus-within > ul.sub-menu.has-right-image::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: calc(100% - 320px - 1px);
  width: 1px;
  background: rgba(173, 18, 18, 0.7);
}

/* Left column = links (default) */
#header .hwr-ddi ul.sub-menu.has-right-image > li:not(.menu-dropdown-image) {
  grid-column: 1;
  padding-right: 24px;
}

/* Right column = image */
#header .hwr-ddi ul.sub-menu.has-right-image > li.menu-dropdown-image {
  grid-column: 2;
  list-style: none;
  margin: 0;
  padding: 12px 12px 12px 24px;
}

/* Card */
#header .hwr-ddi .dropdown-image-card {
  background: #fff;
  display: block;
  width: 100%;
  height: 100%;
}

#header .hwr-ddi .dropdown-image-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 2px;
}

/* Tighten link padding a little */
#header .hwr-ddi ul.sub-menu.has-right-image > li > a {
  padding-right: 8px;
  white-space: normal;
}

/* Mobile: do nothing extra; hide image panel */
@media (max-width: 980px) {
  #header .hwr-ddi ul.sub-menu.has-right-image::before { display: none; }
  #header .hwr-ddi .menu-dropdown-image { display: none !important; }
}

/* ===========================
   HWR DDI – Flex-like layout via absolute image column
   Adjust only the variables below to change sizes/colors.
   =========================== */

#header .hwr-ddi { 
  --hwr-ddi-img-w: 360px;         /* width of the right-side image column */
  --hwr-ddi-pad: 24px;            /* inner padding between links & divider */
  --hwr-ddi-divider: rgba(173,18,18,.7);
}

/* Keep Divi's absolute submenu behavior; just make space for the image column */
#header .hwr-ddi li.menu-item-has-children:hover > ul.sub-menu.has-right-image,
#header .hwr-ddi li.menu-item-has-children:focus-within > ul.sub-menu.has-right-image {
  position: absolute;         
  display: flex;
	flex-direction: column;
  box-sizing: border-box;
  padding-right: calc(var(--hwr-ddi-img-w) + var(--hwr-ddi-pad));
	left: 50%;
	transform: translatex(-50%);
}

/* Vertical divider separating links from the image column */
#header .hwr-ddi li.menu-item-has-children:hover > ul.sub-menu.has-right-image::before,
#header .hwr-ddi li.menu-item-has-children:focus-within > ul.sub-menu.has-right-image::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  right: calc(var(--hwr-ddi-img-w) + 1px); /* anchor from the right column */
  width: 1px;
  background: var(--hwr-ddi-divider);
}

/* The image panel fills the full dropdown height on the right */
#header .hwr-ddi ul.sub-menu.has-right-image > li.menu-dropdown-image {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;                        /* <— full height */
  width: var(--hwr-ddi-img-w);
  list-style: none;
  margin: 0;
  padding: 12px 12px 12px var(--hwr-ddi-pad);
  z-index: 1;                       /* keep above UL background */
}

/* Card & image fill the column */
#header .hwr-ddi .dropdown-image-card { height: 100%; overflow: hidden; background: #fff; }
#header .hwr-ddi .dropdown-image-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Optional: slightly tighter right padding for left-side links */
#header .hwr-ddi ul.sub-menu.has-right-image > li:not(.menu-dropdown-image) > a {
  padding-right: 8px;
  white-space: normal;
}

/* Mobile: hide the image column completely */
@media (max-width: 980px) {
  #header .hwr-ddi ul.sub-menu.has-right-image::before { display: none; }
  #header .hwr-ddi .menu-dropdown-image { display: none !important; }
}
