/* --- Global Reset & Font Setup --- */
* {
    box-sizing: border-box; /* Include padding and border in element's total width and height */
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px; /* Base font size for rem units */
    scroll-behavior: smooth; /* Smooth scrolling for internal links */
}

body {
    /* A clean, modern sans-serif font stack */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.7; /* Generous line spacing for readability */
    color: #343a40; /* Dark grey text, not quite black */
    background-color: #f8f9fa; /* Very light grey background */
    padding: 1rem 0; /* Add some space top/bottom */
}

/* --- Layout Container --- */
.container {
    max-width: 850px; /* Limits line length for readability */
    margin: 2rem auto; /* Center the container horizontally with top/bottom margin */
    padding: 2.5rem 3.5rem; /* Generous padding inside the container */
    background-color: #ffffff; /* White background for the content area */
    border-radius: 10px; /* Slightly rounded corners for a softer look */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07); /* Subtle shadow for depth */
    border: 1px solid #e9ecef; /* Very light border */
}

/* --- Typography --- */
header h1 {
    font-size: 2.6rem; /* Large main title */
    font-weight: 600; /* Semi-bold */
    color: #212529; /* Darker heading color */
    margin-bottom: 2rem;
    padding-bottom: 0.8rem;
    border-bottom: 3px solid #dee2e6; /* Slightly thicker separator line */
    text-align: center;
}

h2 { /* Section headings */
    font-size: 1.9rem;
    font-weight: 600;
    color: #343a40;
    margin-top: 3rem; /* More space above section headings */
    margin-bottom: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef; /* Lighter separator */
}

h3 { /* Subsection headings */
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057; /* Slightly lighter than h2 */
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h4 { /* Video titles */
    font-size: 1.15rem;
    font-weight: 600; /* Bold to stand out */
    color: #495057;
    margin-top: 1.8rem;
    margin-bottom: 0.6rem;
}

p {
    margin-bottom: 1.3rem; /* Consistent paragraph spacing */
}

strong, b {
    font-weight: 600; /* Ensure boldness */
    color: #212529; /* Match darker text */
}

em, i {
    font-style: italic;
    color: #495057; /* Slightly muted italic */
}

a { /* Style links if added later */
    color: #007bff; /* Standard bootstrap blue */
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: #0056b3; /* Darker blue on hover */
    text-decoration: underline;
}

ul, ol {
    margin-bottom: 1.3rem;
    padding-left: 2rem; /* Standard list indentation */
}

li {
    margin-bottom: 0.6rem; /* Space between list items */
}

/* --- MathJax & Equations --- */
/* Ensure block equations have good spacing and are scrollable if too wide */
mjx-container[display="true"] {
    display: block;
    margin-top: 1.8rem;
    margin-bottom: 1.8rem;
    padding: 0.5rem 0; /* Add some padding around math blocks */
    overflow-x: auto; /* Allow horizontal scrolling for wide equations */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* --- Video Styling --- */
video {
    display: block; /* Ensure it takes up its own line */
    max-width: 100%; /* Responsive width */
    height: auto; /* Maintain aspect ratio */
    margin: 0.8rem auto 1.5rem auto; /* Center with vertical space */
    border-radius: 8px; /* Rounded corners for videos */
    background-color: #e9ecef; /* Light background placeholder */
    border: 1px solid #dee2e6; /* Subtle border */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Very subtle shadow */
}

/* --- Subsections (div styling) --- */
.subsection {
    margin-bottom: 2.5rem; /* Space between subsections */
    padding-left: 1.5rem; /* Indent for visual structure */
    border-left: 4px solid #ced4da; /* Clearer left border */
    margin-left: 0.5rem; /* Add slight margin to align border nicely */
}

/* --- Footer --- */
footer {
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
    font-size: 0.9rem;
    color: #6c757d; /* Muted footer text */
}

/* --- Responsive Design Adjustments --- */
@media (max-width: 900px) {
    .container {
        padding: 2rem; /* Reduce padding on smaller screens */
        margin: 1.5rem auto;
    }
    html {
        font-size: 15px; /* Slightly smaller base font */
    }
    header h1 { font-size: 2.3rem; }
    h2 { font-size: 1.7rem; }
    h3 { font-size: 1.4rem; }
}

@media (max-width: 600px) {
     .container {
        padding: 1.5rem 1rem; /* Further reduce padding */
        margin: 1rem auto;
        border-radius: 5px; /* Less pronounced rounding */
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
     }
    html {
        font-size: 14px; /* Smaller font for small devices */
    }
     header h1 { font-size: 2rem; }
     h2 { font-size: 1.5rem; }
     h3 { font-size: 1.3rem; }
     .subsection {
         padding-left: 1rem;
         margin-left: 0; /* Remove margin on smallest screens */
         border-left-width: 3px;
     }
}
