/* Front/back cover gallery (app/Views/components/cover_gallery.php). Uses theme tokens when present. */
.cover-gallery {
    display: grid;
    gap: 0.75rem;
    width: 100%;
    max-width: 20rem;
}

.cover-gallery__zoom {
    display: block;
    border-radius: var(--theme-radius-md, 6px);
    cursor: zoom-in;
}

.cover-gallery__zoom:focus-visible,
.cover-gallery__thumb:focus-visible {
    outline: 3px solid var(--theme-color-primary, #006b67);
    outline-offset: 2px;
}

/* contain, not cover: the back cover's blurb, price and barcode must not be cropped. */
.cover-gallery__zoom img,
.cover-gallery__placeholder {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    border: 1px solid var(--theme-color-border, #d8dde2);
    border-radius: var(--theme-radius-md, 6px);
    background: var(--theme-color-surface-muted, #f4f3ee);
    box-shadow: var(--theme-shadow-md, 0 8px 24px rgb(15 23 42 / 0.12));
    object-fit: contain;
}

.cover-gallery__placeholder {
    display: grid;
    place-content: center;
    gap: 0.25rem;
    color: var(--theme-color-primary, #006b67);
    text-align: center;
}

.cover-gallery__placeholder span {
    color: var(--theme-color-text-muted, #59636e);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.cover-gallery__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cover-gallery__thumb {
    display: grid;
    justify-items: center;
    gap: 0.3rem;
    border-radius: var(--theme-radius-sm, 4px);
    color: var(--theme-color-text-muted, #59636e);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.cover-gallery__thumb img {
    display: block;
    width: 3.75rem;
    aspect-ratio: 2 / 3;
    border: 2px solid var(--theme-color-border, #d8dde2);
    border-radius: var(--theme-radius-sm, 4px);
    background: var(--theme-color-surface-muted, #f4f3ee);
    object-fit: contain;
    transition: border-color var(--theme-motion-fast, 120ms) ease;
}

.cover-gallery__thumb:hover img {
    border-color: var(--theme-color-text-muted, #59636e);
}

.cover-gallery__thumb[aria-current="true"] {
    color: var(--theme-color-text, #1f2933);
}

.cover-gallery__thumb[aria-current="true"] img {
    border-color: var(--theme-color-primary, #006b67);
}

.cover-gallery__note {
    margin: 0;
    color: var(--theme-color-text-muted, #59636e);
    font-size: 0.8rem;
}

@media (max-width: 42rem) {
    .cover-gallery {
        max-width: 15rem;
    }
}

/* "View full size" hint on the main cover. */
.cover-gallery__zoom { position: relative; }
.cover-gallery__hint {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    border-radius: 999px;
    background: rgb(15 23 42 / 0.78);
    padding: 0.25rem 0.65rem;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.15s;
}
.cover-gallery__zoom:hover .cover-gallery__hint,
.cover-gallery__zoom:focus-visible .cover-gallery__hint { opacity: 1; }

/* Full-size cover viewer, like the contents / look-inside reader. */
.cover-viewer {
    width: min(100vw - 2rem, 60rem);
    max-width: none;
    height: min(100vh - 2rem, 70rem);
    max-height: none;
    border: 0;
    border-radius: var(--theme-radius-md, 10px);
    background: #111827;
    padding: 0;
    color: #fff;
}
.cover-viewer::backdrop { background: rgb(2 6 23 / 0.8); }
.cover-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.cover-viewer__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgb(255 255 255 / 0.12);
}
.cover-viewer__sides { display: flex; gap: 0.35rem; }
.cover-viewer__sides button,
.cover-viewer__close {
    border: 1px solid rgb(255 255 255 / 0.25);
    border-radius: 999px;
    background: transparent;
    padding: 0.35rem 0.9rem;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.cover-viewer__sides button[aria-pressed="true"] { background: #fff; color: #111827; }
.cover-viewer__close { margin-left: auto; padding: 0.2rem 0.7rem; font-size: 1.3rem; line-height: 1; }
.cover-viewer__sides button:focus-visible,
.cover-viewer__close:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.cover-viewer__stage { position: relative; min-height: 0; }
/* Always fits the viewer, whatever the cover's size. */
.cover-viewer__stage img {
    position: absolute;
    inset: 0.75rem;
    width: calc(100% - 1.5rem);
    height: calc(100% - 1.5rem);
    object-fit: contain;
}
