/**
 * 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) {
  .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));
  }

  .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;
  }
}
