/* =============================================
   SITE FIXES - Gallery, Navbar, Popup
   ============================================= */

/* --- NAVBAR FIX: Full-width responsive --- */
.elementor-section.elementor-sticky,
.elementor-section.elementor-sticky--active {
  width: 100% !important;
  max-width: 100% !important;
  left: 0 !important;
  right: 0 !important;
}

.elementor-nav-menu--dropdown.elementor-nav-menu__container {
  width: 100vw !important;
  left: 0 !important;
  right: 0 !important;
  margin-left: calc(-50vw + 50%) !important;
  top: 100% !important;
  position: fixed !important;
  top: auto !important;
  background: #fff !important;
  z-index: 99999 !important;
  box-sizing: border-box !important;
  padding: 20px 0 !important;
  border-top: 1px solid #eee;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
  max-height: 70vh !important;
  overflow-y: auto !important;
}

.elementor-nav-menu--dropdown .menu-item {
  text-align: center !important;
  list-style: none !important;
  width: 100% !important;
}

.elementor-nav-menu--dropdown .elementor-item,
.elementor-nav-menu--dropdown .elementor-sub-item {
  display: block !important;
  text-align: center !important;
  padding: 15px 30px !important;
  line-height: 1.5 !important;
  color: #333 !important;
  font-size: 17px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.elementor-nav-menu--dropdown .elementor-item:hover,
.elementor-nav-menu--dropdown .elementor-sub-item:hover {
  color: #F37E21 !important;
  background: #faf4ef !important;
}

/* Mobile dropdown: arrow icons inline with text */
.elementor-nav-menu--dropdown .has-submenu {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}

.elementor-nav-menu--dropdown .sub-arrow {
  display: inline-flex !important;
  align-items: center !important;
  font-size: 12px !important;
}

/* --- NESTED FLYOUT SUBMENU (Areas We Work In) --- */
/* Ensure nested parent li is positioned for flyout */
.elementor-nav-menu--main .sub-menu .menu-item-has-children {
  position: relative !important;
}

/* Nested sub-menu: flyout to the right */
.elementor-nav-menu--main .sub-menu .menu-item-has-children > .sub-menu {
  display: none !important;
  position: absolute !important;
  top: 0 !important;
  left: 100% !important;
  z-index: 99999 !important;
  min-width: 180px !important;
  background: #fff !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
  padding: 0 !important;
  margin: 0 !important;
  list-style: none !important;
  border-radius: 2px;
}

/* Show on hover */
.elementor-nav-menu--main .sub-menu .menu-item-has-children:hover > .sub-menu {
  display: block !important;
}

/* Flyout items */
.elementor-nav-menu--main .sub-menu .sub-menu li {
  display: block !important;
  width: 100% !important;
}

.elementor-nav-menu--main .sub-menu .sub-menu a {
  padding: 10px 20px !important;
  white-space: nowrap !important;
  display: block !important;
  color: #333 !important;
  text-decoration: none !important;
  transition: background 0.15s, color 0.15s;
}

.elementor-nav-menu--main .sub-menu .sub-menu a:hover {
  background: #f5f5f5 !important;
  color: #F37E21 !important;
}

/* --- CARET / ARROW ICON INLINE FIX --- */
.elementor-nav-menu--main .sub-menu .has-submenu,
.elementor-nav-menu--main .sub-menu a.has-submenu {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.elementor-nav-menu--main .sub-menu .sub-arrow {
  display: inline-flex !important;
  align-items: center;
  margin-left: auto;
  font-size: 12px;
}

/* Rotate caret to point right for nested flyout */
.elementor-nav-menu--main .sub-menu .sub-arrow i {
  transform: rotate(-90deg);
}

/* Top-level dropdown carets stay inline too */
.elementor-nav-menu--main .has-submenu {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}

.elementor-nav-menu--main .sub-arrow {
  display: inline-flex !important;
  align-items: center;
  font-size: 12px;
}

/* --- MOBILE DROPDOWN: Remove sub-menu left padding --- */
.elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu {
  padding-left: 0px !important;
}

/* --- CAROUSEL / PROJECTS SLIDER --- */
.elementor-widget-media-carousel .elementor-swiper {
  position: relative;
  overflow: hidden;
}

.elementor-widget-media-carousel .elementor-main-swiper {
  height: 400px !important;
  overflow: hidden !important;
}

.elementor-widget-media-carousel .swiper-wrapper {
  display: flex !important;
  overflow: visible !important;
  height: 100% !important;
  transition: transform 0.4s ease !important;
}

.elementor-widget-media-carousel .swiper-slide {
  display: block !important;
  flex: 0 0 33.3333% !important;
  max-width: 33.3333% !important;
  height: 100% !important;
  padding: 0 5px;
  box-sizing: border-box;
}

.elementor-widget-media-carousel .swiper-slide a {
  display: block;
  height: 100%;
}

.elementor-widget-media-carousel .elementor-carousel-image {
  width: 100% !important;
  height: 100% !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border-radius: 4px;
}

.elementor-widget-media-carousel .elementor-swiper-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 18px;
}

.elementor-widget-media-carousel .elementor-swiper-button:hover {
  background: rgba(0,0,0,0.75);
}

.elementor-widget-media-carousel .elementor-swiper-button-prev {
  left: 10px;
}

.elementor-widget-media-carousel .elementor-swiper-button-next {
  right: 10px;
}

@media (max-width: 1024px) {
  .elementor-widget-media-carousel .swiper-slide {
    display: block !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
}

@media (max-width: 600px) {
  .elementor-widget-media-carousel .swiper-slide {
    display: block !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

/* --- GALLERY FIX: CSS Grid replacement for broken masonry --- */
/* Override e-gallery-masonry absolute positioning with CSS grid */
.e-gallery-container.e-gallery-masonry {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 10px !important;
  padding-bottom: 0 !important;
  height: auto !important;
  margin-bottom: 0 !important;
  position: relative !important;
}

@media (max-width: 1024px) {
  .e-gallery-container.e-gallery-masonry {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 600px) {
  .e-gallery-container.e-gallery-masonry {
    grid-template-columns: 1fr !important;
  }
}

/* Override masonry absolute positioning on items */
.e-gallery-masonry .e-gallery-item,
.e-gallery--ltr.e-gallery-masonry .e-gallery-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  transform: none !important;
  opacity: 1 !important;
  overflow: hidden !important;
  border-radius: 4px;
  cursor: pointer;
  display: block !important;
}

.e-gallery-masonry .e-gallery-item.gallery-hidden {
  display: none !important;
}

/* Override masonry image padding-bottom with aspect ratio */
.e-gallery-masonry .e-gallery-image {
  padding-bottom: 100% !important;
  position: relative !important;
  width: 100% !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  transition: transform 0.3s ease;
}

.e-gallery-masonry .e-gallery-item:hover .e-gallery-image {
  transform: scale(1.05);
}

.elementor-gallery-item__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0);
  transition: background 0.3s ease;
  z-index: 1;
}

.e-gallery-item:hover .elementor-gallery-item__overlay {
  background: rgba(0,0,0,0.15);
}

/* Gallery filter tabs */
.elementor-gallery__titles-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.elementor-gallery-title {
  padding: 8px 20px;
  cursor: pointer;
  border: none;
  border-radius: 3px;
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none !important;
  color: #333 !important;
  outline: none !important;
}

.elementor-gallery-title:hover,
.elementor-gallery-title.active {
  color: #F37E21 !important;
  background: rgba(243, 126, 33, 0.05);
}

.elementor-gallery-title:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* --- LIGHTBOX --- */
.fst-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  cursor: pointer;
}

.fst-lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.fst-lightbox-overlay img {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.fst-lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 100000;
  line-height: 1;
  font-weight: 300;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fst-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 48px;
  cursor: pointer;
  padding: 20px;
  user-select: none;
  z-index: 100000;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.fst-lightbox-nav:hover {
  opacity: 1;
}

.fst-lightbox-prev {
  left: 10px;
}

.fst-lightbox-next {
  right: 10px;
}

/* --- CONTACT POPUP --- */
.fst-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  padding: 20px;
}

.fst-popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.fst-popup {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  max-width: 850px;
  width: 100%;
  max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  animation: fstPopupSlideIn 0.4s ease;
}

@keyframes fstPopupSlideIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.fst-popup-image {
  flex: 0 0 45%;
  background-size: cover;
  background-position: center;
  min-height: 400px;
}

.fst-popup-content {
  flex: 1;
  padding: 40px 35px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.fst-popup-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 28px;
  color: #666;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  z-index: 10;
  line-height: 1;
}

.fst-popup-close:hover {
  background: rgba(0,0,0,0.08);
  color: #333;
}

.fst-popup-content h2 {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 32px;
  font-weight: 900;
  color: #222;
  margin: 0 0 10px 0;
  line-height: 1.2;
  text-align: center;
}

.fst-popup-content .popup-subtitle {
  color: #555;
  font-size: 15px;
  margin-bottom: 15px;
  line-height: 1.5;
  text-align: center;
}

.fst-popup-content .popup-phone {
  display: block;
  background: none;
  color: #F37E21 !important;
  text-decoration: none !important;
  padding: 8px 0;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
  transition: color 0.2s;
}

.fst-popup-content .popup-phone:hover {
  color: #e06d10 !important;
}

.fst-popup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fst-popup-form .form-row {
  display: flex;
  gap: 12px;
}

.fst-popup-form input,
.fst-popup-form textarea,
.fst-popup-form select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: 'Lato', sans-serif;
  font-size: 15px;
  color: #333;
  background: #faf4ef;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.fst-popup-form input:focus,
.fst-popup-form textarea:focus,
.fst-popup-form select:focus {
  outline: none;
  border-color: #F37E21;
}

.fst-popup-form textarea {
  resize: vertical;
  min-height: 80px;
}

.fst-popup-form button {
  background: #F37E21;
  color: #fff;
  border: none;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  transition: background 0.2s;
  margin-top: 5px;
}

.fst-popup-form button:hover {
  background: #e06d10;
}

@media (max-width: 700px) {
  .fst-popup {
    flex-direction: column;
    max-height: 95vh;
  }
  .fst-popup-image {
    min-height: 180px;
    flex: 0 0 180px;
  }
  .fst-popup-content {
    padding: 25px 20px;
  }
  .fst-popup-content h2 {
    font-size: 26px;
  }
  .fst-popup-form .form-row {
    flex-direction: column;
    gap: 12px;
  }
}
