/* Prevent horizontal scroll and fix mobile header layout */

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

#wrapper,
#content {
  max-width: 100%;
  overflow-x: clip;
}

/* Header bar: logo left, cart + hamburger right */
header .container,
#topbar .container {
  width: 100%;
}

@media (min-width: 992px) {
  header .container,
  #topbar .container {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 991px) {
  header .container,
  #topbar .container {
    max-width: 100%;
  }
}

header .de-flex.sm-pt10 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

header .de-flex.sm-pt10 > .de-flex-col:first-child {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
}

header .de-flex.sm-pt10 > .de-flex-col:last-child {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

header #logo {
  max-width: 100%;
}

header #logo a {
  display: block;
  max-width: 100%;
}

header #logo img {
  width: auto;
  max-width: min(250px, 52vw);
  height: auto;
}

header .header-cart-link {
  flex-shrink: 0;
  margin-right: 0;
}

header .menu_side_area {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 0;
  width: auto;
}

header #menu-btn {
  float: none;
}

/* Footer images should not overflow */
footer.footer-bg img,
footer .w-300px {
  max-width: 100%;
  width: auto;
  height: auto;
}

footer .subfooter .de-flex {
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 991px) {
  header .de-flex.sm-pt10 {
    flex-wrap: wrap;
    align-items: center;
  }

  /* Keep nav out of the logo row until the menu is opened */
  header .header-col-mid {
    order: 10;
    flex: 1 1 100%;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
  }

  header.menu-open .header-col-mid {
    max-height: none;
    overflow: visible;
    padding-top: 4px;
  }

  header:not(.menu-open) #mainmenu {
    display: none !important;
  }

  header.menu-open #mainmenu {
    display: block !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 8px 0 16px !important;
    overflow: visible !important;
  }

  header #logo img {
    max-width: min(200px, 48vw);
    max-height: 46px;
    object-fit: contain;
    object-position: left center;
  }

  #topbar .topbar-widget a {
    display: block;
    max-width: 58vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 767px) {
  #topbar {
    display: none;
  }

  header .container {
    min-width: 0 !important;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* One logo only on mobile (theme hides extras; do not override with display:block) */
  header #logo .logo-main,
  header #logo .logo-scroll {
    display: none !important;
  }

  header #logo .logo-mobile {
    display: block !important;
    max-width: min(170px, 44vw);
    max-height: 40px;
    object-fit: contain;
    object-position: left center;
  }

  header .menu_side_area {
    margin-left: 0 !important;
    width: auto !important;
    display: inline-flex !important;
  }

  #extra-wrap {
    width: min(100vw, 420px);
    right: calc(-1 * min(100vw, 420px));
  }

  footer.footer-bg {
    padding-top: 48px;
  }

  footer .subfooter .de-flex,
  footer .subfooter .de-flex-col {
    display: block;
    text-align: center;
  }

  footer .subfooter .social-icons {
    margin-top: 12px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  header #logo .logo-mobile {
    max-width: min(185px, 56vw);
    max-height: 50px;
  }
}
