/* Product gallery with complete thumbnails and a separate zoom preview. */
.product-page-section { padding-top: 1.6rem; }
.product-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1.5rem; color: var(--muted); font-size: .82rem; }
.product-breadcrumb a:hover { color: var(--green); text-decoration: underline; }
.product-breadcrumb [aria-current] { color: var(--ink); }
.product-detail-refined { grid-template-columns: minmax(0, 1.296fr) minmax(0, .784fr); gap: clamp(1.6rem, 4vw, 3.6rem); align-items: start; }
.product-gallery {
  --gallery-ratio: 1;
  --gallery-max-height: min(672px, 72vh);
  --gallery-thumb-size: 74px;
  --gallery-rail-width: 84px;
  --gallery-gap: .8rem;
  position: sticky;
  top: 100px;
  min-width: 0;
}
@supports (height: 100dvh) {
  .product-gallery { --gallery-max-height: min(672px, 72dvh); }
}
.gallery-modes { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.gallery-mode { min-height: 44px; padding: .55rem 1rem; border: 1px solid #ccd5c8; border-radius: 99px; background: #fffdf8; color: var(--green); font-weight: 700; cursor: pointer; font-size: .83rem; }
.gallery-mode.is-active { background: var(--green); color: #fff; border-color: var(--green); }

/* Keep the rail close to the photo, including when the photo is very tall. */
.gallery-layout {
  display: grid;
  grid-template-columns: var(--gallery-rail-width) minmax(0, 1fr);
  align-items: start;
  gap: var(--gallery-gap);
  width: min(100%, calc(var(--gallery-rail-width) + var(--gallery-gap) + var(--gallery-max-height) * var(--gallery-ratio)));
  margin-inline: auto;
}
.gallery-viewer { min-width: 0; }
.gallery-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: var(--gallery-ratio);
  max-height: var(--gallery-max-height);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(49,91,58,.14);
  border-radius: 18px;
  background: #fff;
  touch-action: pan-y;
}
.gallery-stage .gallery-main-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  object-fit: fill !important;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
}
.is-enhanced .gallery-stage.is-image { cursor: zoom-in; }
.is-enhanced .gallery-dialog-stage.is-image.is-zooming-out { cursor: zoom-out; }
.gallery-stage.is-spin .gallery-main-image { object-fit: contain !important; }
.gallery-stage.is-zoomed { touch-action: none; }
.gallery-stage.is-spin { cursor: grab; touch-action: pan-y; }
.gallery-stage.is-dragging { cursor: grabbing !important; }
.gallery-stage .gallery-video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; background: #111; }
.gallery-stage[aria-busy="true"] { cursor: progress !important; }
.gallery-stage[aria-busy="true"]::after { content: "Loading…"; position: absolute; bottom: .8rem; padding: .35rem .7rem; border-radius: 99px; color: var(--green); background: rgba(255,253,248,.94); font-size: .78rem; pointer-events: none; }
.gallery-caption-row { display: flex; gap: .6rem; justify-content: space-between; align-items: start; margin-top: .7rem; }
.gallery-caption { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: .82rem; color: var(--muted); }
.gallery-counter { white-space: nowrap; font-size: .76rem; font-variant-numeric: tabular-nums; color: var(--muted); }

/* The rail stays on the left on phones, too. Extra thumbnails scroll vertically. */
.gallery-thumbnails {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-height: var(--gallery-stage-height, var(--gallery-max-height));
  min-height: 0;
  margin: 0;
  padding: 3px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  list-style: none;
  scrollbar-width: thin;
  scroll-snap-type: y proximity;
}
.gallery-thumbnails li { flex: 0 0 auto; width: var(--gallery-thumb-size); max-width: 100%; scroll-snap-align: start; }
.gallery-thumbnail { position: relative; display: grid; place-items: center; width: var(--gallery-thumb-size); height: var(--gallery-thumb-size); max-width: 100%; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px #e0e4dc; }
.product-gallery .gallery-thumbnail img { position: absolute !important; inset: 3px !important; display: block !important; width: calc(100% - 6px) !important; height: calc(100% - 6px) !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; max-height: none !important; aspect-ratio: auto !important; object-fit: contain !important; object-position: center !important; transform: none !important; margin: 0 !important; padding: 0 !important; }
.gallery-thumbnail:hover { box-shadow: 0 0 0 1px var(--green); }
.gallery-thumbnail.is-active { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.gallery-play-mark { position: absolute; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(29,33,29,.78); color: #fff; font-size: .8rem; }
.gallery-video-placeholder { align-self: end; padding-bottom: .2rem; font-size: .66rem; color: var(--muted); }
.gallery-visually-hidden, .gallery-status:not(.is-error) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.gallery-status.is-error { margin: .5rem 0 0; color: var(--danger); font-size: .78rem; }
.gallery-media-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow-y: auto; padding: .8rem; text-align: center; font-size: .8rem; }
.gallery-media-error p { margin-bottom: .6rem; }
.gallery-media-error a { display: block; margin-top: .6rem; text-decoration: underline; }
.gallery-tool { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: .45rem; border: 1px solid #ccd5c8; border-radius: 10px; color: var(--green); background: #fff; cursor: pointer; font-weight: 700; line-height: 1; }
.gallery-tool:hover:not(:disabled) { border-color: var(--green); background: var(--green-soft); }
.gallery-tool:disabled { opacity: .4; cursor: default; }
.gallery-tool-text { padding-inline: .8rem; font-size: .8rem; }
.gallery-zoom-value { min-width: 42px; text-align: center; font-size: .8rem; font-variant-numeric: tabular-nums; }
.gallery-spin-controls { margin-top: .8rem; }
.gallery-spin-buttons { display: flex; justify-content: center; align-items: center; gap: 1rem; color: var(--muted); font-size: .83rem; }
.gallery-spin-range { display: block; width: min(100%, 360px); min-height: 44px; margin: .3rem auto; accent-color: var(--green); }
.product-gallery.is-spin-mode .gallery-layout { grid-template-columns: minmax(0, 1fr); width: min(100%, calc(var(--gallery-max-height) * var(--gallery-ratio))); }
.product-gallery [hidden] { display: none !important; }

/* The preview fits the viewport; only its photo scales when zooming. */
.gallery-dialog { width: min(1100px, calc(100vw - 2rem)); max-width: none; height: min(900px, calc(100vh - 2rem)); max-height: calc(100vh - 2rem); padding: 1rem; border: 1px solid rgba(49,91,58,.2); border-radius: 18px; color: var(--ink); background: var(--cream); box-shadow: var(--shadow); overflow: hidden; }
.gallery-dialog[open] { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: .7rem; margin: auto; }
.gallery-dialog:not([open]) { display: none; }
.gallery-dialog::backdrop { background: rgba(15,24,18,.8); backdrop-filter: blur(4px); }
.gallery-dialog.is-dialog-fallback[open] { z-index: 1000; }
.gallery-dialog-fallback-backdrop { position: fixed; inset: 0; z-index: 999; background: rgba(15,24,18,.8); }
.gallery-dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-width: 0; }
.gallery-dialog-header h2 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: clamp(1.05rem, 2.5vw, 1.5rem); }
.gallery-dialog-header button { flex: 0 0 auto; }
.gallery-dialog-stage { min-height: 0; height: 100%; width: 100%; max-height: none; aspect-ratio: auto; border-radius: 12px; }
.gallery-dialog-stage .gallery-main-image { object-fit: contain !important; }
.gallery-dialog-tools { display: flex; justify-content: center; flex-wrap: wrap; align-items: center; gap: .4rem; }
.gallery-dialog-help { margin: 0; color: var(--muted); font-size: .76rem; text-align: center; }
.product-gallery-modal-open { overflow: hidden; }
@supports (height: 100dvh) {
  .gallery-dialog { height: min(900px, calc(100dvh - 2rem)); max-height: calc(100dvh - 2rem); }
}
.product-purchase-panel h1 { margin: .6rem 0 .7rem; font-size: clamp(2rem, 3.7vw, 3.6rem); }
.product-detail-price { font-size: 1.7rem; margin: 1.2rem 0 .35rem; }
.product-detail-price del { font-size: 1rem; }
.product-cart-form { padding: 1.2rem; border: 1px solid #d6dfd0; border-radius: 16px; background: rgba(255,253,248,.85); }
.product-cart-form > label { margin-bottom: .6rem; font-size: .8rem; font-weight: 700; }
.product-buy-row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.product-buy-row > .button { flex: 1; min-width: 160px; }
.product-quantity-control { display: inline-flex; min-height: 48px; overflow: hidden; border: 1px solid #cbd0ca; border-radius: 999px; background: #fff; }
.product-quantity-control button { width: 44px; min-height: 46px; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 1.2rem; }
.product-quantity-control button:hover { background: var(--green-soft); }
.product-quantity-control input { width: 54px; padding: .5rem .15rem; border: 0; border-radius: 0; text-align: center; -moz-appearance: textfield; }
.product-quantity-control input::-webkit-inner-spin-button, .product-quantity-control input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.product-shopping-note { display: grid; gap: .3rem; margin: 1rem 0 1.5rem; color: var(--muted); font-size: .8rem; }
.product-shopping-note a { width: fit-content; color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.product-information { margin-bottom: 1.5rem; border-top: 1px solid #d6dfd0; }
.product-information details { border-bottom: 1px solid #d6dfd0; }
.product-information summary { position: relative; padding: 1rem 2rem 1rem 0; cursor: pointer; list-style: none; font-size: .95rem; font-weight: 700; }
.product-information summary::-webkit-details-marker { display: none; }
.product-information summary::after { content: "+"; position: absolute; right: .2rem; font-size: 1.2rem; color: var(--green); }
.product-information details[open] summary::after { content: "−"; }
.product-information details > div { padding: 0 0 1.1rem; font-size: .92rem; color: var(--muted); }
.product-label-note { margin-top: 1rem; }
.product-gallery :is(button, a, input, [tabindex]):focus-visible, .product-information summary:focus-visible, .product-breadcrumb a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
@media (max-width: 980px) {
  .product-detail-refined { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 1.6rem; }
  .product-gallery { position: static; }
}
@media (max-width: 760px) {
  .product-detail-refined { grid-template-columns: 1fr; }
  .product-page-section { padding-top: 1rem; }
  .product-gallery { --gallery-thumb-size: 54px; --gallery-rail-width: 64px; --gallery-gap: .55rem; }
  .gallery-stage { border-radius: 14px; }
  .gallery-dialog { width: calc(100vw - 1rem); height: calc(100vh - 1rem); max-height: calc(100vh - 1rem); padding: .65rem; gap: .55rem; }
  .gallery-dialog-help { font-size: .7rem; }
}
@supports (height: 100dvh) {
  @media (max-width: 760px) {
    .gallery-dialog { height: calc(100dvh - 1rem); max-height: calc(100dvh - 1rem); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .product-gallery *, .product-information * { scroll-behavior: auto !important; transition: none !important; }
}

