/* Base Reset & Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Background Image Implementation */
    background-color: #1e1e2f; /* Fallback color */
    background-image: url('../images/bg.png'); /* REPLACE WITH YOUR IMAGE PATH */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* Keeps the background static if scrolling occurs */
    
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* Floating Download Button */
.floating-download {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 1000;
}

.showcase-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 20px;
    animation: fadeUp 0.8s ease-out forwards;
}

/* Global Button Styles (Glassmorphism) */
.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.15); /* Slightly more opaque to stand out against custom backgrounds */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    border-radius: 50px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Book Layout */
.book-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
}

.nav-btn {
    padding: 15px;
    border-radius: 50%;
}

/* Flipbook Core CSS */
.flipbook-container {
    perspective: 2000px;
    width: 100%;
    max-width: 430px; 
    aspect-ratio: 3 / 4; 
    position: relative;
    box-shadow: 20px 20px 40px rgba(0, 0, 0, 0.6); 
    border-radius: 2px 8px 8px 2px;
}

.flipbook {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
    background-color: #fcfcfc;
    backface-visibility: hidden;
    border-radius: 2px 8px 8px 2px;
    overflow: hidden;

    /* Smooth flip transition */
            transform-origin: left center;
            transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
            transform-style: preserve-3d;
            backface-visibility: hidden; /* Hides the back of the page when turned */
}

/* Simulates the inner shadow of the book spine */
.page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}

.page img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.page.flipped {
    transform: rotateY(-180deg);
}

.swipe-hint {
    margin-top: 20px;
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5); /* Helps text stand out against custom backgrounds */
    display: none; 
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Optimization */
@media (max-width: 768px) {
    /* Shrink the floating download button to just an icon */
    .floating-download {
        top: 15px;
        left: 15px;
        padding: 12px;
        border-radius: 50%;
    }

    .floating-download .btn-text {
        display: none;
    }

    .book-area {
        position: relative;
    }
    
    .nav-btn {
        display: none;
    }

    .flipbook-container {
        max-width: 85vw; 
    }

    .swipe-hint {
        display: block;
        animation: pulse 2s infinite;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}