/* RESET CSS */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* VARIABLES */
:root {
    --dark-color: rgb(2, 4, 8);
    --dark-hover: rgba(255, 255, 255, 0.1);

    --light-color: rgb(245, 245, 245);
    --light-hover: rgba(0, 0, 0, 0.1);

    --flip-duration: 1s;
}

/* GENERAL */
body {
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: monospace, sans-serif;
    font-size: 0.5rem;
    transition: background-color 0.3s;
}

body.light-mode {
    color: var(--dark-color);
    background-color: var(--light-color)
}

body.light-mode #toggle-mode-btn:hover {
    background-color: var(--light-hover);
}

body.dark-mode {
    color: var(--light-color);
    background-color: var(--dark-color);
}

body.dark-mode #toggle-mode-btn:hover {
    background-color: var(--dark-hover);
}

a {
    text-decoration: none;
    color: var(--dark-color);
}

input {
    display: none;
}

/* RESPONSIVE WARNING */
#responsive-warning {
    width: 100%;
    height: 100%;
    padding: 2rem;
    position: fixed;
    top: 0;
    left: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    font-size: 1rem;
    text-align: center;
    z-index: 9999;
}

/* FLIP BOOK */
.container {
    width: 100%;
    height: calc(100% - 90px);
    display: flex;
    justify-content: center;
    align-items: center;

    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

@media (max-width: 768px) {
    .container {
        height: 90%;
    }
}

#flipbook {
    height: 90%;
    aspect-ratio: 612/792;
    position: relative;
    transition-duration: 1s;
    perspective: 2000px;
}

.front_cover,
.back_cover {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 5px 0 rgb(25, 25, 25, 0.25);
}

.page {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 1px;
    background-color: white;
    transform-origin: left;
    transform-style: preserve-3d;
    transform: rotateY(0deg);

    transition: transform var(--flip-duration), z-index calc(var(--flip-duration) / 2) 0s;
    transition-duration: var(--flip-duration);

    z-index: 1;
    border: 1px solid rgb(25, 25, 25, 0.25);
}

.page * img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.front_page {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
}

.front_page label {
    width: 100%;
    height: 100%;
    position: absolute;
    cursor: pointer;
    z-index: 100;
}

.back_page {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    z-index: 100;
}

.back_page label {
    width: 100%;
    height: 100%;
    position: absolute;
    cursor: pointer;
    z-index: 100;
}

.edge_shading {
    width: 288px;
    height: 400px;
    position: absolute;
    z-index: 98;
    transform: translateY(-100%);
}

.front_content {
    width: 287px;
    height: 398px;
    position: absolute;
    top: 1px;
    z-index: 97;
}

.back_content {
    width: 287px;
    height: 398px;
    position: absolute;
    top: 1px;
    left: 1px;
    z-index: 97;
}

.container #flipbook:has(.front_cover.flipped) {
    transform: translateX(50%);
    transition: transform var(--flip-duration), z-index calc(var(--flip-duration) / 2) 0s;
}

.page.flipped {
    transform: rotateY(-180deg);
    transition: transform var(--flip-duration), z-index calc(var(--flip-duration) / 2) 0s;
    /* z-index: 1; */
}

.container #flipbook:has(.back_cover.flipped) {
    transform: translateX(100%);
    transition: transform var(--flip-duration), z-index calc(var(--flip-duration) / 2) 0s;
}