:root {
    --bg-color: #e0e0e0;
    --card-bg-color: #303030;
    --header-card-bg-color: #f7f7f7;
    --text-color: #000000;
    --text-color-2: #ffffff;
    --accent-color: #008653;
    --accent-color-2: #00b46f;
    --medium-gray: #757575;
    --button-gray: #505050;
    --font-logo: 'knewave', cursive;
    --font-body: 'Roboto', sans-serif;
    --underline-color: #ffffff;
}

/* ----------------------------- Base & Navbar ----------------------------- */

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    max-width: 100%;
    overflow-x: hidden;
}

.font-container {
    font-size: 16px;
}

.page-container {
    max-width: clamp(320px, 1200px, 90vw);
    margin: 0 auto;
    box-sizing: border-box;
}

header {
    height: auto;
    min-height: 70px;
    background-color: var(--card-bg-color);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5vw;
    margin-bottom: 3em;
}

.logo {
    font-family: var(--font-logo);
    font-size: clamp(1.8em, 4vw, 2.5em);
    color: var(--accent-color-2);
    margin-right: 20px;
}

nav a, .nav-active {
    color: white;
    text-decoration: none;
    margin-left: clamp(15px, 3vw, 30px);
    font-size: clamp(1em, 2.5vw, 1.5em);
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--accent-color);
}

.nav-active {
    color: var(--accent-color-2); /* Highlight the active page link */
    cursor: default;
}

.chapter-title-card {
    background-color: var(--card-bg-color);
    padding: clamp(1em, 3vw, 2em) clamp(1.5em, 4vw, 2.6em);
    border-radius: 1.5em;
    margin-bottom: 3em;
    text-align: center;
}

.chapter-title-card h2 {
    margin: 0;
    font-size: clamp(1.5em, 4vw, 2.5em);
    color: var(--accent-color-2);
    font-weight: 500;
}

/* ----------------------------- Chapter Grid (New Styles) ----------------------------- */

.chapter-grid {
    display: grid;
    /* Creates a responsive grid that fills the space with columns between 260px and 1fr */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2em;
    padding-bottom: 6em; /* Space at the bottom of the page */
}

.chapter-card {
    background-color: var(--header-card-bg-color);
    color: var(--text-color);
    padding: 1.5em;
    border-radius: 1em;
    text-decoration: none;
    display: block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-left: 5px solid var(--accent-color);
}

.chapter-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-left-color: var(--accent-color-2);
}

.chapter-card h3 {
    margin: 0 0 0.25em 0;
    font-size: clamp(1.6em, 3vw, 2em);
    font-weight: 500;
    color: var(--accent-color);
    transition: color 0.3s ease;
}

.chapter-card:hover h3 {
    color: var(--accent-color-2);
}

.chapter-card p {
    margin: 0;
    font-size: clamp(1em, 2vw, 1.1em);
    color: var(--medium-gray);
    line-height: 1.4;
}


/* ----------------------------- Mobile Layout Adjustments ----------------------------- */

@media (max-width: 600px) {
    header {
        flex-direction: column;
        gap: 15px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    .logo {
        margin-right: 0;
    }
    nav {
        display: flex;
        justify-content: center;
        gap: 25px;
        width: 100%;
    }
    nav a, .nav-active {
        margin-left: 0;
    }

    .chapter-grid {
        grid-template-columns: 1fr; /* Stack cards vertically on small screens */
        gap: 1.5em;
    }
}