body {
    font-family: "Georgia", "Times New Roman", Times, serif;
    font-size: 24px;
    line-height: 1.6;
    margin: 0; /* Remove the old margin */
    padding: 0 1rem; /* Adds left and right padding on all screens */
    max-width: 800px; /* Limits width on larger screens */
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box; /* Ensures padding doesn't cause overflow */

    /* background cycle */
    background-image: 
        /*linear-gradient(#311d00de, #311d00de),  /* Dark green overlay */
	linear-gradient(rgba(49, 29, 0, 0.92), rgba(49, 29, 0, 0.92)),
        url('Aeneas_Flight_from_Troy_by_Federico_Barocci.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;  /* Keeps image fixed while scrolling */
    background-repeat: no-repeat;
    color: white;  /* Makes all text white */
    min-height: 100vh;  /* Ensures body covers full viewport */
}

/* Ensure links are visible on the dark background */
a {
    color: #aaffaa; /* Light green for links */
    text-decoration: underline;
}

a:hover {
    color: #ffffff;
}

/* Extra comfort on very small phones */
@media (max-width: 480px) {
    body {
        padding: 0 1.25rem; /* Slightly more breathing room */
    }
}

/* Ensure table and other elements respect the body padding */
table, p, h1, header {
    width: 100%;
    box-sizing: border-box;
}

h1 {
    font-size: 2rem;
    margin: 2rem 0 1rem;
}

p {
    margin: 1rem 0;
}

/* Header and nav styling (optional, keeps it clean) */
header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.brand {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: inherit;
}

nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

nav a {
    text-decoration: none;
}

nav a[aria-current="page"] {
    font-weight: bold;
    color: inherit;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 1.5rem;
}

/* Normal table on larger screens */
th, td {
    padding: 1rem;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}

thead th {
    font-weight: 600;
}

/* Stacked layout on small screens */
@media (max-width: 640px) {
    thead {
        display: none; /* Hide header row on mobile */
    }

    tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
        background: #fcfcfc;
	background-color: rgba(0, 0, 0, 0.4);  /* Slightly darker card background */
    }

    td {
        display: block;
        width: 100%;
	padding: 0.75rem 1.5rem 0.75rem 1rem;
        border: none;
        border-bottom: 1px solid #eee;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        box-sizing: border-box;   /* Important: ensures padding doesn't cause overflow */
    }

    /* Ensure the label doesn't cause issues */
    td[data-label]::before {
        content: attr(data-label) ": ";
        font-weight: bold;
        display: block;
        margin-bottom: 0.25rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    td:last-child {
        border-bottom: none;
    }
    
    /* Add labels using data attributes (see HTML change below) */
    td[data-label]::before {
        content: attr(data-label) ": ";
        font-weight: bold;
        display: block;
        margin-bottom: 0.25rem;
    }
    
    table.intermediate-text-problems td:first-child::before {
        content: "Problem: ";
    }
    
    table.intermediate-text-problems td:last-child::before {
        content: "Solution: ";
    }
}

.footnotes {
    font-size: 18px;
}
