/* FableFoolery - Magical CSS Styles */

/* CSS Variables for Theme Management */
:root {
    /* Dark theme (default) */
    --bg-primary: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --text-primary: #1e3a8a;
    --text-light: #ffffff;
    --text-secondary: #cbd5e1;
    --accent-blue: #60a5fa;
    --accent-light: rgba(30, 58, 138, 0.5);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-hover: rgba(255, 255, 255, 0.2);
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.3);
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    --bg-secondary: rgba(30, 58, 138, 0.95);
    --text-primary: #ffffff;
    --text-light: #1a1a2e;
    --text-secondary: #374151;
    --accent-blue: #60a5fa;
    --accent-light: rgba(96, 165, 250, 0.5);
    --card-bg: rgba(30, 58, 138, 0.1);
    --card-hover: rgba(255, 255, 255, 0.2);
    --shadow: rgba(30, 58, 138, 0.1);
    --shadow-strong: rgba(30, 58, 138, 0.3);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: var(--text-light);
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

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

/* Magical Header */
.magical-header {
    background: #153A50;
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 4px 20px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.magical-header .container {
    position: relative;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.site-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-shadow: 0 4px 15px var(--shadow);
    transition: transform 0.3s ease;
}

.site-logo:hover {
    transform: scale(1.05) rotate(5deg);
}

.site-logo-main {
    height: 100px;
    width: auto;
    max-width: 400px;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 15px var(--shadow));
}

.site-logo-main:hover {
    transform: scale(1.02);
}

.title-section {
    text-align: center;
}

.theme-toggle {
    position: absolute;
    top: 0;
    right: 20px;
    background: var(--accent-blue);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px var(--shadow);
    z-index: 101;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px var(--shadow-strong);
}

.theme-toggle .theme-icon {
    display: block;
    transition: transform 0.3s ease;
}

.site-title {
    font-size: 2.5rem;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px var(--shadow);
    animation: gentle-glow 3s ease-in-out infinite alternate;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

@keyframes gentle-glow {
    from { text-shadow: 2px 2px 4px var(--shadow); }
    to { text-shadow: 2px 2px 8px var(--accent-light); }
}

.site-tagline {
    text-align: center;
    color: #ffffffcf;
    font-style: italic;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.main-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: #ffffffcf;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    background: var(--card-hover);
    color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-strong);
}

/* Hero Section */
.hero-section {
    padding: 4rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 8px var(--shadow-strong);
    animation: float 6s ease-in-out infinite;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

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

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

.cta-button {
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px var(--shadow-strong);
    font-family: inherit;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow-strong);
    background: var(--card-hover);
    color: #ffffff;
}

/* Floating Elements */
.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floating-star,
.floating-moon,
.floating-book {
    position: absolute;
    font-size: 2rem;
    animation: float-around 15s linear infinite;
}

.floating-star {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-moon {
    top: 30%;
    right: 15%;
    animation-delay: -5s;
}

.floating-book {
    bottom: 30%;
    left: 20%;
    animation-delay: -10s;
}

@keyframes float-around {
    0% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(90deg); }
    50% { transform: translateY(0px) rotate(180deg); }
    75% { transform: translateY(-15px) rotate(270deg); }
    100% { transform: translateY(0px) rotate(360deg); }
}

/* Section Styles */
section {
    padding: 4rem 0;
}

.books-section,
.about-section {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
}

.stories-section {
    background: linear-gradient(45deg, rgba(30, 58, 138, 0.1), rgba(55, 65, 81, 0.1));
    display: none;
}

.section-title {
    font-size: 2.5rem;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    text-shadow: 2px 2px 4px var(--shadow);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.section-title::after {
    content: '✨';
    position: absolute;
    right: -2rem;
    top: 0;
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.section-description {
    text-align: center;
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.book-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
    border: 2px solid transparent;
}

.book-card:hover {
    transform: translateY(-10px);
    border-color: #bfdbfe;
    box-shadow: 0 15px 35px rgba(30, 58, 138, 0.3);
}

/* Book cover styles - placeholders can be replaced with actual book cover images */
.book-cover {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: book-hover 4s ease-in-out infinite;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* To replace with real images, use: <img src="imgs/book-cover.jpg" alt="Book Title" class="book-cover-img"> */
.book-cover-placeholder {
    width: 140px;
    height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.book-cover-placeholder:hover {
    transform: scale(1.05);
}

.book-title-on-cover {
    color: white;
    font-weight: bold;
    text-align: center;
    font-size: 0.9rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    padding: 0.5rem;
    line-height: 1.2;
}

.book-cover-thomlin {
    background: linear-gradient(135deg, #1e3a8a, #3730a3, #1e40af);
}

.book-cover-boar {
    background: linear-gradient(135deg, #7c2d12, #a16207, #dc2626);
}

.book-cover-scales {
    background: linear-gradient(135deg, #166534, #15803d, #059669);
}

.book-cover-img {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.book-cover-img:hover {
    transform: scale(1.05);
}

@keyframes book-hover {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(15deg); }
}

.book-card h3 {
    color: #1e3a8a;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.book-card p {
    color: #4b5563;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    text-align: justify;
    height: 14.0rem;
}

.book-btn {
    background: linear-gradient(45deg, #1e40af, #3730a3);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-bottom: 1.5rem;
}

.book-btn:hover {
    background: linear-gradient(45deg, #1d4ed8, #4338ca);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(30, 64, 175, 0.4);
}

/* Stories Section */
.story-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.story-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    border: 2px solid transparent;
}

.story-card:hover {
    transform: translateY(-5px);
    border-color: #bfdbfe;
    background: rgba(255, 255, 255, 0.95);
}

.story-card h3 {
    color: #1e3a8a;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.story-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.story-type {
    color: #1e40af;
    font-size: 0.9rem;
    font-weight: 500;
}

.read-story-btn {
    background: linear-gradient(45deg, #1e40af, #3730a3);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-family: inherit;
}

.read-story-btn:hover {
    background: linear-gradient(45deg, #1d4ed8, #4338ca);
    transform: translateY(-2px);
}

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

.about-text p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.social-links {
    margin-top: 2rem;
}

.social-link {
    display: inline-block;
    background: linear-gradient(45deg, #1e40af, #3730a3);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.social-link:hover {
    background: linear-gradient(45deg, #1d4ed8, #4338ca);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(30, 64, 175, 0.4);
}

/* Footer */
.magical-footer {
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer-magic {
    margin-top: 1rem;
}

.magic-sparkle {
    display: inline-block;
    margin: 0 0.5rem;
    animation: sparkle 2s ease-in-out infinite;
}

.magic-sparkle:nth-child(2) {
    animation-delay: 0.5s;
}

.magic-sparkle:nth-child(3) {
    animation-delay: 1s;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.5) rotate(180deg); opacity: 0.7; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        right: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .site-logo {
        width: 60px;
        height: 60px;
    }

    .site-logo-main {
        height: 80px;
        max-width: 300px;
    }

    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .site-title {
        font-size: 2rem;
    }
    
    .main-nav ul {
        gap: 1rem;
    }
    
    .books-grid,
    .story-showcase {
        grid-template-columns: 1fr;
    }
    
    .floating-elements {
        display: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        right: 10px;
    }

    .site-logo {
        width: 50px;
        height: 50px;
    }

    .site-logo-main {
        height: 60px;
        max-width: 250px;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .book-card,
    .story-card {
        padding: 1.5rem;
    }
}