/*
 * Product page main mockup: caisse américaine, no mat. The printed image fills the frame.
 * Markup lives in the child theme (woocommerce/single-product/product-image.php, #frameMockup).
 * The frame is one 9-slice image (400 px, sliced at 70 px) drawn as a CSS border-image.
 * Oak, matte white and matte black share one geometry: the frame occupies the outer 36 px of each 400 px image,
 * so the images are sliced at 36 px and drawn half a strip wide, entirely outside the print.
 * The dibond print floats in front of the frame and casts a short, even shadow onto it on all four sides.
 * .fineart-dim--left / --bottom: framed-size legend added by js/fineart-print-options.js.
 * data-print-size: short side in cm (30, 40, 60, 80, 100). Larger prints appear larger on the wall.
 * data-frame: oak (default), black, white, or walnut (legacy Acowebs products, darkened oak).
 * --frame-strip is set by the theme script from the displayed image size; the visible frame is half the strip.
 */
.fineart-product-mockup {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.fineart-product-mockup .frame-mockup-wrapper { transform: none; }

.fineart-product-frame {
    --frame-strip: 10px;
    --fa-scale: 0.62;
    --fa-wall-width: min(42vw, 600px);
    --fa-wall-height: min(66vh, 680px);
    --frame-image: url("../assets/images/frames/frame-oak-400.webp");
    position: relative;
    display: inline-block;
    line-height: 0;
    filter: drop-shadow(10px 10px 10px rgba(90, 90, 90, 0.35));
}

.fineart-product-frame[data-print-size="40"] { --fa-scale: 0.72; }
.fineart-product-frame[data-print-size="60"] { --fa-scale: 0.84; }
.fineart-product-frame[data-print-size="80"] { --fa-scale: 0.93; }
.fineart-product-frame[data-print-size="100"] { --fa-scale: 1; }

.fineart-product-frame[data-frame="black"] { --frame-image: url("../assets/images/frames/frame-black-400.webp"); }
.fineart-product-frame[data-frame="white"] { --frame-image: url("../assets/images/frames/frame-white-400.webp"); }

.fineart-product-frame #mockupImage {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(var(--fa-wall-width) * var(--fa-scale));
    max-height: calc(var(--fa-wall-height) * var(--fa-scale));
    position: relative;
    z-index: 4;
    margin: 0;
    border-radius: 0;
    /* Print sits above the frame; its shadow falls evenly on the frame behind it. */
    box-shadow: 0 0 calc(0.1 * var(--frame-strip)) rgba(0, 0, 0, 0.5);
    transition: max-width 0.45s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.fineart-product-frame__border {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    z-index: 3;
    border: calc(0.5 * var(--frame-strip)) solid transparent;
    border-image-source: var(--frame-image);
    border-image-slice: 36;
    border-image-width: calc(0.5 * var(--frame-strip));
    /* Push the frame fully outside the print; its inner edge meets the print edge. */
    border-image-outset: calc(0.5 * var(--frame-strip));
    border-image-repeat: stretch;
    pointer-events: none;
}

/* Framed-size legend, outside the frame on the left and bottom. */
.fineart-product-frame .fineart-dim {
    position: absolute;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #333;
    font: 400 11px/1 'Oswald', sans-serif;
    letter-spacing: 0;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.fineart-product-frame .fineart-dim::before,
.fineart-product-frame .fineart-dim::after {
    content: "";
    flex: 1;
    background: #333;
}

.fineart-product-frame .fineart-dim--bottom {
    left: calc(-0.5 * var(--frame-strip));
    right: calc(-0.5 * var(--frame-strip));
    top: calc(100% + 0.5 * var(--frame-strip) + 10px);
    height: 11px;
    border-left: 1px solid #333;
    border-right: 1px solid #333;
}

.fineart-product-frame .fineart-dim--bottom::before,
.fineart-product-frame .fineart-dim--bottom::after { height: 1px; }

/* Vertical text reading bottom to top; in vertical writing mode the flex row runs top to bottom. */
.fineart-product-frame .fineart-dim--left {
    top: calc(-0.5 * var(--frame-strip));
    bottom: calc(-0.5 * var(--frame-strip));
    right: calc(100% + 0.5 * var(--frame-strip) + 10px);
    width: 11px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}

.fineart-product-frame .fineart-dim--left::before,
.fineart-product-frame .fineart-dim--left::after { width: 1px; }

.fineart-product-frame.fineart-dims-off .fineart-dim { opacity: 0; }

/* Hide / show button, under the bottom legend. */
.fineart-product-frame .fineart-dim-toggle {
    position: absolute;
    z-index: 5;
    left: 50%;
    top: calc(100% + 0.5 * var(--frame-strip) + 32px);
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
    border: 0;
    background: none !important;
    box-shadow: none;
    color: #333;
    font: 400 11px/1.4 'Oswald', sans-serif;
    letter-spacing: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.fineart-product-frame .fineart-dim-toggle:hover { opacity: 1; }
.fineart-product-frame.fineart-dims-off .fineart-dim-toggle { top: calc(100% + 0.5 * var(--frame-strip) + 12px); }

/* Acrylic glazing over the print (z-index above the print, below the legend), 2026-11-20.
   Gloss: the WheelsOnWalls reflection, a broad soft diagonal band (overlay) and a glow in the top-left corner (screen).
   Matte (anti-reflective): no reflection, slightly softer contrast. */
.fineart-product-frame .fineart-glaze {
    position: absolute;
    z-index: 5;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background: none !important;
    transition: opacity 0.35s ease;
}
.fineart-product-frame .fineart-glaze::before {
    content: "";
    position: absolute;
    top: 0;
    left: 35%;
    width: 150%;
    height: 150%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.19) 12%, rgba(255, 255, 255, 0.2) 25%, rgba(255, 255, 255, 0.28) 40%, rgba(255, 255, 255, 0.06) 55%, rgba(255, 255, 255, 0.02) 70%, rgba(255, 255, 255, 0) 85%, transparent 100%);
    transform: rotate(108deg);
    transform-origin: left top;
    mix-blend-mode: overlay;
}
.fineart-product-frame .fineart-glaze::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 25%;
    height: 25%;
    background: radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0) 70%, transparent 100%);
    mix-blend-mode: screen;
}
.fineart-product-frame[data-glazing="matte"] .fineart-glaze { opacity: 0; }
.fineart-product-frame[data-glazing="matte"] > img { filter: contrast(0.97) saturate(0.97); }
.fineart-room .fineart-room__art[data-glazing="matte"] .fineart-room__img { filter: brightness(0.97) contrast(0.95) saturate(0.92); }

/* Show in room: same frame rendering, at true scale on a room photo, opened in the theme's Fancybox. */
.fineart-product-mockup.has-room { position: relative; flex-direction: column; }

.fineart-room-toggle {
    margin: 72px auto 0; /* clears the framed-size legend and its toggle */
    padding: 7px 16px;
    border: 1px solid rgba(51, 51, 51, 0.35);
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.55) !important;
    box-shadow: none;
    color: #333;
    font: 400 12px/1.4 'Oswald', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease;
}
.fineart-room-toggle:hover { background: rgba(255, 255, 255, 0.85) !important; }

/* Lightbox shell */
.fineart-room-fancybox .fancybox-bg { background: #111; }
.fineart-room-fancybox.fancybox-is-open .fancybox-bg { opacity: 0.92; }
.fineart-room-fancybox .fancybox-slide { padding: 24px; }
.fineart-room-fancybox .fancybox-content.fineart-room,
.fineart-room.is-overlay {
    padding: 0;
    background: transparent;
    overflow: visible;
}
/* Shrink the lightbox to the room photo, so the size bar lines up with it. */
.fineart-room-fancybox .fancybox-content.fineart-room {
    display: inline-grid !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
}
.fineart-room.is-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(17, 17, 17, 0.92);
}
.fineart-room-fancybox .fancybox-close-small {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    padding: 7px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    opacity: 1;
}
.fineart-room-fancybox .fancybox-close-small:hover { background: rgba(0, 0, 0, 0.7); color: #fff; }

.fineart-room { text-align: center; }

.fineart-room__stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    border-radius: 6px;
    overflow: hidden;
    vertical-align: top;
}

.fineart-room .fineart-room__bg {
    display: block;
    width: auto;
    height: auto;
    max-width: min(92vw, 1600px);
    max-height: calc(100vh - 140px);
    margin: 0 !important;
}

/* Framed artwork. The caisse américaine stands about 4 cm off the wall: a soft cast shadow plus a tighter contact shadow. */
.fineart-room .fineart-room__art {
    --cm: 2px;
    position: absolute;
    transform: translate(-50%, calc(-100% - 0.5 * var(--frame-strip)));
    filter:
        drop-shadow(0 calc(0.25 * var(--cm)) calc(0.35 * var(--cm)) rgba(0, 0, 0, 0.28))
        drop-shadow(calc(0.4 * var(--cm)) calc(1.4 * var(--cm)) calc(2.2 * var(--cm)) rgba(40, 30, 20, 0.22));
}

.fineart-room .fineart-room__img {
    display: block;
    height: auto;
    max-width: none;
    margin: 0 !important; /* the theme adds a bottom margin to images */
    position: relative;
    z-index: 4;
    box-shadow: 0 0 calc(0.1 * var(--frame-strip)) rgba(0, 0, 0, 0.5);
    /* Sit the print in the room's soft daylight. */
    filter: brightness(0.97) contrast(0.97) saturate(0.94);
}

/* Room light across print and frame: a little brighter top left, a little darker bottom right. */
.fineart-room__light {
    position: absolute;
    z-index: 6;
    inset: calc(-0.5 * var(--frame-strip));
    background: linear-gradient(135deg, rgba(255, 250, 240, 0.12) 0%, rgba(255, 250, 240, 0) 45%, rgba(30, 20, 10, 0.08) 100%);
    pointer-events: none;
}

/* Size pills and caption under the room */
.fineart-room__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
    margin-top: 14px;
    line-height: 1;
}
.fineart-room__sizes {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}
.fineart-room__sizes button {
    margin: 0;
    padding: 6px 14px;
    border: 0;
    border-radius: 999px !important;
    background: transparent;
    box-shadow: none;
    color: #fff;
    font: 400 12px/1.2 'Oswald', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.fineart-room__sizes button[aria-pressed="true"] { background: #f5f0ec; color: #000; }
.fineart-room__sizes button:focus:not(:focus-visible) { outline: none; }
.fineart-room__caption {
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.75);
    font: 300 13px/1.4 'Oswald', sans-serif;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .fineart-room .fineart-room__bg { max-height: calc(100vh - 190px); }
    .fineart-room__bar { justify-content: center; }
    .fineart-room__sizes button { padding: 6px 9px; font-size: 11px; }
}

/* No walnut image yet: darken the oak one for legacy Acowebs products that still sell walnut. */
.fineart-product-frame[data-frame="walnut"] .fineart-product-frame__border { filter: brightness(0.55) saturate(1.2); }

@media (max-width: 768px) {
    .fineart-product-frame {
        --fa-wall-width: calc(100vw - 48px);
        --fa-wall-height: 52vh;
    }
    /* Smaller steps on phones so the 30 cm print stays readable. */
    .fineart-product-frame,
    .fineart-product-frame[data-print-size="30"] { --fa-scale: 0.8; }
    .fineart-product-frame[data-print-size="40"] { --fa-scale: 0.85; }
    .fineart-product-frame[data-print-size="60"] { --fa-scale: 0.9; }
    .fineart-product-frame[data-print-size="80"] { --fa-scale: 0.95; }
    .fineart-product-frame[data-print-size="100"] { --fa-scale: 1; }
}

/* Room view zoom (2026-11-20): bg and artwork scale together inside the stage, around the artwork. */
.fineart-room__scene { position: relative; transition: transform .45s cubic-bezier(.16, 1, .3, 1); }
@media (prefers-reduced-motion: reduce) { .fineart-room__scene { transition: none; } }

/* Classic frame (2026-11-26): Nielsen Fortuna, a slim 15 mm wood profile, white border around the image, full glass.
   --classic-k shrinks the image so the bigger framed piece keeps its room on the wall; --classic-mat is the white border and
   --classic-strip the frame (twice its visible width), both set in cm-true pixels by js/fineart-print-options.js.
   The frame is one 9-slice image per colour (600 px, sliced at 60): mitred corners, grain along each side, a rounded outer
   edge and a chamfer into the recess, lit from the top left. */
.fineart-product-frame[data-style="classic"] #mockupImage {
    box-sizing: content-box;
    max-width: calc(var(--fa-wall-width) * var(--fa-scale) * var(--classic-k, 0.78));
    max-height: calc(var(--fa-wall-height) * var(--fa-scale) * var(--classic-k, 0.78));
    padding: var(--classic-mat, 18px);
    background: #e3e3e3;
    box-shadow: none;
    filter: none;
}
.fineart-product-frame[data-style="classic"] {
    filter: drop-shadow(4px 8px 10px rgba(60, 50, 40, 0.3));
    /* Space above and below so the piece takes the Gallery Frame's height: no jump when switching (set by the script). */
    margin-top: var(--classic-gap, 0px);
    margin-bottom: var(--classic-gap, 0px);
}
.fineart-product-frame[data-style="classic"] .fineart-product-frame__border {
    --frame-image: url("../assets/images/frames/classic-frame-black.webp");
    border-width: calc(0.5 * var(--classic-strip, 10px));
    border-image-source: var(--frame-image);
    border-image-slice: 60;
    border-image-width: calc(0.5 * var(--classic-strip, 10px));
    border-image-outset: calc(0.5 * var(--classic-strip, 10px));
    border-image-repeat: stretch;
    box-shadow: none;
}
.fineart-product-frame[data-style="classic"][data-frame="white"] .fineart-product-frame__border { --frame-image: url("../assets/images/frames/classic-frame-white.webp"); }
.fineart-product-frame[data-style="classic"][data-frame="oak"] .fineart-product-frame__border { --frame-image: url("../assets/images/frames/classic-frame-oak.webp"); }
/* Full glass: the reflection covers the image and the border up to the frame, stronger than on the acrylic. */
.fineart-product-frame[data-style="classic"] .fineart-glaze { inset: 0; opacity: 1; z-index: 6; }
.fineart-product-frame[data-style="classic"] .fineart-glaze::before {
    mix-blend-mode: normal;
    opacity: 1;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0.34) 12%, rgba(255, 255, 255, 0.3) 25%, rgba(255, 255, 255, 0.42) 40%, rgba(255, 255, 255, 0.12) 55%, rgba(255, 255, 255, 0.04) 70%, transparent 85%);
}
.fineart-product-frame[data-style="classic"] .fineart-glaze::after { opacity: 1; width: 38%; height: 38%; }
.fineart-product-frame[data-style="classic"] .fineart-dim--bottom { left: calc(-0.5 * var(--classic-strip, 10px)); right: calc(-0.5 * var(--classic-strip, 10px)); top: calc(100% + 0.5 * var(--classic-strip, 10px) + 10px); }
.fineart-product-frame[data-style="classic"] .fineart-dim--left { top: calc(-0.5 * var(--classic-strip, 10px)); bottom: calc(-0.5 * var(--classic-strip, 10px)); right: calc(100% + 0.5 * var(--classic-strip, 10px) + 10px); }

/* The frame's lip casts a soft shadow onto the paper, deeper at the top and left. Its own layer above the reflection
   (added by js/fineart-print-options.js), so the shadow also darkens the reflection near the frame. */
.fineart-product-frame .fineart-classic-shade { display: none; }
.fineart-product-frame[data-style="classic"] .fineart-classic-shade {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 7;
    pointer-events: none;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.22), inset 2px 0 5px rgba(0, 0, 0, 0.12), inset 0 0 1px rgba(0, 0, 0, 0.35);
}

/* Under the frame (2026-11-27): framed size, then image size. The arrows along the sides and their toggle are retired. */
.fineart-product-frame .fineart-dim,
.fineart-product-frame .fineart-dim-toggle { display: none !important; }
.fineart-product-frame .fineart-dim-caption {
    position: absolute;
    left: 50%;
    top: calc(100% + 0.5 * var(--frame-strip) + 16px);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transform: translateX(-50%);
    white-space: nowrap;
    line-height: 1.3;
    pointer-events: none;
}
.fineart-product-frame[data-style="classic"] .fineart-dim-caption { top: calc(100% + 0.5 * var(--classic-strip, 10px) + 16px); }
.fineart-dim-caption__framed { color: #222; font: 600 13px/1.3 Manrope, system-ui, sans-serif; }
.fineart-dim-caption__image { color: #777; font: 400 12px/1.3 Manrope, system-ui, sans-serif; }
.fineart-dim-caption__image:empty { display: none; }
