/* Global Reset & Base Styles */
body {
    font-family: 'Gill Sans', 'Gill Sans MT', 'Myriad Pro', 'DejaVu Sans Condensed', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: white;
    color: #352B2B;
    line-height: 1.6;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

body,
td,
th {
    font-family: 'Gill Sans', 'Gill Sans MT', 'Myriad Pro', 'DejaVu Sans Condensed', Helvetica, Arial, sans-serif;
    color: #352B2B;
}

/* Global Image Responsiveness */
img {
    max-width: 100%;
    height: auto;
    display: block;
    /* Removes bottom space */
}

/* Links */
a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    text-decoration: underline;
    color: #000;
}

/* Main Container - The "Paper" background */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    /* Important for responsive padding */
}

/* Header Section */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    /* Allows wrapping on huge zooms or tiny screens */
    margin-bottom: 20px;
}

.logo-section {
    flex: 1 1 600px;
    /* Grow, shrink, basis */
    max-width: 100%;
}

.nav-top {
    text-align: right;
    font-size: 11px;
    /* Matching original small size */
    padding-top: 10px;
    flex: 0 1 auto;
    padding-right: 20px;
    /* Added spacing from edge */
}

.nav-top a {
    display: block;
    margin: 5px 0;
    color: #333;
    font-weight: bold;
    text-transform: uppercase;
}

/* Main Content Title */
.main-title {
    font-size: 24px;
    text-align: center;
    font-weight: bold;
    color: #302626;
    margin: 20px 0;
    width: 100%;
    clear: both;
    word-wrap: break-word;
    /* Prevent long words form breaking layout */
}

/* Book Spread Layout - Replaces Table */
.book-spread {
    display: flex;
    flex-direction: row;
    width: 100%;
    border-collapse: collapse;
    /* Kept for feel, though generic to tables */
    margin-top: 20px;
}

.page {
    flex: 1;
    /* Each page takes 50% width */
    padding: 30px;
    vertical-align: top;
    /* Flex equivalent is align-items: stretch usually, but text aligns top */
    color: #302626;
    font-size: 16px;
    box-sizing: border-box;
}

.page-left {
    border-right: 2px solid #ddd;
    /* The book spine line */
}

.page-right {
    padding-left: 60px;
    /* Extra padding as per original design intention */
}

/* Typography & Content */
.page p {
    margin: 15px 0;
    line-height: 1.9;
}

.page ul {
    margin: 10px 0;
    padding-left: 20px;
}

.page li {
    margin: 8px 0;
}

.page strong,
.page b {
    font-weight: 600;
}

.page h2 {
    font-size: 22px;
    color: #302626;
    margin: 20px 0;
}

.page h3 {
    font-size: 18px;
    color: #302626;
    margin: 15px 0;
    font-weight: bold;
}

/* Images */
.img-center {
    margin: 0 auto;
}

/* Notes Box - Bottom area */
.notes-box {
    margin-top: 30px;
    padding: 20px;
    background-color: #fff;
    word-wrap: break-word;
}

/* Bottom Navigation */
.nav-bottom {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    border-top: 2px solid #ddd;
}

.btn-next {
    color: #333;
    text-decoration: none;
    padding: 10px 40px;
    border: 2px solid #333;
    border-radius: 5px;
    display: inline-block;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.btn-next:hover {
    background-color: #333;
    color: white;
    text-decoration: none;
}

/* =========================================
   RESPONSIVE DESIGN (Media Queries)
   ========================================= */

/* Tablet (Portrait) and Mobile */
@media (max-width: 768px) {

    /* Header Reflow */
    .header-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .logo-section {
        flex: 0 1 auto;
        /* Fix: Reset flex-basis so it doesn't take 600px height */
        margin-bottom: 10px;
    }

    .nav-top {
        width: 100%;
        text-align: center;
        margin-top: 15px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .nav-top a {
        display: inline-block;
        margin: 0;
        padding: 5px;
    }

    /* Stack Book Pages */
    .book-spread {
        flex-direction: column;
    }

    .page {
        width: 100%;
        padding: 20px;
    }

    .page-left {
        border-right: none;
        border-bottom: 2px solid #ddd;
        padding-bottom: 40px;
        margin-bottom: 20px;
    }

    .page-right {
        padding-left: 20px;
        /* Reset the extra desktop padding */
        padding-top: 0;
    }

    .main-title {
        font-size: 20px;
        padding: 0 10px;
    }
}

/* Small Mobile Phones */
@media (max-width: 480px) {
    .main-container {
        padding: 10px;
    }

    .logo-section img {
        width: 100%;
    }

    .main-title {
        font-size: 18px;
    }

    .page h2 {
        font-size: 20px;
    }

    .page {
        font-size: 15px;
        padding: 15px 5px;
    }

    .btn-next {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Poem Styling (from w9.html) */
.poem-line {
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 17px;
    font-weight: normal;
}

.stanza-break {
    height: 15px;
}