/* General & Dark Theme */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #ccc;
    background-color: #ffffff;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: #61afef;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    color: #e5e5e5;
}

/* Layout */
.wrapper {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

.main-container {
    display: flex;
    padding: 0 0 0 0;
    flex-grow: 1; 
}

.main-content {
    flex: 1;
    max-width: 1280px;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    color: #333; /* Dark text for light background */
    padding: 0 0 0 16px;
    border-radius: 4px;
    font-family: Georgia, 'Times New Roman', Times, serif; /* New font for content */
}

.sidebar {
    flex-shrink: 0;
    flex-basis: 300px;
    background-color: #222;
    padding: 0 16px;
}

/* Header & Footer */
header {
    background-color: #111;
    border-bottom: 1px solid #333;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
}

/* Hamburger Toggle Button */
.sidebar-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.sidebar-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #ccc;
    margin: 5px 0;
}

header nav ul.main-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 16px;
}

header nav a {
    font-weight: bold;
}

.main-content footer {
    margin-top: auto;
    padding-top: 32px;
    text-align: center;
    opacity: 0.8; /* Increased opacity for better visibility on white */
}

/* Typography inside main content */
.main-content h1,
.main-content h2,
.main-content h3,
.main-content h4,
.main-content h5,
.main-content h6 {
    color: #111; /* Dark headings for light background */
}

.main-content a {
    color: #0056b3; /* Darker blue for links on light background */
}

/* Images and Figures in content */
.main-content figure {
    margin: 24px 0; /* Add some vertical space around figures */
}

.main-content figure img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 4px; /* Optional: adds slightly rounded corners to images */
}

/* Search */
.search-container {
    position: relative;
}

#search-input {
    padding: 8px;
    min-width: 250px;
    background-color: #333;
    border: 1px solid #555;
    color: #eee;
    border-radius: 4px;
}

#search-results {
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    background-color: #2a2a2a;
    border: 1px solid #555;
    border-top: none;
    z-index: 10;
    max-height: 400px;
    overflow-y: auto;
}
#search-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
#search-results a {
    display: block;
    padding: 12px 16px;
    font-weight: normal;
    color: #61afef; /* Ensure search result links are light */
}
#search-results a:hover {
    background-color: #61afef;
    color: #1a1a1a;
    text-decoration: none;
}

/* Sidebar Widgets */
.widget {
    margin-bottom: 32px;
}

.widget h3 {
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tag-cloud a {
    display: inline-block;
    padding: 4px 12px;
    margin: 4px;
    background-color: #333;
    color: #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}
.tag-cloud a:hover {
    background-color: #61afef;
    color: #1a1a1a;
    text-decoration: none;
}

/* === Responsive Styles === */

/* For tablets and smaller devices (up to 1100px wide) */
@media (max-width: 1100px) {
    .main-container {
        flex-direction: column;
    }

    .main-content {
        order: 1; /* Display main content first on mobile */
        max-width: none;
        padding: 16px;
    }

    .sidebar {
        display: none; /* Hide sidebar by default on smaller screens */
        order: 2; /* Display sidebar after main content */
        flex-basis: auto;
        padding: 16px;
    }

    body.sidebar-visible .sidebar {
        display: block; /* Show sidebar when toggled */
    }

    .sidebar-toggle {
        display: block; /* Show the hamburger button */
    }
}

/* For mobile phones (up to 768px wide) */
@media (max-width: 768px) {
    header nav {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .search-container {
        width: 100%;
    }

    #search-input {
        width: 100%;
        box-sizing: border-box;
    }
}

/* F011S001T004_AddCodeBlockStyling: Background and text color for code blocks */
.main-content pre {
    background-color: #f8f8f8; /* Light gray background for readability */
    color: #333; /* Dark text for contrast against light gray */
    padding: 16px; /* Add some padding around the code */
    border-radius: 4px; /* Slightly rounded corners */
    border: 1px solid #ddd; /* A subtle border */
    overflow-x: auto; /* Keep the scrollbar for super long lines or if wrapping is not enough */
}

/* If Hugo's syntax highlighter (Chroma) uses specific classes, you might need to target them too */
/* For example, if you're using Chroma, it might output a structure like <pre class="chroma"><code>...</code></pre> */
/* In that case, you might also want to add: */
.main-content pre.chroma {
    background-color: #f8f8f8;
    color: #333;
}

/* Ensure code inside pre blocks also inherits the color */
.main-content pre code {
    color: #333; /* Explicitly set code text color */
    /* No need for background-color here if it's set on pre */
}

/* F011S001T002_ApplyCSSWrappingRules: Ensure long text within code blocks wraps */
pre {
    white-space: pre-wrap; /* Allows text to wrap within the pre block */
    word-wrap: break-word; /* Ensures long words break to prevent overflow */
    word-break: break-all; /* Breaks words at any character for maximum wrapping */
    overflow-x: auto; /* Adds horizontal scrollbar if content still overflows (as a fallback) */
}

/* Apply similar wrapping rules to code tags within pre, if distinct styling is needed */
pre code {
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

/* Optionally, if you have inline code (single backticks) that overflows,
   though less common for long content, you can add: */
/* code {
    word-wrap: break-word;
    word-break: break-all;
} */