/* ============================================================
   Site fixes: navbar responsiveness, gallery, popup
   ============================================================ */

/* -------- NAVBAR FIXES -------- */
/* Kill the hardcoded 1440px inline widths on the sticky header */
header .elementor-sticky,
header section.elementor-top-section[data-id="5ce8b08a"] {
  width: 100% !important;
  max-width: 100% !important;
  left: 0 !important;
  right: 0 !important;
  box-sizing: border-box !important;
}

/* Inner container should be bounded and centered */
header .elementor-sticky > .elementor-container,
header section.elementor-top-section[data-id="5ce8b08a"] > .elementor-container {
  max-width: 1280px !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
  box-sizing: border-box !important;
}

/* Mobile slide-in dropdown nav:
   • span the full viewport (100vw) regardless of its parent's width
   • position: fixed so it breaks out of the narrow nav column
   • scrollable when taller than 70% of the screen
   Inline `width`/`left`/`top` from Elementor's JS are cleared by site-fixes.js
   so this CSS takes over. */
header nav.elementor-nav-menu--dropdown {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: 110px !important;            /* push dropdown below the sticky nav */
  width: 100vw !important;
  max-width: 100vw !important;
  max-height: 70vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box !important;
  z-index: 9998;
}
@media (max-width: 768px) {
  header nav.elementor-nav-menu--dropdown { top: 90px !important; }
}
@media (max-width: 480px) {
  header nav.elementor-nav-menu--dropdown { top: 80px !important; }
}

/* Logo image should scale on mobile */
#site-logo img {
  max-width: 100%;
  height: auto;
}

/* Hide desktop nav on tablet/mobile, show hamburger (right-aligned) */
@media (max-width: 1024px) {
  header .elementor-nav-menu--main { display: none !important; }
  header .elementor-menu-toggle { display: inline-flex !important; }
  header .elementor-col-25.elementor-hidden-tablet,
  header .elementor-col-25.elementor-hidden-mobile { display: none !important; }
  header .elementor-col-50 { width: 60% !important; }
  header .elementor-col-25:not(.elementor-hidden-tablet):not(.elementor-hidden-mobile) { width: 40% !important; }

  /* Push the hamburger toggle to the right edge of its column */
  header .elementor-widget-nav-menu > .elementor-widget-container {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
  }
  header .elementor-menu-toggle {
    margin-left: auto !important;
    margin-right: 0 !important;
  }
}

@media (max-width: 768px) {
  header .elementor-col-50 { width: 70% !important; }
  header .elementor-col-25:not(.elementor-hidden-tablet):not(.elementor-hidden-mobile) { width: 30% !important; }
  header #site-logo img { max-width: 240px; }
}

/* Dropdown panel (hamburger open): readable styling */
header nav.elementor-nav-menu--dropdown {
  background: #fff !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  border-top: 1px solid #eee;
}
header nav.elementor-nav-menu--dropdown ul {
  list-style: none; margin: 0; padding: 0;
}
header nav.elementor-nav-menu--dropdown a {
  padding: 15px 30px !important;
  display: block !important;
  border-bottom: 1px solid #f2f2f2;
  color: #222 !important;
  text-decoration: none !important;
  font-size: 17px !important;
  line-height: 1.3 !important;
  text-align: center !important;
}
header nav.elementor-nav-menu--dropdown a:hover {
  background: #f7f7f7;
}
/* Keep the sub-menu text centered too, without indenting one side only */
header nav.elementor-nav-menu--dropdown .sub-menu a {
  padding-left: 30px !important;
  padding-right: 30px !important;
  font-size: 16px !important;
  text-align: center !important;
}
header nav.elementor-nav-menu--dropdown .sub-menu .sub-menu a {
  padding-left: 30px !important;
  padding-right: 30px !important;
  font-size: 15px !important;
  text-align: center !important;
}

/* Kill the inline 15px left padding applied to mobile/tablet sub-menus
   (index.html's inline rule indents the open flyout — we want flush-left). */
header nav.elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu,
.elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
/* Caret arrows: center the text-with-arrow row */
header nav.elementor-nav-menu--dropdown .has-submenu {
  justify-content: center !important;
}

/* -------- DESKTOP NAV: inline caret + flyout submenus -------- */
/* 1) Keep the caret inline with the link text.
      Elementor's CSS sets .sub-arrow { display:flex } which breaks it to a new line.
      Scope to .elementor-nav-menu--main so this doesn't make the mobile dropdown
      anchors `inline-flex` (which would break their `text-align: center`). */
header .elementor-nav-menu--main .elementor-item.has-submenu,
header .elementor-nav-menu--main .elementor-sub-item.has-submenu {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

/* Mobile dropdown nav anchors: force block + centered text, even with caret */
header nav.elementor-nav-menu--dropdown .elementor-item,
header nav.elementor-nav-menu--dropdown .elementor-sub-item,
header nav.elementor-nav-menu--dropdown .elementor-item.has-submenu,
header nav.elementor-nav-menu--dropdown .elementor-sub-item.has-submenu {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 6px;
  text-align: center !important;
  width: 100% !important;
}
header .elementor-nav-menu .sub-arrow {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 0 0 4px !important;
  line-height: 1 !important;
  vertical-align: middle;
}
/* Parent submenu items (e.g. "Areas We Work In") should show a right-pointing caret
   because their submenu flies out to the right. */
header .elementor-nav-menu--main .sub-menu .menu-item-has-children > a .sub-arrow i,
header .elementor-nav-menu--main .sub-menu .menu-item-has-children > a .sub-arrow .e-font-icon-svg {
  transform: rotate(-90deg) !important;
}

/* 2) Flyout submenu (right of parent) on hover ------------------------- */
/* Top-level dropdowns open below their parent (top: 100%, left: 0). */
header .elementor-nav-menu--main > ul > li.menu-item-has-children { position: relative; }

/* Shared submenu appearance */
header .elementor-nav-menu--main .sub-menu {
  position: absolute !important;
  min-width: 220px;
  background: #ffffff !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  border-radius: 3px;
  padding: 6px 0 !important;
  margin: 0 !important;
  list-style: none !important;
  z-index: 9999;
  display: none !important;
  opacity: 0;
  transition: opacity .15s ease;
}
header .elementor-nav-menu--main > ul > li.menu-item-has-children > .sub-menu {
  top: 100% !important;
  left: 0 !important;
}

/* "Our Services" dropdown — 30px wider than the default 220px */
header .elementor-nav-menu--main > ul > li.menu-item-59 > .sub-menu {
  min-width: 250px !important;
}

/* "Areas We Work In" flyout submenu — force white background */
header .elementor-nav-menu--main .sub-menu li.menu-item-1008 > .sub-menu,
header .elementor-nav-menu--main li.menu-item-1008 > ul.sub-menu {
  background: #ffffff !important;
  background-color: #ffffff !important;
}
header .elementor-nav-menu--main li.menu-item-1008 > ul.sub-menu li,
header .elementor-nav-menu--main li.menu-item-1008 > ul.sub-menu a {
  background: #ffffff !important;
  background-color: #ffffff !important;
}
header .elementor-nav-menu--main li.menu-item-1008 > ul.sub-menu a:hover,
header .elementor-nav-menu--main li.menu-item-1008 > ul.sub-menu a:focus {
  background: #f4f4f4 !important;
}

/* Nested submenus (e.g., Areas We Work In → Spearfish/Sturgis/Deadwood):
   fly OUT to the right of their parent row, not below. */
header .elementor-nav-menu--main .sub-menu li.menu-item-has-children {
  position: relative;
}
header .elementor-nav-menu--main .sub-menu li.menu-item-has-children > .sub-menu {
  top: -6px !important;          /* align to top of parent li */
  left: 100% !important;
  margin-left: 2px !important;
}

/* Show on hover, and keep shown while cursor is inside the submenu itself */
header .elementor-nav-menu--main li.menu-item-has-children:hover > .sub-menu,
header .elementor-nav-menu--main li.menu-item-has-children:focus-within > .sub-menu {
  display: block !important;
  opacity: 1;
}

/* Invisible "bridge" to prevent hover loss when moving cursor from
   parent item to the flyout submenu */
header .elementor-nav-menu--main .sub-menu li.menu-item-has-children > .sub-menu::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  width: 6px;
  height: 100%;
}

/* Submenu item links */
header .elementor-nav-menu--main .sub-menu a {
  display: block !important;
  padding: 10px 18px !important;
  color: #222 !important;
  text-decoration: none !important;
  background: transparent !important;
  font-size: 15px;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
header .elementor-nav-menu--main .sub-menu a:hover,
header .elementor-nav-menu--main .sub-menu a:focus,
header .elementor-nav-menu--main .sub-menu li.sfHover > a {
  background: #f4f4f4 !important;
  color: #1fa4e0 !important;
}

/* Disable the mobile-only rules from Elementor that might try to force
   the nested submenu to display static/stacked on desktop. */
@media (min-width: 1025px) {
  header .elementor-nav-menu--main .sub-menu,
  header .elementor-nav-menu--main .sub-menu .sub-menu {
    position: absolute !important;
    float: none !important;
  }
}

/* -------- GALLERY FIXES -------- */
/* Override Elementor masonry positioning to a responsive CSS grid.
   This makes every thumbnail visible and clickable reliably. */
.elementor-widget-gallery .e-gallery-container.e-gallery-masonry,
.elementor-widget-gallery .e-gallery-container {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 10px !important;
  height: auto !important;
  padding-bottom: 0 !important;
  position: relative !important;
}

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

.elementor-widget-gallery .e-gallery-item {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  aspect-ratio: 4 / 3 !important;
  display: block !important;
  overflow: hidden;
  border-radius: 4px;
  background: #eee;
  cursor: pointer;
}

.elementor-widget-gallery .e-gallery-image {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  transition: transform .4s ease;
}

.elementor-widget-gallery .e-gallery-item:hover .e-gallery-image {
  transform: scale(1.05);
}

.elementor-widget-gallery .elementor-gallery-item__overlay {
  background: rgba(0,0,0,0);
  transition: background .3s ease;
}
.elementor-widget-gallery .e-gallery-item:hover .elementor-gallery-item__overlay {
  background: rgba(0,0,0,0.25);
}

/* -------- CUSTOM LIGHTBOX SLIDER -------- */
.pb-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
}
.pb-lightbox.pb-open { display: flex; }
.pb-lightbox__img-wrap {
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.pb-lightbox__img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  user-select: none;
}
.pb-lightbox__close,
.pb-lightbox__prev,
.pb-lightbox__next {
  position: absolute;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, transform .2s ease;
  z-index: 10;
  line-height: 1;
}
.pb-lightbox__close:hover,
.pb-lightbox__prev:hover,
.pb-lightbox__next:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.08);
}
.pb-lightbox__close { top: 20px; right: 20px; }
.pb-lightbox__prev  { left: 20px;  top: 50%; transform: translateY(-50%); }
.pb-lightbox__next  { right: 20px; top: 50%; transform: translateY(-50%); }
.pb-lightbox__prev:hover,
.pb-lightbox__next:hover { transform: translateY(-50%) scale(1.08); }
.pb-lightbox__caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-family: Roboto, sans-serif;
  font-size: 16px;
  background: rgba(0,0,0,0.5);
  padding: 8px 18px;
  border-radius: 4px;
  max-width: 80%;
  text-align: center;
}
.pb-lightbox__counter {
  position: absolute;
  top: 20px;
  left: 20px;
  color: #fff;
  font-family: Roboto, sans-serif;
  font-size: 14px;
  background: rgba(0,0,0,0.4);
  padding: 6px 14px;
  border-radius: 20px;
}
@media (max-width: 600px) {
  .pb-lightbox__prev, .pb-lightbox__next { width: 40px; height: 40px; font-size: 22px; }
  .pb-lightbox__prev { left: 10px; }
  .pb-lightbox__next { right: 10px; }
  .pb-lightbox { padding: 10px; }
  .pb-lightbox__caption { font-size: 14px; bottom: 10px; }
}

/* -------- GET IN TOUCH POPUP -------- */
.pb-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity .25s ease;
}
.pb-popup-overlay.pb-popup-open {
  display: flex;
  opacity: 1;
}
.pb-popup {
  background: #fff;
  max-width: 900px;
  width: 100%;
  max-height: 92vh;
  border-radius: 4px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  position: relative;
  font-family: Roboto, sans-serif;
}
.pb-popup__image {
  background-image: url("../images/deck-hero.jpg");
  background-size: cover;
  background-position: center;
  min-height: 400px;
}
.pb-popup__content {
  padding: 40px 40px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}
.pb-popup__title {
  font-family: "Bebas Neue", display, sans-serif;
  font-size: 36px;
  text-transform: uppercase;
  margin: 0 0 14px;
  color: #222;
  text-align: center;
  letter-spacing: 0.5px;
  line-height: 1.1;
}
.pb-popup__lead {
  margin: 0 0 14px;
  color: #333;
  font-size: 16px;
  text-align: center;
  line-height: 1.45;
}
.pb-popup__phone {
  display: block;
  text-align: center;
  font-size: 26px;
  font-weight: 500;
  color: #1fa4e0;
  text-decoration: none !important;
  margin: 4px 0 20px;
  font-family: "Bebas Neue", display, sans-serif;
  letter-spacing: 1px;
}
.pb-popup__phone:hover { color: #1785b6; }
.pb-popup__form { display: flex; flex-direction: column; gap: 10px; }
.pb-popup__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pb-popup__form input,
.pb-popup__form textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid #e0e0e0;
  background: #f5f5f5;
  color: #222;
  font-family: inherit;
  border-radius: 3px;
  box-sizing: border-box;
  outline: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.pb-popup__form input:focus,
.pb-popup__form textarea:focus {
  border-color: #1fa4e0;
  background: #f5f5f5;
}
.pb-popup__form input::placeholder,
.pb-popup__form textarea::placeholder {
  color: #7a7a7a;
}
.pb-popup__form textarea { resize: vertical; min-height: 48px; }
.pb-popup__submit {
  background: #ECA809;
  color: #fff;
  border: none;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  text-transform: none;
  cursor: pointer;
  border-radius: 3px;
  margin-top: 4px;
  font-family: inherit;
  transition: background .15s ease;
}
.pb-popup__submit:hover { background: #d69607; }
.pb-popup__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #222;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .15s ease;
  line-height: 1;
}
.pb-popup__close:hover { background: rgba(0,0,0,.08); }
.pb-popup__success {
  text-align: center;
  padding: 30px 10px;
  color: #1a7f1a;
  font-size: 18px;
  font-weight: 500;
  display: none;
}
.pb-popup__success.pb-show { display: block; }
.pb-popup__form.pb-hide { display: none; }

@media (max-width: 768px) {
  .pb-popup { grid-template-columns: 1fr; max-height: 96vh; }
  .pb-popup__image { min-height: 160px; display: block; }
  .pb-popup__content { padding: 28px 22px; }
  .pb-popup__title { font-size: 30px; }
  .pb-popup__phone { font-size: 22px; }
}

body.pb-popup-locked,
body.pb-lightbox-locked {
  overflow: hidden;
}

/* -------- CRAFTSMANSHIP SLIDER -------- */
.pb-craft-slider {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: transparent;
  border-radius: 0;
}
.pb-craft-slider__viewport {
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 5;
  max-height: 520px;
}
.pb-craft-slider__track {
  display: flex;
  height: 100%;
  transition: transform .5s ease;
  will-change: transform;
  gap: 2px;
}
.pb-craft-slide {
  flex: 0 0 calc((100% - 4px) / 3);   /* 3 per view on desktop, 2 gaps × 2px */
  height: 100%;
  position: relative;
  background: transparent;
  overflow: hidden;
  border-radius: 0;
}
@media (max-width: 1024px) {
  .pb-craft-slider__viewport { aspect-ratio: 16 / 7; }
  .pb-craft-slide { flex: 0 0 calc((100% - 2px) / 2); }  /* 2 per view on tablet */
}
@media (max-width: 600px) {
  .pb-craft-slider__viewport { aspect-ratio: 4 / 3; }
  .pb-craft-slide { flex: 0 0 100%; }                    /* 1 per view on mobile */
  .pb-craft-slider__track { gap: 0; }
}
.pb-craft-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.pb-craft-slider__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background .2s ease, transform .2s ease;
}
.pb-craft-slider__btn:hover {
  background: rgba(0,0,0,0.75);
  transform: translateY(-50%) scale(1.08);
}
.pb-craft-slider__prev { left: 14px; }
.pb-craft-slider__next { right: 14px; }
.pb-craft-slider__dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 3;
}
.pb-craft-slider__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background .2s ease, transform .2s ease;
}
.pb-craft-slider__dot.is-active {
  background: #ECA809;
  transform: scale(1.25);
}
@media (max-width: 600px) {
  .pb-craft-slider__btn { width: 40px; height: 40px; font-size: 22px; }
  .pb-craft-slider__prev { left: 8px; }
  .pb-craft-slider__next { right: 8px; }
}
