/*
  MAIDO STAGE 5J - MOBILE / TABLET POLISH V1
  Upload path: assets/css/maido-stage5j-mobile-tablet-polish.css

  Purpose:
  - Final responsive override loaded from includes/footer.php after page-level CSS.
  - Keeps the existing footer contact fix intact.
  - Focuses on mobile/tablet spacing, overflow prevention, menu readability,
    responsive product grids, product pages, forms, banners and footer wrapping.
*/

html,
body {
  max-width: 100% !important;
  overflow-x: hidden !important;
}

html body img,
html body svg,
html body video,
html body iframe {
  max-width: 100% !important;
}

html body .content img {
  height: auto !important;
}

html body .content table {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

html body .btn,
html body button,
html body input,
html body select,
html body textarea {
  max-width: 100% !important;
}

/* -------------------------------------------------------------------------
   Tablet polish
   ------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  html body .container,
  html body .narrow {
    width: min(100% - 36px, 1320px) !important;
  }

  html body .section {
    padding-top: clamp(42px, 5.8vw, 66px) !important;
    padding-bottom: clamp(42px, 5.8vw, 66px) !important;
  }

  html body .section__heading {
    gap: 14px !important;
    margin-bottom: clamp(22px, 3vw, 34px) !important;
  }

  html body .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px !important;
  }

  html body .category-grid--small,
  html body .category-grid--home {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html body.has-hero-header .site-header .main-nav .nav-link,
  html body.has-hero-header .site-header .main-nav > a,
  html body.maido-stage4i-inner-page .site-header .main-nav .nav-link,
  html body.maido-stage4i-inner-page .site-header .main-nav > a {
    white-space: normal !important;
  }
}

/* -------------------------------------------------------------------------
   Mobile header, hero and menu polish
   ------------------------------------------------------------------------- */
@media (max-width: 760px) {
  html body .container,
  html body .narrow {
    width: min(100% - 28px, 1320px) !important;
  }

  html body .section {
    padding-top: 42px !important;
    padding-bottom: 42px !important;
  }

  html body .section__heading {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    text-align: center !important;
  }

  html body h1 {
    font-size: clamp(34px, 10vw, 46px) !important;
    line-height: 1.04 !important;
  }

  html body h2 {
    font-size: clamp(30px, 9vw, 42px) !important;
    line-height: 1.02 !important;
  }

  html body.has-hero-header .site-header .container.header-grid,
  html body.has-hero-header .site-header .container.header-grid--landing,
  html body.maido-stage4i-inner-page .site-header .container.header-grid,
  html body.maido-stage4i-inner-page .site-header .container.header-grid--landing {
    padding-left: 12px !important;
    padding-right: 12px !important;
    gap: 8px !important;
  }

  html body.has-hero-header .site-header .menu-toggle,
  html body.maido-stage4i-inner-page .site-header .menu-toggle {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
  }

  html body.has-hero-header .site-header .brand__logo,
  html body.has-hero-header .site-header .brand__logo--full,
  html body.has-hero-header .site-header .brand img,
  html body.maido-stage4i-inner-page .site-header .brand__logo,
  html body.maido-stage4i-inner-page .site-header .brand__logo--full,
  html body.maido-stage4i-inner-page .site-header .brand img {
    max-height: 64px !important;
    max-width: 82px !important;
  }

  html body.has-hero-header .site-header .header-actions,
  html body.maido-stage4i-inner-page .site-header .header-actions,
  html body .header-actions {
    gap: 8px !important;
  }

  html body.has-hero-header .site-header .header-icon,
  html body.has-hero-header .site-header .maido-stage3s-cart-icon,
  html body.maido-stage4i-inner-page .site-header .header-icon,
  html body.maido-stage4i-inner-page .site-header .maido-stage3s-cart-icon,
  html body .header-icon,
  html body .maido-stage3s-cart-icon {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
  }

  html body.has-hero-header .site-header .main-nav,
  html body.has-hero-header .site-header .main-nav[data-main-nav],
  html body.maido-stage4i-inner-page .site-header .main-nav,
  html body.maido-stage4i-inner-page .site-header .main-nav[data-main-nav] {
    left: 12px !important;
    right: auto !important;
    width: calc(100vw - 24px) !important;
    max-width: 420px !important;
    max-height: calc(100vh - 104px) !important;
    border-radius: 16px !important;
  }

  html body.has-hero-header .site-header .main-nav .nav-link,
  html body.has-hero-header .site-header .main-nav > a,
  html body.maido-stage4i-inner-page .site-header .main-nav .nav-link,
  html body.maido-stage4i-inner-page .site-header .main-nav > a {
    min-height: 50px !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
    font-size: 21px !important;
    white-space: normal !important;
  }

  html body.maido-stage3k-home .landing-hero,
  html body.maido-stage4i-inner-page .maido-stage4i-inner-hero {
    min-height: clamp(460px, 82vh, 560px) !important;
    background-position: center center !important;
  }

  html body.maido-stage3k-home .landing-hero {
    background-image: var(--hero-mobile, var(--hero-desktop, url('/image/catalog/imgs/banner-mble-1.png'))) !important;
  }

  html body.maido-stage4i-inner-page .maido-stage4i-inner-hero {
    background-image: var(--maido-stage4i-inner-hero-mobile-image, var(--maido-stage4i-inner-hero-image, url('/image/catalog/imgs/banner-mble-1.png'))) !important;
  }

  html body.maido-stage4i-inner-page .maido-stage4i-inner-hero__content,
  html body.maido-stage3k-home .landing-hero__inner {
    left: 18px !important;
    bottom: 46px !important;
    max-width: calc(100vw - 36px) !important;
  }

  html body.maido-stage4i-inner-page .maido-stage4i-inner-hero__title,
  html body.maido-stage3k-home .landing-hero h1,
  html body.maido-stage3k-home .landing-hero__title {
    font-size: clamp(30px, 8.8vw, 44px) !important;
    line-height: 1.05 !important;
    white-space: normal !important;
  }

  html body .maido-home-banner {
    min-height: var(--maido-home-banner-mobile-height, 220px) !important;
    height: var(--maido-home-banner-mobile-height, 220px) !important;
  }

  html body .maido-home-banner__inner {
    width: min(100% - 28px, 520px) !important;
  }

  html body .maido-home-banner h2 {
    font-size: clamp(30px, 10vw, 52px) !important;
    line-height: .96 !important;
  }
}

/* -------------------------------------------------------------------------
   Product/card grids on smaller screens
   ------------------------------------------------------------------------- */
@media (max-width: 900px) {
  html body .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
  }

  html body .category-grid,
  html body .category-grid--small,
  html body .category-grid--home {
    grid-template-columns: 1fr !important;
  }

  html body .category-card {
    grid-template-columns: 150px 1fr !important;
    min-height: 150px !important;
  }

  html body .maido-stage4k-product-section__container,
  html body .maido-popular-mods__container {
    width: min(100% - 30px, 760px) !important;
  }

  html body .maido-stage4l-grid .maido-stage4k-track {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 22px 16px !important;
  }
}

@media (max-width: 560px) {
  html body .container,
  html body .narrow {
    width: min(100% - 24px, 1320px) !important;
  }

  html body .product-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  html body .product-card__image {
    aspect-ratio: 1 / 1 !important;
    padding: 12px !important;
  }

  html body .product-card__body {
    padding: 16px !important;
  }

  html body .category-card {
    grid-template-columns: 1fr !important;
  }

  html body .category-card img {
    height: 190px !important;
  }

  html body .maido-stage4l-grid .maido-stage4k-track {
    grid-template-columns: 1fr !important;
  }

  html body .maido-stage4k-product-section__container,
  html body .maido-popular-mods__container {
    width: min(100% - 24px, 440px) !important;
  }

  html body .maido-popular-mods.maido-popular-mods--stage4l .maido-popular-mods__track {
    grid-auto-columns: minmax(250px, 86vw) !important;
  }

  html body .maido-stage4k-product-section__head h2,
  html body .maido-popular-mods .maido-popular-mods__head h2,
  html body .maido-popular-mods__head h2,
  html body #maido-popular-mods-title {
    font-size: clamp(42px, 12vw, 62px) !important;
    line-height: .9 !important;
  }
}

/* -------------------------------------------------------------------------
   Product page and form polish
   ------------------------------------------------------------------------- */
@media (max-width: 640px) {
  html body .maido-stage5i-product-detail.section {
    padding-top: 24px !important;
    padding-bottom: 34px !important;
  }

  html body .maido-stage5i-product-detail .product-detail__grid {
    gap: 22px !important;
  }

  html body .maido-stage5i-product-detail .gallery__main-wrap {
    min-height: 250px !important;
    height: min(84vw, 380px) !important;
  }

  html body .maido-stage5i-product-detail .product-actions .btn,
  html body .product-actions .btn,
  html body .contact-form .btn,
  html body form .btn {
    width: 100% !important;
  }

  html body .spec-list div {
    grid-template-columns: 92px 1fr !important;
    gap: 12px !important;
  }

  html body .form-card,
  html body .contact-card,
  html body .product-enquiry-summary {
    border-radius: 16px !important;
    padding: 16px !important;
  }

  html body .big-search {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  html body .big-search input,
  html body .big-search button {
    width: 100% !important;
  }
}

/* -------------------------------------------------------------------------
   Footer/mobile bottom spacing
   ------------------------------------------------------------------------- */
@media (max-width: 760px) {
  html body .site-footer {
    padding-top: 42px !important;
  }

  html body .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    text-align: left !important;
  }

  html body .footer-bottom {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  html body .footer-payments,
  html body .maido-stage3k-payments {
    justify-content: center !important;
  }

  html body .sticky-image-button {
    right: 12px !important;
    bottom: 12px !important;
    width: min(132px, 38vw) !important;
    max-width: 132px !important;
  }
}

@media (max-width: 380px) {
  html body.has-hero-header .site-header .brand__logo,
  html body.has-hero-header .site-header .brand__logo--full,
  html body.has-hero-header .site-header .brand img,
  html body.maido-stage4i-inner-page .site-header .brand__logo,
  html body.maido-stage4i-inner-page .site-header .brand__logo--full,
  html body.maido-stage4i-inner-page .site-header .brand img {
    max-height: 58px !important;
    max-width: 74px !important;
  }

  html body.has-hero-header .site-header .header-actions,
  html body.maido-stage4i-inner-page .site-header .header-actions,
  html body .header-actions {
    gap: 6px !important;
  }

  html body.has-hero-header .site-header .main-nav .nav-link,
  html body.has-hero-header .site-header .main-nav > a,
  html body.maido-stage4i-inner-page .site-header .main-nav .nav-link,
  html body.maido-stage4i-inner-page .site-header .main-nav > a {
    font-size: 20px !important;
  }
}
