/* ------------------------------------------------------
   GLOBAL PAGE TYPOGRAPHY
------------------------------------------------------- */
body {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    line-height: 1.8;
    color: #222;
    margin: 0;
    padding: 30px 10% 0 10%;
    /* top + side padding */
    background: #ffffff;
}

p {
    text-align: justify;
    text-justify: inter-word;
}

/* ------------------------------------------------------
   MAIN CHAPTER WRAPPER
------------------------------------------------------- */
.chapter-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 10% 50px 10%;
}

/* ------------------------------------------------------
   HEADINGS
------------------------------------------------------- */
h1,
h2 {
    text-align: center;
    font-weight: normal;
    margin: 0 0 20px 0;
}

/* ------------------------------------------------------
   IMAGES
------------------------------------------------------- */
img {
    display: block;
    margin: 25px auto;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* ------------------------------------------------------
   ORDERED + UNORDERED LISTS
------------------------------------------------------- */
ol,
ul {
    padding-left: 40px;
}

/* ------------------------------------------------------
   NAVIGATION LINKS
------------------------------------------------------- */
.nav-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0;
    width: 100%;
}

.nav-links a {
    flex: 1;
    text-decoration: none;
    color: #003366;
    font-size: 1.1rem;
}

.nav-links a:first-child {
    text-align: left;
}

.nav-links a:nth-child(2) {
    text-align: center;
}

.nav-links a:last-child {
    text-align: right;
}

.nav-links a:hover {
    text-decoration: underline;
}

/* ============================================================
   MOBILE OPTIMIZATION (TABLETS + PHONES)
==============================================================*/
@media (max-width: 900px) {
    body {
        padding: 20px 5%;
        font-size: 18px;
    }

    .chapter-wrapper {
        padding-left: 5%;
        padding-right: 5%;
    }
}

/* ============================================================
   SMALL SCREENS (PHONES)
==============================================================*/
@media (max-width: 768px) {

    /* Larger, more readable text */
    body,
    #content {
        font-size: 1.3rem;
        line-height: 1.9;
        padding: 20px !important;
    }

    /* Headings */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    /* Full-width images on small screens */
    img {
        width: 100% !important;
        max-width: 100% !important;
        margin: 1.2em 0 !important;
    }

    /* Table readability */
    table td,
    table th {
        font-size: 1.15rem;
        padding: 14px 8px;
    }

    /* Navigation: one single row on mobile (← Main →) */
    .nav-links {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 0;
        margin-top: 40px;
        margin-bottom: 20px;
    }

    .nav-links a {
        flex: 1;
        padding: 8px 0;
        font-size: 1.15rem;
        text-decoration: none;
        color: #003366;
    }

    /* Align each link properly */
    .nav-links a:first-child {
        text-align: left;
    }

    .nav-links a:nth-child(2) {
        text-align: center;
    }

    .nav-links a:last-child {
        text-align: right;
    }
}