/*
 * Decorative CSS-only mockups for the two printed-paper product types.
 * Original artwork files and all flag products are deliberately unchanged.
 * The enlarged lightbox continues to display the untouched source image.
 */

/* A neutral wall that makes both print formats visually distinct from fabric flags. */
.product-media .cf-mockup--poster,
.product-media .cf-mockup--frame,
.ready-card-media .cf-mockup--poster,
.ready-card-media .cf-mockup--frame,
.main-image .cf-mockup--poster,
.main-image .cf-mockup--frame {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 16px;
  background: radial-gradient(ellipse at 52% 8%, rgba(255,255,255,.95), transparent 64%),
              linear-gradient(145deg, #eeeae4 0%, #ddd7ce 100%);
}

/* FIX 2026-11-19: ALL mockup wrappers must contain their absolute ::before.
   In the product gallery, .thumb .static-image-box had position: static.
   Its ::before {position:absolute; inset:0} therefore used the viewport as its
   containing block, painting a white radial gradient over the entire page,
   including the SnappPay banner and the main artwork. */
.cf-mockup--poster,
.cf-mockup--frame {
  position: relative;
}

/* The small gallery thumbnail never needs a wall-lighting pseudo-element.
   Suppressing it preserves the exact vivid thumbnail preview. */
.thumb .cf-mockup--poster::before,
.thumb .cf-mockup--frame::before {
  content: none;
  display: none;
}

/* Slight light falloff onto the wall, behind the picture. */
.cf-mockup--poster::before,
.cf-mockup--frame::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.60) 5%, transparent 72%);
}

/* Fit the ENTIRE source image; do not stretch or crop the design. */
.product-media .cf-mockup--poster > img,
.product-media .cf-mockup--frame > img,
.ready-card-media .cf-mockup--poster > img,
.ready-card-media .cf-mockup--frame > img,
.main-image .cf-mockup--poster > img,
.main-image .cf-mockup--frame > img {
  position: relative;
  z-index: 1;
  display: block;
  flex: none;
  box-sizing: border-box;
  width: auto;
  height: auto;
  max-width: calc(100% - 40px);
  max-height: calc(100% - 32px);
  object-fit: contain;
  object-position: center;
  border-radius: 0;
}

/* Loose, lightly angled poster print with a white paper margin. */
.cf-mockup--poster > img {
  padding: 9px;
  border: 1px solid #f4f2ec;
  background: #fff;
  box-shadow: 0 1px 2px rgba(26,26,26,.14),
              1px 12px 18px rgba(36,34,30,.15),
              6px 24px 34px rgba(36,34,30,.13);
  transform: rotate(-1.5deg);
}

/* Black gallery frame, a slim white mount and wall-cast shadow. */
.cf-mockup--frame > img {
  padding: 8px;
  border: 9px solid #252625;
  background: #fefefe;
  box-shadow: 0 0 0 1px #85837e,
              1px 2px 2px rgba(11,14,17,.28),
              4px 12px 17px rgba(11,14,17,.23),
              11px 25px 33px rgba(11,14,17,.19);
  transform: translateY(-2px);
}

/* A frame that follows the selected frame colour on the product page. */
.cf-mockup--frame.cf-mockup--white-frame > img {
  border-color: #faf9f6;
  box-shadow: 0 0 0 1px #b7b5b1,
              1px 2px 3px rgba(25,25,25,.20),
              4px 12px 17px rgba(25,25,25,.20),
              11px 25px 33px rgba(25,25,25,.15);
}

/* Product detail has more room, so show a fuller frame and stronger depth. */
.main-image .cf-mockup--poster,
.main-image .cf-mockup--frame { width: 100%; height: 100%; }
.main-image .cf-mockup--poster > img,
.main-image .cf-mockup--frame > img {
  max-width: calc(100% - 84px);
  max-height: calc(100% - 68px);
}
.main-image .cf-mockup--poster > img { padding: 14px; }
.main-image .cf-mockup--frame > img { border-width: 13px; padding: 12px; }

/* Gallery thumbnails also signal the product type. The full screen lightbox stays original. */
.thumb .cf-mockup--poster,
.thumb .cf-mockup--frame { display: flex; align-items:center; justify-content:center; min-height:0; overflow:hidden; background:#e9e5de; }
.thumb .cf-mockup--poster > img,
.thumb .cf-mockup--frame > img { width:auto; height:auto; max-width:82%; max-height:82%; object-fit:contain; border-radius:0; box-sizing:border-box; }
.thumb .cf-mockup--poster > img { border: 3px solid white; box-shadow: 1px 3px 5px #0003; transform:rotate(-1.5deg); }
.thumb .cf-mockup--frame > img { border: 4px solid #252625; padding: 2px; background:#fff; box-shadow: 1px 3px 5px #0004; }

/* Consistent layouts on narrow phones: keep the mockup clear, never clipped. */
@media (max-width: 700px) {
  .product-media .cf-mockup--poster > img,
  .product-media .cf-mockup--frame > img,
  .ready-card-media .cf-mockup--poster > img,
  .ready-card-media .cf-mockup--frame > img { max-width:calc(100% - 24px); max-height:calc(100% - 24px); }
  .product-media .cf-mockup--frame > img,
  .ready-card-media .cf-mockup--frame > img { border-width: 6px; padding: 5px; }
  .product-media .cf-mockup--poster > img,
  .ready-card-media .cf-mockup--poster > img { padding: 6px; }
  .main-image .cf-mockup--poster > img,
  .main-image .cf-mockup--frame > img { max-width:calc(100% - 48px); max-height:calc(100% - 44px); }
  .main-image .cf-mockup--frame > img { border-width: 9px; padding: 7px; }
  .main-image .cf-mockup--poster > img { padding: 10px; }
}

/* Retain a little tilt during detail hover magnification. */
.product-zoom-frame.cf-mockup--poster.is-zoomed > img { transform: scale(1.6) rotate(-1.5deg); }
.product-zoom-frame.cf-mockup--frame.is-zoomed > img { transform: scale(1.6) translateY(-2px); }
@media (hover:none) {
  .product-zoom-frame.cf-mockup--poster.is-zoomed > img { transform: rotate(-1.5deg); }
  .product-zoom-frame.cf-mockup--frame.is-zoomed > img { transform: translateY(-2px); }
}


/* Product-page print mockups: keep the INFORMATION CARD fully opaque.
   The paper/frame visual treatment must never wash out the product summary.
   A dedicated class prevents any change to flags or other categories. */
body[data-page="product"] .product-detail-layout > .info-card.cf-print-info-card {
  position: relative;
  z-index: 2;
  isolation: isolate;
  opacity: 1 !important;
  filter: none !important;
  -webkit-filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  mix-blend-mode: normal !important;
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
}
body[data-page="product"] .product-detail-layout > .info-card.cf-print-info-card::before,
body[data-page="product"] .product-detail-layout > .info-card.cf-print-info-card::after {
  content: none !important;
}
body[data-page="product"] .cf-print-info-card .detail-title,
body[data-page="product"] .cf-print-info-card .feature-item strong,
body[data-page="product"] .cf-print-info-card .size-guide-btn {
  opacity: 1 !important;
  filter: none !important;
  color: var(--text, #0f172a);
}
body[data-page="product"] .cf-print-info-card .product-category-tag {
  opacity: 1 !important;
  color: var(--primary, #1457ff);
}


/* Product detail: an unwashed print preview, identical to the store card.
   The gallery now receives cf-print-gallery from product.ejs. Previous versions
   targeted that class without adding it to the HTML, leaving the light stage in
   place. This only applies to posters/frames, never normal flag products. */
body[data-page="product"] .main-image.cf-print-gallery {
  background: #e9e5de !important;
  background-image: none !important;
  opacity: 1 !important;
  filter: none !important;
  -webkit-filter: none !important;
  isolation: isolate;
}

/* No translucent sheen above the artwork, including pseudo-elements. */
body[data-page="product"] .main-image.cf-print-gallery::before,
body[data-page="product"] .main-image.cf-print-gallery::after,
body[data-page="product"] .main-image.cf-print-gallery .product-zoom-frame::before,
body[data-page="product"] .main-image.cf-print-gallery .product-zoom-frame::after {
  content: none !important;
  display: none !important;
}

body[data-page="product"] .main-image.cf-print-gallery .product-zoom-frame.cf-mockup--poster,
body[data-page="product"] .main-image.cf-print-gallery .product-zoom-frame.cf-mockup--frame {
  background: linear-gradient(145deg, #eeeae4 0%, #ddd7ce 100%) !important;
  background-image: linear-gradient(145deg, #eeeae4 0%, #ddd7ce 100%) !important;
  opacity: 1 !important;
  filter: none !important;
  -webkit-filter: none !important;
  mix-blend-mode: normal !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Preserve original image colours; only the frame/paper border and shadow
   participate in the mockup. Do not add brightness, opacity or tint filters. */
body[data-page="product"] .main-image.cf-print-gallery .product-zoom-frame.cf-mockup--poster > img,
body[data-page="product"] .main-image.cf-print-gallery .product-zoom-frame.cf-mockup--frame > img {
  position: relative;
  z-index: 2;
  opacity: 1 !important;
  filter: none !important;
  -webkit-filter: none !important;
  mix-blend-mode: normal !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  /* The gallery's GPU hint can move large images to a differently blended
     compositor layer. Only promote the image when the user is actually zooming. */
  will-change: auto;
}
body[data-page="product"] .main-image.cf-print-gallery .product-zoom-frame.is-zoomed > img {
  will-change: transform;
}


/* Release v3: compatibility with older product.ejs markup still held in an
   Express/EJS view cache. Modern Chromium/Firefox support :has(). The source
   image is kept fully opaque; white frame borders/shadows remain untouched. */
body[data-page="product"] .main-image:has(> .product-zoom-frame.cf-mockup--frame),
body[data-page="product"] .main-image:has(> .product-zoom-frame.cf-mockup--poster) {
  background-image: none !important;
  background-color: #e9e5de !important;
}
body[data-page="product"] .main-image:has(> .product-zoom-frame.cf-mockup--frame) > .product-zoom-frame::before,
body[data-page="product"] .main-image:has(> .product-zoom-frame.cf-mockup--poster) > .product-zoom-frame::before,
body[data-page="product"] .main-image:has(> .product-zoom-frame.cf-mockup--frame) > .product-zoom-frame::after,
body[data-page="product"] .main-image:has(> .product-zoom-frame.cf-mockup--poster) > .product-zoom-frame::after {
  content: none !important;
  display: none !important;
}
