:root {
    --bg-color: #f8f9fa;
    --text-color: #343a40;
    --heading-color: #212529;
    --link-color: #007bff;
    --header-bg: rgba(255, 255, 255, 0.9);
    --header-border: transparent;
    --header-scrolled-bg: #ffffff;
    --header-scrolled-border: #e9ecef;
    --card-bg: #ffffff;
    --card-border: #e9ecef;
    --footer-bg: #343a40;
    --footer-text: #f8f9fa;
    --highlight-bg: #e9ecef;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #121212;
        --text-color: #e0e0e0;
        --heading-color: #ffffff;
        --link-color: #4dabf7;
        --header-bg: rgba(30, 30, 30, 0.85);
        --header-border: transparent;
        --header-scrolled-bg: #1e1e1e;
        --header-scrolled-border: #333;
        --card-bg: #1e1e1e;
        --card-border: #333;
        --footer-bg: #1e1e1e;
        --footer-text: #e0e0e0;
        --highlight-bg: #2a2a2a;
    }

    header:not(.scrolled) .logo a,
    header:not(.scrolled) ul li a {
        color: #fff;
    }

    header.scrolled .logo a, 
    header.scrolled ul li a {
        color: var(--text-color);
    }

    header ul li a:hover {
        color: var(--link-color);
    }

    footer .thanks a {
        color: var(--link-color);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

header {
    background: var(--header-bg);
    padding: 1rem 0;
    border-bottom: 1px solid var(--header-border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: background-color 0.3s, border-bottom 0.3s, backdrop-filter 0.3s;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

header.scrolled {
    background: var(--header-scrolled-bg);
    border-bottom: 1px solid var(--header-scrolled-border);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

header .logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

header ul {
    list-style: none;
    display: flex;
}

header ul li {
    margin-left: 2rem;
}

header ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

header ul li a:hover {
    color: var(--link-color);
}


main section {
    padding: 5rem 2rem;
    max-width: 900px;
    margin: auto;
    text-align: center;
}

#hero {
    color: #fff;
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 2rem;
    position: relative;
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('background.webp');
    background-size: cover;
    background-position: center;
    margin: 0;
    max-width: none;
}

#hero h1 {
    font-size: 4.5rem;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.6);
}

#hero p {
    font-size: 1.4rem;
    margin-bottom: 2.5rem;
    color: #f0f0f0;
    max-width: 600px;
}

/* Hero layout with book cover */
.hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2.5rem;
    width: 100%;
    max-width: 1200px;
}

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

.book-cover {
    width: min(40vw, 520px);
    height: auto;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    transform: rotate(-2deg);
    will-change: transform;
}

.cta-button {
    background: var(--link-color);
    color: #fff;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: background-color 0.3s, transform 0.3s;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

.cta-button:hover {
    background-color: #0056b3;
    transform: translateY(-3px);
}

@media (prefers-color-scheme: dark) {
    .cta-button {
        box-shadow: 0 4px 20px rgba(77, 171, 247, 0.4);
    }

    .cta-button:hover {
        background-color: #2b95f1;
    }
}

#signup {
    padding-top: 5rem;
}

.signup-form {
    margin-top: 2rem;
    padding: 2.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    text-align: center;
}

.signup-form h2 {
    margin-bottom: 1rem;
}

h2 {
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    color: var(--heading-color);
}

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

.feature-item {
    background: var(--highlight-bg);
    padding: 2rem;
    border-radius: 8px;
}

.feature-item h3 {
    font-size: 1.5rem;
    color: var(--link-color);
    margin-bottom: 1rem;
}

#chapters .chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2.5rem;
    text-align: left;
    margin-top: 2rem;
}

#chapters h3 {
    font-size: 1.5rem;
    color: var(--link-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--link-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

#chapters ul {
    list-style: none;
    padding-left: 0;
}

#chapters ul li {
    margin-bottom: 0.75rem;
}

footer {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--footer-bg);
    color: var(--footer-text);
    transition: background-color 0.3s, color 0.3s;
}

footer .thanks {
    margin-bottom: 1rem;
}

footer .thanks a {
    color: var(--link-color);
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    header nav {
        flex-direction: column;
    }

    header ul {
        margin-top: 1rem;
        padding: 0;
    }

    #hero h1 {
        font-size: 3rem;
    }

    h2 {
        font-size: 2.2rem;
    }

    /* Stack hero content on mobile */
    .hero-inner {
        flex-direction: column-reverse;
        text-align: center;
    }

    .hero-content {
        text-align: center;
        align-items: center;
    }

    .book-cover {
        width: min(70vw, 420px);
        transform: none;
    }
}
