/* Local / post-clone fixes — overrides for Duda-scraped CSS.
 *
 * Two things this file does:
 *
 * 1) Desktop: pins the contact-info header row so the main nav doesn't
 *    jump 8px between pages (Duda's JS column-height equalizer picks
 *    64 vs 72 depending on which scraped runtime bundle loads).
 *
 * 2) Mobile: the scrape only contains the DESKTOP HTML variant — Duda
 *    normally serves a separate mobile render. We don't have that, so
 *    these media queries make the desktop markup usable on phones:
 *    unlock the forced 768px min-width, stack the header rows, make
 *    the nav a vertical menu, scale down headline type, and prevent
 *    horizontal scrolling.
 */

/* -------------------------------------------------------------------
 * (1) Desktop — header row height equalization
 * ------------------------------------------------------------------- */

#dm .p_hfcontainer div.u_1810894964 { min-height: 82px; }
#dm .p_hfcontainer div.u_1803538726 { min-height: 82px; }
#dm .p_hfcontainer div.u_1803538726 > .dmRespColsWrapper { min-height: 72px; }
#dm .p_hfcontainer div.u_1000182092,
#dm .p_hfcontainer div.u_1679823859,
#dm .p_hfcontainer div.u_1729478202 { min-height: 72px; }


/* -------------------------------------------------------------------
 * (2) Mobile — make the desktop HTML viewable on phones (<= 767px)
 * ------------------------------------------------------------------- */
@media (max-width: 767px) {

  /* --- Kill horizontal overflow and the hard 768px layout width ---
   *
   * Duda's runtime injects inline <style> rules like
   *   .dmInner { min-width: 768px !important }
   * AFTER our <link> loads. Same specificity (0,0,1,0) + same !important +
   * later in cascade = they win. We bump specificity by prefixing every
   * selector with `html body.dmDesktopBody` (0,0,2,2) and target the
   * concrete IDs (0,1,0,0) so we beat both the class rule and any future
   * .dmDesktopBody .dmInner variants. */
  html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
    min-width: 0 !important;
  }
  html body#dm,
  html body.dmDesktopBody,
  html body.dmDesktopBody .dmOuter,
  html body.dmDesktopBody .dmInner,
  html body.dmDesktopBody .dmLayoutWrapper,
  html body.dmDesktopBody .standardHeaderLayout,
  html body.dmDesktopBody .dmHeaderContainer,
  html body.dmDesktopBody .dmHeader,
  html body.dmDesktopBody .dmHeaderResp,
  html body.dmDesktopBody .dmFooterResp,
  html body.dmDesktopBody .dmPageBody,
  html body.dmDesktopBody .allWrapper,
  html body.dmDesktopBody .dmContent,
  html body.dmDesktopBody #dmStyle_innerContainer,
  html body.dmDesktopBody #iscrollBody,
  html body.dmDesktopBody #site_content,
  html body.dmDesktopBody #hcontainer,
  html body.dmDesktopBody #dm-outer-wrapper,
  html body.dmDesktopBody #dmFirstContainer,
  html body.dmDesktopBody #allWrapper,
  html body.dmDesktopBody #dm_content,
  html body.dmDesktopBody #stickyHeaderSpacer {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    left: 0 !important;
  }

  /* --- Responsive columns: stack vertically --- */
  html body.dmDesktopBody .dmRespRow,
  html body.dmDesktopBody .dmRespColsWrapper {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  html body.dmDesktopBody .dmRespCol {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }

  /* --- Images never overflow viewport --- */
  img, video, iframe {
    max-width: 100% !important;
    height: auto !important;
  }

  /* --- Header: stack the contact row, relax our min-heights --- */
  #dm .p_hfcontainer div.u_1810894964,
  #dm .p_hfcontainer div.u_1803538726 {
    min-height: 0 !important;
    padding: 6px 12px !important;
  }
  #dm .p_hfcontainer div.u_1803538726 > .dmRespColsWrapper,
  #dm .p_hfcontainer div.u_1000182092,
  #dm .p_hfcontainer div.u_1679823859,
  #dm .p_hfcontainer div.u_1729478202 {
    min-height: 0 !important;
  }

  /* --- Main navigation: horizontal scrolling strip -------------------
   *
   * We keep the nav horizontal (no hamburger — would need extra markup)
   * and let it overflow-scroll left/right on touch. Submenus stay hidden
   * by default and pop out on tap like the desktop behavior.
   * --------------------------------------------------------------- */
  nav.unifiednav,
  nav.main-navigation {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  nav.unifiednav::-webkit-scrollbar,
  nav.main-navigation::-webkit-scrollbar { display: none !important; }

  nav.unifiednav .unifiednav__container,
  nav.main-navigation .unifiednav__container {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    width: max-content !important;
    min-width: 100% !important;
    justify-content: flex-start !important;
    padding: 0 4px !important;
  }
  nav.unifiednav .unifiednav__item-wrap,
  nav.main-navigation .unifiednav__item-wrap {
    flex: 0 0 auto !important;
  }
  nav.unifiednav .unifiednav__item,
  nav.main-navigation .unifiednav__item {
    white-space: nowrap !important;
    padding: 10px 14px !important;
    font-size: 15px !important;
  }

  /* --- Type: stop oversized headlines from overflowing ---
   *
   * Duda's runtime injects inline `<style>` blocks like
   *   .font-size-48, .size-48 { font-size: 48px !important }
   * after our stylesheet loads. To beat them we chain body + tag +
   * class to push specificity high enough (and keep !important).
   * We also scale by range so `font-size-42` etc. are caught. */
  html body h1, html body h2, html body h3,
  html body h4, html body h5, html body h6 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.15 !important;
  }
  html body [class*="size-48"],
  html body [class*="size-44"],
  html body [class*="size-42"],
  html body [class*="size-40"] {
    font-size: 26px !important;
    letter-spacing: normal !important;
  }
  html body [class*="size-38"],
  html body [class*="size-36"],
  html body [class*="size-34"] { font-size: 22px !important; }
  html body [class*="size-32"],
  html body [class*="size-30"],
  html body [class*="size-29"] { font-size: 18px !important; }
  html body [class*="size-24"],
  html body [class*="size-22"] { font-size: 16px !important; }

  /* --- Forms & buttons: fit within screen --- */
  input, textarea, select, button, .btn {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* --- Defang any elements Duda positioned absolutely off-canvas --- */
  [style*="position: absolute"], [style*="position:absolute"] {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
  }

  /* --- Unstick the header ---
   * Desktop has the contact-bar + nav as `position: fixed` (~417px tall).
   * On a 844px-tall phone screen that covers half the viewport and visually
   * overlaps the hero. Make it scroll with the page instead.
   *
   * The winning Duda rule is:
   *   html:not(.ios-preview) #dm .hasStickyHeader .dmInner div.dmHeaderContainer
   *   { position: fixed !important }   (specificity 0,1,4,2)
   * We match its full selector chain (so we tie on specificity) and rely on
   * source-order to win — our stylesheet loads after Duda's runtime CSS. */
  html:not(.ios-preview) body #dm .hasStickyHeader .dmInner div.dmHeaderContainer,
  html body #dm div.dmHeaderContainer,
  html body.dmDesktopBody .fHeader,
  html body.dmDesktopBody .d-header-wrapper {
    position: static !important;
    height: auto !important;
    transform: none !important;
  }
  html body.dmDesktopBody #stickyHeaderSpacer {
    display: none !important;
    height: 0 !important;
  }

  /* --- Hide the modal popup overlay (signup/quote prompt) --- */
  html body.dmDesktopBody #dmPopup,
  html body.dmDesktopBody .dmPopup {
    display: none !important;
  }

  /* --- Move the floating "Get a free quote" button out of the way ---
   * Desktop has it `position: fixed` mid-screen on the right; on phone
   * it lands on top of form fields. Pin it to the bottom-right corner. */
  html body.dmDesktopBody a[id="1857378229"],
  html body.dmDesktopBody .u_1857378229 {
    position: fixed !important;
    bottom: 12px !important;
    right: 12px !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    max-width: 70vw !important;
    z-index: 9999 !important;
  }

  /* --- Form widget headings: stop nowrap+ellipsis truncation ---
   * Desktop forms use `white-space: nowrap; text-overflow: ellipsis;`
   * so headings like "FREE ESTIMATE" get cut to "FREE ESTIMA..." on
   * narrow widths. Let them wrap. */
  html body.dmDesktopBody h3.dmform-title,
  html body.dmDesktopBody .dmform-title,
  html body.dmDesktopBody .dmwidget-title {
    white-space: normal !important;
    text-overflow: clip !important;
    overflow: visible !important;
  }

  /* --- Multi-column captions ("4.9 stars") cramming in narrow cols ---
   * The 3-up "Verified Reviews" block keeps its columns at ~33% on mobile
   * because Duda overrides `dmRespCol` width per-instance. Force them to
   * stack and shrink the giant 35px caption type. */
  html body.dmDesktopBody h3.caption-title,
  html body.dmDesktopBody .caption-title {
    font-size: 22px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }


/* -------------------------------------------------------------------
 * Hide the interactive map widget on inner mobile pages — Mapbox tiles
 * are licensed and we don't mirror them. Address is still shown in
 * adjacent text blocks.
 * ------------------------------------------------------------------- */
.dmMobileBody .dmRespCol [class*="dmMap"],
.dmMobileBody .dmRespCol .dmMap,
.dmMobileBody [class*="googlemap"],
.dmMobileBody [class*="dmGoogleMap"],
.dmMobileBody iframe[src*="google.com/maps"],
.dmMobileBody [data-element-type="dmGoogleMap"],
.dmMobileBody [class*="map-element"] {
    display: none !important;
}

/* The empty share popup must yield taps to the phone header until opened. */
body.dmMobileBody:not(.popupOpen) #dmPopup:not(.dmPopup--visible) {
  display: none !important;
}
