.product-gallery--portrait > .book-preview-open {
    grid-column: 1 / -1;
    justify-self: stretch;
    margin-top: 5px;
    min-height: 44px;
    padding: 9px 14px;
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
    white-space: normal;
}

.book-preview {
    width: min(1120px, calc(100vw - 24px));
    max-width: none;
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: clamp(12px, 2.4vw, 26px);
    color: #443224;
    background: #fcf5ea;
    border: 0;
    border-radius: 6px;
    overflow: auto;
    overscroll-behavior: contain;
}

.book-preview[open] {
    display: grid;
    gap: clamp(8px, 1.4vw, 14px);
}

.book-preview::backdrop { background: rgb(29 21 15 / .72); }
html:has(.book-preview[open]) { overflow: hidden; }
.book-preview [hidden] { display: none !important; }

.book-preview__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.book-preview__header h2 {
    margin: 0;
    color: inherit;
    font: inherit;
    font-size: clamp(14px, 2.1vw, 22px);
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.book-preview .book-preview__control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 8px 15px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    line-height: 1.25;
    white-space: nowrap;
}

.book-preview-open:focus-visible,
.book-preview__control:focus-visible {
    outline: 2px solid var(--brown);
    outline-offset: 3px;
}

.book-preview .book-preview__control:disabled {
    color: rgba(var(--brown-rgb), .6);
    background: transparent;
    border-color: rgba(var(--brown-rgb), .23);
    opacity: 1;
}

.book-preview [data-preview-previous] { justify-self: start; }
.book-preview [data-preview-next] { justify-self: end; }
.book-preview [data-preview-zoom][aria-pressed="true"] {
    color: var(--cream);
    background: var(--brown);
}

.book-preview [data-preview-previous]::before,
.book-preview [data-preview-next]::after {
    content: '';
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-block-start: 1px solid currentColor;
    border-inline-end: 1px solid currentColor;
    transform: rotate(45deg);
}

.book-preview [data-preview-previous]::before { transform: rotate(-135deg); }

.book-preview__stage {
    position: relative;
    width: min(100%, max(280px, calc(2 * (100dvh - 190px))));
    margin-inline: auto;
    perspective: 80rem;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.book-preview__paper {
    position: relative;
    aspect-ratio: 2 / 1;
}

.book-preview__mark {
    display: block;
    margin-top: 3px;
    color: #806b56;
    font: italic 11px/1.2 Georgia, serif;
    letter-spacing: .03em;
    text-align: right;
    pointer-events: none;
}

.book-preview__image {
    display: block;
    position: absolute;
    inset: 0 auto auto 25%;
    width: 50%;
    max-width: none;
    height: 100%;
    object-fit: fill;
    border-radius: 3px;
    box-shadow: 0 5px 16px rgb(68 50 36 / .16);
    -webkit-user-drag: none;
}

.book-preview__stage[data-side] .book-preview__image { left: 0; width: 100%; }
.book-preview__stage:not([data-side]) .book-preview__image { box-shadow: none; }
.book-preview__leaf {
    position: absolute;
    z-index: 2;
    inset-block: 0;
    width: 50%;
    overflow: hidden;
    border-radius: 3px;
    background: #fff5e5;
    pointer-events: none;
    backface-visibility: hidden;
}
.book-preview__leaf img { position: absolute; width: 200%; max-width: none; height: 100%; }

.book-preview__navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(4px, 1vw, 14px);
}

.book-preview__position {
    text-align: center;
    font-size: clamp(11px, 1.65vw, 15px);
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}

.book-preview__zoom { display: flex; justify-content: center; }
.book-preview__error { margin: 0; text-align: center; font-size: 13px; }
.book-preview__stage.is-zoomed {
    width: min(100%, max(280px, calc(100dvh - 210px)), 620px);
    touch-action: none;
    cursor: grab;
}
.book-preview__stage.is-panning { cursor: grabbing; }
.book-preview__stage.is-zoomed .book-preview__paper {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 3px;
    background: #fff5e5;
}
.book-preview__stage.is-zoomed .book-preview__image { border-radius: 0; box-shadow: none; }

@media (max-width: 575px) {
    .product-gallery--portrait > .book-preview-open {
        padding-inline: 7px;
        font-size: clamp(10px, 2.7vw, 12px);
        letter-spacing: .04em;
    }
    .book-preview__stage:not([data-side]) .book-preview__paper { aspect-ratio: 1 / 1; }
    .book-preview__stage:not([data-side]) .book-preview__image { left: 0; width: 100%; }
    .book-preview .book-preview__control {
        gap: 5px;
        padding-inline: 9px;
        font-size: 10px;
        letter-spacing: .04em;
    }
}

@media print {
    .book-preview, .book-preview-open { display: none !important; }
}
