/* ============================================
   PRECISION YARD SERVICES — CUSTOM OVERRIDES
   ============================================ */

/* === Fix 1: Sticky Header === */
.elementor-location-header,
header[data-elementor-type="header"] {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  width: 100% !important;
  background: #fff !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Override frozen inline styles from WP capture */
.elementor-location-header .elementor-sticky {
  position: relative !important;
  width: 100% !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  top: auto !important;
}

/* Hide the duplicated sticky spacer section */
.elementor-sticky__spacer {
  display: none !important;
}

/* Ensure full viewport width */
.elementor-sticky--active {
  left: 0 !important;
  width: 100% !important;
  position: relative !important;
}


/* === Fix 3: Navigation System === */

/* --- 3C: Desktop Dropdown --- */
@media (min-width: 1025px) {
  /* Always hide mobile dropdown and hamburger on desktop */
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    display: none !important;
  }
  .elementor-menu-toggle {
    display: none !important;
  }

  /* Desktop dropdown submenus */
  .elementor-nav-menu--main .menu-item-has-children {
    position: relative;
  }
  .elementor-nav-menu--main .menu-item-has-children > .sub-menu {
    display: none !important;
    position: absolute !important;
    top: 100%;
    left: 0;
    background: #fff !important;
    min-width: 220px;
    width: max-content;
    max-width: 320px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14) !important;
    z-index: 10000 !important;
    padding: 0;
    margin: 0;
    list-style: none;
  }
  .elementor-nav-menu--main .menu-item-has-children:hover > .sub-menu {
    display: block !important;
  }
  /* Nested flyout to the right */
  .elementor-nav-menu--main .sub-menu .menu-item-has-children > .sub-menu {
    position: absolute !important;
    top: 0 !important;
    left: 100% !important;
    background: #fff !important;
    z-index: 10001 !important;
  }
  /* Sub-menu item styling */
  .elementor-nav-menu--main .sub-menu li {
    display: block !important;
    width: 100%;
  }
  .elementor-nav-menu--main .sub-menu a {
    padding: 10px 20px !important;
    white-space: nowrap;
    display: block !important;
    color: inherit;
  }
  .elementor-nav-menu--main .sub-menu a:hover {
    background: #f5f5f5;
  }
}

/* --- 3D: Tablet/Mobile Dropdown --- */
@media (max-width: 1024px) {
  /* Hide desktop nav */
  .elementor-nav-menu--main {
    display: none !important;
  }

  /* Override Elementor's dropdown-tablet rules that hide toggle + dropdown */
  .elementor-nav-menu--dropdown-tablet .elementor-menu-toggle {
    display: flex !important;
  }

  /* Allow dropdown to escape narrow column */
  .elementor-location-header .elementor-column,
  .elementor-location-header .elementor-widget-wrap,
  .elementor-location-header .elementor-widget-container,
  .elementor-location-header .elementor-widget-nav-menu {
    overflow: visible !important;
  }

  /* Mobile dropdown container — hidden by default */
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    display: none !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-height: calc(100vh - 80px) !important;
    height: auto !important;
    z-index: 99998 !important;
    background: #fff !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
  }

  /* Show dropdown when hamburger is active */
  .elementor-menu-toggle.elementor-active + .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    display: block !important;
    max-height: calc(100vh - 80px) !important;
    transform: scaleY(1) !important;
    overflow-y: auto !important;
  }

  .elementor-menu-toggle {
    z-index: 99999 !important;
    cursor: pointer;
  }

  .elementor-nav-menu--stretch .elementor-nav-menu__container.elementor-nav-menu--dropdown {
    position: fixed !important;
    width: 100vw !important;
    left: 0 !important;
  }

  /* Mobile sub-menu accordion — override Elementor's dropdown-tablet hide rule */
  .elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu,
  .elementor-nav-menu--dropdown-tablet .sub-menu.elementor-nav-menu--dropdown {
    display: none !important;
    position: static !important;
    box-shadow: none !important;
    background: transparent !important;
    padding-left: 15px !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .elementor-nav-menu--dropdown .menu-item-has-children.sub-menu-open > .sub-menu,
  .elementor-nav-menu--dropdown-tablet .menu-item-has-children.sub-menu-open > .sub-menu.elementor-nav-menu--dropdown {
    display: block !important;
  }

  /* Mobile nav item styling */
  .elementor-nav-menu--dropdown li {
    border-bottom: 1px solid #f0f0f0;
  }
  .elementor-nav-menu--dropdown a {
    padding: 12px 20px !important;
    display: block !important;
    color: #222 !important;
    font-size: 15px;
    text-align: center;
  }

  /* Mobile nav hover + active state */
  .elementor-nav-menu--dropdown a:hover,
  .elementor-nav-menu--dropdown a:focus,
  .elementor-nav-menu--dropdown a.elementor-item-active {
    color: #fff !important;
    background: #2B5034 !important;
  }

  /* Sub-arrow inline with text, not below */
  .elementor-nav-menu--dropdown .has-submenu {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }
  .elementor-nav-menu--dropdown .sub-arrow {
    display: inline-flex !important;
    align-items: center;
    line-height: 1;
  }

  /* Sub-menu items slightly indented */
  .elementor-nav-menu--dropdown .sub-menu a {
    padding-left: 30px !important;
    font-size: 14px;
  }
  .elementor-nav-menu--dropdown .sub-menu a:hover,
  .elementor-nav-menu--dropdown .sub-menu a:focus {
    color: #fff !important;
    background: #2B5034 !important;
  }
}


/* === Fix 4: Gallery Page — Grid + Lightbox === */

/* Override Elementor lazyload hiding — show all gallery images */
.e-gallery--lazyload .e-gallery-image:not(.e-gallery-image-loaded) {
  filter: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* Override Elementor justified layout with CSS Grid */
.elementor-gallery__container.e-gallery-container {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  position: relative !important;
  height: auto !important;
  padding-bottom: 0 !important;
}

@media (max-width: 1024px) {
  .elementor-gallery__container.e-gallery-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .elementor-gallery__container.e-gallery-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Reset the absolute positioning from Elementor justified */
.e-gallery-item.elementor-gallery-item {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  top: auto !important;
  left: auto !important;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
  padding-bottom: 0 !important;
  margin: 0 !important;
}

/* Kill Elementor grid padding-bottom that creates the white gap */
.e-gallery-justified,
.e-gallery-grid {
  padding-bottom: 0 !important;
}

.e-gallery-item.elementor-gallery-item:hover {
  transform: scale(1.02);
}

.e-gallery-image.elementor-gallery-item__image {
  width: 100% !important;
  height: 100% !important;
  background-size: cover !important;
  background-position: center !important;
  position: absolute;
  top: 0;
  left: 0;
}

/* Hide gallery overlay text/titles */
.elementor-gallery-item__overlay {
  display: none !important;
}


/* === Fix 4D: Lightbox === */
#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 === */

/* Outer wrapper — arrows positioned relative to this */
.elementor-widget-reviews .elementor-swiper {
  position: relative;
  padding: 0 40px; /* room for arrows outside the track */
}

/* Track — clips the sliding cards */
.elementor-widget-reviews .elementor-main-swiper {
  overflow: hidden !important;
}

/* Sliding strip */
.elementor-widget-reviews .swiper-wrapper {
  display: flex !important;
  overflow: visible !important;
  transition: transform 0.5s ease !important;
  gap: 0 !important;
}

/* Each slide — width set by JS, gap via margin */
.elementor-widget-reviews .swiper-slide {
  display: block !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}

/* Card styling + subtle hover animation */
.elementor-widget-reviews .elementor-testimonial {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.elementor-widget-reviews .elementor-testimonial:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Arrows — no background, outside the track */
.elementor-widget-reviews .elementor-swiper-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: #335F3F !important;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s ease, transform 0.2s ease;
  width: auto !important;
  height: auto !important;
}

.elementor-widget-reviews .elementor-swiper-button:hover {
  color: #2B5034 !important;
  transform: translateY(-50%) scale(1.2);
}

.elementor-widget-reviews .elementor-swiper-button-prev {
  left: 0;
}

.elementor-widget-reviews .elementor-swiper-button-next {
  right: 0;
}

/* Hide pagination dots */
.elementor-widget-reviews .swiper-pagination {
  display: none !important;
}

@media (max-width: 768px) {
  .elementor-widget-reviews .elementor-swiper {
    padding: 0 30px;
  }
}


/* === Media Carousel (project gallery sections) === */

/* Un-freeze slides and wrapper */
.elementor-widget-media-carousel .swiper-slide {
  display: block !important;
  flex-shrink: 0;
}
.elementor-widget-media-carousel .swiper-wrapper {
  display: flex !important;
  overflow: visible !important;
}
.elementor-widget-media-carousel .elementor-swiper {
  overflow: hidden;
  position: relative;
}
.elementor-widget-media-carousel .elementor-main-swiper {
  overflow: hidden !important;
}

/* Image sizing — 4:3 aspect */
.elementor-widget-media-carousel .elementor-carousel-image {
  width: 100%;
  padding-bottom: 75%;
  background-size: cover !important;
  background-position: center !important;
  border-radius: 4px;
}

/* Black arrows, no background */
.elementor-widget-media-carousel .elementor-swiper-button {
  display: flex !important;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: #000 !important;
  font-size: 24px;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.2s;
}
.elementor-widget-media-carousel .elementor-swiper-button:hover {
  opacity: 1;
}
.elementor-widget-media-carousel .elementor-swiper-button-prev { left: 8px; }
.elementor-widget-media-carousel .elementor-swiper-button-next { right: 8px; }
.elementor-widget-media-carousel .elementor-swiper-button i {
  color: #000 !important;
  font-size: 24px !important;
}


/* === Fix 7: Smooth Scroll === */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}
