.haystack-frame-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 68px));
  gap: 8px;
  margin: 0 0 10px;
}

.haystack-frame-picker__choice {
  appearance: none;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 2px;
  color: #111;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 5px 5px 7px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.haystack-frame-picker__choice[aria-checked="true"] {
  border-color: #111;
  box-shadow: inset 0 0 0 1px #111;
}

.haystack-frame-picker__choice:focus-visible {
  outline: 2px solid #111;
  outline-offset: 3px;
}

.haystack-frame-picker__choice:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.haystack-frame-picker__image {
  aspect-ratio: 1;
  display: block;
  height: auto;
  max-width: 100%;
  width: 50px;
}

.haystack-frame-picker__label {
  font-size: 11px;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: center;
}

.haystack-frame-picker__price {
  color: #6f6a61;
  font-size: 10px;
  line-height: 1.15;
  min-height: 1.15em;
  white-space: nowrap;
}

.haystack-frame-picker__native {
  border: 0 !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  padding: 0 !important;
  position: absolute !important;
  white-space: nowrap !important;
  width: 1px !important;
}

/*
 * Artwork viewer foundation.
 *
 * The native WooCommerce gallery remains responsible for the source image.
 * This stage gives the artwork a predictable, centered area
 * that future frame layers can occupy without changing the product layout.
 */
.single-product.haystack-framing-product .woocommerce-product-gallery {
  --haystack-art-shadow-size: clamp(4px, 0.42vw, 7px);
  --haystack-frame-rail: clamp(9px, 0.9vw, 13px);
  --haystack-mat-width: calc(clamp(10px, 1.2vw, 16px) * var(--haystack-mat-scale, 1));
  align-items: center;
  background: #f2f2f2;
  display: flex;
  height: clamp(560px, calc(100vh - 98px), 760px);
  justify-content: center;
  overflow: hidden;
  padding: clamp(36px, 4vw, 64px);
}

/* Scale the existing mat and its dependent shadows/fit calculations together.
 * Keep unframed images, the frame rail and additional photos unchanged. */
.single-product.haystack-wide-preview-mat .woocommerce-product-gallery:is([data-haystack-frame="black"], [data-haystack-frame="white"], [data-haystack-frame="natural"]) {
  --haystack-mat-scale: 2;
}

/* Include WooCommerce's gallery container to outrank its display:block link
 * rule. Center the actual image in every slide, regardless of aspect ratio. */
.single-product.haystack-framing-product .woocommerce-product-gallery__wrapper,
.single-product.haystack-framing-product .woocommerce-product-gallery__image,
.single-product.haystack-framing-product .woocommerce-product-gallery.images .woocommerce-product-gallery__image > a {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.single-product.haystack-framing-product .woocommerce-product-gallery__wrapper {
  position: relative;
}

.single-product.haystack-framing-product .woocommerce-product-gallery__image.haystack-artwork-viewer__detail-slide {
  display: none;
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-artwork-viewer="ready"] .haystack-artwork-viewer__slide {
  display: flex;
  flex: 0 0 100%;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: translateX(7%);
  transition: opacity 300ms ease, transform 380ms cubic-bezier(0.22, 0.61, 0.36, 1), visibility 380ms ease;
  visibility: hidden;
  width: 100% !important;
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-artwork-viewer="ready"] .haystack-artwork-viewer__slide--before {
  transform: translateX(-7%);
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-artwork-viewer="ready"] .haystack-artwork-viewer__slide--after {
  transform: translateX(7%);
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-artwork-viewer="ready"] .haystack-artwork-viewer__slide--active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  visibility: visible;
}

.single-product.haystack-framing-product .haystack-artwork-viewer__detail {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.single-product.haystack-framing-product .haystack-artwork-viewer__detail-image {
  height: auto !important;
  margin-inline: auto;
  max-height: 88%;
  max-width: 82%;
  object-fit: contain;
  width: auto !important;
}

.single-product.haystack-framing-product .haystack-artwork-viewer__navigation {
	inset: 0;
	pointer-events: none;
	position: absolute;
	z-index: 8;
}

.single-product.haystack-framing-product .haystack-artwork-viewer__arrow {
	pointer-events: auto;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
}

.single-product.haystack-framing-product .haystack-artwork-viewer__arrow--previous {
	left: clamp(12px, 2vw, 26px);
}

.single-product.haystack-framing-product .haystack-artwork-viewer__arrow--next {
	right: clamp(12px, 2vw, 26px);
}

.single-product.haystack-framing-product .haystack-artwork-viewer__arrow {
  align-items: center;
  appearance: none;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 17, 17, 0.45);
  border-radius: 50%;
  color: #111;
  cursor: pointer;
  display: flex;
  font-size: 21px;
  height: 42px;
  justify-content: center;
  line-height: 1;
  padding: 0 0 2px;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
  width: 42px;
}

.single-product.haystack-framing-product .haystack-artwork-viewer__arrow[hidden] {
  display: none !important;
}

.single-product.haystack-framing-product .haystack-artwork-viewer__arrow:hover {
  background: #fff;
  border-color: #111;
  transform: translateY(-50%) scale(1.04);
}

.single-product.haystack-framing-product .haystack-artwork-viewer__arrow:focus-visible {
  outline: 2px solid #111;
  outline-offset: 3px;
}

.single-product.haystack-framing-product .woocommerce-product-gallery__image > a {
  cursor: default;
  max-height: 100%;
  max-width: 100%;
  transition: opacity 160ms ease-in, transform 160ms ease-in;
}

/* Image wrappers are non-interactive; retain focus rings on viewer controls. */
.single-product.haystack-framing-product .woocommerce-product-gallery__image > a:focus {
  outline: none;
  box-shadow: none;
}

/* Scale the existing main-image presentation, including its CSS frame/mat.
 * Individual scale leaves the frame-change transform and image alignment intact.
 * The gallery already clips overflow; navigation remains above it and unscaled.
 * No animated pointer tracking, so reduced-motion users get no trailing motion. */
@media (hover: hover) and (pointer: fine) {
  .single-product.haystack-framing-product .haystack-artwork-viewer__artwork {
    scale: var(--haystack-viewer-zoom, 1);
    transform-origin: var(--haystack-viewer-zoom-x, 50%) var(--haystack-viewer-zoom-y, 50%);
  }

  .single-product.haystack-framing-product .haystack-artwork-viewer__artwork--zoomable {
    cursor: zoom-in;
  }
}

.single-product.haystack-framing-product .woocommerce-product-gallery.haystack-artwork-viewer--changing .woocommerce-product-gallery__image > a {
  opacity: 0.45;
  transform: scale(0.992);
  transition-duration: 90ms;
  transition-timing-function: ease-out;
}

.single-product.haystack-framing-product .woocommerce-product-gallery__image img.wp-post-image {
  background: transparent;
  border: 0 solid transparent;
  box-shadow: 0 5px 14px rgba(31, 27, 20, 0.14);
  height: auto !important;
  margin-left: auto !important;
  margin-right: auto !important;
  max-height: 100%;
  max-width: 68%;
  object-fit: contain;
  width: auto !important;
}

.single-product.haystack-framing-product .haystack-artwork-viewer--landscape .woocommerce-product-gallery__image img.wp-post-image {
  max-width: 100%;
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-frame="unframed"] img.wp-post-image {
  box-shadow: 0 10px 24px rgba(24, 20, 15, 0.32), 0 2px 5px rgba(24, 20, 15, 0.24);
  max-height: calc(100% - (var(--haystack-mat-width) + var(--haystack-mat-width) + var(--haystack-frame-rail) + var(--haystack-frame-rail)));
  max-width: calc(68% - (var(--haystack-mat-width) + var(--haystack-mat-width) + var(--haystack-frame-rail) + var(--haystack-frame-rail)));
}

.single-product.haystack-framing-product .haystack-artwork-viewer--landscape[data-haystack-frame="unframed"] img.wp-post-image {
  max-width: calc(100% - (var(--haystack-mat-width) + var(--haystack-mat-width) + var(--haystack-frame-rail) + var(--haystack-frame-rail)));
}

/*
 * Optional curled-paper experiment. Add ?unframed_preview=curl to a framed
 * product URL to compare it with the normal unframed presentation.
 */
.single-product.haystack-framing-product.haystack-unframed-curl-preview .woocommerce-product-gallery {
  --haystack-paper-shadow-x: clamp(11px, 1vw, 15px);
  --haystack-paper-shadow-y: clamp(9px, 0.85vw, 13px);
}

.single-product.haystack-framing-product.haystack-unframed-curl-preview .woocommerce-product-gallery[data-haystack-frame="unframed"] img.wp-post-image {
  background-color: transparent;
  background-image: none;
  border-image-repeat: stretch;
  border-image-slice: 40 34 34 40 fill;
  border-image-source: url("../images/framing/haystack-unframed-paper-shadow.png?v=2");
  border-image-width: 1;
  border-style: solid;
  border-width: var(--haystack-paper-shadow-y) var(--haystack-paper-shadow-x);
  box-shadow: none;
  max-height: calc(100% - (var(--haystack-mat-width) + var(--haystack-mat-width) + var(--haystack-frame-rail) + var(--haystack-frame-rail)) + (var(--haystack-paper-shadow-y) + var(--haystack-paper-shadow-y)));
  max-width: calc(68% - (var(--haystack-mat-width) + var(--haystack-mat-width) + var(--haystack-frame-rail) + var(--haystack-frame-rail)) + (var(--haystack-paper-shadow-x) + var(--haystack-paper-shadow-x)));
}

.single-product.haystack-framing-product.haystack-unframed-curl-preview .haystack-artwork-viewer--landscape {
  --haystack-paper-shadow-x: clamp(14px, 1.35vw, 20px);
  --haystack-paper-shadow-y: clamp(5px, 0.5vw, 8px);
}

.single-product.haystack-framing-product.haystack-unframed-curl-preview .haystack-artwork-viewer--landscape[data-haystack-frame="unframed"] img.wp-post-image {
  max-width: calc(100% - (var(--haystack-mat-width) + var(--haystack-mat-width) + var(--haystack-frame-rail) + var(--haystack-frame-rail)) + (var(--haystack-paper-shadow-x) + var(--haystack-paper-shadow-x)));
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-frame="black"] img.wp-post-image,
.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-frame="white"] img.wp-post-image,
.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-frame="natural"] img.wp-post-image {
  background-color: #fafaf9;
  background-clip: padding-box;
  background-image:
    radial-gradient(circle var(--haystack-art-shadow-size) at bottom right, rgba(31, 27, 20, 0.22), rgba(31, 27, 20, 0.07) 52%, transparent),
    radial-gradient(circle var(--haystack-art-shadow-size) at bottom left, rgba(31, 27, 20, 0.22), rgba(31, 27, 20, 0.07) 52%, transparent),
    radial-gradient(circle var(--haystack-art-shadow-size) at top left, rgba(31, 27, 20, 0.22), rgba(31, 27, 20, 0.07) 52%, transparent),
    radial-gradient(circle var(--haystack-art-shadow-size) at top right, rgba(31, 27, 20, 0.22), rgba(31, 27, 20, 0.07) 52%, transparent),
    linear-gradient(to right, rgba(31, 27, 20, 0.22), rgba(31, 27, 20, 0.07) 52%, transparent),
    linear-gradient(to bottom, rgba(31, 27, 20, 0.22), rgba(31, 27, 20, 0.07) 52%, transparent),
    linear-gradient(to left, rgba(31, 27, 20, 0.22), rgba(31, 27, 20, 0.07) 52%, transparent),
    linear-gradient(to top, rgba(31, 27, 20, 0.22), rgba(31, 27, 20, 0.07) 52%, transparent);
  background-position:
    left calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)) top calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)),
    right calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)) top calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)),
    right calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)) bottom calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)),
    left calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)) bottom calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)),
    right calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)) top var(--haystack-mat-width),
    left var(--haystack-mat-width) bottom calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)),
    left calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size)) top var(--haystack-mat-width),
    left var(--haystack-mat-width) top calc(var(--haystack-mat-width) - var(--haystack-art-shadow-size));
  background-repeat: no-repeat;
  background-size:
    var(--haystack-art-shadow-size) var(--haystack-art-shadow-size),
    var(--haystack-art-shadow-size) var(--haystack-art-shadow-size),
    var(--haystack-art-shadow-size) var(--haystack-art-shadow-size),
    var(--haystack-art-shadow-size) var(--haystack-art-shadow-size),
    var(--haystack-art-shadow-size) calc(100% - (var(--haystack-mat-width) + var(--haystack-mat-width))),
    calc(100% - (var(--haystack-mat-width) + var(--haystack-mat-width))) var(--haystack-art-shadow-size),
    var(--haystack-art-shadow-size) calc(100% - (var(--haystack-mat-width) + var(--haystack-mat-width))),
    calc(100% - (var(--haystack-mat-width) + var(--haystack-mat-width))) var(--haystack-art-shadow-size);
  border-image-repeat: stretch;
  border-image-width: 1;
  border-style: solid;
  border-width: var(--haystack-frame-rail);
  box-shadow: 0 8px 20px rgba(31, 27, 20, 0.2);
  max-height: 100%;
  max-width: 68%;
  padding: var(--haystack-mat-width);
}

.single-product.haystack-framing-product .haystack-artwork-viewer--landscape[data-haystack-frame="black"] img.wp-post-image,
.single-product.haystack-framing-product .haystack-artwork-viewer--landscape[data-haystack-frame="white"] img.wp-post-image,
.single-product.haystack-framing-product .haystack-artwork-viewer--landscape[data-haystack-frame="natural"] img.wp-post-image {
  max-width: 100%;
}

/* The suite's first slide is a composite photograph, not one frameable work.
 * Keep it unframed while the six component slides use the selected treatment. */
.single-product.haystack-suite-product .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child img.wp-post-image {
  background: transparent;
  background-image: none;
  border: 0;
  border-image: none;
  box-shadow: 0 10px 24px rgba(24, 20, 15, 0.24);
  max-height: 100%;
  max-width: 92%;
  padding: 0;
}

.single-product.haystack-suite-product .woocommerce-product-gallery .haystack-suite-artwork-slide--landscape img.wp-post-image {
  max-width: 100%;
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-frame="black"] img.wp-post-image {
  border-image-slice: 130;
  border-image-source: url("../images/framing/frame-approved-black.webp?v=1");
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-frame="white"] img.wp-post-image {
  border-image-slice: 116;
  border-image-source: url("../images/framing/frame-approved-white.webp?v=1");
}

.single-product.haystack-framing-product .woocommerce-product-gallery[data-haystack-frame="natural"] img.wp-post-image {
  border-image-slice: 130;
  border-image-source: url("../images/framing/frame-approved-natural.webp?v=1");
}

@media (prefers-reduced-motion: reduce) {
  .single-product.haystack-framing-product .woocommerce-product-gallery__image > a {
    transition: none;
  }
}

body.haystack-framing-reminder-open {
  overflow: hidden;
}

.haystack-framing-reminder {
  background: #fff;
  border: 0;
  border-radius: 3px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.25);
  color: #111;
  margin: auto;
  max-height: calc(100vh - 40px);
  max-width: 700px;
  overflow-y: auto;
  padding: 0;
  width: calc(100% - 40px);
}

.haystack-framing-reminder::backdrop {
  background: rgba(24, 28, 34, 0.62);
}

.haystack-framing-reminder__inner {
  padding: 30px 40px 28px;
  position: relative;
}

.haystack-framing-reminder__close {
  appearance: none;
  background: transparent;
  border: 0;
  color: #111;
  cursor: pointer;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  padding: 8px;
  position: absolute;
  right: 14px;
  top: 10px;
}

.haystack-framing-reminder__close:focus-visible,
.haystack-framing-reminder__actions button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 3px;
}

.haystack-framing-reminder__heading {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 16px;
  text-align: center;
}

.haystack-framing-reminder__feature {
  background: #f2efe9;
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}

.haystack-framing-reminder__photo {
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  width: 100%;
}

.haystack-framing-reminder__copy {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 24px;
  text-align: center;
}

.haystack-framing-reminder__copy h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
}

.haystack-framing-reminder__copy p {
  font-size: 17px;
  line-height: 1.45;
  margin: 0;
  max-width: 560px;
  white-space: pre-line;
}

.haystack-framing-reminder__actions {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  margin-top: 20px;
}

.haystack-framing-reminder__actions button {
  appearance: none;
  border: 1px solid #111;
  border-radius: 999px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  min-height: 54px;
  padding: 12px 24px;
}

.haystack-framing-reminder__choose {
  background: #111;
  color: #fff;
}

.haystack-framing-reminder__continue {
  background: #fff;
  color: #111;
}

@media (min-width: 481px) {
  .haystack-framing-reminder {
    transform: scale(0.8);
  }

  .haystack-framing-reminder .haystack-framing-reminder__photo {
    height: auto !important;
  }
}

@media (max-width: 480px) {
  .single-product.haystack-framing-product .woocommerce-product-gallery {
    --haystack-frame-rail: 8px;
    --haystack-mat-width: calc(10px * var(--haystack-mat-scale, 1));
    aspect-ratio: 1 / 1.08;
    height: auto;
    min-height: 0;
    padding: 32px 24px;
  }

  .single-product.haystack-framing-product .woocommerce-product-gallery__image img.wp-post-image {
    max-width: 82%;
  }

  .single-product.haystack-framing-product .haystack-artwork-viewer__detail-image {
    max-height: 84%;
    max-width: 88%;
  }

  .single-product.haystack-framing-product .haystack-artwork-viewer__navigation {
    bottom: 10px;
    grid-template-columns: 36px auto 36px;
  }

  .single-product.haystack-framing-product .haystack-artwork-viewer__arrow {
    height: 36px;
    width: 36px;
  }

  .haystack-frame-picker {
    grid-template-columns: repeat(4, minmax(0, 68px));
    max-width: 296px;
  }

  .haystack-framing-reminder {
    max-height: calc(100vh - 20px);
    width: calc(100% - 20px);
  }

  .haystack-framing-reminder__inner {
    padding: 44px 20px 24px;
  }

  .haystack-framing-reminder__heading {
    margin-bottom: 22px;
  }

  .haystack-framing-reminder__feature {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .haystack-framing-reminder__photo {
    aspect-ratio: 16 / 9;
  }

  .haystack-framing-reminder__copy {
    padding: 26px 22px;
  }

  .haystack-framing-reminder__actions {
    grid-template-columns: 1fr;
  }
}

/* CQC-0925-023: supplemental photos use the full window without cropping.
 * Only the active supplemental view loses the primary artwork's floating inset. */
.single-product.haystack-framing-product .woocommerce-product-gallery.haystack-artwork-viewer--detail-active {
  padding: 0;
}

.single-product.haystack-framing-product .woocommerce-product-gallery .haystack-artwork-viewer__detail-image {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  box-shadow: none;
}

/* CQC-0925-004: paper -> 1 cm clear glass -> 2-inch mat -> frame.
 * Four opaque perimeter strips leave a genuinely transparent inner opening.
 * 2 inches = 5.08 cm; keep gap and mat proportional at every breakpoint. */
.single-product.haystack-framing-product.haystack-window-preview-mat .woocommerce-product-gallery:is([data-haystack-frame="black"], [data-haystack-frame="white"], [data-haystack-frame="natural"]) img.wp-post-image {
  --haystack-window-gap: calc(var(--haystack-mat-width) / 5.08);
  padding: calc(var(--haystack-mat-width) + var(--haystack-window-gap));
  background-color: transparent;
  background-image: linear-gradient(#fafaf9, #fafaf9), linear-gradient(#fafaf9, #fafaf9), linear-gradient(#fafaf9, #fafaf9), linear-gradient(#fafaf9, #fafaf9);
  background-origin: padding-box;
  background-clip: padding-box;
  background-position: left top, right top, left top, left bottom;
  background-size: var(--haystack-mat-width) 100%, var(--haystack-mat-width) 100%, 100% var(--haystack-mat-width), 100% var(--haystack-mat-width);
  background-repeat: no-repeat;
}
