/* style.css */
body {
    min-height: 100vh;
    margin: 0;
    background: #f2e9e4;
    font-family: 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.centered {
    margin: auto;
    width: max-content;
}

.flipbook {
    margin: 2em auto;
    width: 500px;
    height: 350px;
    position: relative;
    transform-style: preserve-3d;
    perspective: 1500px;
}

.leaf {
    position: absolute;
    transform-style: preserve-3d;
    height: 100%;
    width: 50%;
    left: 50%;
    transition: transform 1s ease;
    transform-origin: left center;
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #fff8dc;
    padding: 1.5em;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    box-sizing: border-box;
}

.page.front {
    transform: rotateY(0deg) translateZ(0.1px);
    border-radius: 0 10px 10px 0;
}

.page.back {
    transform: rotateY(180deg) translateZ(0.1px);
    border-radius: 10px 0 0 10px;
}

.title {
    text-align: center;
    font-family: 'Playfair Display', serif;
    color: white;
}

.portada {
    background: linear-gradient(135deg, #ff6f61, #ffb88c);
    color: white;
}

.pageNumber {
    font-size: 0.8em;
    position: absolute;
    bottom: 0.5em;
    color: #555;
}

.contents-row {
    display: flex;
}

.contents-row .spacer {
    flex: 1;
    border-bottom: 1px dashed #aaa;
    margin: 0 0.5em;
}

.controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-bottom: 2em;
}

button {
    background: #ff6f61;
    border: none;
    color: white;
    padding: 0.5em 1em;
    font-size: 1em;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s;
}

button:hover:not(:disabled) {
    background: #ff8b7e;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* --- Responsividad --- */
@media (max-width: 600px) {
    .flipbook {
        width: 90vw;
        height: calc(90vw * 0.7); /* Relación ancho/alto */
    }

    .page {
        padding: 1em;
        font-size: 0.9em;
    }

    button {
        font-size: 0.9em;
        padding: 0.4em 0.8em;
    }
}

@media (max-width: 400px) {
    .flipbook {
        width: 95vw;
        height: calc(95vw * 0.7);
    }

    .page {
        padding: 0.8em;
        font-size: 0.85em;
    }

    button {
        width: 100%;
    }
}
