/* ==========================================================
   MY STORYLAND VIEWER STYLES - BOOK FLIP EFFECT
   File    : /viewer.css
   ========================================================== */

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body{
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: Arial, Helvetica, sans-serif;
}

/* Container utama penampil dengan efek kedalaman 3D */
.viewer{
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    perspective: 1500px; /* Memberikan efek ruang 3D saat halaman berputar */
}

/* Base style untuk halaman buku */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Poros lipatan buku ada di sebelah kiri layar */
    transform-origin: left center; 
    
    /* Transisi mulus untuk rotasi dan bayangan */
    transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.9s ease, 
                box-shadow 0.9s ease;
    
    backface-visibility: hidden; /* Mencegah kedipan visual saat berputar */
}

.page img {
    display: block;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* --- LOGIKA ANIMASI MEMBUKA BUKU (3D FLIP) --- */

/* Halaman Aktif (Terbuka Rata) */
.page.current {
    opacity: 1;
    transform: rotateY(0deg);
    z-index: 10;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0);
}

/* Halaman Berikutnya (Ada di kanan, siap menutup ke kiri) */
.page.next {
    opacity: 0;
    transform: rotateY(90deg); /* Berputar berdiri tegak sebelum menutup */
    z-index: 9;
}

/* Halaman Sebelumnya (Terbuka ke arah kiri) */
.page.prev {
    opacity: 0;
    transform: rotateY(-90deg); /* Berputar ke kiri menjauhi pembaca */
    z-index: 9;
}

/* Halaman Tersembunyi */
.page.hidden {
    opacity: 0;
    display: none;
    z-index: 1;
}

/* --- STYLE INTERFACE LAINNYA --- */

/* Counter */
.counter{
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 30;

    padding: 8px 15px;
    border-radius: 30px;

    background: rgba(0,0,0,.58);
    color: #fff;

    font-size: 14px;
}

/* Control bar */
.controls{
    position: fixed;
    bottom: 18px;
    left: 50%;
    z-index: 40;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: auto;
    padding: 7px 10px;
    border-radius: 40px;

    background: rgba(0,0,0,.38);
    transform: translateX(-50%);
}

/* Circular control buttons */
.control-button{
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(255,255,255,.94);
    color: #111;

    font-family:
        Arial,
        "Segoe UI Symbol",
        "Apple Color Emoji",
        "Segoe UI Emoji",
        sans-serif;

    font-size: 18px;
    font-weight: bold;
    line-height: 1;

    text-decoration: none;
    cursor: pointer;

    box-shadow: 0 2px 7px rgba(0,0,0,.35);
}

.control-button:hover{
    background: #ffd54f;
}

.control-button:active{
    transform: scale(.92);
}

.control-button:focus-visible{
    outline: 3px solid #ffd54f;
    outline-offset: 2px;
}

/* State Musik Aktif/Mute */
#musicBtn.music-on{
    background: #81c784;
    color: #102413;
}

#musicBtn.music-off{
    background: rgba(255,255,255,.94);
    color: #111;
}

/* Watermark */
.watermark{
    position: fixed;
    right: 10px;
    bottom: 7px;
    z-index: 20;

    color: rgba(255,255,255,.38);
    font-size: 12px;

    pointer-events: none;
}

/* Responsif Layar Kecil */
@media(max-width:600px){
    .counter{
        top: 10px;
        right: 10px;
        padding: 7px 12px;
        font-size: 12px;
    }

    .controls{
        bottom: 12px;
        gap: 5px;
        padding: 6px 8px;
    }

    .control-button{
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 16px;
    }

    .watermark{
        display: none;
    }
}