/* ============================================
   CUSTOM OVERRIDES — Leids Carpentry LLC
   Fix static site issues from WP conversion
   ============================================ */

/* -------------------------------------------
   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;
  max-width: 100% !important;
}

/* Override frozen fixed positioning from WP capture */
.elementor-location-header .elementor-section.elementor-sticky,
.elementor-location-header .elementor-section.elementor-sticky--active {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  top: auto !important;
  left: auto !important;
  margin: 0 !important;
}

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

/* -------------------------------------------
   Fix 3: Navigation System
   ------------------------------------------- */

/* Desktop: hide mobile dropdown and hamburger */
@media (min-width: 1025px) {
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    display: none !important;
  }
  .elementor-menu-toggle {
    display: none !important;
  }

  /* Desktop dropdown submenus */
  .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;
    z-index: 10000 !important;
    padding: 8px 0 !important;
    border-radius: 4px;
    list-style: none !important;
  }
  .elementor-nav-menu--main .menu-item-has-children:hover > .sub-menu {
    display: block !important;
  }
  .elementor-nav-menu--main .sub-menu li a {
    padding: 8px 20px !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap;
    color: #222 !important;
    text-decoration: none !important;
    font-size: 15px !important;
  }
  /* Sub-arrow: inline after text, pointing right for nested flyout */
  .elementor-nav-menu--main .sub-menu .sub-arrow {
    display: inline-flex !important;
    margin-left: auto !important;
    padding-left: 8px !important;
  }
  .elementor-nav-menu--main .sub-menu .sub-arrow i,
  .elementor-nav-menu--main .sub-menu .sub-arrow svg {
    transform: rotate(-90deg) !important;
  }
  .elementor-nav-menu--main .sub-menu li a:hover {
    background: #f5f5f5 !important;
    color: #1e73be !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: #fff !important;
    z-index: 10001 !important;
  }
}

/* Tablet/Mobile: position the dropdown full-width 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;
  }

  .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;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
  }

  .elementor-menu-toggle { z-index: 99999 !important; }

  .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
   ------------------------------------------- */

/* Gallery masonry layout — 3 columns with CSS columns */
.e-gallery-masonry {
  height: auto !important;
  margin-bottom: 0 !important;
  display: block !important;
  column-count: 3 !important;
  column-gap: 10px !important;
}

@media (max-width: 1024px) {
  .e-gallery-masonry {
    column-count: 2 !important;
  }
}

@media (max-width: 768px) {
  .e-gallery-masonry {
    column-count: 1 !important;
  }
}

.e-gallery-masonry .e-gallery-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  height: auto !important;
  transform: none !important;
  display: inline-block !important;
  break-inside: avoid !important;
  margin-bottom: 10px !important;
}

.e-gallery-masonry .e-gallery-image {
  width: 100% !important;
  padding-bottom: var(--item-height, 75%) !important;
  height: 0 !important;
  background-size: cover !important;
  background-position: center !important;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

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

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

/* -------------------------------------------
   Lightbox CSS
   ------------------------------------------- */
#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: 100px;
}

/* -------------------------------------------
   Gallery Filter Buttons (active state)
   ------------------------------------------- */
/* -------------------------------------------
   Reviews Carousel Arrows — black, no background
   ------------------------------------------- */
.elementor-widget-reviews .elementor-swiper-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: none !important;
  color: #000 !important;
  font-size: 24px !important;
  width: 40px !important;
  height: 40px !important;
  cursor: pointer;
}
.elementor-widget-reviews .elementor-swiper-button i {
  color: #000 !important;
}
.elementor-widget-reviews .elementor-swiper-button:hover {
  opacity: 0.7;
}

/* Ensure swiper slides are visible */
.elementor-widget-reviews .swiper-slide {
  display: block !important;
  flex-shrink: 0;
}

.elementor-gallery-title.elementor-item-active {
  color: #1e73be !important;
  font-weight: 600;
}

/* ============================================
   ADAPT FORM (form-relay)
   ============================================ */
.adapt-form-wrapper {
  width: 100%;
}
.adapt-form {
  display: block;
  font-family: Poppins, sans-serif;
}
.adapt-form .form-required-legend {
  font-size: 13px;
  color: #666;
  margin: 0 0 14px;
}
.adapt-form .required {
  color: #c0392b;
  font-weight: 600;
}
.adapt-form fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 12px;
}
.adapt-form fieldset > legend {
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
  width: 100%;
  font-size: 16px;
}
.adapt-form .form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.adapt-form .form-row > .form-group {
  flex: 1 1 calc(50% - 6px);
  min-width: 200px;
}
.adapt-form .form-group {
  margin-bottom: 12px;
}
.adapt-form label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  font-size: 15px;
}
.adapt-form .sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.adapt-form input[type="text"],
.adapt-form input[type="email"],
.adapt-form input[type="tel"],
.adapt-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font: inherit;
  background: #fff;
  color: #222;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.adapt-form input:focus,
.adapt-form textarea:focus {
  outline: 0;
  border-color: #1e73be;
  box-shadow: 0 0 0 3px rgba(30, 115, 190, 0.15);
}
.adapt-form textarea {
  resize: vertical;
  min-height: 120px;
}
.adapt-form-submit {
  background: #1e73be;
  color: #fff;
  border: 0;
  padding: 12px 28px;
  font: inherit;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.adapt-form-submit:hover:not(:disabled),
.adapt-form-submit:focus-visible {
  background: #155a96;
}
.adapt-form-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.adapt-form-status {
  margin-top: 12px;
  font-size: 15px;
  min-height: 1.4em;
}
.adapt-form-status.is-success {
  color: #1e7d3a;
  font-weight: 500;
}
.adapt-form-status.is-error {
  color: #c0392b;
  font-weight: 500;
}
