#grid { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 22px; }
#grid > .product { display: flex; flex-direction: column; min-width: 0; }
#grid .product-image-link { overflow: hidden; }
#grid .product-image-link img { display: block; }
#grid .product-image-link:hover img { transform: scale(1.035); }
#grid .product h3 { min-height: 0; margin: 8px 0 0; overflow-wrap: anywhere; }
#grid .product h3 a { color: inherit; text-decoration: none; }
#grid .product p { margin: auto 0 8px; padding-top: 4px; }
#grid a:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.product-controls { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.details-link, .add-to-cart {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 40px;
  padding: 5px;
  border-radius: 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.details-link { border: 1px solid #c8c4bd; color: #222; text-decoration: none; }
.details-link:hover { border-color: var(--gold); }
.add-to-cart {
  grid-template-columns: auto minmax(0, max-content);
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  letter-spacing: 0;
}
.add-to-cart svg { display: block; }
.add-to-cart:disabled, .bag-summary .black:disabled {
  background: #f1efeb;
  color: #68615a;
  cursor: not-allowed;
}
.size-picker { display: grid; gap: 5px; }
.size-label { color: var(--ink); font-size: 12px; line-height: 1.25; }
.size-choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; max-width: 200px; }
.size-button { min-width: 0; min-height: 34px; padding: 2px 1px; border: 1px solid #c8c4bd; border-radius: 0; font-size: 12px; line-height: 1.15; overflow-wrap: anywhere; }
.size-button:only-child { grid-column: 1 / -1; justify-self: start; width: auto; min-width: 38px; padding-inline: 8px; }
.size-button:hover { border-color: #111; }
.color-choices { display: flex; flex-wrap: wrap; gap: 5px; }
.color-button { width: auto; min-width: 34px; min-height: 36px; padding: 2px 5px; border-radius: 4px; font-size: 12px; }
.size-button[aria-pressed="true"], .color-button[aria-pressed="true"] { border-color: #111; background: #111; color: white; }
.size-button:disabled, .color-button:disabled { border-color: #e4e0d9; background: #f9f7f4; color: #77706a; cursor: not-allowed; }
.color-button span { display: block; width: 18px; height: 18px; margin: auto; border: 1px solid #aaa; border-radius: 50%; }
.color-button:disabled span { opacity: .35; }
.product-notice { margin: 0; color: #6e5936; font-size: 12px; font-weight: 400; }
.product-controls :focus-visible, #bag :focus-visible, #detail :is(a, button):focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#detail { width: min(850px, 100%); margin-inline: auto; padding: 25px clamp(12px, 4vw, 25px); }
.detail-back { width: fit-content; margin-bottom: 16px; padding-inline: 12px; }
.detail-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: clamp(20px, 4vw, 32px); }
.detail-photo {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: white;
  cursor: zoom-in;
}
.detail-photo img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; max-height: 520px; max-height: min(520px, 70dvh); object-fit: contain; object-position: center; }
.detail-zoom-icon { display: grid; place-items: center; width: 36px; height: 36px; margin: 4px 0 0 auto; border: 1px solid #e9e5de; }
.detail-thumbnails { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.detail-thumbnails button { width: 48px; height: 48px; padding: 2px; }
.detail-thumbnails button[aria-pressed="true"] { border-color: var(--gold); }
.detail-thumbnails img { display: block; width: 100%; height: 100%; object-fit: contain; }
.detail-info { display: grid; gap: 12px; min-width: 0; }
.detail-title { font-size: clamp(28px, 3.5vw, 36px); font-weight: 400; line-height: 1.2; text-align: left; overflow-wrap: anywhere; }
.detail-info > :is(h2, h3, h4, p, hr) { margin: 0; }
.detail-info > hr { margin-top: 8px; border: 0; border-top: 1px solid #e9e5de; }
.detail-zoom { width: fit-content; max-width: min(100%, 960px); padding: 0 0 8px; border: 0; background: white; }
.detail-zoom-close { display: block; width: 44px; height: 44px; margin: 4px 4px 4px auto; padding: 0; border: 0; font-size: 24px; }
.detail-zoom img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); margin-inline: auto; cursor: auto; }
.detail-zoom img:hover { transform: none; }

#bag {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100%);
  height: 100%;
  height: 100dvh;
  max-width: 100%;
  max-height: none;
  margin: 0;
  padding: 22px clamp(15px, 5vw, 26px);
  border: 0;
  background: white;
  color: var(--ink);
  box-shadow: -15px 0 60px #0002;
  overscroll-behavior: contain;
}
body:has(#bag[open], .detail-zoom[open]) { overflow: hidden; }
.bag-heading { position: relative; padding: 3px 44px 14px 0; border-bottom: 1px solid #e9e5de; }
.bag-heading h2 { margin: 3px 0 0; font-size: 30px; text-align: left; }
.bag-close { position: absolute; top: 0; right: 0; width: 40px; height: 40px; padding: 0; border-radius: 4px; font-size: 22px; }
.bag-lines { margin: 0; padding: 0; list-style: none; }
.bag-line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 15px 0; border-bottom: 1px solid #e9e5de; }
.bag-photo img, .bag-placeholder { display: block; width: 100%; aspect-ratio: 3 / 4; background: #f8f5ef; object-fit: contain; }
#bag img { cursor: auto; transform: none; }
.bag-line-info h3 { margin: 0; font-size: 14px; line-height: 1.35; font-weight: 500; overflow-wrap: anywhere; }
.bag-size, .bag-unit-price { margin: 2px 0 0; color: #6d665c; font-size: 12px; }
.bag-swatch { display: inline-block; width: 10px; height: 10px; margin-inline-start: 2px; border: 1px solid #aaa; border-radius: 50%; }
.bag-line-price { font-size: 13px; white-space: nowrap; }
.bag-line-alert { margin: 8px 0; color: #6e5936; font-size: 13px; }
.bag-line-controls { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 6px; }
.bag-stepper { display: inline-grid; grid-template-columns: 32px minmax(22px, auto) 32px; align-items: center; border: 1px solid #e0dbd1; border-radius: 4px; text-align: center; font-variant-numeric: tabular-nums; }
.bag-stepper button { min-height: 34px; padding: 0; border: 0; border-radius: 4px; font-size: 16px; }
.bag-stepper button:disabled { color: #99928a; cursor: not-allowed; }
.bag-remove { min-height: 36px; padding: 0; border: 0; color: #635b50; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.bag-summary { display: grid; gap: 10px; padding-top: 16px; }
.bag-total { display: flex; justify-content: space-between; gap: 10px; font-size: 17px; }
.bag-summary button, .bag-continue, #orderForm button { min-height: 44px; border-radius: 4px; }
.bag-empty { padding-block: 10px; color: #6d665c; }
#orderForm input { width: 100%; border-radius: 4px; }
[aria-busy="true"] :is([data-add], [data-cart-action]) { cursor: progress; }

@media (max-width: 700px) {
  #grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
  .detail-title { font-size: clamp(22px, 5.6vw, 24px); }
}

@media (max-width: 360px) {
  .bag-line { grid-template-columns: 54px minmax(0, 1fr) auto; }
  .bag-heading h2 { font-size: 27px; }
}

@media (forced-colors: active) {
  .size-button[aria-pressed="true"], .color-button[aria-pressed="true"] { border: 2px solid Highlight; }
}
