/* CSS Custom Properties for Theming */
:root {
    /* Light theme colors */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: white;
    --bg-tertiary: linear-gradient(135deg, #f8f9fa, #e9ecef);
    --bg-card: white;
    --bg-nav: rgba(255, 255, 255, 0.95);
    --bg-footer: #2c3e50;
    --bg-chapter-card: linear-gradient(135deg, #667eea, #764ba2);
    --bg-author-note: #f8f9fa;
    
    --text-primary: #2c3e50;
    --text-secondary: #34495e;
    --text-light: #e8f4f8;
    --text-muted: #95a5a6;
    --text-footer: #bdc3c7;
    --text-character-desc: #555;
    --text-author-note: #666;
    
    --accent-gold: #ffd700;
    --accent-purple: #667eea;
    --accent-red: #e74c3c;
    
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --border-light: #34495e;
    
    --transition: all 0.3s ease;
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: #0f1419;
    --bg-tertiary: linear-gradient(135deg, #1e2329, #16181e);
    --bg-card: #1e2329;
    --bg-nav: rgba(30, 35, 41, 0.95);
    --bg-footer: #0a0e13;
    --bg-chapter-card: linear-gradient(135deg, #2d3748, #1a202c);
    --bg-author-note: #2d3748;
    
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e0;
    --text-light: #a0aec0;
    --text-muted: #718096;
    --text-footer: #a0aec0;
    --text-character-desc: #cbd5e0;
    --text-author-note: #e2e8f0;
    
    --accent-gold: #ffd700;
    --accent-purple: #8b5cf6;
    --accent-red: #f56565;
    
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --border-light: #4a5568;
}

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

body {
    font-family: 'Crimson Text', serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    transition: var(--transition);
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Cinzel', serif;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
}

h2 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

h3 {
    font-size: 1.8rem;
    font-weight: 600;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
    text-align: center;
    color: white;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><radialGradient id="a"><stop offset="0%" stop-color="%23ffffff" stop-opacity="0.1"/><stop offset="100%" stop-color="%23ffffff" stop-opacity="0"/></radialGradient></defs><circle cx="100" cy="100" r="2" fill="url(%23a)"/><circle cx="300" cy="200" r="1.5" fill="url(%23a)"/><circle cx="500" cy="150" r="1" fill="url(%23a)"/><circle cx="700" cy="300" r="2.5" fill="url(%23a)"/><circle cx="200" cy="400" r="1" fill="url(%23a)"/><circle cx="800" cy="450" r="1.5" fill="url(%23a)"/><circle cx="400" cy="600" r="2" fill="url(%23a)"/><circle cx="900" cy="700" r="1" fill="url(%23a)"/></svg>') repeat;
    animation: twinkle 4s ease-in-out infinite alternate;
}

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

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 1200px;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4rem;
    align-items: center;
    width: 100%;
}

.hero-text {
    text-align: left;
}

.book-title {
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.title-main {
    display: block;
    font-size: 4rem;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.title-subtitle {
    display: block;
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text-light);
    font-style: italic;
}

.hero-tagline {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    color: var(--text-light);
    font-style: italic;
}

.coming-soon {
    position: relative;
    margin-bottom: 2rem;
}

.coming-soon-text {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 1rem 2rem;
    border: 2px solid #ffd700;
    border-radius: 30px;
    background: rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(10px);
    animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    100% { transform: scale(1.05); box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
}

.cta-button {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
    background: linear-gradient(45deg, #c0392b, #a93226);
}

/* Book Display */
.book-display {
    perspective: 1000px;
    margin: 2rem 0;
}

.book-cover {
    width: 300px;
    height: 450px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-15deg) rotateX(5deg);
    transition: transform 0.3s ease;
    margin: 0 auto;
}

.book-cover:hover {
    transform: rotateY(-10deg) rotateX(2deg) scale(1.05);
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 
        20px 20px 40px rgba(0, 0, 0, 0.3),
        -5px 0 20px rgba(0, 0, 0, 0.1);
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 8px;
    height: 100%;
    background: linear-gradient(to right, 
        rgba(0, 0, 0, 0.3) 0%, 
        rgba(0, 0, 0, 0.1) 50%, 
        rgba(255, 255, 255, 0.1) 100%);
    transform: rotateY(90deg);
    transform-origin: right;
    border-radius: 0 8px 8px 0;
}

.book-cover::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%, 
        rgba(0, 0, 0, 0.1) 100%);
    border-radius: 4px;
    pointer-events: none;
}

/* Floating Navigation */
.floating-nav {
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    z-index: 1000;
    background: var(--bg-nav);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1rem 0;
    box-shadow: 0 8px 32px var(--shadow-light);
    opacity: 0;
    transition: var(--transition);
}

.floating-nav.visible {
    opacity: 1;
}

.floating-nav ul {
    list-style: none;
}

.floating-nav li {
    margin: 0.5rem 0;
}

.floating-nav a {
    display: block;
    padding: 0.8rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border-radius: 15px;
    margin: 0 0.5rem;
}

.floating-nav a:hover {
    background: var(--accent-purple);
    color: white;
    transform: translateX(-5px);
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-light);
    border-radius: 15px;
    padding: 0.8rem 1.5rem;
    margin: 0 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    color: var(--text-secondary);
    font-weight: 600;
}

.theme-toggle:hover {
    background: var(--accent-purple);
    color: white;
    transform: translateX(-5px);
    border-color: var(--accent-purple);
}

/* Main sections */
main {
    background: var(--bg-secondary);
}

section {
    padding: 5rem 0;
}

.about-section {
    background: var(--bg-secondary);
}

.intro-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
}

.about-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

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

.feature {
    text-align: center;
    padding: 2rem;
    background: var(--bg-tertiary);
    border-radius: 15px;
    box-shadow: 0 5px 15px var(--shadow-light);
    transition: var(--transition);
}

.feature:hover {
    transform: translateY(-5px);
}

.feature h3 {
    color: var(--accent-purple);
    margin-bottom: 1rem;
}

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

.characters-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.character-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow-light);
    transition: var(--transition);
    text-align: center;
}

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

.character-avatar {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.character-title {
    color: #667eea;
    font-weight: 600;
    margin-bottom: 1rem;
    font-style: italic;
}

.character-description {
    margin-bottom: 1.5rem;
    color: var(--text-character-desc);
}

blockquote {
    font-style: italic;
    color: #7f8c8d;
    border-left: 3px solid #667eea;
    padding-left: 1rem;
    margin-top: 1rem;
}

/* Chapters Section */
.chapters-section {
    background: var(--bg-secondary);
}

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

.chapter-card {
    background: var(--bg-chapter-card);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.chapter-card:hover {
    transform: scale(1.02);
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

.chapter-card h3 {
    color: var(--accent-gold);
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.chapter-excerpt {
    font-style: italic;
    margin-bottom: 1rem;
    line-height: 1.6;
    position: relative;
    z-index: 2;
}

.chapter-status {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.available-link {
    background: var(--bg-primary);
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.available-link:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Justified text */
.justified-text p {
    text-align: justify;
}

/* Author Section */
.author-section {
    background: var(--bg-tertiary);
}

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

.author-info h3 {
    color: var(--accent-purple);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.author-bio {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    text-align: left;
}

.author-works {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    margin: 2rem 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.author-works h4 {
    color: #34495e;
    margin-bottom: 1rem;
}

.author-works ul {
    list-style: none;
    text-align: left;
}

.author-works li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.author-works li::before {
    content: '📚';
    position: absolute;
    left: 0;
}

.author-note {
    font-style: italic;
    text-align: left;
}

/* Newsletter Section */
.newsletter-section {
    background: var(--bg-primary);
    color: white;
    text-align: center;
}

.newsletter-content h2 {
    color: white;
    margin-bottom: 1rem;
}

.newsletter-form {
    display: flex;
    gap: 1rem;
    max-width: 500px;
    margin: 2rem auto;
    flex-wrap: wrap;
    justify-content: center;
}

.newsletter-form input {
    flex: 1;
    min-width: 250px;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
}

.newsletter-form button {
    padding: 1rem 2rem;
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.newsletter-form button:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.privacy-note {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1rem;
}

/* Footer */
footer {
    background: var(--bg-footer);
    color: white;
    padding: 3rem 0 1rem;
}

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

.footer-section h3 {
    color: var(--accent-gold);
    margin-bottom: 1rem;
}

.footer-section p {
    margin-bottom: 0.5rem;
    color: var(--text-footer);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .hero-text {
        text-align: center;
        order: 1;
    }
    
    .book-display {
        order: 2;
    }
    
    .book-cover {
        width: 200px;
        height: 300px;
        transform: rotateY(-10deg) rotateX(3deg);
    }
    
    .title-main {
        font-size: 2.5rem;
    }
    
    .title-subtitle {
        font-size: 1.3rem;
    }
    
    .floating-nav {
        display: none;
    }
    
    .newsletter-form {
        flex-direction: column;
        align-items: center;
    }
    
    .newsletter-form input,
    .newsletter-form button {
        width: 100%;
        max-width: 300px;
    }
    
    .characters-grid,
    .chapters-preview {
        grid-template-columns: 1fr;
    }
    
    section {
        padding: 3rem 0;
    }
}

@media (max-width: 480px) {
    .book-cover {
        width: 160px;
        height: 240px;
        transform: rotateY(-8deg) rotateX(2deg);
    }
    
    .title-main {
        font-size: 2rem;
    }
    
    .hero-tagline {
        font-size: 1.1rem;
    }
    
    .coming-soon-text {
        font-size: 1.2rem;
        padding: 0.8rem 1.5rem;
    }
    
    .cta-button {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }
}

/* Animation for elements coming into view */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Chapter Reading Page Styles */
.chapter-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.chapter-nav {
    margin-bottom: 2rem;
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.chapter-title-section {
    max-width: 800px;
    margin: 0 auto;
}

.chapter-title {
    font-size: 3rem;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.chapter-subtitle {
    font-size: 1.3rem;
    color: #e8f4f8;
    font-style: italic;
    margin-bottom: 2rem;
}

.chapter-heading {
    font-size: 2rem;
    color: #ffd700;
    margin-bottom: 1rem;
}

.chapter-byline {
    font-style: italic;
    color: #e8f4f8;
    font-size: 1.1rem;
}

.chapter-content {
    background: white;
    padding: 4rem 0;
}

.chapter-text {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
}

.chapter-text p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.chapter-text h3 {
    color: #667eea;
    font-size: 1.8rem;
    margin: 3rem 0 1.5rem 0;
    text-align: center;
}

.to-be-continued {
    text-align: center;
    font-size: 1.2rem;
    margin: 3rem 0;
    color: #667eea;
}

.author-note {
    background: var(--bg-author-note);
    border-left: 4px solid #667eea;
    padding: 2rem;
    margin: 3rem 0;
    border-radius: 0 10px 10px 0;
}

.author-note p {
    margin-bottom: 0;
    font-size: 0.95rem;
    color: var(--text-author-note);
}

.chapter-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 3rem auto 0;
    padding: 2rem 0;
    border-top: 1px solid #e9ecef;
}

.nav-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.nav-info {
    text-align: center;
    color: #666;
    font-style: italic;
}

.chapter-footer {
    background: #2c3e50;
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.chapter-footer p {
    color: #95a5a6;
    font-style: italic;
}

/* Mobile responsiveness for chapter page */
@media (max-width: 768px) {
    .chapter-title {
        font-size: 2rem;
    }
    
    .chapter-heading {
        font-size: 1.5rem;
    }
    
    .chapter-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .chapter-text {
        padding: 0 1rem;
    }
}

/* RSS Link Styling */
.rss-link {
    color: #ffd700 !important;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
}

.rss-link:hover {
    color: #ffed4e !important;
    transform: translateY(-2px);
    text-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}