/* Product detail adaptation. Loaded last; catalog/cart/admin pricing is unchanged.
   Prices remain whole, readable numbers. Only values wider than their own price
   region scroll horizontally; the page and purchase buttons never inherit that
   overflow. The price regions have explicit keyboard focus in the markup. */
.storefront #detail .detail-layout {
  grid-template-columns:minmax(0,1.45fr) minmax(0,1fr) minmax(292px,.92fr);
}
.storefront #detail .detail-info,
.storefront #detail .detail-heading,
.storefront #detail .purchase-column,
.storefront #detail .detail-buy,
.storefront #detail .buy-slot {
  min-width:0;
  max-width:100%;
}
.storefront #detail .detail-heading h1,
.storefront #detail .detail-category,
.storefront #detail .price-pack,
.storefront #detail .pack-label,
.storefront #detail .availability-note {
  min-width:0;
  overflow-wrap:anywhere;
}
.storefront #detail .detail-buy .price,
.storefront #mobile-buy-price {
  display:block;
  max-width:100%;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-x:contain;
  scrollbar-width:thin;
  padding:2px 0 5px;
  font-variant-numeric:tabular-nums;
  letter-spacing:normal;
}
.storefront #detail .detail-buy .price { font-size:28px; }
.storefront #detail .detail-buy .product-price,
.storefront #mobile-buy-price .product-price {
  display:inline-grid;
  grid-template-columns:max-content max-content;
  align-items:baseline;
  gap:5px 8px;
  width:max-content;
  min-width:0;
  max-width:none;
  flex-wrap:nowrap;
  line-height:1.25;
}
.storefront #detail .detail-buy .discount-current,
.storefront #mobile-buy-price .discount-current {
  grid-column:1;
  grid-row:1;
  white-space:nowrap;
  overflow-wrap:normal;
  max-width:none;
}
/* Flatten the visual comparison wrapper, preserving its semantic <del> child. */
.storefront #detail .detail-buy .discount-comparison,
.storefront #mobile-buy-price .discount-comparison { display:contents; }
.storefront #detail .detail-buy .discount-regular,
.storefront #mobile-buy-price .discount-regular {
  grid-column:2;
  grid-row:1;
  max-width:none;
  white-space:nowrap;
  overflow-wrap:normal;
  font-size:16px;
  line-height:1.3;
}
.storefront #detail .detail-buy .discount-badge,
.storefront #mobile-buy-price .discount-badge {
  grid-column:1 / -1;
  grid-row:2;
  justify-self:start;
  font-size:11px;
  line-height:1.2;
}
.storefront #detail .detail-buy .price:focus-visible,
.storefront #mobile-buy-price:focus-visible {
  outline:2px solid var(--green,#166c3f);
  outline-offset:-2px;
  border-radius:4px;
}
.storefront #detail .detail-buy .detail-purchase-row {
  grid-template-columns:120px minmax(0,1fr);
  gap:8px;
}
.storefront #detail .detail-buy .detail-quantity {
  grid-template-columns:44px minmax(32px,1fr) 44px;
}
.storefront #detail .detail-buy .detail-quantity-value { line-height:1.3; }
.storefront #detail .detail-buy .detail-purchase-row>.add,
.storefront #detail .detail-buy .buy-now {
  min-height:48px;
  font-size:14px;
  line-height:1.3;
  white-space:normal;
}
.storefront #detail .purchase-note { white-space:normal; }
.storefront #detail .purchase-note svg { flex:none; }
.storefront #detail .variant-list button {
  min-height:44px;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
}
.storefront #detail .back-arrow { min-width:44px; min-height:44px; }
.storefront #detail .product-breadcrumb nav { min-height:44px; }
.storefront #detail .product-breadcrumb nav>a,
.storefront #detail .product-breadcrumb nav>button { min-width:44px; min-height:44px; }
.storefront #detail .product-breadcrumb nav>a { flex:none; }
.storefront #detail .product-breadcrumb nav>button {
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.storefront #detail .detail-info .product-meta-brand-link {
  display:inline-flex;
  align-items:center;
  width:fit-content;
  max-width:100%;
  min-width:44px;
  min-height:44px;
  padding:6px 9px;
  color:#475449;
  text-decoration:none;
  overflow-wrap:anywhere;
}
.storefront #detail .product-meta-brand-link:hover { color:var(--green,#166c3f); }
.storefront #detail .product-meta-brand-link:focus-visible {
  outline:3px solid var(--green,#166c3f);
  outline-offset:3px;
}
.storefront .catalog-product-return { margin:0 0 12px; }
.storefront .catalog-product-return-link {
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  max-width:100%;
  padding:8px 12px;
  border-radius:9px;
  background:var(--soft-green,#edf6ef);
  color:var(--green,#166c3f);
  font-size:14px;
  line-height:1.4;
  text-decoration:none;
  overflow-wrap:anywhere;
}
.storefront .catalog-product-return-link>span:first-child { flex:none; font-size:20px; }
.storefront .catalog-product-return-link:focus-visible {
  outline:3px solid var(--green,#166c3f);
  outline-offset:3px;
}
/* Tablet: two useful columns rather than squeezing gallery, text and controls. */
@media (min-width:761px) and (max-width:1080px) {
  .storefront #detail .detail-layout {
    grid-template-columns:minmax(0,1.15fr) minmax(280px,1fr);
    gap:24px 20px;
  }
  .storefront #detail .product-gallery { grid-column:1; grid-row:1 / 3; }
  .storefront #detail .detail-info { grid-column:2; grid-row:1; }
  .storefront #detail .purchase-column { grid-column:2; grid-row:2; position:static; }
  .storefront #detail .detail-photo { height:440px; }
  .storefront #detail .gallery-thumb { min-width:44px; }
  .storefront #detail .product-gallery { grid-template-columns:44px minmax(0,1fr); }
}
@media (max-width:760px) {
  .storefront.product-view .market-header .header-favorites,
  .storefront.product-view .market-header #cart-toggle { min-height:44px; }
  .storefront #detail .product-breadcrumb { gap:6px; padding:8px 0; }
  .storefront #detail .product-breadcrumb .detail-actions { gap:2px; }
  .storefront #detail .detail-layout { display:flex; gap:0; }
  .storefront #detail .product-gallery { gap:10px; }
  .storefront #detail .detail-photo { height:clamp(280px,94vw,420px); padding:24px 24px 45px; }
  .storefront #detail .detail-photo .photo-pack-reference { max-width:calc(100% - 24px); white-space:normal; overflow-wrap:anywhere; text-align:center; }
  .storefront #detail .thumbnail-rail {
    max-width:100%;
    min-width:0;
    overflow-x:auto;
    overscroll-behavior-x:contain;
    padding:2px 2px 5px;
  }
  .storefront #detail .gallery-thumb { flex:0 0 52px; width:52px; min-width:52px; height:68px; }
  .storefront #detail .detail-info { padding-top:16px; }
  .storefront #detail .detail-heading h1 { font-size:23px; line-height:1.3; }
  .storefront #detail .detail-category { margin-bottom:16px; }
  .storefront #detail .variant-list { gap:8px; }
  .storefront #detail .variant-list button { flex:0 1 auto; min-width:73px; min-height:48px; }
  .storefront #detail .purchase-column { width:100%; margin-top:20px; }
  .storefront #detail .purchase-column .detail-buy { display:block; padding:18px 16px 14px; }
  .storefront #detail .detail-buy .detail-purchase-row { grid-template-columns:120px minmax(0,1fr); }
  .storefront #detail .detail-buy .detail-purchase-row>.add,
  .storefront #detail .detail-buy .buy-now { min-height:52px; }
  .storefront #detail .detail-buy .detail-quantity,
  .storefront #detail .detail-buy .detail-quantity button { min-height:52px; }
  .storefront #detail .delivery-card>div { min-width:0; overflow-wrap:anywhere; }
  .storefront #detail .delivery-card a { display:inline-flex; align-items:center; min-height:44px; }
  .storefront #detail .related .section-title { flex-wrap:wrap; }
  .storefront #detail .related .quiet-button { min-height:44px; }
  .storefront #detail .product .favorite { width:44px; height:44px; min-height:44px; }
  .storefront #detail .product .card-variants button { min-width:44px; min-height:44px; }
  .storefront #detail .product .add { min-height:48px; }
  .storefront #detail .product .quick-quantity { grid-template-columns:44px minmax(0,1fr) 44px; }
  .storefront #detail .product .quick-quantity button { min-width:44px; min-height:46px; }
  .storefront #detail .product-feedback { max-width:100%; }
  .storefront #detail .feedback-tabs { flex-wrap:wrap; column-gap:18px; row-gap:0; }
  .storefront #detail .feedback-tabs [role=tab] { max-width:100%; flex-wrap:wrap; }
  .storefront #detail .feedback-list-toolbar,
  .storefront #detail .feedback-form-heading { flex-wrap:wrap; }
  .storefront #detail .feedback-score { min-width:0; max-width:100%; flex-wrap:wrap; }
  .storefront #detail .feedback-empty-title { overflow-wrap:anywhere; }
  /* Price/pack gets a complete row. Two equal-height, readable actions follow. */
  .storefront #mobile-buybar {
    grid-template-columns:minmax(0,1fr) minmax(144px,1fr);
    gap:8px;
    padding:10px max(12px,env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
    align-items:stretch;
  }
  .storefront #mobile-buybar .mobile-buy-info { grid-column:1 / -1; grid-row:1; min-width:0; }
  .storefront #mobile-buy-volume { font-size:12px; line-height:1.3; margin:0 0 2px; }
  .storefront #mobile-buybar #mobile-buy-price { font-size:24px; line-height:1.25; letter-spacing:normal; padding-bottom:3px; }
  .storefront #mobile-buy-price .product-price { grid-template-columns:max-content max-content max-content; }
  .storefront #mobile-buy-price .discount-regular { font-size:14px; }
  .storefront #mobile-buy-price .discount-badge { grid-column:3; grid-row:1; align-self:center; font-size:11px; padding:3px 5px; }
  .storefront #mobile-buy-now { grid-column:1; grid-row:2; }
  .storefront #mobile-buy-action { grid-column:2; grid-row:2; min-width:0; }
  .storefront #mobile-buy-now,
  .storefront #mobile-buy-action>.add {
    min-width:0;
    min-height:52px;
    height:100%;
    padding:8px 6px;
    font-size:14px;
    line-height:1.3;
    white-space:normal;
  }
  .storefront #mobile-buy-action .quick-quantity {
    min-height:52px;
    height:100%;
    grid-template-columns:44px minmax(44px,1fr) 44px;
  }
  .storefront #mobile-buy-action .quick-quantity button { min-width:44px; min-height:50px; padding:5px 0; }
  .storefront #mobile-buy-action .in-cart { font-size:13px; line-height:1.3; overflow-wrap:anywhere; }
  .storefront #mobile-buy-action small { font-size:10px; line-height:1.3; }
  .storefront.product-view.has-mobile-buybar {
    padding-bottom:calc(var(--mobile-buybar-height,calc(130px + env(safe-area-inset-bottom))) + 12px);
  }
  .storefront.product-view.has-mobile-buybar .toast {
    bottom:calc(var(--mobile-buybar-height,calc(130px + env(safe-area-inset-bottom))) + 12px);
  }
}
