/* ============================================
   Custom Overrides — Murrayhill Remodeling
   ============================================ */

/* === Fix 1: Sticky Header === */
.main-navigation,
#site-navigation,
#sticky-navigation {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  width: 100% !important;
  background: #20201d !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
/* Nav menu item text styling */
.main-nav .sf-menu > li > a {
  color: #e4e4e1 !important;
  text-transform: uppercase;
  font-size: 16px;
  font-weight: 400;
  line-height: 90px;
  font-family: 'Montserrat', sans-serif;
}
.main-nav .sf-menu > li > a:hover {
  color: #a59987 !important;
}
.main-nav .sf-menu > li.current-menu-item > a,
.main-nav .sf-menu > li.current_page_item > a {
  color: #fff !important;
}
/* Nav CTA button — matches original */
.main-nav .sf-menu > li.nav-cta > a {
  background: #ae400b !important;
  color: #fff !important;
  height: 50px;
  padding: 0 20px !important;
  line-height: 50px !important;
  border-radius: 2px;
  display: inline-block;
  margin-right: 15px;
  margin-left: 10px;
  text-transform: uppercase;
  font-size: 14px !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px;
}
.main-nav .sf-menu > li.nav-cta > a:hover {
  background: #8a3209 !important;
  color: #fff !important;
}
/* Hide the frozen sticky placeholder on homepage */
#sticky-placeholder { display: none !important; }
/* Hide frozen Elementor popup modal overlay */
.elementor-popup-modal,
.dialog-lightbox-widget { display: none !important; }

/* === Fix 3: Desktop Dropdown Navigation === */
@media (min-width: 1151px) {
  .main-nav .menu-item-has-children { position: relative; }
  .main-nav .menu-item-has-children > .sub-menu {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    z-index: 10000 !important;
    min-width: 220px;
    width: max-content;
    max-width: 320px;
    background: #1a1a17 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
    padding: 5px 0 !important;
    margin: 0 !important;
    list-style: none !important;
    border-radius: 0;
  }
  .main-nav .menu-item-has-children:hover > .sub-menu {
    display: block !important;
  }
  /* Nested flyout to the right — light background like original */
  .main-nav .sub-menu .menu-item-has-children > .sub-menu {
    position: absolute !important;
    top: 0 !important;
    left: 100% !important;
    background: #f5f5f2 !important;
    border-radius: 0;
  }
  .main-nav .sub-menu .menu-item-has-children > .sub-menu a {
    color: #333 !important;
  }
  .main-nav .sub-menu .menu-item-has-children > .sub-menu a:hover {
    background: #e8e8e5 !important;
    color: #ae400b !important;
  }
  .main-nav .sub-menu li {
    display: block !important;
    width: 100%;
  }
  .main-nav .sub-menu a {
    padding: 10px 20px !important;
    white-space: nowrap;
    display: block !important;
    color: #e4e4e1 !important;
    text-decoration: none;
    font-size: 14px;
    line-height: normal !important;
    text-transform: none;
  }
  .main-nav .sub-menu a:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #a59987 !important;
  }
  /* Desktop dropdown chevron — hide GP icon, show clean arrow */
  .main-nav .sf-menu .dropdown-menu-toggle {
    display: inline-block;
    padding-left: 5px;
    font-size: 0 !important;
    vertical-align: middle;
    cursor: pointer;
    line-height: 0;
  }
  .main-nav .sf-menu .dropdown-menu-toggle::after {
    content: '\25BE';
    font-size: 16px;
    font-family: sans-serif;
    opacity: 0.8;
  }
  /* Nested flyout arrow */
  .main-nav .sub-menu .menu-item-has-children > a .dropdown-menu-toggle::after {
    content: '\25B8' !important;
  }
  /* Hide hamburger on desktop */
  .menu-toggle { display: none !important; }
  /* Ensure desktop sub-menus and items display correctly */
  .main-nav > ul { display: block !important; }
}

/* === Fix 3: Mobile/Tablet Navigation === */
/* Let the inline GeneratePress CSS handle the mobile nav system. */
/* We only override what's missing or broken. */
@media (max-width: 1150px) {
  /* Ensure hamburger is visible and clickable */
  .menu-toggle {
    pointer-events: auto !important;
    min-width: 44px;
    min-height: 44px;
  }

  /* Center mobile menu text + keep arrow inline with text */
  .main-navigation.toggled .main-nav li {
    text-align: center !important;
  }
  .main-navigation.toggled .main-nav li a {
    text-align: center !important;
  }
  .main-navigation.toggled .menu-item-has-children .dropdown-menu-toggle {
    float: none !important;
    display: inline !important;
    padding: 0 0 0 5px !important;
  }

  /* Mobile CTA button */
  .main-navigation.toggled .main-nav .nav-cta > a {
    background: #ae400b !important;
    text-align: center !important;
    padding: 15px 20px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    height: auto !important;
    line-height: normal !important;
  }
}

/* === Fix 4: Gallery Grid Layout === */
/* Override masonry absolute positioning — must beat .e-gallery-masonry specificity */
.e-gallery-container.e-gallery-masonry,
.elementor-gallery__container.e-gallery-container {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  position: relative !important;
  height: auto !important;
  margin-bottom: 0 !important;
}
.e-gallery-masonry .e-gallery-item,
.elementor-gallery__container .e-gallery-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  height: auto !important;
  transform: none !important;
}
.e-gallery-masonry .e-gallery-image,
.elementor-gallery__container .e-gallery-image {
  width: 100%;
  padding-bottom: 75% !important; /* 4:3 aspect ratio */
  background-size: cover !important;
  background-position: center !important;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.elementor-gallery__container .e-gallery-item:hover .e-gallery-image {
  transform: scale(1.02);
}
/* Hide overlay title/description text in gallery */
.elementor-gallery-item__overlay { display: none !important; }

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

/* === Disable Elementor gallery lazyload hiding === */
.e-gallery--lazyload .e-gallery-image {
  filter: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* === Gallery page section bottom padding === */
.elementor-element-e2da029 {
  padding-bottom: 90px !important;
}
@media (max-width: 768px) {
  .elementor-element-e2da029 {
    padding-bottom: 60px !important;
  }
}

/* === Gallery Filter Tabs === */
.elementor-gallery__titles-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.elementor-gallery-title {
  padding: 8px 20px;
  cursor: pointer;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  transition: all 0.3s;
  text-decoration: none;
  color: #333;
}
.elementor-gallery-title:hover,
.elementor-gallery-title.elementor-item-active {
  border-color: #d14c12;
  color: #d14c12;
  background: rgba(209, 76, 18, 0.05);
}

/* === 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 7: Smooth Scroll === */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

/* === Prevent horizontal overflow (without breaking sticky) === */
body {
  overflow-x: clip;
}
.elementor-section-stretched {
  max-width: 100% !important;
  width: 100% !important;
  left: 0 !important;
  margin-left: 0 !important;
}
.elementor-section-full_width > .elementor-container {
  max-width: 100% !important;
}
.site, #page, .site-content {
  overflow-x: clip;
}

/* === Featured Image Fix === */
.featured-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* === Swiper Carousel Un-freeze === */
/* Override the conversion freeze CSS */
.elementor-swiper-button { display: flex !important; }
.swiper-wrapper {
  display: flex !important;
  overflow: visible !important;
  transition-property: transform;
}
.elementor-widget-media-carousel .swiper-slide,
.elementor-widget-image-carousel .swiper-slide {
  display: block !important;
  flex-shrink: 0 !important;
}
/* === Slideshow carousel (kitchens Project Gallery) === */
/* Main swiper — single large image */
.elementor-skin-slideshow .elementor-main-swiper:not(.elementor-thumbnails-swiper) {
  height: 450px;
  margin-bottom: 10px;
}
.elementor-carousel-image {
  width: 100%;
  height: 100%;
  background-size: cover !important;
  background-position: center !important;
}
/* Thumbnail strip below */
.elementor-skin-slideshow > .elementor-widget-container > .elementor-swiper:last-child {
  width: 100% !important;
}
.elementor-thumbnails-swiper {
  height: 90px !important;
  width: 100% !important;
}
.elementor-thumbnails-swiper .swiper-wrapper {
  width: 100% !important;
}
.elementor-thumbnails-swiper .swiper-slide {
  cursor: pointer;
  position: relative;
}
.elementor-thumbnails-swiper .swiper-slide:not(.swiper-slide-thumb-active)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
}
.elementor-thumbnails-swiper .elementor-carousel-image {
  height: 100%;
  width: 100%;
  aspect-ratio: 16/9;
}
@media (max-width: 1024px) {
  .elementor-skin-slideshow .elementor-main-swiper:not(.elementor-thumbnails-swiper) {
    height: 320px;
  }
}
@media (max-width: 768px) {
  .elementor-skin-slideshow .elementor-main-swiper:not(.elementor-thumbnails-swiper) {
    height: 250px;
  }
  .elementor-thumbnails-swiper { height: 60px !important; }
}
/* Swiper navigation arrows */
.elementor-swiper-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 44px;
  height: 44px;
  background: none !important;
  color: hsla(0, 0%, 93%, 0.9) !important;
  border: none;
  border-radius: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  transition: color 0.3s;
}
.elementor-swiper-button:hover {
  color: #fff !important;
  background: none !important;
}
.elementor-swiper-button-prev { left: 10px; }
.elementor-swiper-button-next { right: 10px; }
/* Swiper container */
.elementor-main-swiper {
  position: relative;
  overflow: hidden !important;
}

/* === Form-relay form styling === */
.ads-form ul.gform_fields,
.ads-form .gform_fields {
  list-style: none !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}
.ads-form ul.gform_fields > li,
.ads-form .gform_fields > li {
  list-style: none !important;
  margin-left: 0 !important;
  padding-left: 0 !important;
}
.ads-form ul.gform_fields > li::before,
.ads-form ul.gform_fields > li::marker,
.ads-form .gform_fields > li::before,
.ads-form .gform_fields > li::marker {
  content: none !important;
  display: none !important;
}
.ads-form .field-error {
  color: #c0392b;
  font-size: 13px;
  margin-top: 4px;
  font-family: 'Montserrat', sans-serif;
}
.ads-form input.has-error,
.ads-form textarea.has-error {
  border-color: #c0392b !important;
  box-shadow: 0 0 0 1px #c0392b;
}
.ads-form .form-message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 4px;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  display: none;
}
.ads-form .form-message--success {
  display: block;
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #66bb6a;
}
.ads-form .form-message--error {
  display: block;
  background: #fdecea;
  color: #b71c1c;
  border: 1px solid #ef5350;
}
.ads-form button[disabled],
.ads-form input[type="submit"][disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
