/* Root Variables */
:root {
    --primary-color: #4338ca;
    --secondary-color: #f59e0b;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.loading-windmill {
    animation: pulse 2s infinite;
}

.loading-windmill .windmill-blades {
    animation: rotate 2s linear infinite;
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 1.2rem;
    animation: fadeInOut 2s infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: var(--transition);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-md);
}

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

.nav-logo {
    text-decoration: none;
    color: var(--primary-color);
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    margin: 3px 0;
    transition: var(--transition);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Hero Section */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.windmill-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.infinite-windmill {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    animation: fadeInUp 1s ease-out;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.cta-button {
    background: linear-gradient(135deg, var(--primary-color), #5b21b6);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Sections */
.section {
    padding: 5rem 2rem;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-dark);
    position: relative;
    display: inline-block;
    width: 100%;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

/* Characters Section */
.characters-section {
    background: var(--bg-white);
}

.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    animation: fadeIn 1s;
}

.character-card {
    background: var(--bg-light);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.character-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.character-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.character-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.character-role {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.character-description {
    color: var(--text-dark);
    line-height: 1.8;
}

/* Quotes Section */
.quotes-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.quotes-carousel {
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quote-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    animation: fadeIn 0.5s;
}

.quote-text {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-style: italic;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.quote-author {
    font-size: 1.2rem;
    opacity: 0.9;
}

.carousel-controls {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.carousel-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Reading Progress Section */
.reading-section {
    background: var(--bg-white);
}

.progress-container {
    margin-bottom: 3rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-light);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 50px;
    transition: width 0.5s ease;
    box-shadow: 0 2px 10px rgba(67, 56, 202, 0.3);
}

.progress-text {
    margin-top: 1rem;
    font-size: 1.2rem;
    color: var(--text-dark);
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.chapter-card {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.chapter-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.chapter-card.completed {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: white;
}

.chapter-card.current {
    border-color: var(--secondary-color);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.chapter-number {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.chapter-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.chapter-status {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Themes Section */
.themes-section {
    background: var(--bg-light);
}

.themes-visualization {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.theme-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.theme-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.theme-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.theme-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.theme-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.theme-description {
    color: var(--text-light);
    line-height: 1.8;
}

/* About Section */
.about-section {
    background: var(--bg-white);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-text {
    font-size: 1.2rem;
    color: var(--text-dark);
    line-height: 2;
    margin-bottom: 3rem;
}

.about-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--bg-light);
    border-radius: 15px;
    padding: 2rem;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.feature-card p {
    color: var(--text-light);
}

/* SVG Animations for Illustrations */
@keyframes breathe {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes particle {
    0% { opacity: 0; transform: translateY(0) scale(0); }
    50% { opacity: 1; transform: translateY(-20px) scale(1); }
    100% { opacity: 0; transform: translateY(-40px) scale(0.5); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes float-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes windmill-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes typewriter {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* SVG Element Styles */
.breathe {
    animation: breathe 4s ease-in-out infinite;
}

.particle {
    animation: particle 6s ease-in-out infinite;
}

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

.float-gentle {
    animation: float-gentle 4s ease-in-out infinite;
}

.twinkle {
    animation: twinkle 2s ease-in-out infinite;
}

.windmill-rotate {
    animation: windmill-rotate 10s linear infinite;
    transform-origin: center;
}

.typewriter {
    animation: typewriter 2s ease-out forwards;
}

/* Gallery Section */
.gallery-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    padding: 5rem 2rem;
}

.gallery-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 3rem;
    font-style: italic;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.gallery-item {
    position: relative;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    aspect-ratio: 4/3;
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 1.5rem 1rem 1rem;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.gallery-title {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.gallery-number {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    animation: fadeIn 0.3s;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    animation: zoomIn 0.3s;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 45px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.lightbox-close:hover {
    color: var(--secondary-color);
}

.lightbox-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1.2rem;
    text-align: center;
    padding: 1rem 2rem;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 3rem;
    background: rgba(0,0,0,0.5);
    border: none;
    padding: 1rem;
    cursor: pointer;
    transition: background 0.3s;
    border-radius: 5px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0,0,0,0.8);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.footer-subtitle {
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 2rem;
        box-shadow: var(--shadow-lg);
        transition: right 0.3s;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .hero-content {
        padding: 1.5rem;
    }
    
    .section {
        padding: 3rem 1rem;
    }
    
    .characters-grid,
    .themes-visualization {
        grid-template-columns: 1fr;
    }
    
    .chapters-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* PWA Install Button */
.install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 100;
    transition: var(--transition);
}

.install-button:hover {
    transform: scale(1.05);
}

.install-button.show {
    display: block;
    animation: slideInUp 0.5s;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .install-button {
        display: none;
    }
    
    .section {
        page-break-inside: avoid;
    }
}