/* Animated Bible Hero Section */
.hero-bible {
    position: relative;
    height: 400px;
    max-height: 400px;
    background: linear-gradient(135deg, #372ac3 0%, #0500ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
}

/* Overlay for better text contrast */
.hero-bible::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.hero-bible-content {
    position: absolute;
    top: 0;
    left: 5%;
    height: 100%;
    z-index: 10;
    text-align: left;
    color: white;
    max-width: 35%;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-bible-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
}

.hero-bible-content p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.hero-buttons .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* 3D Bible Container */
.bible-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    perspective: 3000px;
    z-index: 2;
    padding-right: 5%;
}

.bible {
    position: relative;
    width: 60vw;
    height: 100%;
    max-width: 900px;
    transform-style: preserve-3d;
    transform: rotateY(-15deg) rotateX(5deg);
    margin: 0;
}

/* Bible Cover */
.bible-cover {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4a1a0a 0%, #6b2914 100%);
    border: 2px solid #2d0f06;
    border-radius: 0 4px 4px 0;
    box-shadow:
        -5px 5px 15px rgba(0, 0, 0, 0.5),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transform-origin: left center;
    animation: open-close-bible 10s ease-in-out infinite;
}

/* Bible Cover Design */
.bible-cover::before {
    content: '';
    position: absolute;
    width: 80%;
    height: 85%;
    border: 1px solid #d4af37;
    border-radius: 2px;
}

.bible-cover::after {
    content: '✝';
    position: absolute;
    font-size: 5rem;
    color: #d4af37;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

/* Bible Spine */
.bible-spine {
    position: absolute;
    left: -20px;
    width: 20px;
    height: 100%;
    background: linear-gradient(to right, #2d0f06 0%, #4a1a0a 100%);
    border-radius: 8px 0 0 8px;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    transform: rotateY(-90deg);
    transform-origin: right center;
}

/* Pages Container */
.bible-pages {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* Individual Page */
.page {
    position: absolute;
    width: 50%;
    height: 100%;
    right: 0;
    background: linear-gradient(to right, #f5f1e8 0%, #fffef9 10%, #fffef9 90%, #e8e4d8 100%);
    border: 1px solid #d4cfc0;
    border-left: none;
    transform-origin: left center;
    transform-style: preserve-3d;
    box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
    backface-visibility: hidden;
}

/* Page back side */
.page::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to left, #f5f1e8 0%, #fffef9 10%, #fffef9 90%, #e8e4d8 100%);
    transform: rotateY(180deg);
    backface-visibility: hidden;
    z-index: 1;
}

/* Back page content */
.page::after {
    content: attr(data-back-verse);
    position: absolute;
    width: 85%;
    height: 80%;
    left: 10%;
    top: 10%;
    padding: 1rem;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #2d2520;
    transform: rotateY(180deg);
    backface-visibility: hidden;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Page content styling */
.page-content {
    position: absolute;
    width: 85%;
    height: 80%;
    left: 10%;
    top: 10%;
    padding: 1.5rem;
    font-family: 'Georgia', 'Times New Roman', serif;
    color: #2d2520;
    z-index: 10;
    pointer-events: none;
}

.page-content h4 {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0 0 1rem 0;
    color: #4a1a0a;
    text-align: center;
    border-bottom: 2px solid #d4cfc0;
    padding-bottom: 0.5rem;
}

.page-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    text-align: justify;
    text-indent: 1.5em;
}

/* Page turning animations - 13 pages, each turns after 30s */
.page:nth-child(1) {
    animation: turn-page-1 390s infinite;
    z-index: 13;
}

.page:nth-child(2) {
    animation: turn-page-2 390s infinite;
    z-index: 12;
}

.page:nth-child(3) {
    animation: turn-page-3 390s infinite;
    z-index: 11;
}

.page:nth-child(4) {
    animation: turn-page-4 390s infinite;
    z-index: 10;
}

.page:nth-child(5) {
    animation: turn-page-5 390s infinite;
    z-index: 9;
}

.page:nth-child(6) {
    animation: turn-page-6 390s infinite;
    z-index: 8;
}

.page:nth-child(7) {
    animation: turn-page-7 390s infinite;
    z-index: 7;
}

.page:nth-child(8) {
    animation: turn-page-8 390s infinite;
    z-index: 6;
}

.page:nth-child(9) {
    animation: turn-page-9 390s infinite;
    z-index: 5;
}

.page:nth-child(10) {
    animation: turn-page-10 390s infinite;
    z-index: 4;
}

.page:nth-child(11) {
    animation: turn-page-11 390s infinite;
    z-index: 3;
}

.page:nth-child(12) {
    animation: turn-page-12 390s infinite;
    z-index: 2;
}

.page:nth-child(13) {
    animation: turn-page-13 390s infinite;
    z-index: 1;
}

/* Keyframe animations for page turns - each page visible for 30s */
@keyframes turn-page-1 {
    0%, 7.69% { transform: rotateY(0deg); }
    15.38%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-2 {
    0%, 15.38% { transform: rotateY(0deg); }
    23.07%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-3 {
    0%, 23.07% { transform: rotateY(0deg); }
    30.76%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-4 {
    0%, 30.76% { transform: rotateY(0deg); }
    38.45%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-5 {
    0%, 38.45% { transform: rotateY(0deg); }
    46.14%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-6 {
    0%, 46.14% { transform: rotateY(0deg); }
    53.83%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-7 {
    0%, 53.83% { transform: rotateY(0deg); }
    61.52%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-8 {
    0%, 61.52% { transform: rotateY(0deg); }
    69.21%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-9 {
    0%, 69.21% { transform: rotateY(0deg); }
    76.90%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-10 {
    0%, 76.90% { transform: rotateY(0deg); }
    84.59%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-11 {
    0%, 84.59% { transform: rotateY(0deg); }
    92.28%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-12 {
    0%, 92.28% { transform: rotateY(0deg); }
    97%, 100% { transform: rotateY(-180deg); }
}

@keyframes turn-page-13 {
    0%, 97% { transform: rotateY(0deg); }
    99%, 100% { transform: rotateY(-180deg); }
}

/* Floating animation for the entire Bible */
@keyframes float-bible {
    0%, 100% { transform: rotateY(-15deg) rotateX(5deg) translateY(0); }
    50% { transform: rotateY(-15deg) rotateX(5deg) translateY(-10px); }
}

.bible {
    animation: float-bible 10s ease-in-out infinite;
}

/* Open and close Bible cover animation - 10 second cycle */
@keyframes open-close-bible {
    0% {
        transform: rotateY(0deg);
    }
    20% {
        transform: rotateY(-120deg);
    }
    80% {
        transform: rotateY(-120deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

/* Light rays effect */
.light-rays {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 30%,
        transparent 70%
    );
    animation: pulse-light 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 3;
}

@keyframes pulse-light {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

/* Responsive Design */
@media (min-width: 769px) {
    .hero-bible-content {
        max-width: 40%;
    }

    .bible {
        width: 55vw;
    }
}

@media (min-width: 1024px) {
    .hero-bible-content {
        max-width: 35%;
    }

    .bible {
        width: 50vw;
    }
}

@media (max-width: 768px) {
    .hero-bible {
        height: 400px;
        max-height: 400px;
    }

    .hero-bible-content {
        padding: 1rem 1.5rem;
        max-width: 45%;
        left: 2%;
        top: 0;
        bottom: auto;
        height: 100%;
        transform: none;
        text-align: left;
    }

    .hero-buttons {
        justify-content: flex-start;
        gap: 0.5rem;
    }

    .hero-bible-content h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .hero-bible-content p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .hero-buttons .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .bible {
        width: 90vw;
        height: 100%;
        margin: 0;
    }

    .bible-container {
        padding-right: 2%;
        justify-content: center;
    }

    .bible-cover::after {
        font-size: 4rem;
    }

    .page-content {
        padding: 1rem;
    }

    .page-content h4 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .page-content p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .page::after {
        font-size: 0.85rem;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .hero-bible {
        height: 400px;
        max-height: 400px;
    }

    .hero-bible-content {
        padding: 0.75rem 1rem;
        max-width: 40%;
        left: 1%;
        top: 0;
        bottom: auto;
        height: 100%;
        transform: none;
        text-align: left;
    }

    .hero-buttons {
        justify-content: flex-start;
        gap: 0.5rem;
    }

    .hero-bible-content h1 {
        font-size: 1.4rem;
        margin-bottom: 0.4rem;
    }

    .hero-bible-content p {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .hero-buttons .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }

    .bible {
        width: 95vw;
        height: 100%;
        margin: 0;
    }

    .bible-container {
        padding-right: 1%;
        justify-content: center;
    }

    .bible-cover::after {
        font-size: 3rem;
    }

    .hero-buttons {
        flex-direction: row;
        width: 100%;
        gap: 0.5rem;
    }

    .hero-buttons .btn {
        width: auto;
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }

    .page-content {
        padding: 0.75rem;
    }

    .page-content h4 {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    .page-content p {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .page::after {
        font-size: 0.7rem;
        line-height: 1.4;
    }
}
