body {
    background-color: #0B1120;
    color: white;
    overflow-x: hidden;
    font-family: 'Inter', sans-serif;
}

/* ========================================
   FLIPBOOK 3D 
   ======================================== */
.flipbook-wrapper {
    perspective: 1000px;
    max-width: 340px;
    margin: 0 auto;
    position: relative;
}

.flipbook {
    position: relative;
    width: 80%;
    height: 340px; 
    transform-style: preserve-3d;
}

/* Página individual */
.page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    cursor: pointer;
    border-radius: 8px 16px 16px 8px;
}

/* Z-index para apilamiento correcto */
.page-1 { z-index: 4; }
.page-2 { z-index: 3; }
.page-3 { z-index: 2; }
.page-4 { z-index: 1; }

/* Estado volteado */
.page.flipped {
    transform: rotateY(-180deg);
    pointer-events: none; 
}

/* ========================================
   CARAS DE LA PÁGINA
   ======================================== */
.page-front,
.page-back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 8px 16px 16px 8px;
    overflow: hidden;
    
    /* CRÍTICO: Ocultar reverso en todos los navegadores */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
}

/* Frente */
.page-front {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-left: 5px solid #D4AF37;
    z-index: 2;
    transform: rotateY(0deg);
}

/* Reverso */
.page-back {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-left: 5px solid #D4AF37;
    z-index: 1;
    transform: rotateY(180deg);
}

/* Contenido */
.page-content {
    padding: 2.5rem 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ========================================
   LOMO DEL LIBRO (Fijo)
   ======================================== */
.flipbook-spine {
    position: absolute;
    left: 0;
    top: 0;
    width: 15px;
    height: 100%;
    background: linear-gradient(90deg, #D4AF37 0%, #B8860B 50%, #D4AF37 100%);
    border-radius: 4px 0 0 4px;
    z-index: 20;
    box-shadow: 3px 0 15px rgba(0,0,0,0.6);
}

/* ========================================
   SOMBRA DINÁMICA
   ======================================== */
.page::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    border-radius: 0 8px 8px 0;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.page.flipped::after {
    opacity: 0;
}

/* ========================================
   SERVICIOS & GENERAL
   ======================================== */
.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transition: left 0.5s ease;
}

.service-card:hover::before {
    left: 100%;
}

/* Animaciones Hero */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

.animate-fade-in { animation: fadeIn 1s ease-out forwards; }
.animate-fade-in-up { animation: fadeInUp 1s ease-out forwards; }
.animate-fade-in-up-delay { opacity: 0; animation: fadeInUp 1s ease-out 0.3s forwards; }
.animate-fade-in-up-delay-2 { opacity: 0; animation: fadeInUp 1s ease-out 0.6s forwards; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #0B1120; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

::selection { background: #D4AF37; color: #0B1120; }

/* Responsive */
@media (max-width: 768px) {
    .flipbook { height: 340px; }
    .page-content { padding: 1.5rem; }
    .flipbook-spine { width: 10px; }
}