/**
 * Neo Compounds — mobile hardening (0.5.41). Loaded on every page, after all other theme CSS.
 *
 * 1. Form controls >= 16px on touch / narrow screens. iOS Safari zooms into any focused input whose
 *    computed font-size is below 16px and leaves the page zoomed (wider than the screen, header cut off).
 *    User zoom is NOT disabled (no maximum-scale / user-scalable=no).
 *    The :not(#neo-*) pairs only raise specificity so these win over every page-level rule, including
 *    the !important ones (e.g. the 13px coupon field); they never match anything else.
 * 2. Header that fits 360-414px: logo + account/cart on one row, search below, nav below that.
 *    NC-070: after that header sticks, `.is-compact` (toggled by chrome.js) clips search, nav and the
 *    research-use line out of the ~195px stack, leaving one row. Search and Menu buttons on that row
 *    (or focusing the field / a nav link) restore the full header.
 * 3. Page-width safety net (clip, not hidden: no scroll container, sticky header keeps working).
 */

/* ── 1. No input auto-zoom ─────────────────────────────────── */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  html body:not(#neo-x1):not(#neo-x2) input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="file"]):not([type="range"]):not([type="color"]),
  html body:not(#neo-x1):not(#neo-x2) select,
  html body:not(#neo-x1):not(#neo-x2) textarea,
  html body:not(#neo-x1):not(#neo-x2) .select2-container .select2-search__field,
  html body:not(#neo-x1):not(#neo-x2) .select2-container .select2-selection__rendered {
    font-size: 16px !important;
  }

  /* Keep the small mono / letter-spaced look of placeholders (the placeholder size does not trigger zoom). */
  html body:not(#neo-x1):not(#neo-x2) .neo-cko-summary .checkout_coupon .input-text::placeholder {
    font-size: 13px;
    letter-spacing: 0.06em;
  }
}

/* ── 2. Mobile header ──────────────────────────────────────── */
/* Hidden on the full header. Shown only on the compact phone bar (rule inside max-width 767px). */
.neo-header__reveal {
  display: none;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 auto;
  border-radius: var(--neo-pill);
  border: 1px solid var(--neo-border-input);
  background: #fff;
  color: var(--neo-navy);
  cursor: pointer;
  box-shadow: none;
}

.neo-header__reveal--search {
  background: var(--neo-navy);
  border-color: var(--neo-navy);
  color: #fff;
}

.neo-header__reveal:focus-visible {
  outline: 2px solid var(--neo-blue);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .neo-header__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "logo actions"
      "search search"
      "nav nav";
    align-items: center;
    column-gap: 10px;
    row-gap: 10px;
    padding: 10px 16px 8px;
  }

  .neo-header__logo {
    grid-area: logo;
    width: 104px;
    height: 36px;
  }

  .neo-header__actions {
    grid-area: actions;
    justify-self: end;
    min-width: 0;
    max-width: 100%;
    gap: 6px;
  }

  .neo-header__search {
    grid-area: search;
    min-width: 0;
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    padding: 0 5px 0 16px;
    margin: 0; /* Storefront gives forms a 1.6em bottom margin (the big gap under search) */
  }

  /* 0.5.71: nav + research-use-only line share the last grid row; the RUO line is a small centred line under the nav. */
  .neo-header__row2 {
    grid-area: nav;
    justify-items: stretch;
    row-gap: 4px;
  }

  .neo-header__ruo {
    padding-top: 6px;
    border-top: 1px solid var(--neo-border-row);
    font-size: 9.5px;
    letter-spacing: 0.05em;
  }

  .neo-header__nav-wrap {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .neo-header__nav-wrap::-webkit-scrollbar {
    display: none;
  }

  .neo-header__nav {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 12px;
    padding-top: 0;
    font-size: 14px;
  }

  .neo-header__nav a {
    display: block;
    padding: 6px 0;
  }

  .neo-header__signin,
  .neo-header__acct-btn,
  .neo-header__cart {
    height: 40px;
    font-size: 14px;
  }

  .neo-header__signin {
    padding: 0 12px;
    gap: 6px;
  }

  .neo-header__acct {
    min-width: 0;
  }

  .neo-header__acct-btn {
    gap: 6px;
    padding: 0 10px 0 12px;
    max-width: 100%;
    min-width: 0;
  }

  /* Long first names: ellipsis instead of pushing the cart off screen. */
  .neo-header__acct-btn > span:not(.neo-header__acct-dot) {
    min-width: 0;
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .neo-header__acct-dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    box-shadow: 0 0 0 3px var(--neo-green-tint);
  }

  .neo-header__acct-btn svg {
    flex: 0 0 auto;
  }

  .neo-header__acct-menu {
    max-width: calc(100vw - 32px);
  }

  .neo-header__cart {
    flex: 0 0 auto;
    gap: 6px;
    padding: 0 6px 0 12px;
  }

  .neo-header__cart-count {
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    font-size: 12.5px;
  }

  /* NC-070: scrolled compact bar. Search + nav/RUO are the lower two rows (~140px).
     Clip them out of the row (not display:none — that cannot be focused) so the bar is
     logo + Search + Menu + account/cart. Desktop rules never see this. */
  .neo-header {
    overflow-anchor: none;
    transition: box-shadow 0.18s ease;
  }

  .neo-header.is-compact {
    box-shadow: 0 8px 20px -14px rgba(11, 26, 48, 0.35);
  }

  .neo-header.is-compact .neo-header__inner {
    grid-template-areas: "logo actions";
    grid-template-rows: auto;
    row-gap: 0;
    padding: 8px 16px;
  }

  .neo-header.is-compact .neo-header__reveal {
    display: inline-flex;
  }

  /* Icon-sized account and cart so Search + Menu fit beside them at 320px. */
  .neo-header.is-compact .neo-header__signin,
  .neo-header.is-compact .neo-header__acct-btn,
  .neo-header.is-compact .neo-header__cart {
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    padding: 0;
    gap: 0;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 0;
    overflow: hidden;
  }

  .neo-header.is-compact .neo-header__acct-btn > svg {
    display: none;
  }

  .neo-header.is-compact .neo-header__cart-count {
    font-size: 12.5px;
  }

  .neo-header.is-compact .neo-header__search,
  .neo-header.is-compact .neo-header__row2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    min-width: 0;
    max-width: 1px;
    max-height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .neo-header {
    transition: none;
  }
}

@media (max-width: 374px) {
  .neo-header__logo {
    width: 92px;
  }

  .neo-header__acct-btn > span:not(.neo-header__acct-dot) {
    max-width: 64px;
  }

  .neo-header__nav {
    gap: 8px;
    font-size: 13.5px;
  }
}

/* ── 3. Safety net ─────────────────────────────────────────── */
.neo-marquee {
  max-width: 100%;
  contain: paint;
}

@supports (overflow-x: clip) {
  html,
  body {
    overflow-x: clip;
  }
}
