/* ============================================
   CUSTOM OVERRIDES — Lex Handyman LLC
   Static site fixes for WP/Elementor conversion
   ============================================ */

/* === Fix 1: Sticky Header === */
.elementor-location-header,
header[data-elementor-type="header"] {
  position: sticky !important;
  top: 0;
  z-index: 9999;
  width: 100% !important;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Remove frozen fixed positioning from inner sticky section */
.elementor-location-header .elementor-sticky {
  position: relative !important;
  width: 100% !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  top: auto !important;
}

/* Hide the sticky spacer duplicate */
.elementor-sticky__spacer {
  display: none !important;
}

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


/* === Fix 3A: Desktop Dropdown Navigation === */
@media (min-width: 1025px) {
  /* Hide mobile dropdown and hamburger on desktop */
  .elementor-menu-toggle {
    display: none !important;
  }

  /* Desktop flyout submenus */
  .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: #ffffff !important;
    min-width: 280px;
    width: max-content;
    max-width: 420px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14) !important;
    z-index: 10000 !important;
    padding: 0;
    list-style: none;
  }

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

  /* Nested flyout to the right */
  .elementor-nav-menu--main .sub-menu .menu-item-has-children > .sub-menu {
    position: absolute !important;
    top: 0 !important;
    left: 100% !important;
    background: #ffffff !important;
    z-index: 10001 !important;
  }

  .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: 10px 20px;
    color: #222222;
    text-decoration: none;
    white-space: normal !important;
    font-size: 15px;
    border-bottom: 1px solid #f0f0f0;
  }

  .elementor-nav-menu--main .sub-menu a:hover {
    background: #f0f0f0;
    color: #1e73be;
  }

  /* Sub-arrow caret — keep inline after text */
  .elementor-nav-menu--main .sub-arrow {
    display: inline-flex !important;
    align-items: center;
    margin-left: 8px;
    flex-shrink: 0;
  }

  .elementor-nav-menu--main .sub-menu .sub-arrow i {
    transform: rotate(-90deg);
    font-size: 12px;
  }

  /* Top-level nav links with carets — keep inline */
  .elementor-nav-menu--main > ul > li > a {
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap;
  }

  .elementor-nav-menu--main > ul > li > a .sub-arrow {
    margin-left: 5px;
  }
}


/* === Fix 3B: Mobile/Tablet Navigation === */
@media (max-width: 1024px) {
  /* Hide desktop nav on mobile */
  .elementor-nav-menu--main {
    display: none !important;
  }

  /* Show hamburger */
  .elementor-menu-toggle {
    display: flex !important;
    z-index: 99999 !important;
    cursor: pointer;
  }

  /* Allow dropdown to escape 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;
  }

  /* Mobile dropdown — positioning and styling (display controlled by inline nav-scope-fix) */
  .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: #ffffff !important;
    overflow-y: auto !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
    /* Override widget CSS that hides via max-height/transform instead of display */
    transform: none !important;
  }

  /* Override widget CSS: hide when NOT active (uses max-height:0 + scaleY(0)) */
  .elementor-nav-menu--toggle .elementor-menu-toggle:not(.elementor-active) + .elementor-nav-menu__container {
    max-height: 0 !important;
    overflow: hidden !important;
    transform: scaleY(0) !important;
  }

  /* Override widget CSS: show when active (fix frozen --menu-height: 0) */
  .elementor-nav-menu--toggle .elementor-menu-toggle.elementor-active + .elementor-nav-menu__container {
    max-height: calc(100vh - 80px) !important;
    transform: scaleY(1) !important;
    overflow-y: auto !important;
  }

  /* Override tablet dropdown overflow:hidden from widget CSS */
  .elementor-nav-menu--dropdown-tablet nav.elementor-nav-menu--dropdown.elementor-nav-menu__container {
    overflow-y: auto !important;
  }

  /* Mobile sub-menus: accordion style */
  .elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu {
    display: none !important;
    position: static !important;
    box-shadow: none !important;
    background: transparent !important;
    padding-left: 15px !important;
    width: 100% !important;
  }

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

  /* Mobile menu link styling — centered text */
  .elementor-nav-menu--dropdown li a {
    display: block;
    padding: 14px 20px;
    color: #222222;
    text-decoration: none;
    text-align: center;
    font-size: 16px;
    border-bottom: 1px solid #f0f0f0;
  }

  .elementor-nav-menu--dropdown li a:hover {
    color: #1e73be;
  }

  /* Center sub-arrow carets on mobile */
  .elementor-nav-menu--dropdown .sub-arrow {
    display: inline-flex;
    margin-left: 6px;
  }

  /* Stretch mode fix */
  .elementor-nav-menu--stretch .elementor-nav-menu__container.elementor-nav-menu--dropdown {
    position: fixed !important;
    width: 100vw !important;
    left: 0 !important;
  }
}


/* === Fix 4: Gallery Grid & Lightbox === */

/* Fix gallery grid layout */
.e-gallery-container.e-gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  position: relative !important;
}

.e-gallery-container.e-gallery-grid .e-gallery-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: auto !important;
  height: auto !important;
}

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

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

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

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

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

.elementor-gallery-title {
  padding: 8px 18px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  background: #f0f0f0;
  color: #222222;
}

.elementor-gallery-title.active,
.elementor-gallery-title.elementor-item-active,
.elementor-gallery-title:hover {
  background: #3D1669;
  color: #ffffff;
}

/* Hide gallery overlay text (filename/desc) */
.elementor-gallery-item__overlay {
  display: none !important;
}


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


/* === Lightbox Styles === */
#lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  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); }
}


/* === Service Card Image Consistency (outdoor page + similar service card layouts) === */
.elementor-413 .elementor-element-7fcd7aa img,
.elementor-413 .elementor-element-e556261 img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

@media (max-width: 768px) {
  .elementor-413 .elementor-element-7fcd7aa img,
  .elementor-413 .elementor-element-e556261 img {
    height: 220px;
  }
}


/* === Misc Cleanup === */

/* Remove broken carousel freeze that hides slides */
.elementor-widget-image-carousel .swiper-slide:not(:first-child) {
  display: block !important;
}

/* Fix srcset external URLs being broken by removing specific sizing */
img[srcset*="lexhandyman.com"] {
  srcset: none;
}


/* ============================================
   ADAPT FORMS — replaces Gravity Forms
   ============================================ */

.adapt-form-wrapper {
  width: 100%;
  font-family: inherit;
}

.adapt-form-wrapper .adapt-quote-form,
.adapt-form-wrapper .adapt-contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.adapt-form-wrapper .adapt-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .adapt-form-wrapper .adapt-form-row { grid-template-columns: 1fr; }
}

.adapt-form-wrapper .adapt-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.adapt-form-wrapper .adapt-form-field label {
  font-size: 13px;
  font-weight: 600;
  color: #2b2b2b;
  letter-spacing: 0.01em;
  text-transform: none;
}

.adapt-form-wrapper .adapt-form-field .required {
  color: #c9342c;
  font-weight: 700;
  margin-left: 2px;
}

.adapt-form-wrapper input[type="text"],
.adapt-form-wrapper input[type="tel"],
.adapt-form-wrapper input[type="email"],
.adapt-form-wrapper select,
.adapt-form-wrapper textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  color: #2b2b2b;
  background: #ffffff;
  border: 1.5px solid #d8d8d8;
  border-radius: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.adapt-form-wrapper select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236f6f6f' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px 7px;
  padding-right: 36px;
}

.adapt-form-wrapper textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
}

.adapt-form-wrapper input::placeholder,
.adapt-form-wrapper textarea::placeholder {
  color: #9a9a9a;
  opacity: 1;
}

.adapt-form-wrapper input:focus,
.adapt-form-wrapper select:focus,
.adapt-form-wrapper textarea:focus {
  outline: none;
  border-color: #6224a8;
  box-shadow: 0 0 0 3px rgba(98, 36, 168, 0.12);
}

.adapt-form-wrapper input.invalid,
.adapt-form-wrapper select.invalid,
.adapt-form-wrapper textarea.invalid {
  border-color: #c9342c;
  background-color: #fff5f5;
}

.adapt-form-wrapper .adapt-form-required-note {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: #6f6f6f;
}

/* Honeypot — visually hidden but in the layout (bots fill it; humans never see it) */
.adapt-form-wrapper .adapt-form-honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.adapt-form-wrapper .adapt-form-actions {
  margin-top: 6px;
}

.adapt-form-wrapper .adapt-form-submit {
  display: inline-block;
  width: 100%;
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(180deg, #7FD858 0%, #66D039 100%);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(102, 208, 57, 0.25);
}

.adapt-form-wrapper .adapt-form-submit:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 208, 57, 0.35);
}

.adapt-form-wrapper .adapt-form-submit:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(102, 208, 57, 0.25);
}

.adapt-form-wrapper .adapt-form-submit:disabled {
  filter: grayscale(0.4);
  cursor: not-allowed;
  transform: none;
}

.adapt-form-wrapper .adapt-form-status {
  font-size: 14px;
  min-height: 1em;
}

.adapt-form-wrapper .adapt-form-status.success {
  color: #1f7a1f;
  background: #e8f7e6;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid #1f7a1f;
}

.adapt-form-wrapper .adapt-form-status.error {
  color: #a81d18;
  background: #fdecec;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid #c9342c;
}

/* When form sits inside the homepage purple hero card, adjust palette */
.elementor-element-2728d62 .adapt-form-wrapper .adapt-form-field label,
.gform_wrapper .adapt-form-wrapper .adapt-form-field label {
  color: #2b2b2b;
}


/* ============================================
   MAP STATIC PLACEHOLDER (replaces Google iframe)
   ============================================ */

.adapt-map-link {
  display: block;
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #e8f0e7;
}

.adapt-map-link a {
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.adapt-map-link img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
}

.adapt-map-link .adapt-map-cta {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: #6224a8;
  color: #fff;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

.adapt-map-link a:hover .adapt-map-cta {
  background: #7a2cd0;
}
