/* 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);
}

/* 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;
}

#toggle-mode-btn {
    width: 2rem;
    height: 2rem;
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    border: none;
    border-radius: 0.5rem;
    background-color: transparent;
    cursor: pointer;
}

#autoflip-btn {
    width: 2rem;
    height: 2rem;
    position: fixed;
    top: 1rem;
    right: 3rem;   /* ← فقط همین خط باعث میشه کنار ماه قرار بگیره */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    border: none;
    border-radius: 0.5rem;
    background-color: transparent;
    cursor: pointer;
}

#fullscreen-btn {
    width: 2rem;
    height: 2rem;
    position: fixed;
    top: 1rem;
    right: 5rem;   /* ← فقط همین خط باعث میشه کنار ماه قرار بگیره */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    border: none;
    border-radius: 0.5rem;
    background-color: transparent;
    cursor: pointer;
}

#portfolio-link {
    padding-right: 0.5rem;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    font-size: 0.75rem;
}

#github-link {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
}

/* 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;
}

.warning-icons {
    font-size: 10rem;
}

@media (max-width: 768px) {
    #responsive-warning.show {
        display: flex;
    }
}

/* FLIP BOOK */
#flip_book {
    width: 498px;
    height: 620px;
    position: relative;
    transition-duration: 1s;
    perspective: 2000px;
}

.front_cover {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;

    border-radius: 2.5px 5px 5px 2.5px;

    /* دو تصویر روی هم */
    background-image: 
        url(./assets/images/cover_image.webp),   /* عکس اصلی جلد */
        url(./assets/images/pages/Page1.webp); /* شیدینگ */

    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;

    box-shadow: 0 0 5px 0 rgba(25, 25, 25, 0.25);
}


.back_cover {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 2.5px 5px 5px 2.5px;
    background-image: url(./assets/images/flip_book_edge_shading.webp);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgb(220, 20, 60);
    box-shadow: 0 0 5px 0 rgb(25, 25, 25, 0.25);
}


.front_cover {
    position: absolute;
    cursor: pointer;
    transform-origin: center left;
    transition: transform 0.5s;
    z-index: 99;
}

.front_cover label {
    width: 100%;
    height: 100%;
    position: absolute;
    cursor: pointer;
}

.page {
    width: 488px;
    height: 600px;
    position: absolute;
    top: 10px;
    left: 1px;
    border-radius: 0 5px 5px 0;
    background-color: white;
    transform-origin: left;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
    transition-duration: 0.5s;
}

.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: 488px;
    height: 600px;
    position: absolute;
    z-index: 98;
}

.front_content {
    width: 487px;
    height: 598px;
    position: absolute;
    top: 1px;
    border-radius: 0 5px 5px 0;
    z-index: 97;
}

.back_content {
    width: 487px;
    height: 598px;
    position: absolute;
    top: 1px;
    left: 1px;
    border-radius: 5px 0 0 5px;
    z-index: 97;
}

.back_cover {
    position: relative;
    z-index: -1;
}

#page1 { z-index: 85; }
#page2 { z-index: 84; }
#page3 { z-index: 83; }
#page4 { z-index: 82; }
#page5 { z-index: 81; }
#page6 { z-index: 80; }
#page7 { z-index: 79; }
#page8 { z-index: 78; }
#page9 { z-index: 77; }
#page10 { z-index: 76; }

#page11 { z-index: 75; }
#page12 { z-index: 74; }
#page13 { z-index: 73; }
#page14 { z-index: 72; }
#page15 { z-index: 71; }
#page16 { z-index: 70; }
#page17 { z-index: 69; }
#page18 { z-index: 68; }
#page19 { z-index: 67; }
#page20 { z-index: 66; }

#page21 { z-index: 65; }
#page22 { z-index: 64; }
#page23 { z-index: 63; }
#page24 { z-index: 62; }
#page25 { z-index: 61; }
#page26 { z-index: 60; }
#page27 { z-index: 59; }
#page28 { z-index: 58; }
#page29 { z-index: 57; }
#page30 { z-index: 56; }



#cover_checkbox:checked~#flip_book {
    transform: translateX(144px)
}

#cover_checkbox:checked~#flip_book .front_cover {
    transform: rotateY(-180deg);
    transition: transform 1.5s, z-index 0.5s 0.5s;
    z-index: 1;
}

#cover_checkbox:checked~#flip_book #cover {
    width: 80%;
    height: 80%;
    position: absolute;
}

#page1_checkbox:checked~#flip_book #page1 {
    transform: rotateY(-180deg);
    z-index: 3;
}

#page2_checkbox:checked ~ #flip_book #page2 {
    transform: rotateY(-180deg);
    z-index: 4;
}

#page3_checkbox:checked ~ #flip_book #page3 {
    transform: rotateY(-180deg);
    z-index: 5;
}

#page4_checkbox:checked ~ #flip_book #page4 {
    transform: rotateY(-180deg);
    z-index: 6;
}

#page5_checkbox:checked ~ #flip_book #page5 {
    transform: rotateY(-180deg);
    z-index: 7;
}

#page6_checkbox:checked ~ #flip_book #page6 {
    transform: rotateY(-180deg);
    z-index: 9;
}

#page7_checkbox:checked ~ #flip_book #page7 {
    transform: rotateY(-180deg);
    z-index: 15;
}

#page8_checkbox:checked ~ #flip_book #page8 {
    transform: rotateY(-180deg);
    z-index: 18;
}

#page9_checkbox:checked ~ #flip_book #page9 {
    transform: rotateY(-180deg);
    z-index: 21;
}

#page10_checkbox:checked ~ #flip_book #page10 {
    transform: rotateY(-180deg);
    z-index: 24;
}

#page11_checkbox:checked ~ #flip_book #page11 {
    transform: rotateY(-180deg);
    z-index: 27;
}

#page12_checkbox:checked ~ #flip_book #page12 {
    transform: rotateY(-180deg);
    z-index: 30;
}

#page13_checkbox:checked ~ #flip_book #page13 {
    transform: rotateY(-180deg);
    z-index: 33;
}

#page14_checkbox:checked ~ #flip_book #page14 {
    transform: rotateY(-180deg);
    z-index: 36;
}

#page15_checkbox:checked ~ #flip_book #page15 {
    transform: rotateY(-180deg);
    z-index: 39;
}

#page16_checkbox:checked ~ #flip_book #page16 {
    transform: rotateY(-180deg);
    z-index: 42;
}

#page17_checkbox:checked ~ #flip_book #page17 {
    transform: rotateY(-180deg);
    z-index: 45;
}

#page18_checkbox:checked ~ #flip_book #page18 {
    transform: rotateY(-180deg);
    z-index: 48;
}

#page19_checkbox:checked ~ #flip_book #page19 {
    transform: rotateY(-180deg);
    z-index: 51;
}

#page20_checkbox:checked ~ #flip_book #page20 {
    transform: rotateY(-180deg);
    z-index: 54;
}

#page21_checkbox:checked ~ #flip_book #page21 {
    transform: rotateY(-180deg);
    z-index: 57;
}

#page22_checkbox:checked ~ #flip_book #page22 {
    transform: rotateY(-180deg);
    z-index: 60;
}

#page23_checkbox:checked ~ #flip_book #page23 {
    transform: rotateY(-180deg);
    z-index: 63;
}

#page24_checkbox:checked ~ #flip_book #page24 {
    transform: rotateY(-180deg);
    z-index: 66;
}

#page25_checkbox:checked ~ #flip_book #page25 {
    transform: rotateY(-180deg);
    z-index: 69;
}

#page26_checkbox:checked ~ #flip_book #page26 {
    transform: rotateY(-180deg);
    z-index: 72;
}

#page27_checkbox:checked ~ #flip_book #page27 {
    transform: rotateY(-180deg);
    z-index: 75;
}

#page28_checkbox:checked ~ #flip_book #page28 {
    transform: rotateY(-180deg);
    z-index: 78;
}

#page29_checkbox:checked ~ #flip_book #page29 {
    transform: rotateY(-180deg);
    z-index: 81;
}

#page30_checkbox:checked ~ #flip_book #page30 {
    transform: rotateY(-180deg);
    z-index: 84;
}


.zoom-btn {
    position: absolute;
    top: 8px;
    left: 8px; /* اگر خواستی راست باشه: right: 8px */
    z-index: 99999;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.zoom-btn:hover {
    background: rgba(0,0,0,0.8);
}


#zoom-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#zoom-viewer img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
}

#zoom-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    color: white;
    cursor: pointer;
}


.page.flipped .front_page .zoom-btn {
    display: none;
}


#page-list-container {
    position: fixed; /* کنار کتاب */
    left: 32rem; /* میخوای راست باشه برای فارسی: left یا right؟ */
    width: 240px; /* عرض دلخواه */
    max-height: 620px; /* ارتفاع حداکثر */
    overflow-y: auto; /* اسکرول عمودی */
    direction: rtl; /* راست‌چین */
    text-align: right; /* متن راست */
    padding: 0.5rem;
    background-color: rgba(245,245,245,0.9); /* زمینه روشن */
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    font-size: 0.85rem;
}

#page-list-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#page-list-container ul li {
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#page-list-container ul li:hover {
    background-color: rgba(0,0,0,0.1);
}

/* PAGE LIST - DARK MODE */
body.dark-mode #page-list-container {
    background-color: rgba(2, 4, 8, 0.9); /* زمینه تیره */
    color: var(--light-color); /* متن روشن */
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}

body.dark-mode #page-list-container ul li {
    color: var(--light-color);
}

body.dark-mode #page-list-container ul li:hover {
    background-color: rgba(255,255,255,0.1); /* هاور روشن روی تیره */
}

