/*! Riley Hays — mobile overrides for the Duda desktop export.
 *
 *  Per CLAUDE.md, only the desktop HTML/CSS is wired up on this Vercel
 *  build; Duda's own mobile.css is byte-identical to desktop.css and the
 *  per-device export trees aren't referenced. Without this file, narrow
 *  viewports get the desktop layout cut in half.
 *
 *  Every rule below is wrapped in @media (max-width: 900px) and uses
 *  !important to win against Duda's high-specificity #dm rules.
 *  Loaded LAST in the head so it overrides everything before it.
 */

@media (max-width: 900px) {

  /* ── Document baseline ──────────────────────────────────────────── */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  body, #dm, .dmInner, .dmOuter, .dmContent, .dmLayoutWrapper,
  #dmFirstContainer, #site_content, #iscrollBody, .allWrapper {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  /* CRITICAL: Duda's desktop CSS sets `.dmDesktopBody .dmInner { min-width:960px }`
     and `.dmInner { min-width:768px !important }`. Both fixed widths force the
     entire page to render at desktop width. Override aggressively. */
  #dm .dmInner,
  .dmDesktopBody .dmInner,
  body.dmDesktopBody .dmInner,
  .dmInner.dmInner,
  div.dmInner {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  /* Same trick for the logo title wrapper which forces 960px */
  .standardHeaderLayout .dmStandardDesktop .logoTitleWrapper,
  #dm .standardHeaderLayout .logoTitleWrapper {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  /* And the .large-N percentage widths via .dmDesktopBody */
  .dmDesktopBody .dmRespRow [class*="large-"],
  .dmDesktopBody .dmRespRow .dmRespCol,
  body.dmDesktopBody .dmRespRow [class*="large-"] {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
  }
  /* Header may also have a forced 768px min-width */
  body.dmDesktopBody .hasStickyHeader .dmInner div.dmHeaderContainer,
  html:not(.ios-preview) body.dmDesktopBody .hasStickyHeader .dmInner div.dmHeaderContainer {
    min-width: 0 !important;
    width: 100% !important;
  }

  /* ── Force every Duda row/column to stack ───────────────────────── */
  #dm .dmRespRow,
  #dm .dmRespColsWrapper {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  #dm .dmRespCol,
  #dm [class*="dmRespCol"][class*="large-"],
  #dm [class*="dmRespCol"][class*="medium-"],
  #dm [class*="dmRespCol"][class*="small-"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    padding: 8px 16px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* ── Sticky header → static on mobile ───────────────────────────── */
  /* Duda's `.hasStickyHeader .dmInner div.dmHeaderContainer` is
     position:fixed with min-width:768px. On mobile this both overflows
     the viewport AND overlaps the hero CTAs (CALL TODAY hides behind
     it). Force static + width:100%; the page just scrolls normally. */
  body.dmDesktopBody.hasStickyHeader .dmInner div.dmHeaderContainer,
  html:not(.ios-preview) body.dmDesktopBody.hasStickyHeader .dmInner div.dmHeaderContainer,
  html body.dmDesktopBody .hasStickyHeader .dmInner div.dmHeaderContainer,
  html:not(.ios-preview) #dm .hasStickyHeader .dmInner div.dmHeaderContainer,
  html:not(.ios-preview) #dm .hasStickyHeader .dmInner div#desktopHeaderBox {
    position: static !important;
    min-width: 0 !important;
    width: 100% !important;
  }
  /* Body padding-top added by Duda for sticky-header offset must go too */
  body.hasStickyHeader, body.inMiniHeaderMode {
    padding-top: 0 !important;
  }

  /* ── Top bar (red "HIRING" + phone) ─────────────────────────────── */
  #dm .dmHeaderContainer .dmHeaderResp > .dmRespRow:first-child {
    padding: 6px 12px !important;
  }
  #dm .dmHeaderContainer .dmHeaderResp > .dmRespRow:first-child .dmRespCol {
    padding: 4px 8px !important;
  }
  #dm .socialHubInnerDiv {
    text-align: center !important;
  }
  /* HIRING MULTIPLE POSTIONS button: shrink text so the sticky-bar isn't huge */
  #dm .dmButtonLink.u_1507939199 {
    font-size: 11px !important;
    padding: 6px 10px !important;
    white-space: normal !important;
    line-height: 1.15 !important;
    letter-spacing: 0.02em !important;
    width: 100% !important;
    min-height: 36px !important;
  }
  #dm .dmButtonLink.u_1507939199 .text,
  #dm .dmButtonLink.u_1507939199 span.text {
    font-size: 11px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
  }
  #dm .dmButtonLink.u_1507939199 .iconBg,
  #dm .dmButtonLink.u_1507939199 .icon {
    font-size: 12px !important;
  }
  /* Phone number row in the top bar — also tighten */
  #dm .u_1225355354 p,
  #dm .u_1225355354 a strong {
    font-size: 18px !important;
  }
  /* Social hub icons row: small + inline */
  #dm .dmHeaderContainer .dmSocialHub .socialHubIcon {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
  }

  /* ── Logo row: shrink + center ──────────────────────────────────── */
  #dm .dmHeaderContainer .imageWidget img {
    max-width: 180px !important;
    height: auto !important;
    margin: 0 auto !important;
    display: block !important;
  }
  /* Hide "Best of Best" badge — too cluttered on small screens */
  #dm .dmHeaderContainer .dmRespCol[class*="large-"]:last-child .imageWidget {
    display: none !important;
  }

  /* ── Hide desktop nav, show hamburger drawer (added via inline JS) ─ */
  #dm nav.main-navigation,
  #dm nav.unifiednav,
  #dm .dmLinksMenu {
    display: none !important;
  }
  #dm nav.main-navigation.rh-mobile-open,
  #dm nav.unifiednav.rh-mobile-open {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 80vw !important;
    max-width: 320px !important;
    background: #fff !important;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18) !important;
    z-index: 9999 !important;
    overflow-y: auto !important;
    padding: 64px 0 24px !important;
  }
  #dm nav.rh-mobile-open .unifiednav__container {
    flex-direction: column !important;
    align-items: stretch !important;
    display: block !important;
  }
  #dm nav.rh-mobile-open .unifiednav__item-wrap {
    display: block !important;
    width: 100% !important;
    border-bottom: 1px solid #f0f0f0 !important;
  }
  #dm nav.rh-mobile-open .unifiednav__item {
    display: block !important;
    padding: 14px 24px !important;
    font-size: 15px !important;
    color: #313131 !important;
  }
  /* Always-show sub-items as a flat list inside the drawer */
  #dm nav.rh-mobile-open .unifiednav__container_sub-nav {
    position: static !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    box-shadow: none !important;
    background: #f8f8f8 !important;
    padding: 0 !important;
    transform: none !important;
  }
  #dm nav.rh-mobile-open .unifiednav__container_sub-nav .unifiednav__item {
    padding: 10px 24px 10px 40px !important;
    font-size: 14px !important;
    color: #555 !important;
  }
  /* Hamburger button injected by rh-mobile.js */
  .rh-hamburger {
    position: absolute !important;
    top: 50% !important;
    right: 16px !important;
    transform: translateY(-50%) !important;
    z-index: 10000 !important;
    background: transparent !important;
    border: 0 !important;
    padding: 12px !important;
    cursor: pointer !important;
    color: #313131 !important;
  }
  .rh-hamburger span {
    display: block !important;
    width: 26px !important;
    height: 3px !important;
    background: currentColor !important;
    margin: 5px 0 !important;
    border-radius: 2px !important;
    transition: transform .2s, opacity .2s !important;
  }
  .rh-hamburger.rh-open span:nth-child(1) { transform: translateY(8px) rotate(45deg) !important; }
  .rh-hamburger.rh-open span:nth-child(2) { opacity: 0 !important; }
  .rh-hamburger.rh-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg) !important; }
  .rh-hamburger.rh-open { color: #fff !important; position: fixed !important; right: 16px !important; top: 16px !important; transform: none !important; }
  .rh-mobile-overlay {
    display: none !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 9998 !important;
  }
  .rh-mobile-overlay.rh-open { display: block !important; }

  /* ── Photo galleries (e.g. home-page service tiles, layout="square") ─
     Duda renders these as `.photogallery-column.column-3` set to 33.333%
     width. On mobile we need them stacked, full-width, with reasonable
     caption sizing — otherwise the caption-button text wraps to one
     letter per line. */
  #dm .photogallery-row,
  #dm .layout-container .photogallery-row {
    display: block !important;
    width: 100% !important;
    flex-direction: column !important;
  }
  #dm .photogallery-column,
  #dm .photogallery-column.column-1,
  #dm .photogallery-column.column-2,
  #dm .photogallery-column.column-3,
  #dm .photogallery-column.column-4,
  #dm .photogallery-column.column-5,
  #dm .photogallery-column.column-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-bottom: 12px !important;
  }
  #dm .photoGalleryThumbs {
    width: 100% !important;
    max-width: 100% !important;
  }
  #dm .photoGalleryThumbs .image-container {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
  }
  /* Caption containers + buttons: full-width text, no per-letter wrap */
  #dm .photoGalleryThumbs .caption-container,
  #dm .photoGalleryThumbs .caption-inner {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 16px !important;
  }
  #dm .photoGalleryThumbs .caption-title,
  #dm .photoGalleryThumbs .caption-title h3 {
    font-size: 18px !important;
    line-height: 1.25 !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    white-space: normal !important;
  }
  #dm .photoGalleryThumbs .caption-button {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 120px !important;
    padding: 10px 18px !important;
    white-space: normal !important;
    word-break: normal !important;
    writing-mode: horizontal-tb !important;
  }
  #dm .photoGalleryThumbs .caption-button .text {
    white-space: normal !important;
    writing-mode: horizontal-tb !important;
    word-break: normal !important;
  }

  /* ── Headings + body text ───────────────────────────────────────── */
  /* Duda authors mark elements with both `size-72` (desktop) and
     `m-size-36` (mobile). Without Duda's runtime swapping classes by
     device, only `size-N` ever wins. Activate the m-* variants here. */
  [class*="m-size-"][class*="m-size-13"], #dm [class*="m-font-size-13"]                  { font-size: 13px !important; }
  [class*="m-size-"][class*="m-size-14"], #dm [class*="m-font-size-14"]                  { font-size: 14px !important; }
  [class*="m-size-"][class*="m-size-16"], #dm [class*="m-font-size-16"]                  { font-size: 16px !important; }
  [class*="m-size-"][class*="m-size-19"], #dm [class*="m-font-size-19"]                  { font-size: 19px !important; }
  [class*="m-size-"][class*="m-size-22"], #dm [class*="m-font-size-22"]                  { font-size: 22px !important; }
  [class*="m-size-"][class*="m-size-24"], #dm [class*="m-font-size-24"]                  { font-size: 24px !important; }
  [class*="m-size-"][class*="m-size-29"], #dm [class*="m-font-size-29"]                  { font-size: 29px !important; }
  [class*="m-size-"][class*="m-size-36"], #dm [class*="m-font-size-36"]                  { font-size: 36px !important; }
  /* The huge desktop sizes — clamp to something readable even when no m-* twin exists */
  #dm .size-72, #dm .font-size-72, #dm [class*="size-72"], #dm [class*="font-size-72"]   { font-size: 36px !important; line-height: 1.15 !important; }
  #dm .size-60, #dm .font-size-60, #dm [class*="size-60"], #dm [class*="font-size-60"]   { font-size: 32px !important; line-height: 1.2 !important; }
  #dm .size-48, #dm .font-size-48, #dm [class*="size-48"], #dm [class*="font-size-48"]   { font-size: 28px !important; line-height: 1.2 !important; }
  #dm .size-40, #dm .font-size-40, #dm [class*="size-40"], #dm [class*="font-size-40"]   { font-size: 24px !important; line-height: 1.25 !important; }
  #dm .size-36, #dm .font-size-36                                                        { font-size: 22px !important; line-height: 1.25 !important; }
  #dm .size-30, #dm .font-size-30                                                        { font-size: 20px !important; line-height: 1.3 !important; }
  #dm .size-28, #dm .font-size-28                                                        { font-size: 19px !important; line-height: 1.3 !important; }

  #dm h1, #dm h1 span { font-size: 26px !important; line-height: 1.2 !important; }
  #dm h2, #dm h2 span { font-size: 20px !important; line-height: 1.25 !important; }
  #dm h3, #dm h3 span { font-size: 17px !important; line-height: 1.3 !important; }
  #dm p, #dm p span, #dm li, #dm li span { font-size: 15px !important; line-height: 1.55 !important; }
  #dm .dmNewParagraph p[class*="size-"] span,
  #dm .dmNewParagraph p[class*="size-"] { font-size: 15px !important; }

  /* ── Buttons: tap-friendly + kill 280px-fixed Call buttons ──────── */
  /* Duda hardcodes `.dmCall { width: 280px }` and BIG_BASIC variants are
     similarly fixed. With two side-by-side they shrink and break their
     text vertically. Force buttons to full-width on mobile and reset
     all writing-mode / word-break to horizontal-words. */
  #dm .dmCall,
  #dm .dmButtonLink,
  #dm a.dmWidget[data-display-type="block"],
  #dm a[type="call"],
  #dm a[runtime_url^="tel:"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 12px 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 15px !important;
    box-sizing: border-box !important;
    margin: 6px 0 !important;
    flex: 0 0 auto !important;
    writing-mode: horizontal-tb !important;
  }
  #dm .dmCall .text,
  #dm .dmButtonLink .text,
  #dm a.dmWidget .text {
    display: inline-block !important;
    white-space: normal !important;
    word-break: normal !important;
    writing-mode: horizontal-tb !important;
    overflow-wrap: normal !important;
    line-height: 1.2 !important;
  }
  /* If multiple buttons sit in a flex row, stack them */
  #dm .dmRespCol > .dmButtonLink + .dmButtonLink,
  #dm .dmRespCol > .dmCall + .dmCall {
    margin-top: 0 !important;
  }

  /* ── Forms: full-width + 16px to prevent iOS zoom-on-focus ──────── */
  #dm form input,
  #dm form select,
  #dm form textarea {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
    padding: 12px !important;
  }
  #dm form input[type="submit"],
  #dm form button[type="submit"] {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 15px !important;
  }

  /* ── Images / videos / iframes ──────────────────────────────────── */
  #dm img,
  #dm video,
  #dm iframe {
    max-width: 100% !important;
    height: auto !important;
  }

  /* ── Hero/banner sections: cap height ──────────────────────────── */
  #dm .dmHomeSection1,
  #dm .dmSectionParallex,
  #dm .flex-container.dmImageSlider {
    min-height: 0 !important;
    height: auto !important;
  }
  #dm .flex-container.dmImageSlider .flexslider .slides li {
    height: auto !important;
    min-height: 240px !important;
  }

  /* ── Footer ─────────────────────────────────────────────────────── */
  #dm .dmFooterContainer .dmRespRow {
    text-align: center !important;
    padding: 12px 16px !important;
  }
  #dm .dmFooterContainer .dmRespCol {
    margin-bottom: 12px !important;
  }
  #dm .dmFooterContainer img {
    max-width: 200px !important;
  }

  /* ── Photo galleries (clean rh-* swap-ins already responsive) ───── */
  #dm .rh-masonry { column-count: 2 !important; }
}

@media (max-width: 540px) {
  #dm .rh-masonry { column-count: 1 !important; }
  #dm .dmHeaderContainer .imageWidget img { max-width: 150px !important; }
  #dm h1, #dm h1 span { font-size: 22px !important; }
}
