/* ===============================
   BACKGROUND
=============================== */
html {
    background: url("../images/paper-bg.jpg") center / cover no-repeat fixed;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: transparent;

    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===============================
   MAIN WRAPPER
=============================== */
#ui-wrapper {
    position: relative;
}

/* ===============================
   BOOK
=============================== */
#book-shell {
    width: min(90vw, 900px);
    aspect-ratio: 3 / 2; /* FIXED: safer than calc height */
    max-height: 600px;

    position: relative;
    box-shadow:
        0 80px 140px rgba(26, 26, 26, 0.9),
        0 30px 60px rgba(36, 36, 36, 0.6);

    overflow: hidden;
    border-radius: 12px;
}

#book-container {
    width: 100%;
    height: 100%;
}

/* ===============================
   NAV BUTTONS (BELOW MENU)
=============================== */
.nav {
    position: absolute;
    bottom: -70px;

    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    font-size: 26px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;

    display: flex;
    align-items: center;
    justify-content: center;
}

.nav.prev {
    left: 42%;
}

.nav.next {
    right: 42%;
}

/* ===============================
   PAGE NUMBER
=============================== */
#page-number {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: #ddd;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#page-number.show {
    opacity: 1;
}

/* ===============================
   BACK HOME BUTTON
=============================== */
.back-home {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 20px;
    z-index: 9999;

    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px); /* FIXED: Safari support */
}

.back-home:hover {
    background: rgba(0, 0, 0, 0.85);
}

/* ===============================
   TABLET
=============================== */
@media (max-width: 1024px) {

    body {
        padding: 20px;
    }

    #book-shell {
        width: 95vw;
        height:500px;
        aspect-ratio: 3 / 2;
        max-height: 520px;

        box-shadow:
            0 30px 60px rgba(26, 26, 26, 0.6),
            0 10px 25px rgba(36, 36, 36, 0.4);
    }

    .nav {
        bottom: -60px;
        width: 46px;
        height: 46px;
        font-size: 24px;
    }

    .nav.prev {
        left: 40%;
    }

    .nav.next {
        right: 40%;
    }
}

/* ===============================
   MOBILE – USE SLIDER ONLY
=============================== */
.mobile-menu-slider {
    display: none;
}

@media (max-width: 768px) {

    /* Hide flipbook */
    #ui-wrapper,
    .nav,
    #page-number {
        display: none !important;
    }
#book-shell {
        height: auto !important;
        max-height: none !important;
        aspect-ratio: auto !important;
    }
    /* Mobile slider */
    .mobile-menu-slider {
        display: flex;
        min-height: 100vh;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
        padding: 72px 16px 40px;
        background: #eaeaea;
        box-sizing: border-box;
    }

    .slider-track {
        display: flex;
        flex-direction: column;
        gap: 40px;
        width: 100%;
    }
@media (max-width: 768px) {

    /* Fix small height issue */
    .mobile-menu-slider {
        display: flex;
        min-height: 100svh; /* better than 100vh on mobile */
        align-items: center;
    }

    .slider-track img {
        width: 100%;
        height: auto;               /* IMPORTANT */
        max-height: none;           /* REMOVE height limit */
        aspect-ratio: auto;         /* RESET desktop ratio */
        object-fit: contain;        /* Keep full menu visible */
    }
}

    .slider-track img {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
        border-radius: 14px;
        scroll-snap-align: start;
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
        background: #fff;
        display: block;
    }

    .back-home {
        top: 12px;
        left: 12px;
        font-size: 13px;
    }
}
