
    :root {
        --paper:      #fcfbf7;
        --paper-dark: #f0ece0;
        --ink:        #27272a;
        --spine:      #d6d3d1;
    }

    * { box-sizing: border-box; }
    /* --- Typography --- */
    .font-sans { font-family: 'Inter', sans-serif; }
    .font-display { font-family: 'Cinzel', serif !important; }

    /* ── Book wrapper ── */
    .book-container {
        display: flex;
        justify-content: center;
        width: 100%;
        padding: 20px 0;
    }

    .book-scene {
        perspective: 2500px;
        width: 95%;
        max-width: 1000px;
        margin: 0 auto;
    }

    /* The book itself: fixed height, clips overflow so flipping page
       doesn't spill outside the book boundary */
    .book {
        width: 100%;
        height: 580px;
        display: flex;
        position: relative;
        background: var(--spine);
        border: 1px solid var(--spine);
        overflow: hidden; /* keeps flip inside book bounds */
    }

    /* Static left/right page halves */
    .page-display {
        width: 50%;
        height: 100%;
        background: var(--paper);
        position: relative;
        overflow: hidden;
    }

    /* Subtle spine shadow */
    .page-display.left  { border-right: 1px solid #c8c4bc; }
    .page-display.right { border-left:  1px solid #c8c4bc; }
    .page-display.left::after {
        content: '';
        position: absolute;
        top: 0; right: 0; bottom: 0;
        width: 18px;
        background: linear-gradient(to left, rgba(0,0,0,0.06), transparent);
        pointer-events: none;
    }
    .page-display.right::after {
        content: '';
        position: absolute;
        top: 0; left: 0; bottom: 0;
        width: 18px;
        background: linear-gradient(to right, rgba(0,0,0,0.08), transparent);
        pointer-events: none;
    }

    .page-content {
        padding: 28px 28px 30px;
        font-family: 'EB Garamond', serif;
        color: var(--ink);
        line-height: 1.75;
        font-size: 15px;
        height: 100%;
        overflow: hidden;
    }

    .page-content p { margin-bottom: 0.85em; }
    .page-content p:last-child { margin-bottom: 0; }
    .page-content em { font-style: italic; }

    /* ── The flip element ── */
    /* Sits absolutely inside .book, same size as one page half.
       Uses CSS 3D: front face = page being turned, back face = arriving page. */
    #flip {
        position: absolute;
        top: 0;
        width: 50%;
        height: 100%;
        transform-style: preserve-3d;
        z-index: 20;
        pointer-events: none;
        display: none;
        /* will-change helps browsers promote to GPU layer */
        will-change: transform;
    }

    #flip .face {
        position: absolute;
        inset: 0;
        background: var(--paper);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        overflow: hidden;
    }

    /* Back face is pre-rotated 180° so it shows when the parent flips over */
    #flip .face.back {
        transform: rotateY(180deg);
        background: var(--paper-dark);
    }

    #flip .face .page-content { height: 100%; }

    /* ── Mobile ── */
    @media (max-width: 768px) {
        .book { flex-direction: column; height: auto; overflow: visible; }
        .page-display { width: 100%; height: auto; min-height: 420px; }
        .page-display.right { display: none; }
        #flip { display: none !important; } /* no flip on mobile — fade used instead */
    }

    /* ── Mobile fade transition ── */
    .page-fade-out { animation: pageFadeOut 0.25s ease forwards; }
    .page-fade-in  { animation: pageFadeIn  0.25s ease forwards; }

    @keyframes pageFadeOut { from { opacity: 1; } to { opacity: 0; } }
    @keyframes pageFadeIn  { from { opacity: 0; } to { opacity: 1; } }
    /* --- Navigation & Interaction --- */
    button:disabled {
        cursor: not-allowed;
        opacity: 0.3;
    }
    
    .nav-link {
        transition: transform 0.2s ease-in-out, color 0.2s ease;
        display: inline-block;
    }
    
    .nav-link:hover {
        transform: scale(1.1);
    }

.face {
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
}

/* This adds a gradient shadow that moves with the flip */
#flip {
    transition: transform 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
    transform-style: preserve-3d;
}

/* The shadow effect: creates depth by darkening the edge of the turning page */
.face.front::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.1), rgba(0,0,0,0));
    pointer-events: none;
}

.face.back::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(to left, rgba(0,0,0,0.1), rgba(0,0,0,0));
    pointer-events: none;
}
.page-display, .face {
    background-color: #fdf6e3; /* A warm, aged paper yellow */
    background-image: radial-gradient(circle at 50% 50%, #fbf3db 0%, #fdf6e3 100%);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
    border: 1px solid #eaddc0;
}

/* Optional: Add a slight paper texture/noise if desired */
.page-content {
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
}
.fade-in {
    animation: fadeInAnimation 1s ease-in forwards;
}

@keyframes fadeInAnimation {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}