/* ============================================
   Custom Overrides — Lone Star Seamless Gutters
   ============================================ */

/* === Fix 1: Sticky Header === */
.elementor-location-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  width: 100% !important;
  background: #04246D;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.elementor-location-header .elementor-section.elementor-sticky {
  position: relative !important;
  width: 100% !important;
  top: auto !important;
  margin-top: 0 !important;
}

.elementor-sticky__spacer { display: none !important; }

.elementor-sticky--active {
  left: 0 !important;
  width: 100% !important;
}

/* === Fix 3: Desktop Dropdown Menu — Flyout === */
.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;
  top: 100%;
  left: 0;
  background: #fff;
  min-width: 220px;
  width: max-content;
  max-width: 320px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
  border-radius: 0 0 4px 4px;
  z-index: 10000;
  padding: 6px 0;
  margin: 0;
  list-style: none;
}

.elementor-nav-menu--main .menu-item-has-children:hover > .sub-menu {
  display: block !important;
}

/* Sub-menu link items */
.elementor-nav-menu--main .sub-menu li {
  display: block !important;
  width: 100%;
}

.elementor-nav-menu--main .sub-menu a {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 11px 22px !important;
  font-size: 14px;
  color: #333;
  text-decoration: none;
  white-space: normal;
  word-wrap: break-word;
  transition: background 0.2s, color 0.2s;
}

.elementor-nav-menu--main .sub-menu a:hover {
  background: #04246D;
  color: #fff;
}

/* Caret/arrow inline fix */
.elementor-nav-menu--main .sub-menu .menu-item-has-children > a .sub-arrow {
  display: inline-flex !important;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.elementor-nav-menu--main .sub-menu .menu-item-has-children > a .sub-arrow i {
  transform: rotate(-90deg) !important;
}

/* Nested flyout submenu (opens to the right) */
.elementor-nav-menu--main .sub-menu .menu-item-has-children > .sub-menu {
  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;
}

/* Prevent header overflow clipping dropdowns */
.elementor-location-header,
.elementor-location-header .elementor-section,
.elementor-location-header .elementor-container,
.elementor-location-header .elementor-column,
.elementor-location-header .elementor-widget-wrap {
  overflow: visible !important;
}

/* === Fix 4: Gallery Page — CSS Grid Override === */

/* Kill the lazyload hiding — force ALL gallery images visible */
.e-gallery--lazyload .e-gallery-image:not(.e-gallery-image-loaded) {
  filter: none !important;
  opacity: 1 !important;
  transform: none !important;
}

.e-gallery-container.e-gallery-masonry {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  height: auto !important;
  position: relative !important;
}

@media (max-width: 1024px) {
  .e-gallery-container.e-gallery-masonry {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .e-gallery-container.e-gallery-masonry {
    grid-template-columns: 1fr;
  }
}

.e-gallery-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  height: auto !important;
  transform: none !important;
  display: block !important;
  opacity: 1 !important;
}

.e-gallery-item .e-gallery-image {
  width: 100%;
  padding-bottom: 75% !important; /* 4:3 ratio via padding trick */
  height: 0 !important;
  background-size: cover !important;
  background-position: center !important;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.e-gallery-item:hover .e-gallery-image {
  transform: scale(1.02);
}

.e-gallery-item .elementor-gallery-item__overlay {
  display: none !important;
}

/* === Project Gallery Carousel (Swiper-driven) === */

/* Un-freeze: show arrows on media carousels */
.elementor-widget-media-carousel .elementor-swiper-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #042062;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.2s, color 0.2s;
}

.elementor-widget-media-carousel .elementor-swiper-button:hover {
  background: #04246D;
  color: #fff;
  opacity: 0.9;
}

.elementor-widget-media-carousel .elementor-swiper-button-prev {
  left: 10px;
}

.elementor-widget-media-carousel .elementor-swiper-button-next {
  right: 10px;
}

/* Swiper container: explicit height + overflow */
.elementor-widget-media-carousel .elementor-main-swiper {
  height: 450px !important;
  overflow: hidden !important;
  position: relative !important;
}

/* CRITICAL: override the global .swiper-wrapper overflow:hidden for media carousels */
/* Swiper uses transform on the wrapper — overflow:hidden on wrapper clips translated slides */
.elementor-widget-media-carousel .swiper-wrapper {
  display: flex !important;
  overflow: visible !important;
  height: 100% !important;
  transition-timing-function: ease;
}

/* Slides need explicit height */
.elementor-widget-media-carousel .swiper-slide {
  height: 100% !important;
  flex-shrink: 0;
  opacity: 1 !important;
}

/* Carousel images: fill the slide */
.elementor-widget-media-carousel .elementor-carousel-image {
  height: 100% !important;
  width: 100% !important;
  min-height: 450px;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
}

.elementor-widget-media-carousel .elementor-carousel-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.3s ease;
}

.elementor-widget-media-carousel .elementor-carousel-image:hover img {
  transform: scale(1.05);
}

/* Hide pagination dots on media carousels — arrows only */
.elementor-widget-media-carousel .swiper-pagination {
  display: none !important;
}

@media (max-width: 768px) {
  .elementor-widget-media-carousel .elementor-swiper-button {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* === Reviews Carousel (Swiper-driven) === */

.elementor-widget-reviews .elementor-swiper-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: 0;
  color: #042062;
  font-size: 22px;
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  box-shadow: none;
  transition: opacity 0.2s;
}

.elementor-widget-reviews .elementor-swiper-button:hover {
  opacity: 0.7;
}

.elementor-widget-reviews .elementor-swiper-button-prev {
  left: -20px;
}

.elementor-widget-reviews .elementor-swiper-button-next {
  right: -20px;
}

.elementor-widget-reviews .elementor-main-swiper {
  overflow: hidden !important;
  position: relative !important;
}

.elementor-widget-reviews .swiper-wrapper {
  display: flex !important;
  overflow: visible !important;
  height: auto !important;
}

.elementor-widget-reviews .swiper-slide {
  height: auto !important;
  flex-shrink: 0;
  opacity: 1 !important;
  display: block !important;
}

/* Hide pagination dots — arrows only */
.elementor-widget-reviews .swiper-pagination {
  display: none !important;
}

@media (max-width: 768px) {
  .elementor-widget-reviews .elementor-swiper-button {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  .elementor-widget-reviews .elementor-swiper-button-prev { left: -10px; }
  .elementor-widget-reviews .elementor-swiper-button-next { right: -10px; }
}

/* === Fix 7: Smooth Scroll === */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

/* === 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); }
}
