/* ============================================
   CUSTOM OVERRIDES — Briggs & Nins Construction
   Brand Colors:
     Primary Green: #4E964C
     CTA Red: #C32B09
     Accent Blue: #1e73be
     Header BG: #ffffff
     Text: #222222
   ============================================ */

/* --- 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: #ffffff !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Override inline fixed positioning from Elementor */
header .elementor-section.elementor-sticky {
  position: relative !important;
  width: 100% !important;
  top: auto !important;
}

.elementor-sticky__spacer {
  display: none !important;
}

.elementor-sticky--active {
  left: 0 !important;
  width: 100% !important;
}

/* --- Blog: Hide featured image in hero section --- */
.elementor-widget-theme-post-featured-image {
  display: none !important;
}

/* --- Fix: Menu caret arrows --- */
.menu-item-has-children > a .sub-arrow {
  display: inline-flex !important;
  align-items: center;
  margin-left: 5px;
}

.menu-item-has-children > a .sub-arrow i {
  font-size: 12px;
}

/* --- Fix: Text+Image section image height matching --- */
/* Make two-column sections stretch columns to equal height */
/* Exclude hero sections (min-height) so CTA cards stay naturally sized */
.elementor-section-content-middle:not(.elementor-section-height-min-height) > .elementor-container {
  align-items: stretch !important;
}

.elementor-section-content-middle .elementor-column {
  display: flex !important;
}

.elementor-section-content-middle .elementor-widget-wrap {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

/* Make images in two-column sections fill their container height */
.elementor-section-content-middle .elementor-widget-image {
  flex: 1;
  display: flex;
}

.elementor-section-content-middle .elementor-widget-image .elementor-widget-container {
  flex: 1;
  display: flex;
}

.elementor-section-content-middle .elementor-widget-image .elementor-widget-container a {
  flex: 1;
  display: flex;
}

.elementor-section-content-middle .elementor-widget-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  max-height: 500px;
}

/* On mobile, reset to natural height */
@media (max-width: 768px) {
  .elementor-section-content-middle .elementor-widget-image img {
    height: auto;
    max-height: none;
  }
}

/* --- Fix 3: Desktop Dropdown Menu — Flyout Submenu --- */
/* Only apply desktop dropdown styles above tablet breakpoint */
@media (min-width: 1025px) {
  .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;
    border-radius: 0 0 4px 4px;
    z-index: 10000 !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    list-style: none !important;
  }

  .elementor-nav-menu--main .menu-item-has-children:hover > .sub-menu {
    display: block !important;
  }

  /* Submenu link items with inline caret */
  .elementor-nav-menu--main .sub-menu li {
    display: block !important;
    width: 100% !important;
  }

  .elementor-nav-menu--main .sub-menu li a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 11px 22px !important;
    font-size: 14px;
    color: #222 !important;
    text-decoration: none !important;
    white-space: normal;
    word-wrap: break-word;
    transition: background 0.2s, color 0.2s;
  }

  .elementor-nav-menu--main .sub-menu li a:hover {
    background: #4E964C !important;
    color: #fff !important;
  }

  /* Caret/arrow inline fix */
  .elementor-nav-menu--main .sub-menu .menu-item-has-children > a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .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 !important;
  }
}

/* --- Mobile nav: full-width dropdown below header --- */
@media (max-width: 1024px) {
  /* Allow dropdown to escape the 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;
  }

  /* Position dropdown below header using fixed */
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    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;
    transform: scaleY(1) !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
  }

  /* Keep hamburger toggle above the dropdown */
  .elementor-menu-toggle {
    position: relative;
    z-index: 99999 !important;
  }

  /* Override Elementor's --menu-height: 0 freeze */
  .elementor-nav-menu--toggle .elementor-menu-toggle.elementor-active + .elementor-nav-menu__container {
    max-height: calc(100vh - 80px) !important;
    transform: scaleY(1) !important;
  }

  /* Override the stretch absolute positioning */
  .elementor-nav-menu--stretch .elementor-nav-menu__container.elementor-nav-menu--dropdown {
    position: fixed !important;
    width: 100vw !important;
    left: 0 !important;
  }

  /* Mobile menu items styling */
  .elementor-nav-menu--dropdown .elementor-nav-menu {
    padding: 10px 0 !important;
  }

  .elementor-nav-menu--dropdown .elementor-nav-menu li a {
    padding: 12px 24px !important;
    font-size: 16px !important;
    color: #222 !important;
    border-bottom: 1px solid #f0f0f0;
  }

  .elementor-nav-menu--dropdown .elementor-nav-menu li a:hover,
  .elementor-nav-menu--dropdown .elementor-nav-menu li a:focus {
    background: #4E964C !important;
    color: #fff !important;
  }

  /* Sub-menu items indent */
  .elementor-nav-menu--dropdown .sub-menu li a {
    padding-left: 40px !important;
    font-size: 15px !important;
  }

  /* Sub-arrow caret styling */
  .elementor-nav-menu--dropdown .sub-arrow {
    float: right;
    padding: 0 8px;
  }
}

/* --- Fix 4: Gallery Masonry Layout --- */
.e-gallery-container.e-gallery-masonry {
  columns: 4 !important;
  column-gap: 10px !important;
  display: block !important;
  position: relative !important;
  padding-bottom: 0 !important;
  height: auto !important;
}

@media (max-width: 1024px) {
  .e-gallery-container.e-gallery-masonry {
    columns: 3 !important;
  }
}

@media (max-width: 768px) {
  .e-gallery-container.e-gallery-masonry {
    columns: 2 !important;
  }
}

.e-gallery-item.elementor-gallery-item {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  break-inside: avoid !important;
  margin-bottom: 10px !important;
}

/* Only force display:block when not filtered out by JS */
.e-gallery-item.elementor-gallery-item:not([style*="display: none"]) {
  display: block !important;
}

/* Remove hidden class from gallery items */
.e-gallery-item--hidden {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Override lazyload opacity — Elementor hides unloaded images */
.e-gallery--lazyload .e-gallery-image {
  filter: none !important;
  transform: none !important;
  opacity: 1 !important;
}

.e-gallery-image.elementor-gallery-item__image {
  width: 100% !important;
  padding-bottom: 0 !important;
  background-size: cover !important;
  background-position: center !important;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
  min-height: 200px;
}

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

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

/* Gallery filter buttons */
.elementor-gallery__titles-container {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.elementor-gallery-title {
  padding: 8px 18px !important;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  text-decoration: none !important;
}

.elementor-gallery-title:hover,
.elementor-gallery-title.elementor-item-active {
  background: #4E964C !important;
  color: #fff !important;
  border-color: #4E964C !important;
}

/* --- Media Carousel (Project Gallery Sections) --- */
/* Un-freeze: show all slides and arrows for media carousels */
.elementor-widget-media-carousel .swiper-slide {
  display: block !important;
  flex-shrink: 0;
}

.elementor-widget-media-carousel .swiper-wrapper {
  display: flex !important;
  overflow: visible !important;
  transition-timing-function: ease;
}

.elementor-widget-media-carousel .elementor-swiper {
  overflow: hidden;
  position: relative;
}

.elementor-widget-media-carousel .elementor-main-swiper {
  overflow: hidden !important;
}

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

/* Arrow styling: black arrows, no circle background */
.elementor-widget-media-carousel .elementor-swiper-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 36px;
  height: 36px;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
  color: #000 !important;
  font-size: 24px;
  opacity: 0.7;
  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;
}

/* ===== Google Reviews Carousel ===== */
.google-reviews-section {
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.google-reviews-header {
  display: none;
}

.google-g-icon { flex-shrink: 0; }

.google-reviews-rating {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  font-family: Cabin, sans-serif;
}

.google-reviews-stars {
  color: #F4B400;
  font-size: 1.3rem;
  letter-spacing: 2px;
}

.google-reviews-carousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.google-reviews-carousel {
  overflow: hidden;
  flex: 1;
}

.google-reviews-track {
  display: flex;
  transition: transform 0.5s ease;
}

.google-review-card {
  flex: 0 0 calc(33.333% - 14px);
  margin: 0 7px;
  background: #F7F6F2;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.google-review-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.google-review-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  position: relative;
}

.google-review-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
  font-family: Cabin, sans-serif;
}

.google-review-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.google-review-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #222;
  font-family: Cabin, sans-serif;
}

.google-review-date {
  font-size: 0.8rem;
  color: #888;
}

.google-review-g {
  position: absolute;
  top: 0;
  right: 0;
  flex-shrink: 0;
}

.google-review-stars {
  color: #F4B400;
  font-size: 1rem;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.google-review-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #444;
  margin: 0;
}

.google-review-readmore,
.google-review-readless {
  color: #4E964C;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.88rem;
}

.google-review-readmore:hover,
.google-review-readless:hover {
  text-decoration: underline;
}

/* Navigation arrows — black, no background */
.google-reviews-arrow {
  background: none;
  border: none;
  font-size: 2.5rem;
  color: #000;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  transition: opacity 0.2s;
  flex-shrink: 0;
  user-select: none;
  opacity: 0.6;
}

.google-reviews-arrow:hover {
  opacity: 1;
  background: none;
  color: #000;
}

/* Responsive */
@media (max-width: 1024px) {
  .google-review-card {
    flex: 0 0 calc(50% - 14px);
  }
}

@media (max-width: 640px) {
  .google-review-card {
    flex: 0 0 calc(100% - 14px);
  }
  .google-reviews-section {
    padding: 30px 15px;
  }
  .google-reviews-arrow {
    font-size: 2rem;
    padding: 0 4px;
  }
}

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

/* --- Lightbox Styles --- */
#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); }
}
