/* Touch and safe-area refinements. Desktop composition stays in the existing layers. */
@media (max-width:900px) {
  .site-header { padding-top:env(safe-area-inset-top,0px); }
  .site-header .nav { padding-left:max(var(--container-pad),env(safe-area-inset-left,0px)); padding-right:max(var(--container-pad),env(safe-area-inset-right,0px)); }
  .site-header .nav__toggle { width:44px; min-width:44px; min-height:44px; }
  .site-header .cart-link { min-width:44px; min-height:44px; }
  .site-header .nav__links { max-height:calc(100vh - 96px); max-height:calc(100dvh - 96px - env(safe-area-inset-top,0px)); overflow-y:auto; overscroll-behavior:contain; padding-bottom:max(20px,env(safe-area-inset-bottom,0px)); }
  .site-header .nav__links a { display:flex; align-items:center; min-height:48px; overflow-wrap:anywhere; }
  .premium-filters :is(input,select),
  .premium-filters .price-range input,
  .premium-collection .sort-select { min-width:0; max-width:100%; font-size:16px; }
  .hero-carousel > button,.hero-motion-toggle { min-height:44px; }
  .premium-filters .filter-opt { min-height:44px; }
  .cart-drawer { padding-top:env(safe-area-inset-top,0px); }
  .cart-drawer__body { min-height:0; overscroll-behavior-y:contain; }
  .cart-drawer__foot { padding-bottom:max(24px,env(safe-area-inset-bottom,0px)); }
  .cart-drawer__qty button { width:44px; height:44px; }
  .cart-drawer__row { flex-wrap:wrap; }
  .cart-drawer__remove,.cart-drawer__viewall { min-height:44px; display:inline-flex; align-items:center; }
  .cart-drawer__viewall { display:flex; justify-content:center; }
  .cart-drawer__name,.cart-drawer__variant { overflow-wrap:anywhere; }
  html:has(.cart-drawer.open),body:has(.cart-drawer.open) { overflow:hidden; }
  .commerce-product .qty button { min-width:44px; width:44px; min-height:44px; }
  .commerce-product .qty input { width:36px; min-height:44px; font-size:16px; }
  .commerce-product .variant__options > .option { min-height:44px; }
  .commerce-product .grade-guide > summary { min-height:44px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
  .commerce-cart-page .cart-qty .qty-stepper button { width:44px; height:44px; }
  .commerce-cart-page .cart-qty .qty-stepper input { width:40px; min-height:44px; font-size:16px; }
  .commerce-cart-page .cart-remove { width:44px; min-height:44px; }
  .journey-account .orders-table td:first-child a { display:inline-flex; align-items:center; min-height:44px; max-width:100%; }
  .checkout-header { padding-top:env(safe-area-inset-top,0px); }
  .checkout-shell .checkout-header__inner,
  .checkout-shell .checkout-main,
  .checkout-shell .checkout-summary-toggle,
  .checkout-shell .checkout-summary-content { padding-left:max(24px,env(safe-area-inset-left,0px)); padding-right:max(24px,env(safe-area-inset-right,0px)); }
  .checkout-shell .checkout-main { padding-bottom:max(24px,env(safe-area-inset-bottom,0px)); }
  .site-footer .footer-social a { width:44px; height:44px; }
  .site-footer .footer__col a { min-height:44px; display:inline-flex; align-items:center; padding-block:6px; }
  .site-footer .footer__legal { flex-wrap:wrap; }
  .site-footer .footer__legal a { min-height:44px; display:inline-flex; align-items:center; }
  .site-footer .footer-credential-card__link { min-height:44px; }
  .site-footer .footer__bottom { padding-bottom:max(30px,env(safe-area-inset-bottom,0px)); }
}
@media (min-width:641px) and (max-width:900px) {
  .commerce-cart-page .cart-item { grid-template-columns:96px minmax(0,1fr) 44px; }
}
@media (max-width:640px) {
  .site-header .nav { grid-template-columns:44px minmax(0,1fr) auto; gap:8px; }
  .site-header .brand { min-width:0; }
  .premium-hero__inner,.premium-hero--collection .premium-hero__inner { min-height:0; padding-bottom:24px; }
  .premium-hero__actions { flex-wrap:wrap; gap:12px 20px; }
  .premium-hero__link { display:inline-flex; align-items:center; min-height:44px; }
  .premium-hero__foot { position:relative; inset:auto; margin:0 var(--container-pad) 20px; display:grid; grid-template-columns:minmax(0,1fr) 44px; gap:8px; padding-top:14px; }
  .premium-hero__explore { grid-column:1/-1; min-height:44px; }
  .hero-carousel { gap:8px; justify-self:start; }
  .hero-carousel > button { width:44px; min-height:44px; }
  .hero-motion-toggle { grid-column:2; min-width:44px; min-height:44px; margin:0; }
  .premium-featured .section-head { align-items:stretch; flex-direction:column; gap:22px; }
  .premium-featured__actions { width:100%; justify-content:space-between; }
  .premium-featured .rail__btn { width:44px; height:44px; }
  .premium-featured__actions .premium-text-link { min-height:44px; display:inline-flex; align-items:center; }
  .premium-collection .results-toolbar { flex-wrap:wrap; gap:12px; }
  .premium-collection .results-toolbar > form { min-width:0; max-width:100%; }
  .premium-collection .sort-select { max-width:100%; }
  .premium-filters .price-range > * { min-width:0; }
  .commerce-product .gallery__caption > * { min-width:0; overflow-wrap:anywhere; }
  .commerce-product .storage-options { min-width:0; }
  .commerce-product .option--storage { min-width:0; }
  .commerce-product .option--storage small { overflow-wrap:anywhere; }
  .image-viewer__panel { padding-top:max(14px,env(safe-area-inset-top,0px)); padding-right:max(14px,env(safe-area-inset-right,0px)); padding-bottom:max(14px,env(safe-area-inset-bottom,0px)); padding-left:max(14px,env(safe-area-inset-left,0px)); }
  .image-viewer__head button { min-width:44px; min-height:44px; }
  .image-viewer__title { min-width:0; overflow-wrap:anywhere; }
  .image-viewer__stage { height:calc(100dvh - 180px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); }
}
@media (max-width:480px) {
  .commerce-product .add-row { flex-wrap:wrap; gap:12px; }
  .commerce-product .add-row .qty { flex:0 0 auto; }
  .commerce-product .add-row .btn { flex:1 0 100%; width:100%; min-height:52px; font-size:14px; }
}
@media (max-width:400px) {
  .checkout-shell .checkout-header__inner,
  .checkout-shell .checkout-main,
  .checkout-shell .checkout-summary-toggle,
  .checkout-shell .checkout-summary-content { padding-left:max(20px,env(safe-area-inset-left,0px)); padding-right:max(20px,env(safe-area-inset-right,0px)); }
}
@media (max-width:360px) {
  body:has(> .site-header) { --container-pad:16px; }
  .site-header .brand { font-size:21px; }
}
@media (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  .site-header .nav { height:60px; }
  .premium-hero__inner,.premium-hero--collection .premium-hero__inner { padding-top:170px; }
}

/* 390px pass: keep every product card inside the viewport, enlarge the small text links */
@media (max-width: 640px) {
  .related-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .related-grid .card--device { min-width: 0; }
  .breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; }
  .price-block { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  .price-block a, .price-block button { min-height: 44px; }
  .home-gallery__controls button { width: 44px; height: 44px; }
  main#main .card__media > img { padding: 10%; }
}
@media (max-width: 640px) {
  .rating-summary { min-height: 44px; padding-block: 6px; }
  .checkout-header .brand { display: inline-flex; align-items: center; min-height: 44px; }
  .checkout-header .checkout-bag { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
}

/* ---- Touch targets and legibility (mobile) ---- */
@media (max-width: 860px) {
  /* Skip link was 43px: one pixel short of the 44px target. */
  .skip-link {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
    padding-block: 10px;
  }

  /* Header, footer and nav links get a real hit area without breaking layout. */
  .site-header .nav a,
  .site-header .nav__links a,
  .site-header .header__actions a,
  .site-header .header__actions button,
  .site-footer .footer__col a,
  .footer__bottom a,
  .journey-help__nav a,
  .breadcrumb a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding-block: 10px;
  }

  /* Filter checkboxes: 24px box inside a full-width 44px row. */
  .filter-opt {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-block: 8px;
  }
  .filter-opt input[type="checkbox"],
  .filter-opt input[type="radio"] {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    min-height: 24px;
    flex: 0 0 24px;
  }

  /* "Clear all" and similar inline filter actions. */
  .filter-clear,
  .filters__clear,
  [data-filter-clear] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding-inline: 10px;
  }

  /* The 10px copy that remained: announcement bar, cart badge, footer legal. */
  .announce__item,
  .announce__sep,
  .announcement,
  .announcement span {
    font-size: 12px !important;
    line-height: 1.5;
  }
  .cart-badge {
    font-size: 11px !important;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
  }
  .footer__bottom,
  .footer__bottom span,
  .footer__bottom p,
  .footer__bottom small {
    font-size: 12px !important;
    line-height: 1.6;
  }
  .card__save,
  .price-note,
  .badge,
  .eyebrow,
  .meta,
  .hint,
  .fine,
  .fine-print,
  .product__meta span,
  .collection__meta span,
  .gallery__zoom,
  .view-larger {
    font-size: 12px !important;
    line-height: 1.55;
  }

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

/* The product description clamp cut text in half on a phone. */
@media (max-width: 860px) {
  .desc-clamp {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
    -webkit-line-clamp: unset !important;
  }
  .desc-clamp__toggle { display: none !important; }
}
