.book-preview-lightbox {
    box-sizing: border-box;
    inset: 0;
    width: min(calc(100% - 32px), 1100px);
    height: 90vh;
    height: 90dvh;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .36);
    background: #fff;
    color: #1e1e1e;
    overflow: hidden;
}

.book-preview-lightbox:not([open]) {
    display: none;
}

.book-preview-lightbox[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.book-preview-lightbox::backdrop {
    background: rgba(0, 0, 0, .88);
}

html:has(.book-preview-lightbox[open]) {
    overflow: hidden;
}

.book-preview-lightbox-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 14px;
    border-bottom: 1px solid #ddd;
}

.book-preview-lightbox-toolbar h2 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.3;
}

.book-preview-lightbox-toolbar a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 6px;
    font-size: .875rem;
    text-underline-offset: .15em;
}

.book-preview-lightbox-close {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
}

.book-preview-lightbox-close:hover {
    background: #eee;
}

.book-preview-lightbox-toolbar :focus-visible {
    outline: 2px solid #1e1e1e;
    outline-offset: -2px;
}

.book-preview-lightbox-viewer {
    position: relative;
    display: grid;
    place-items: center;
    background: #f4f4f4;
}

.book-preview-lightbox-viewer iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

@media (max-width: 600px) {
    .book-preview-lightbox {
        width: calc(100% - 16px);
        height: calc(100vh - 16px);
        height: calc(100dvh - 16px);
        max-width: none;
        max-height: none;
    }
}
