/* =========================================================================
   Book zoom (bpz-) — Amazon-style hover lens + side pane, with a book twist:
   the pane opens like the facing page of an open book (spine shadow, page
   edges, page-turn), and a click/tap opens a full-screen "reader" where the
   cover swings open on its spine and the image lies on a paper page.
   Touch: tap → reader; pinch / double-tap zoom, drag to pan, swipe = page turn.
   Mirror to public/themes/theme_aster/public/assets/css/ after editing.
   ========================================================================= */

.bp-scope .bp-gallery-main .bp-zoom { position: relative; inline-size: 100%; block-size: 100%; cursor: zoom-in; overflow: hidden; }
.bp-scope .bp-gallery-main .bp-zoom img { inline-size: 100%; block-size: 100%; object-fit: cover; }

/* hint pill text per input type */
.bpz-hint-touch { display: none; }
@media (hover: none), (pointer: coarse) {
    .bp-scope .bp-zoom-hint { display: inline-flex !important; }
    .bpz-hint-mouse { display: none; }
    .bpz-hint-touch { display: inline; }
}
.bp-gallery-main.bpz-hovering .bp-zoom-hint { opacity: 0; transition: opacity .15s; }

/* ---------- Lens (on the image) ---------- */
.bpz-lens {
    position: absolute; z-index: 4; pointer-events: none;
    border: 1px solid rgba(74, 46, 28, .55);
    background: rgba(255, 252, 245, .28);
    background-image: repeating-linear-gradient(0deg, rgba(74, 46, 28, .05) 0 1px, transparent 1px 14px);
    border-radius: 3px;
    opacity: 0; transition: opacity .15s ease;
}
.bpz-lens.is-on { opacity: 1; }

/* ---------- Side pane = the facing page of an open book ---------- */
.bpz-pane {
    position: fixed; z-index: 1040; pointer-events: none;
    perspective: 1800px;
    visibility: hidden;
}
.bpz-pane.is-open { visibility: visible; }
.bpz-pane-page {
    position: absolute; inset: 0;
    background: #fbf8f1;
    border: 1px solid #e6dfd2;
    border-radius: 4px 10px 10px 4px;
    box-shadow: 0 18px 50px -18px rgba(28, 22, 19, .35);
    overflow: hidden;
    transform-origin: left center;           /* LTR: spine on the left (gallery side) */
    transform: rotateY(-88deg);
    opacity: .2;
    transition: transform .42s cubic-bezier(.2, .8, .2, 1), opacity .25s ease;
}
.bpz-pane.is-rtl .bpz-pane-page { transform-origin: right center; transform: rotateY(88deg); border-radius: 10px 4px 4px 10px; }
.bpz-pane.is-open .bpz-pane-page { transform: rotateY(0); opacity: 1; }
.bpz-pane-img {
    position: absolute; inset: 10px;
    background-repeat: no-repeat;
    background-color: #fff;
    border-radius: 2px;
}
/* spine shadow on the gallery side, page edges on the outer side */
.bpz-pane-page::before {
    content: ""; position: absolute; z-index: 2; inset-block: 0; inline-size: 34px; inset-inline-start: 0;
    background: linear-gradient(to right, rgba(60, 40, 20, .22), rgba(60, 40, 20, 0));
    pointer-events: none;
}
.bpz-pane.is-rtl .bpz-pane-page::before { inset-inline-start: auto; inset-inline-end: 0; background: linear-gradient(to left, rgba(60, 40, 20, .22), rgba(60, 40, 20, 0)); }
.bpz-pane-page::after {
    content: ""; position: absolute; z-index: 2; inset-block: 6px; inline-size: 6px; inset-inline-end: 0;
    background: repeating-linear-gradient(to right, #efe7d9 0 1px, #fbf8f1 1px 2px);
    pointer-events: none;
}
.bpz-pane.is-rtl .bpz-pane-page::after { inset-inline-end: auto; inset-inline-start: 0; }

/* ---------- Full-screen reader ---------- */
.bpz-viewer {
    position: fixed; inset: 0; z-index: 2147483000;
    display: none; flex-direction: column;
    background: rgba(20, 16, 12, .985);
    color: #f4efe7;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}
.bpz-viewer.is-open { display: flex; }
.bpz-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.bpz-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.bpz-count { font-size: 13px; opacity: .7; font-variant-numeric: tabular-nums; }
.bpz-btn {
    inline-size: 42px; block-size: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .06); color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer; transition: background .15s;
}
.bpz-btn:hover { background: rgba(255, 255, 255, .14); }
.bpz-btn:focus-visible { outline: 2px solid #e8d4ad; outline-offset: 2px; }

.bpz-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: none; overflow: hidden; }
.bpz-nav { position: absolute; inset-block-start: 50%; transform: translateY(-50%); z-index: 5; }
.bpz-nav.bpz-prev { inset-inline-start: 16px; }
.bpz-nav.bpz-next { inset-inline-end: 16px; }

/* the open book */
.bpz-book { position: relative; perspective: 2200px; }
.bpz-page {
    position: relative;
    background: #fbf8f1;
    padding: 12px;
    border-radius: 4px 10px 10px 4px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
    overflow: hidden;
}
.bpz-viewer.is-rtl .bpz-page { border-radius: 10px 4px 4px 10px; }
.bpz-page::before { /* spine */
    content: ""; position: absolute; z-index: 3; inset-block: 0; inset-inline-start: 0; inline-size: 26px; pointer-events: none;
    background: linear-gradient(to right, rgba(60, 40, 20, .28), rgba(60, 40, 20, 0));
}
.bpz-viewer.is-rtl .bpz-page::before { background: linear-gradient(to left, rgba(60, 40, 20, .28), rgba(60, 40, 20, 0)); }
.bpz-page::after { /* page edges */
    content: ""; position: absolute; z-index: 3; inset-block: 8px; inset-inline-end: 0; inline-size: 7px; pointer-events: none;
    background: repeating-linear-gradient(to right, #e9e0cf 0 1px, #fbf8f1 1px 2px);
}
.bpz-clip { position: relative; overflow: hidden; border-radius: 2px; background: #fff; }
.bpz-pan { transform-origin: 50% 50%; will-change: transform; }
.bpz-pan.is-animating { transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.bpz-img { display: block; max-inline-size: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.bpz-stage.is-zoomed { cursor: grab; }
.bpz-stage.is-dragging { cursor: grabbing; }

/* the cover that swings open on entry, and the leaf that turns between images */
.bpz-cover, .bpz-leaf {
    position: absolute; inset: 0; z-index: 6;
    transform-style: preserve-3d;
    transform-origin: left center;
    pointer-events: none;
}
.bpz-viewer.is-rtl .bpz-cover, .bpz-viewer.is-rtl .bpz-leaf { transform-origin: right center; }
.bpz-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: inherit; overflow: hidden; }
.bpz-face img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
.bpz-face-back { transform: rotateY(180deg); background: #efe6d6; box-shadow: inset 0 0 40px rgba(60, 40, 20, .18); }
.bpz-cover .bpz-face-front { box-shadow: 0 10px 30px rgba(0, 0, 0, .35); border-radius: 3px 8px 8px 3px; }
.bpz-leaf .bpz-face-front { background: #fbf8f1; padding: 12px; }
.bpz-leaf .bpz-face-front img { object-fit: contain; }

@keyframes bpz-open-ltr { from { transform: rotateY(0); } to { transform: rotateY(-178deg); } }
@keyframes bpz-open-rtl { from { transform: rotateY(0); } to { transform: rotateY(178deg); } }
.bpz-cover.is-opening { animation: bpz-open-ltr .9s cubic-bezier(.45, .05, .2, 1) forwards; }
.bpz-viewer.is-rtl .bpz-cover.is-opening { animation-name: bpz-open-rtl; }
@keyframes bpz-turn-fwd-ltr { from { transform: rotateY(0); } to { transform: rotateY(-178deg); } }
@keyframes bpz-turn-fwd-rtl { from { transform: rotateY(0); } to { transform: rotateY(178deg); } }
.bpz-leaf.is-turning { animation: bpz-turn-fwd-ltr .55s cubic-bezier(.45, .05, .2, 1) forwards; }
.bpz-viewer.is-rtl .bpz-leaf.is-turning { animation-name: bpz-turn-fwd-rtl; }
.bpz-leaf.is-turning-back { transform-origin: right center; animation: bpz-turn-fwd-rtl .55s cubic-bezier(.45, .05, .2, 1) forwards; }
.bpz-viewer.is-rtl .bpz-leaf.is-turning-back { transform-origin: left center; animation-name: bpz-turn-fwd-ltr; }
@keyframes bpz-fade-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.bpz-viewer.is-open .bpz-book { animation: bpz-fade-in .3s ease both; }

.bpz-hint { text-align: center; font-size: 12.5px; opacity: .7; padding: 6px 16px 0; }
.bpz-thumbs { display: flex; justify-content: center; gap: 8px; padding: 12px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); overflow-x: auto; }
.bpz-thumbs:empty { display: none; }
.bpz-thumb { flex: 0 0 auto; inline-size: 46px; block-size: 62px; border-radius: 4px; overflow: hidden; border: 2px solid transparent; opacity: .55; padding: 0; background: #fff; cursor: pointer; }
.bpz-thumb img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.bpz-thumb.is-active { border-color: #e8d4ad; opacity: 1; }

@media (max-width: 600px) {
    .bpz-nav { display: none; }
    .bpz-page { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .bpz-pane-page, .bpz-pan.is-animating { transition: none; }
    .bpz-cover, .bpz-leaf { display: none; }
    .bpz-viewer.is-open .bpz-book { animation: none; }
}
html.bpz-lock, html.bpz-lock body { overflow: hidden !important; }
