/* CSS Variables for theme management */
:root {
    --bg-dark: #0f0f23;
    --bg-card: #1a1a2e;
    --primary-text: #f0f0f5;
    --secondary-text: #b8b8cc;
    --accent-gold: #d4af37;
    --accent-deep-purple: #4b0082;
    --border-color: rgba(212, 175, 55, 0.2);
    --gradient-warm: linear-gradient(135deg, #4b0082, #8b008b, #d4af37);
    --gradient-cool: linear-gradient(135deg, #2c1810, #4a2c0b, #8b4513);
}

/* --- Preloader Styles --- */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease, visibility 1s ease; /* Slower fade out for preloader */
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.card-flipper {
    position: relative;
    width: 250px;
    height: 380px;
    perspective: 1000px;
}

.preloader-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    opacity: 0;
    animation: crossFade 4s linear forwards;
}

/* Stagger the animations to create the cross-fade effect */
.preloader-card:nth-child(2) { animation-delay: 2s; }
.preloader-card:nth-child(3) { animation-delay: 4s; }
.preloader-card:nth-child(4) { animation-delay: 6s; }

@keyframes crossFade {
    0%   { opacity: 0; transform: scale(0.95); }
    25%  { opacity: 1; transform: scale(1); }
    75%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.95); }
}

.gradient-warm {
    background: var(--gradient-warm);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-cool {
    background: var(--gradient-cool);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Base & Reset Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-dark);
    color: var(--primary-text);
    font-family: 'Poppins', serif;
    line-height: 1.7;
    overflow-x: hidden;
    touch-action: pan-y;
}

/* Ensure Swiper allows horizontal swiping */
.swiper-container {
    touch-action: pan-x;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

section {
    padding: 100px 0;
    position: relative;
    overflow: hidden;
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
    font-size: 3rem;
    font-family: 'Playfair Display', serif;
}

.section-subtitle {
    display: block;
    font-size: 1.1rem;
    color: var(--secondary-text);
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

/* Background Text Effect */
.background-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10vw;
    font-weight: 900;
    color: rgba(212, 175, 55, 0.03);
    z-index: -1;
    white-space: nowrap;
    user-select: none;
    font-family: 'Playfair Display', serif;
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 0;
    z-index: 1000;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.4s ease;
}

.navbar.navbar-hidden {
    transform: translateY(-100%);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-logo {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    text-decoration: none;
    color: var(--primary-text);
}

.nav-logo .accent {
    color: var(--accent-gold);
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 40px;
}

.nav-menu a {
    color: var(--primary-text);
    text-decoration: none;
    font-weight: 400;
    transition: all 0.3s ease;
    position: relative;
    padding: 5px 0;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background: var(--gradient-warm);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-menu a:hover {
    color: var(--accent-gold);
}

.nav-menu a:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    color: var(--primary-text);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(rgba(15,15,35,0.8), rgba(15,15,35,0.8)), url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><radialGradient id="a" cx="50%" cy="50%" r="50%"><stop offset="0%" style="stop-color:%234b0082;stop-opacity:0.1"/><stop offset="100%" style="stop-color:%238b008b;stop-opacity:0.05"/></radialGradient></defs><rect width="100" height="100" fill="url(%23a)"/></svg>');
}

.hero-content {
    max-width: 900px;
    z-index: 2;
}

.hero h1 {
    font-size: 4.5rem;
    line-height: 1.2;
    margin-bottom: 30px;
    font-family: 'Playfair Display', serif;
}

.hero .lead {
    font-size: 1.3rem;
    margin-bottom: 40px;
    color: var(--secondary-text);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button {
    display: inline-block;
    padding: 18px 40px;
    background: var(--gradient-warm);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(75, 0, 130, 0.3);
}

.cta-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(139, 0, 139, 0.4);
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.about-content h3 {
    font-size: 2.5rem;
    margin-bottom: 25px;
    color: var(--primary-text);
}

.about-content p {
    color: var(--secondary-text);
    line-height: 1.8;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.about-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.feature-item {
    background: var(--bg-card);
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.1), transparent);
    transition: left 0.5s;
}

.feature-item:hover::before {
    left: 100%;
}

.feature-item:hover {
    border-color: var(--accent-gold);
    transform: translateY(-5px);
}

.feature-item i {
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 15px;
    display: block;
}

/* Books Section */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 60px;
}

.book-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.4s ease;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 50px rgba(75, 0, 130, 0.4);
    border-color: var(--accent-gold);
}

.book-cover {
    width: 100%;
    height: 220px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/*
.book-cover::after block was here. It has been removed.
*/

.book-info {
    padding: 25px;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-title {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--primary-text);
    font-family: 'Playfair Display', serif;
}

.book-author {
    color: var(--accent-gold);
    font-style: italic;
    margin-bottom: 15px;
    font-family: 'Playfair Display', serif;
}

.book-description {
    color: var(--secondary-text);
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 0.9rem;
    flex-grow: 1;
}

.book-cta {
    display: inline-block;
    padding: 12px 30px;
    background: var(--gradient-warm);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border-radius: 25px;
    transition: all 0.3s ease;
    margin-top: auto;
}

.book-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(139, 0, 139, 0.3);
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    text-align: center;
}

.stat-item {
    background: var(--bg-card);
    padding: 40px 20px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: var(--accent-gold);
    transform: translateY(-5px);
}

.stat-item .number {
    font-size: 3rem;
    font-weight: 900;
    font-family: 'Playfair Display', serif;
    margin-bottom: 10px;
}

.stat-item p {
    font-size: 1rem;
    color: var(--secondary-text);
}

/* Testimonials Section */
.swiper-container {
    width: 100%;
    padding: 20px 0 50px;
}
.testimonial-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 15px;
    border-left: 4px solid var(--accent-gold);
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}
.testimonial-card p {
    font-style: italic;
    color: var(--secondary-text);
    margin-bottom: 20px;
    font-size: 1.1rem;
    line-height: 1.8;
}
.testimonial-author {
    font-weight: 600;
    color: var(--accent-gold);
}

/* CTA Section */
.cta-section {
    background: var(--bg-card);
    text-align: center;
    border-radius: 20px;
    margin: 0 20px;
    padding: 80px 40px;
}

.cta-section h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.cta-section p {
    color: var(--secondary-text);
    font-size: 1.2rem;
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Footer */
footer {
    background: var(--bg-card);
    padding: 60px 0 20px;
    text-align: center;
}
.footer-content h3 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--primary-text);
}
.footer-content p {
    color: var(--secondary-text);
    max-width: 600px;
    margin: 0 auto 30px;
    font-size: 1.1rem;
}
.footer-contact {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}
.footer-contact a {
    color: var(--secondary-text);
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-contact a:hover {
    color: var(--accent-gold);
}
.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}
.social-links a {
    color: var(--secondary-text);
    font-size: 1.5rem;
    transition: color 0.3s;
}
.social-links a:hover {
    color: var(--accent-gold);
}
.copyright {
    margin-top: 40px;
    font-size: 0.9rem;
    color: var(--secondary-text);
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 { font-size: 3rem; }
    .section-title { font-size: 2.2rem; }
    .nav-toggle { display: block; }
    
    .nav-menu {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--bg-dark);
        flex-direction: column;
        gap: 0;
    }

    .nav-menu.nav-active {
        display: flex;
    }

    .nav-menu li {
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu li:first-child {
        border-top: 1px solid var(--border-color);
    }

    .nav-menu a {
        display: block;
        padding: 20px;
        text-align: center;
    }
    
    .about-grid { grid-template-columns: 1fr; gap: 40px; }
    .books-grid { grid-template-columns: 1fr; }
    .cta-section { margin: 0; padding: 60px 20px; }
}