/* ===== Fix 1: Sticky Header ===== */
.elementor-location-header,
header[data-elementor-type="header"] {
  position: sticky;
  top: 0;
  z-index: 9999;
  width: 100%;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.elementor-sticky__spacer { display: none !important; }

.elementor-sticky--active {
  left: 0 !important;
  width: 100% !important;
}

/* ===== Mobile Nav Dropdown ===== */
@media (max-width: 1024px) {
  /* Let the nav widget container be the positioning context */
  .elementor-widget-nav-menu {
    position: static !important;
  }

  /* Make the dropdown span full viewport width */
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    overflow: visible !important;
    background: #fff !important;
    position: fixed !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    z-index: 9998 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-top: 3px solid #e8751a !important;
    margin-top: 0 !important;
  }

  .elementor-nav-menu--toggle .elementor-menu-toggle.elementor-active + .elementor-nav-menu__container {
    overflow: visible !important;
    max-height: none !important;
  }

  /* Mobile dropdown menu items — full width, centered */
  .elementor-nav-menu--dropdown a,
  .elementor-nav-menu--dropdown .elementor-item,
  .elementor-nav-menu--dropdown .elementor-sub-item {
    padding: 14px 20px !important;
    color: #333 !important;
    text-align: center !important;
    justify-content: center !important;
    border-bottom: 1px solid #f0f0f0;
    white-space: normal !important;
  }

  /* Active item — orange background */
  .elementor-nav-menu--dropdown .elementor-item-active,
  .elementor-nav-menu--dropdown .elementor-item.highlighted,
  .elementor-nav-menu--dropdown a.current {
    background-color: #e8751a !important;
    color: #fff !important;
  }

  /* Mobile sub-menus: show inline, full width */
  .elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu,
  .elementor-nav-menu--dropdown .menu-item-has-children > ul {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    box-shadow: none !important;
    background: #f7f7f7 !important;
    border-radius: 0 !important;
    padding: 0 !important;
  }

  .elementor-nav-menu--dropdown .sub-menu li a {
    padding: 12px 20px 12px 40px !important;
    font-size: 14px !important;
    text-align: center !important;
    justify-content: center !important;
  }

  /* Keep menu text and sub-arrow 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: 6px !important;
    white-space: nowrap !important;
  }

  .elementor-nav-menu--dropdown .menu-item-has-children > a .sub-arrow {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0;
  }

  /* Caret points down (not right) */
  .elementor-nav-menu--dropdown .sub-arrow i {
    transform: rotate(0deg) !important;
  }
}

/* ===== Hero Section — 100vh min-height ===== */
.site-content > [data-elementor-type] > .elementor-top-section:first-child {
  min-height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  padding-top: 100px !important;
  padding-bottom: 100px !important;
  box-sizing: border-box;
}

.site-content > [data-elementor-type] > .elementor-top-section:first-child > .elementor-container {
  align-items: center !important;
}

/* ===== Fix 3: Desktop Dropdown Menu — Flyout Submenu (desktop only) ===== */
@media (min-width: 1025px) {
  .menu-item-has-children { position: relative; }

  .menu-item-has-children > .sub-menu,
  .menu-item-has-children > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff !important;
    min-width: 280px;
    width: max-content !important;
    max-width: 420px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    border-radius: 0 0 4px 4px;
    z-index: 10000;
    padding: 6px 0;
    overflow: visible !important;
  }

  /* Override Elementor's narrow 12em dropdown width */
  .elementor-nav-menu--main .elementor-nav-menu ul,
  .elementor-nav-menu--main .menu-item-has-children .sub-menu,
  .elementor-nav-menu--main .menu-item-has-children ul {
    width: max-content !important;
    min-width: 280px;
    max-width: 420px;
  }

  .menu-item-has-children:hover > .sub-menu,
  .menu-item-has-children:hover > ul {
    display: block;
  }

  .sub-menu li a,
  .menu-item-has-children ul li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 22px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    white-space: normal;
    word-wrap: break-word;
    transition: background 0.2s, color 0.2s;
  }

  .sub-menu li a:hover,
  .menu-item-has-children ul li a:hover {
    background: #1e73be;
    color: #fff;
  }

  /* Caret/arrow inline fix */
  .sub-menu .menu-item-has-children > a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .sub-menu .menu-item-has-children > a .sub-arrow,
  .sub-menu .menu-item-has-children > a::after {
    display: inline-flex;
    flex-shrink: 0;
    margin-left: auto;
  }

  .sub-menu .menu-item-has-children > a .sub-arrow {
    display: inline-flex !important;
    align-items: center;
  }

  .sub-menu .menu-item-has-children > a .sub-arrow i {
    transform: rotate(-90deg) !important;
  }

  /* Nested flyout submenu (opens to the right) */
  .sub-menu .menu-item-has-children > .sub-menu,
  .sub-menu .menu-item-has-children > ul {
    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;
  }

  /* Ensure header doesn't clip dropdowns */
  .elementor-location-header,
  header[data-elementor-type="header"],
  .elementor-location-header .elementor-section,
  .elementor-location-header .elementor-container,
  .elementor-location-header .elementor-column,
  .elementor-location-header .elementor-widget-wrap,
  .elementor-location-header .elementor-widget {
    overflow: visible !important;
  }
}

/* ===== Fix 4: Gallery — 4-Column Grid & Lightbox ===== */
.e-gallery-container.e-gallery-masonry {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px !important;
  position: relative !important;
  padding-bottom: 0 !important;
  height: auto !important;
}

.e-gallery-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: auto !important;
  height: auto !important;
  transform: none !important;
  overflow: hidden;
  border-radius: 4px;
}

.e-gallery-image {
  width: 100%;
  height: 100%;
  min-height: 250px;
  background-size: cover !important;
  background-position: center !important;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.e-gallery-item:hover .e-gallery-image {
  transform: scale(1.05);
}

@media (max-width: 1024px) {
  .e-gallery-container.e-gallery-masonry {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .e-gallery-container.e-gallery-masonry {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .e-gallery-container.e-gallery-masonry {
    grid-template-columns: 1fr;
  }
}

/* Lightbox Overlay */
#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;
}
