/* =============================================
   M&M Water Well Service — Custom Overrides
   ============================================= */

/* --- Fix 1: Sticky Header --- */
.elementor-location-header,
header[data-elementor-type="header"] {
  position: sticky;
  top: 0;
  z-index: 9999;
  width: 100%;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.elementor-sticky__spacer { display: none !important; }

.elementor-sticky--active {
  left: 0 !important;
  width: 100% !important;
}

/* --- Fix 3: Desktop Dropdown Menus --- */
@media (min-width: 1025px) {
.menu-item-has-children { position: relative; }

.menu-item-has-children > .sub-menu,
.menu-item-has-children > ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  min-width: 320px;
  width: max-content !important;
  max-width: 450px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
  border-radius: 0 0 4px 4px;
  z-index: 10000;
  padding: 6px 0;
}

.menu-item-has-children:hover > .sub-menu,
.menu-item-has-children:hover > ul {
  display: block;
}

.sub-menu li,
.menu-item-has-children ul li {
  width: 100%;
  list-style: none;
}

.sub-menu li a,
.menu-item-has-children ul li a {
  display: block !important;
  padding: 11px 22px;
  font-size: 14px;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.sub-menu li a:hover,
.menu-item-has-children ul li a:hover {
  background: #0A8EC2;
  color: #fff;
}

/* Caret/arrow inline fix */
.sub-menu .menu-item-has-children > a {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sub-menu .menu-item-has-children > a .sub-arrow {
  display: inline-flex !important;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.sub-menu .menu-item-has-children > a .sub-arrow i {
  transform: rotate(-90deg) !important;
}

/* Nested flyout submenu */
.sub-menu .menu-item-has-children > .sub-menu,
.sub-menu .menu-item-has-children > ul {
  position: absolute !important;
  top: 0 !important;
  left: 100% !important;
  margin: 0 !important;
  background: #fff !important;
  border-radius: 0 4px 4px 0 !important;
  box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.12) !important;
  z-index: 10001 !important;
  min-width: 180px;
  width: max-content;
  max-width: 320px;
  padding: 6px 0;
}

/* Ensure header/nav doesn't clip dropdowns */
.elementor-location-header,
.elementor-location-header .elementor-container,
.elementor-location-header .elementor-column,
.elementor-location-header .elementor-widget-wrap,
.elementor-location-header .elementor-widget-nav-menu,
header .elementor-container,
header .elementor-column,
header .elementor-widget-wrap {
  overflow: visible !important;
}

} /* end @media (min-width: 1025px) desktop dropdown */


/* ===== Mobile/Tablet Nav Dropdown ===== */
@media (max-width: 1024px) {
  /* Let the nav widget container be the positioning context */
  .elementor-widget-nav-menu {
    position: static !important;
  }

  /* Make the dropdown span full viewport width */
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    overflow: visible !important;
    background: #fff !important;
    position: fixed !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    z-index: 9998 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-top: 3px solid #0A8EC2 !important;
    margin-top: 0 !important;
  }

  .elementor-nav-menu--toggle .elementor-menu-toggle.elementor-active + .elementor-nav-menu__container {
    overflow: visible !important;
    max-height: none !important;
  }

  /* Mobile dropdown menu items — full width, centered */
  .elementor-nav-menu--dropdown a,
  .elementor-nav-menu--dropdown .elementor-item,
  .elementor-nav-menu--dropdown .elementor-sub-item {
    padding: 14px 20px !important;
    color: #333 !important;
    text-align: center !important;
    justify-content: center !important;
    border-bottom: 1px solid #f0f0f0;
    white-space: normal !important;
  }

  /* Active item — brand blue background */
  .elementor-nav-menu--dropdown .elementor-item-active,
  .elementor-nav-menu--dropdown .elementor-item.highlighted,
  .elementor-nav-menu--dropdown a.current {
    background-color: #0A8EC2 !important;
    color: #fff !important;
  }

  /* Mobile sub-menus: show inline, full width */
  .elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu,
  .elementor-nav-menu--dropdown .menu-item-has-children > ul {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    box-shadow: none !important;
    background: #f7f7f7 !important;
    border-radius: 0 !important;
    padding: 0 !important;
  }

  .elementor-nav-menu--dropdown .sub-menu li a {
    padding: 12px 20px 12px 40px !important;
    font-size: 14px !important;
    text-align: center !important;
    justify-content: center !important;
  }

  /* Keep menu text and sub-arrow caret on same line */
  .elementor-nav-menu--dropdown .menu-item-has-children > a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
  }

  .elementor-nav-menu--dropdown .menu-item-has-children > a .sub-arrow {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0;
  }

  /* Caret points down (not right) */
  .elementor-nav-menu--dropdown .sub-arrow i {
    transform: rotate(0deg) !important;
  }
}

/* --- Hero Section: 100vh, vertically centered, symmetrical spacing --- */
/* Only target hero sections inside page content, NOT inside header */
.elementor[data-elementor-type="wp-page"] > .elementor-section-height-min-height:first-child > .elementor-container {
  min-height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.elementor[data-elementor-type="wp-page"] > .elementor-section-height-min-height:first-child > .elementor-container > .elementor-column {
  display: flex;
  align-items: center;
  justify-content: center;
}

.elementor[data-elementor-type="wp-page"] > .elementor-section-height-min-height:first-child > .elementor-container > .elementor-column > .elementor-widget-wrap {
  padding-top: 60px;
  padding-bottom: 60px;
}

/* --- Fix 4: Gallery Masonry & Lightbox --- */
.e-gallery-container.e-gallery-masonry {
  columns: 4;
  column-gap: 10px;
  position: relative !important;
  padding-bottom: 0 !important;
  height: auto !important;
  display: block !important;
}

@media (max-width: 1024px) {
  .e-gallery-container.e-gallery-masonry {
    columns: 2;
  }
}

@media (max-width: 768px) {
  .e-gallery-container.e-gallery-masonry {
    columns: 1;
  }
}

.e-gallery-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  height: auto !important;
  transform: none !important;
  display: inline-block;
  margin-bottom: 10px;
  break-inside: avoid;
}

.e-gallery-image {
  width: 100%;
  padding-bottom: var(--item-height, 75%);
  height: 0;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.e-gallery-item:hover .e-gallery-image {
  transform: scale(1.02);
}

/* Override Elementor lazyload hiding — all images have bg-image now */
.e-gallery--lazyload .e-gallery-image:not(.e-gallery-image-loaded) {
  filter: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* Hide gallery overlay text/title */
.elementor-gallery-item__overlay {
  display: none;
}

/* Hide Elementor's built-in lightbox if it fires */
.elementor-lightbox,
.elementor-slideshow,
dialog.elementor-popup-modal {
  display: none !important;
}

/* Lightbox CSS */
#lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

#lightbox-overlay.active {
  display: flex;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
}

.lb-img-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 88vh;
}

.lb-img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  transition: opacity 0.3s;
}

.lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 2;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  line-height: 1;
}

.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 28px;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.lb-prev:hover, .lb-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-spinner {
  display: none;
  position: absolute;
  z-index: 1;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lb-spin 0.8s linear infinite;
}

@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

/* --- Reviews Carousel Arrows --- */
.elementor-widget-reviews .elementor-swiper-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 36px;
  height: 36px;
  background: #0A8EC2;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
}

.elementor-widget-reviews .elementor-swiper-button i {
  color: #ffffff !important;
}

.elementor-widget-reviews .elementor-swiper-button:hover {
  background: #0980AE;
}

.elementor-widget-reviews .elementor-swiper-button-prev { left: -18px; }
.elementor-widget-reviews .elementor-swiper-button-next { right: -18px; }

.elementor-widget-reviews .elementor-swiper {
  position: relative;
}

.elementor-widget-reviews .elementor-widget-container,
.elementor-widget-reviews {
  overflow: visible !important;
}

/* --- Fix: Make Elementor animated elements visible (no WP JS to trigger animations) --- */
.elementor-invisible {
  visibility: visible !important;
  opacity: 1 !important;
}

/* --- Fix 7: Smooth Scroll --- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}
