.book-cover {
    font-size: 18px;
    box-sizing: border-box;
}

.book-cover:has([data-size="small"]) {
    min-width: 70px;
}

.book-cover:has([data-size="medium"]) {
    min-width: 140px;
}

.book-cover:has([data-size="big"]) {
    min-width: 200px;
}

.book-cover-container {
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 600px;
}

@keyframes bookCoverAnimation {
    0% {
        transform: rotateY(0deg);
    }
    0% {
        transform: rotateY(-15deg);
    }
    100% {
        transform: rotateY(-30deg);
    }
}

.book-cover-container .book-cover-image {
    transform: rotateY(-30deg);
}

@media (hover: hover) {
    .book-cover-container .book-cover-image:hover {
        transform: rotateY(0deg);
    }

    /* Rotate 180 degrees if there's an enclosing link.*/
    a.book-cover-link .book-cover-container .book-cover-image:hover {
        transform: rotateY(-180deg);
    }
}

.book-cover-container .book-cover-image {
    width: 200px;
    height: 300px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s ease;
    animation: 1s ease 0s 1 bookCoverAnimation;
}

.book-cover-container .book-cover-image > picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 300px;
    transform: translateZ(31px);
}

.book-cover-container .book-cover-image img {
    height: 100%;
    max-width: 100%;
    border-radius: 2px 5px 5px 2px;
}

img.book-cover-notfound::before {
    content: '' !important;
    width: 100%;
    height: 100%;
    background-color: currentcolor;
    position: absolute;
    top: 50%;
    left: 0px;
    transform: translateY(-50%);
}

img.book-cover-notfound::after {
    content: attr(alt);
    font-size: 1.3em;
    color: black;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    line-height:1.2;
    text-align:center;
    width: 100%;
    height: 100%;
    padding: 1em;
}

.book-cover-container .book-cover-pages {
    position: absolute;
    content: ' ';
    left: 0;
    top: 3px;
    width: 60px;
    height: 294px;
    transform: translateX(166px) rotateY(90deg);
    box-shadow: 8px 1px 3px -8px rgba(0 0 0 / 20%);
    z-index: 1; /* For Safari*/
    background: linear-gradient(90deg,
        #f1f1f1 0%,
        #ebebeb 5%,
        #f1f1f1 10%,
        #ebebeb 15%,
        #f1f1f1 20%,
        #ebebeb 25%,
        #f1f1f1 30%,
        #ebebeb 35%,
        #f1f1f1 40%,
        #ebebeb 45%,
        #f1f1f1 50%,
        #ebebeb 55%,
        #f1f1f1 60%,
        #ebebeb 65%,
        #f1f1f1 70%,
        #ebebeb 75%,
        #f1f1f1 80%,
        #ebebeb 85%,
        #f1f1f1 90%,
        #ebebeb 95%,
        #c3c3c3 100%);
}

.book-cover-container .book-backcover {
    box-sizing: border-box;
    background-position-x: center;
    position: absolute;
    overflow: hidden;
    top: 0;
    left: 0;
    width: 200px;
    height: 300px;
    padding: 10em 1em 1em 1em;
    transform: translateZ(-31px) matrix(-1, 0, 0, 1, 0, 0);
    text-align: center;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    font-family: sans-serif;
    font-size: .9em;
    line-height: 1.3;
    background-repeat: no-repeat;
}

.book-cover-container [data-size="medium"] .book-backcover {
    font-size: .7em;
}

.book-cover-sr-only {
    border:0;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    white-space: nowrap;
    padding: 0;
    position: absolute;
}

/*=================================
=            VARIABLES            =
=================================*/

/**
 *
 * SIZE
 *
 */

/* 300 x 200
-------------------------------*/

.book-cover-container .book-cover-image[data-size="big"],
.book-cover-container .book-cover-image[data-size="big"] .book-backcover,
.book-cover-container .book-cover-image[data-size="big"] > picture {
    width: 200px;
    height: 300px;
}

.book-cover-container .book-cover-image[data-size="big"] > picture {
    transform: translateZ(35px);
    border-radius: 2px 5px 5px 2px;
    box-shadow:
        0 0 30px 0 rgba(0 0 0 / 5%),
        0 0 0 1px rgba(0 0 0 / 5%),
        0.3px 0.5px 0.7px rgba(0 0 0 / 20%),
        0.8px 1.6px 2px -0.8px rgba(0 0 0 / 20%),
        2.1px 4.1px 5.2px -1.7px rgba(0 0 0 / 20%),
        5px 10px 12.6px -2.5px rgba(0 0 0 / 20%);
}

.book-cover-container .book-cover-image[data-size="big"] .book-cover-pages {
    top: 3px;
    width: 68px;
    height: 294px;
    transform: translateX(162px) rotateY(90deg);
}

.book-cover-container .book-cover-image[data-size="big"] .book-backcover {
    transform: translateZ(-35px) matrix(-1, 0, 0, 1, 0, 0);
    background-size: 30%;
    background-position-y: 6em;
    border-radius: 5px 2px 2px 5px;
    box-shadow:
        0 0 0 1px rgba(0 0 0 / 8%),
        0.3px 0.5px 0.7px rgba(0 0 0 / 20%),
        0.8px 1.6px 2px -0.8px rgba(0 0 0 / 20%),
        2.1px 4.1px 5.2px -1.7px rgba(0 0 0 / 20%),
        5px 10px 12.6px -2.5px rgba(0 0 0 / 20%),
        0 0 80px rgba(0 0 0 / 3%) inset;
}


/* 200 x 133
-------------------------------*/

.book-cover-container .book-cover-image[data-size="medium"],
.book-cover-container .book-cover-image[data-size="medium"] .book-backcover,
.book-cover-container .book-cover-image[data-size="medium"] > picture {
    width: 133px;
    height: 200px;
}

.book-cover-container .book-cover-image[data-size="medium"] > picture {
    transform: translateZ(23px);
    border-radius: 1px 2.5px 2.5px 1px;
    box-shadow:
        0 0 15px 0 rgba(0 0 0 / 5%),
        0 0 0 1px rgba(0 0 0 / 8%),
        0.15px 0.25px 0.35px rgba(0 0 0 / 10%),
        0.4px 0.8px 1px -0.4px rgba(0 0 0 / 10%),
        1.05px 2.05px 2.6px -0.85px rgba(0 0 0 / 10%),
        2.5px 5px 6.3px -1.25px rgba(0 0 0 / 10%);
}

.book-cover-container .book-cover-image[data-size="medium"] .book-cover-pages {
    top: 2px;
    width: 44px;
    height: 196px;
    transform: translateX(108px) rotateY(90deg);
}

.book-cover-container .book-cover-image[data-size="medium"] .book-backcover {
    transform: translateZ(-23px) matrix(-1, 0, 0, 1, 0, 0);
    background-size: 35%;
    background-position-y: 4.5em;
    padding-top: 8.5em;
    border-radius: 2.5px 1px 1px 2.5px;
    box-shadow:
        0 0 0 1px rgba(0 0 0 / 8%),
        0.3px 0.5px 0.7px rgba(0 0 0 / 10%),
        0.8px 1.6px 2px -0.8px rgba(0 0 0 / 10%),
        2.1px 4.1px 5.2px -1.7px rgba(0 0 0 / 10%),
        5px 10px 12.6px -2.5px rgba(0 0 0 / 10%),
        0 0 80px rgba(0 0 0 / 3%) inset;
}


/* 100 x 66
-------------------------------*/

.book-cover-container .book-cover-image[data-size="small"],
.book-cover-container .book-cover-image[data-size="small"] .book-backcover,
.book-cover-container .book-cover-image[data-size="small"] > picture {
    width: 66px;
    height: 100px;
}

.book-cover-container .book-cover-image[data-size="small"] > picture {
    transform: translateZ(13px);
    border-radius: 1px 2.5px 2.5px 1px;
    box-shadow:
        0 0 15px 0 rgba(0 0 0 / 5%),
        0 0 0 1px rgba(0 0 0 / 8%),
        0.15px 0.25px 0.35px rgba(0 0 0 / 10%),
        0.4px 0.8px 1px -0.4px rgba(0 0 0 / 10%),
        1.05px 2.05px 2.6px -0.85px rgba(0 0 0 / 10%),
        2.5px 5px 6.3px -1.25px rgba(0 0 0 / 10%);
}

.book-cover-container .book-cover-image[data-size="small"] .book-cover-pages {
    top: 1px;
    width: 24px;
    height: 98px;
    transform: translateX(52px) rotateY(90deg);
}

.book-cover-container .book-cover-image[data-size="small"] .book-backcover {
    transform: translateZ(-13px) matrix(-1, 0, 0, 1, 0, 0);
    background-size: 60%;
    background-position-y: 2em;
    padding-top: 1em;
    content: '';
    border-radius: 2.5px 1px 1px 2.5px;
    box-shadow:
        0 0 0 1px rgba(0 0 0 / 7.5%),
        0.15px 0.25px 0.35px rgba(0 0 0 / 10%),
        0.4px 0.8px 1px -0.4px rgba(0 0 0 / 10%),
        1.2px 2.05px 2.51px -0.85px rgba(0 0 0 / 10%),
        2.5px 5px 6.3px -1.25px rgba(0 0 0 / 10%),
        0 0 10px rgba(0 0 0 / 2%) inset;
}

/**
 *
 * Default colors
 *
 */

:where(.book-cover-container) .book-backcover {
    background-color: white;
    color: #1d4ed8;
}

:where(.book-cover-container) .book-cover-image > picture {
    background-color: #1d4ed8;
}