
/* Opto Zero v3.25 — browser/device compatibility layer */

/* Stable box sizing everywhere */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Form controls should inherit the theme font in Safari/Firefox */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
[type="button"],
[type="submit"],
[type="reset"],
a,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button,
input,
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
}

input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: auto;
  appearance: auto;
}

/* Prevent long names/prices from forcing horizontal overflow */
img,
svg,
video,
canvas {
  max-width: 100%;
}

img {
  height: auto;
}

.oc-product-title,
.oc-product-name,
.oc-cart-product-name,
.oc-account-card-title,
.oc-footer-text,
.oc-description-box,
.oc-search-input {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Safari fallback where backdrop-filter is unavailable */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .oc-header .oc-header-dropdown-button,
  .oc-header .oc-mobile-cart-toggle,
  .oc-header-center .oc-search-wrap {
    background: rgba(255,255,255,.98) !important;
  }
}

/* Dynamic viewport fallback: old browsers use vh, new browsers get dvh */
.oc-cart-drawer,
.oc-mobile-panel {
  max-height: 100vh;
}

@supports (height: 100dvh) {
  .oc-cart-drawer,
  .oc-mobile-panel {
    max-height: 100dvh;
  }
}

/* iPhone / notched Android safe areas */
@supports (padding: max(0px)) {
  @media (max-width: 767px) {
    .oc-header > .container-fluid {
      padding-left: max(10px, env(safe-area-inset-left)) !important;
      padding-right: max(10px, env(safe-area-inset-right)) !important;
    }

    .oc-footer {
      padding-bottom: env(safe-area-inset-bottom);
    }

    .oc-cart-drawer {
      padding-bottom: env(safe-area-inset-bottom);
    }

    .oc-page-wrap,
    #checkout-checkout,
    .oc-account-page {
      padding-left: max(8px, env(safe-area-inset-left));
      padding-right: max(8px, env(safe-area-inset-right));
    }
  }
}

/*
 * iOS Safari zooms the page when a focused input is below 16px.
 * Keep controls >=16px on phones; visual sizes remain controlled by height/padding.
 */
@media (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Smooth horizontal strips on touch devices */
  .oc-product-thumbs,
  .oc-breadcrumbs,
  .table-responsive,
  .oc-order-table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  /* Keep tap targets usable across iOS Safari / Android Chrome */
  .oc-header .oc-header-dropdown-button,
  .oc-header .oc-mobile-cart-toggle,
  .oc-search-button,
  #oc-search-button {
    cursor: pointer;
  }
}

/* Firefox form appearance fixes */
@supports (-moz-appearance: none) {
  select.form-control,
  select.oc-form-control {
    -moz-appearance: auto;
  }
}

/* Fallback class used by JS where CSS :has() isn't available */
.oc-compat-hide {
  display: none !important;
}

.oc-fast-payment-option.is-checked {
  border-color: #0d5de6 !important;
  background: #eef5ff !important;
  box-shadow: 0 0 0 2px rgba(13,93,230,.08) !important;
}

/* Respect accessibility preference without disabling functionality */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
