/**
 * Mobile / H5: safe areas, touch targets, readability, overflow control.
 * Loaded last so it can override main.css, home.css, pages.css, woocommerce.css.
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.site-main {
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

/* Softer tap flash; focus-visible still handled per-component */
a,
button,
input,
select,
textarea,
.es-filter__item {
  -webkit-tap-highlight-color: rgba(11, 92, 168, 0.14);
}

@media (max-width: 992px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  .es-header {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .es-header__inner {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .es-menu-toggle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 11px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .es-nav {
    max-height: min(70vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .es-nav .es-menu li a {
    min-height: 48px;
    padding: 14px 6px;
    display: flex;
    align-items: center;
    font-size: 16px;
    line-height: 1.35;
  }

  .es-brand__text {
    font-size: clamp(18px, 5vw, 22px);
  }

  header.es-header .es-brand .es-brand__logo-img {
    height: 42px;
    max-height: 42px;
    max-width: min(220px, 62vw);
  }

  .es-topbar {
    font-size: clamp(12px, 3.4vw, 13px);
  }

  .es-topbar__inner {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 6px;
    column-gap: 12px;
    text-align: center;
  }

  .es-btn {
    min-height: 44px;
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .es-header__account-register {
    min-height: 44px;
    padding: 10px 16px;
  }

  .es-header__account-link,
  .es-header__account-link--quiet {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 10px 6px;
    box-sizing: border-box;
  }

  .es-header__account-profile {
    min-height: 44px;
    padding: 6px 8px 6px 6px;
  }

  .es-header__cart {
    min-height: 44px;
    padding: 10px 12px;
    box-sizing: border-box;
  }

  .es-section h2 {
    font-size: clamp(24px, 6.5vw, 34px);
    line-height: 1.22;
  }

  .es-lead {
    font-size: clamp(15px, 4vw, 17px);
    line-height: 1.65;
  }

  .es-footer {
    padding-bottom: calc(36px + env(safe-area-inset-bottom, 0px));
  }

  body.es-has-mobile-floating-lead .site-main {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  body.es-has-mobile-floating-lead .es-footer {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .es-floating-lead {
    display: grid;
    grid-template-columns: minmax(0, 0.38fr) minmax(0, 0.62fr);
    position: fixed;
    inset-inline: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    gap: clamp(6px, 2vw, 8px);
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #dbe7f0;
    box-shadow: 0 -8px 24px rgba(13, 42, 67, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-sizing: border-box;
    overflow: hidden;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }

  .es-floating-lead--solo {
    grid-template-columns: minmax(0, 1fr);
  }

  body.es-quote-modal-open .es-floating-lead {
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
  }

  .es-floating-lead [data-es-capture-page] {
    display: none;
  }

  .es-floating-lead button,
  .es-floating-lead a.es-floating-lead__phone {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    padding: 0 8px;
    background: #fff;
    color: #0d2a43;
    font: inherit;
    font-size: clamp(13px, 3.6vw, 15px);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .es-floating-lead__label {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .es-floating-lead [data-es-quote-modal-open] {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
  }

  .es-page-cta,
  #quote-form {
    scroll-margin-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  body.es-has-mobile-floating-lead .es-capture-toast {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .es-footer__social a {
    min-height: 44px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .es-footer-menu a {
    display: inline-block;
    padding: 8px 0;
    min-height: 44px;
    line-height: 1.45;
    box-sizing: border-box;
  }

  .es-footer__form input {
    font-size: 16px;
    min-height: 48px;
    padding: 12px 14px;
  }

  /* Home / sections: horizontal strips easier to swipe without gradient clipping taps */
  .es-hscroll {
    mask-image: none;
    -webkit-mask-image: none;
    scroll-padding-inline: 8px;
  }

  .es-hscroll-nav {
    justify-content: space-between;
    width: 100%;
  }

  .es-form input,
  .es-form textarea {
    font-size: 16px;
    min-height: 48px;
    padding: 14px 14px;
  }

  .es-form textarea {
    min-height: 140px;
  }

  .es-faq summary {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 4px 0;
    box-sizing: border-box;
  }
}

@media (max-width: 640px) {
  .es-pagination .page-numbers {
    min-width: 44px;
    min-height: 44px;
  }

  .es-filter__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }

  .woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: clamp(16px, 4.2vw, 18px);
    line-height: 1.35;
  }

  .woocommerce div.product .product_title {
    font-size: clamp(22px, 6vw, 28px);
    line-height: 1.2;
  }

  .woocommerce div.product .woocommerce-tabs ul.tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 12px 12px 4px;
    scrollbar-width: thin;
  }

  .woocommerce div.product .woocommerce-tabs ul.tabs li {
    flex: 0 0 auto;
  }

  .woocommerce div.product .woocommerce-tabs ul.tabs li a {
    white-space: nowrap;
    padding: 12px 16px;
    font-size: 14px;
  }

  .woocommerce div.product .woocommerce-tabs .panel {
    padding: 16px 16px 18px;
    font-size: 15px;
    line-height: 1.65;
  }

  .woocommerce .quantity .qty {
    font-size: 16px;
  }

  .woocommerce-checkout .form-row input.input-text,
  .woocommerce-checkout .form-row textarea,
  .woocommerce-checkout .form-row select {
    font-size: 16px;
    min-height: 48px;
  }

  .woocommerce-checkout .form-row textarea {
    min-height: 120px;
  }

  .woocommerce-account .woocommerce-MyAccount-content {
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
  }

  .woocommerce-message,
  .woocommerce-info,
  .woocommerce-error {
    font-size: 14px;
    line-height: 1.55;
    padding: 14px 16px;
  }

  .wc-block-components-text-input input,
  .wc-block-components-text-input textarea,
  .wc-block-checkout input[type="text"],
  .wc-block-checkout input[type="email"],
  .wc-block-checkout input[type="tel"],
  .wc-block-checkout textarea,
  .wc-block-checkout select {
    min-height: 48px;
  }

  .wc-block-checkout textarea {
    min-height: 120px;
  }
}
