/* ---------------------------
   GLOBAL RESET
---------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: url("../textures/clean_bg.png") center/cover no-repeat fixed;
    /* Fallback color matching parchment */
    background-color: #F5F1E6;
    font-family: "Cormorant Garamond", serif;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    /* Prevent scrolling when pages fly out */
}

/* ---------------------------
   SKETCH OVERLAY (Disabled for new background)
---------------------------- */
.bg-sketches {
    display: none;
}

/* ---------------------------
   TITLE
---------------------------- */
h1 {
    position: absolute;
    top: 20px;
    width: 100%;
    text-align: center;
    z-index: 1000;

    font-size: 2.5rem;
    color: #2E2B26;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

/* ---------------------------
   CALENDAR STACK WRAPPER
---------------------------- */
.calendar-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;

    /* key for 3D effect */
    perspective: 2000px;
    z-index: 10;
}

/* ---------------------------
   THE STACK (Container for Pages)
---------------------------- */
.calendar-stack {
    position: relative;
    /* Fit to screen logic, leaving space for title/controls */
    width: 100%;
    height: 100%;

    /* Centralize content */
    display: flex;
    align-items: center;
    justify-content: center;

    transform-style: preserve-3d;
    transition: transform 0.4s ease-out;
    /* Zoom smoothing */
}

/* ---------------------------
   PAGES (Individual Images)
---------------------------- */
.calendar-page {
    position: absolute;
    /* Full screen fit */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: transparent;
    /* Ensure no white box */

    /* Animation Physics */
    transform-origin: 50% -200px;
    /* Rotate from way above the screen for a big arc */
    transition: transform 1.2s cubic-bezier(0.6, 0.05, 0.3, 1), opacity 0.8s ease 0.4s;

    backface-visibility: hidden;
    will-change: transform, opacity;
}

/* The Image Itself */
.calendar-page img {
    max-width: 95%;
    max-height: 85%;
    /* Keep clear of title/controls */
    object-fit: contain;

    /* Nice shadow for depth */
    filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.4));

    /* Prevent dragging ghost image */
    user-select: none;
    pointer-events: none;
}

/* ---------------------------
   FLIPPED STATE (The "Roll Up" Animation)
---------------------------- */
.calendar-page.flipped {
    /* 
       Action: Rotate Back + Move Up + Fade
       - rotateX: Tipping backward
       - translateY: Moving up off screen
       - scale: Shrinking slightly as it moves away
    */
    transform: rotateX(100deg) translateY(-150vh) scale(0.8);
    opacity: 0;
    pointer-events: none;
}

/* ---------------------------
   CONTROLS UI
---------------------------- */
.controls-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);

    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 2000;
    /* On top of everything */

    background: rgba(40, 35, 30, 0.9);
    backdrop-filter: blur(10px);
    padding: 10px 25px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.ctrl-btn {
    background: transparent;
    border: none;
    color: #F5F1E6;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.ctrl-btn:active {
    transform: scale(0.9);
}

.ctrl-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
        top: 15px;
    }

    .calendar-page img {
        max-width: 98%;
        max-height: 80%;
    }

    .controls-container {
        padding: 8px 20px;
        bottom: 20px;
    }

    .powered-by {
        width: 90px;
        bottom: auto;
        /* Reset bottom */
        top: 15px;
        /* Move to top right corner */
        right: 15px;
    }
}

/* ---------------------------
   POWERED BY LOGO
---------------------------- */
.powered-by {
    position: fixed;
    bottom: 20px;
    right: 25px;
    width: 140px;
    height: auto;
    z-index: 2000;
    opacity: 0.95;
    pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    transition: opacity 0.3s;
}