/* ============================================
   CUSTOM OVERRIDES — Rooney Excavating
   Fixes for static site converted from WordPress
   ============================================ */

/* === Fix 1: Sticky Header === */
.elementor-location-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);
}

.elementor-location-header .elementor-section.elementor-sticky {
  position: relative !important;
  width: 100% !important;
  margin-top: 0 !important;
}

.elementor-sticky__spacer {
  display: none !important;
}

.elementor-sticky--active {
  left: 0 !important;
  width: 100% !important;
  position: relative !important;
}

.elementor-location-header.scrolled {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

/* === Fix 3-4: Desktop Dropdown Menus & Width === */
.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;
  z-index: 10000;
  min-width: 220px;
  width: max-content;
  max-width: 320px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
  border-radius: 0 0 4px 4px;
  padding: 6px 0;
  margin: 0;
  list-style: none;
}

.elementor-nav-menu--main .menu-item-has-children:hover > .sub-menu {
  display: block !important;
}

.elementor-nav-menu--main .sub-menu li {
  display: block !important;
  width: 100%;
}

.elementor-nav-menu--main .sub-menu a {
  display: block !important;
  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 a:hover {
  background: #F79D1B !important;
  color: #fff !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;
  border-radius: 4px !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14) !important;
  background: #fff !important;
  z-index: 10001 !important;
  min-width: 200px;
  width: max-content;
  max-width: 320px;
  padding: 6px 0 !important;
}

/* Sub-arrow caret — inline to the right of text */
.elementor-nav-menu--main .sub-menu a.has-submenu {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.elementor-nav-menu--main .sub-menu .sub-arrow {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

/* Rotate caret to point right for flyout items */
.elementor-nav-menu--main .sub-menu .sub-arrow i {
  transform: rotate(-90deg);
  font-size: 12px;
}

/* === Fix 5-6: Mobile/Tablet Nav Menu === */
@media (max-width: 1024px) {
  /* Full-width dropdown — break out of the 25% column */
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    background: #fff !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
    z-index: 10000 !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .elementor-menu-toggle.elementor-active + .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    display: block !important;
    transform: none !important;
  }

  /* Reset the inner UL */
  .elementor-nav-menu--dropdown .elementor-nav-menu {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
  }

  /* All menu items full width */
  .elementor-nav-menu--dropdown li {
    display: block !important;
    width: 100% !important;
    position: relative !important;
  }

  /* Base link styling — centered text */
  .elementor-nav-menu--dropdown a {
    display: block !important;
    padding: 14px 20px !important;
    text-align: center !important;
    font-size: 16px !important;
    color: #222 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #f0f0f0 !important;
    white-space: normal !important;
  }

  /* Items with sub-menus: flex layout for text + 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: 8px !important;
    text-align: center !important;
  }

  /* Caret arrow — inline, right of text */
  .elementor-nav-menu--dropdown .sub-arrow {
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.3s ease !important;
  }

  .elementor-nav-menu--dropdown .sub-arrow i {
    font-size: 12px !important;
  }

  /* Rotate caret when sub-menu is open */
  .elementor-nav-menu--dropdown .menu-item-has-children.sub-menu-open > a .sub-arrow {
    transform: rotate(180deg) !important;
  }

  /* Sub-menus: hidden by default, full width */
  .elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu {
    display: none !important;
    position: static !important;
    width: 100% !important;
    background: #f7f7f7 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    min-width: unset !important;
    max-width: unset !important;
  }

  /* Show sub-menu when parent is toggled open */
  .elementor-nav-menu--dropdown .menu-item-has-children.sub-menu-open > .sub-menu {
    display: block !important;
  }

  /* Sub-menu links — slightly indented, smaller */
  .elementor-nav-menu--dropdown .sub-menu a {
    padding: 12px 20px !important;
    font-size: 15px !important;
    color: #333 !important;
    background: #f7f7f7 !important;
  }

  .elementor-nav-menu--dropdown .sub-menu a:hover {
    background: #efefef !important;
  }

  /* Second-level nesting (Areas We Serve → cities) */
  .elementor-nav-menu--dropdown .sub-menu .sub-menu {
    background: #f0f0f0 !important;
  }

  .elementor-nav-menu--dropdown .sub-menu .sub-menu a {
    font-size: 14px !important;
    background: #f0f0f0 !important;
    color: #444 !important;
  }

  .elementor-nav-menu--dropdown .sub-menu .sub-menu a:hover {
    background: #e8e8e8 !important;
  }
}

/* === Fix 7: Gallery — Override lazy-load hiding === */
.e-gallery-image.e-gallery-image-loaded {
  filter: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* === Fix 7: Gallery Page — CSS Grid Override === */
.elementor-gallery__container.e-gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 10px !important;
  position: relative !important;
}

.e-gallery-item {
  position: relative !important;
  transform: none !important;
  width: auto !important;
  height: auto !important;
  left: auto !important;
  top: auto !important;
}

.e-gallery-item .e-gallery-image {
  width: 100% !important;
  aspect-ratio: 4/3;
  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);
}

@media (max-width: 1024px) {
  .elementor-gallery__container.e-gallery-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .elementor-gallery__container.e-gallery-grid {
    grid-template-columns: 1fr !important;
  }
}

/* === Fix 7D: 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); }
}

/* === Fix 11: Smooth Scroll === */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 120px;
}

/* === Fix 12: Un-freeze Swiper for review carousel === */
.ti-widget .reviews-swiper .swiper-wrapper {
  overflow: visible !important;
  display: flex !important;
  transition-timing-function: ease !important;
}

.ti-widget .reviews-swiper .swiper-slide,
.ti-widget-right .swiper-slide,
.reviews-swiper .swiper-slide {
  display: block !important;
  flex-shrink: 0 !important;
  opacity: 1 !important;
  max-width: none !important;
}

.ti-widget .reviews-swiper .swiper-slide:not(:first-child),
.ti-widget-right .swiper-slide:not(:first-child),
.reviews-swiper .swiper-slide:not(:first-child) {
  display: block !important;
}

/* === Fix 12: Review Carousel — TrustIndex Dark Style === */
.ti-widget {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 100%;
  font-family: Manrope, sans-serif;
}

/* Left panel — business info */
.ti-widget-left {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 20px;
  gap: 6px;
}

.ti-widget-left .ti-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 8px;
}

.ti-widget-left .ti-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ti-widget-left .ti-biz-name {
  font-weight: 700;
  font-size: 16px;
  color: #222;
  line-height: 1.3;
}

.ti-widget-left .ti-stars-summary {
  display: flex;
  gap: 2px;
  color: #f4a900;
  font-size: 22px;
  justify-content: center;
  line-height: 1;
  margin: 4px 0;
}

.ti-widget-left .ti-review-count {
  font-size: 13px;
  color: #555;
}

.ti-widget-left .ti-review-count a {
  color: #1a73e8 !important;
  text-decoration: none !important;
  font-weight: 500;
}

.ti-widget-left .ti-write-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 20px;
  border: 2px solid #222;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #222;
  text-decoration: none !important;
  transition: background 0.2s, color 0.2s;
}

.ti-widget-left .ti-write-btn:hover {
  background: #222;
  color: #fff;
}

/* Right panel — carousel */
.ti-widget-right {
  flex: 1;
  min-width: 0;
  position: relative;
  padding: 10px 0;
}

.ti-widget-right .swiper {
  overflow: hidden;
  padding: 5px 2px;
}

/* Dark review cards */
.ti-review-card {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  height: auto;
  color: #fff;
}

/* Card header — avatar + name + google icon */
.ti-review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ti-review-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.ti-review-name-block {
  flex: 1;
  min-width: 0;
}

.ti-review-name {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  line-height: 1.3;
}

.ti-review-date {
  font-size: 12px;
  color: #999;
  line-height: 1.4;
}

.ti-review-google {
  flex-shrink: 0;
}

.ti-review-google svg {
  width: 22px;
  height: 22px;
}

/* Stars + verified */
.ti-review-stars {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 12px;
}

.ti-review-stars .star {
  color: #f4a900;
  font-size: 18px;
  line-height: 1;
}

.ti-review-verified {
  display: inline-flex;
  margin-left: 6px;
}

.ti-review-verified svg {
  width: 16px;
  height: 16px;
}

/* Review text */
.ti-review-body {
  font-size: 14px;
  line-height: 1.65;
  color: #ddd;
  flex: 1;
}

.ti-review-body .review-full {
  display: none;
}

.ti-review-body.expanded .review-short {
  display: none;
}

.ti-review-body.expanded .review-full {
  display: inline;
}

.ti-read-more {
  color: #90caf9;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none !important;
  border: none;
  background: none;
  padding: 0;
  font-family: Manrope, sans-serif;
  display: inline;
  margin-top: 4px;
}

.ti-read-more:hover {
  text-decoration: underline !important;
  color: #bbdefb;
}

/* Swiper nav arrows — light on dark */
.ti-widget-right .swiper-button-prev,
.ti-widget-right .swiper-button-next {
  color: #ccc !important;
  width: 36px !important;
  height: 36px !important;
  top: 50% !important;
  background: transparent;
}

.ti-widget-right .swiper-button-prev::after,
.ti-widget-right .swiper-button-next::after {
  font-size: 20px !important;
  font-weight: 400;
}

.ti-widget-right .swiper-button-prev {
  left: 0px !important;
}

.ti-widget-right .swiper-button-next {
  right: 0px !important;
}

.ti-widget-right .swiper-button-prev:hover,
.ti-widget-right .swiper-button-next:hover {
  color: #fff !important;
}

/* Responsive */
@media (max-width: 768px) {
  .ti-widget {
    flex-direction: column;
  }

  .ti-widget-left {
    flex: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px 16px;
    gap: 4px 14px;
  }

  .ti-widget-left .ti-logo {
    width: 50px;
    height: 50px;
    margin-bottom: 0;
  }

  .ti-widget-left .ti-biz-name {
    font-size: 15px;
  }

  .ti-widget-left .ti-write-btn {
    margin-top: 4px;
  }

  .ti-review-card {
    min-height: 200px;
    padding: 18px 16px 16px;
  }

  .ti-widget-right .swiper-button-prev,
  .ti-widget-right .swiper-button-next {
    display: none !important;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .ti-widget-left {
    flex: 0 0 180px;
    padding: 20px 14px;
  }
}

/* === Fix 13: Image Height Matching === */
.elementor-section .elementor-container {
  align-items: stretch;
}

.elementor-section .elementor-widget-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
