/* Global Resets */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll */
    border: none; /* Ensure no default borders */
    outline: none; /* Ensure no default outlines */
}

:root {
    --text-color: #333;
    --background-color: #ffffff;
    --container-bg: #fff;
    --link-color: #365c7c;
    --header-bg: #365c7c;
    --header-text-color: white;
    --search-input-bg: #3a576e;
    --search-input-border: #4a657c;
    --post-card-bg: #fff;
    --post-card-shadow: rgba(0,0,0,0.1);
    --post-category-color: #666;
    --post-description-color: #555;
    --post-meta-color: #777;
    --tag-bg: #f0f0f0;
    --tag-text: #555;
    --footer-color: #777;
    --section-title-color: #333;
    --section-subtitle-color: #555;
    --mobile-menu-bg: #365c7c;
    --mobile-menu-border: rgba(255,255,255,0.2);
}

body.dark-mode {
    --text-color: #f0f0f0;
    --background-color: #282828;
    --container-bg: #282828;
    --link-color: #365c7c;
    --header-bg: #365c7c; /* Keep original header color in dark mode */
    --header-text-color: #f0f0f0;
    --search-input-bg: #3a3a3a;
    --search-input-border: #555;
    --post-card-bg: #282828;
    --post-card-shadow: rgba(255,255,255,0.1);
    --post-category-color: #b0b0b0;
    --post-description-color: #ccc;
    --post-meta-color: #b0b0b0;
    --tag-bg: #555;
    --tag-text: #f0f0f0;
    --footer-color: #b0b0b0;
    --section-title-color: #f0f0f0;
    --section-subtitle-color: #f0f0f0;
    --mobile-menu-bg: #365c7c; /* Keep original mobile menu background color */
    --mobile-menu-border: rgba(255,255,255,0.2);
}

/* Dark mode specific figure styles */
body.dark-mode .post-body-content figure img {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .post-body-content figure:hover img {
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5), 0 6px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .post-body-content figcaption {
    color: #9ca3af;
}

body.dark-mode .post-body-content figcaption a {
    color: #9ca3af;
}

body.dark-mode .post-body-content figcaption a:hover {
    color: var(--link-color);
    border-bottom-color: var(--link-color);
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-size: 1.1em;
    line-height: 1.7;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.no-scroll {
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: auto;
    padding: 30px;
    box-sizing: border-box;
    background: var(--container-bg);
    border-radius: 0px;
    box-shadow: none;
    border: none;
    outline: none;
    transition: background-color 0.3s ease;
}

h1, h2, h3 {
    color: var(--text-color);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-weight: 700;
    transition: color 0.3s ease;
}

a { 
    color: var(--link-color); 
    text-decoration: none; 
    transition: color 0.3s ease; 
}

a:hover { 
    text-decoration: underline; 
}

.logo h1 a {
    color: var(--header-text-color) !important; /* Ensure logo title is white */
}

/* Additional specificity for logo title */
.main-header .logo h1 a {
    color: white !important;
    text-decoration: none !important;
}

/* Main Header Layout - Mobile First */
.main-header {
    background-color: var(--header-bg);
    color: var(--header-text-color);
    width: 100%;
    box-sizing: border-box;
    border: none;
    outline: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.header-content {
    max-width: 1400px; /* Match container width */
    margin: auto;
    padding: 15px 30px; /* Match container padding */
    display: flex;
    flex-direction: column; /* Default to column for mobile */
    justify-content: center; /* Center items */
    align-items: center; /* Center align items */
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.top-bar .logo h1 {
    margin: 0;
    font-size: 2.5em;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-weight: bold;
}

.top-bar .logo a {
    color: var(--header-text-color);
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px; /* Space between elements in header-right */
}

/* Search Form */
.search-form {
    display: flex;
    align-items: center;
    background-color: var(--search-input-bg);
    border: 1px solid var(--search-input-border);
    border-radius: 20px; /* Rounded corners for search bar */
    padding: 5px 10px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.search-form input[type="text"] {
    background: transparent;
    border: none;
    color: var(--header-text-color);
    padding: 5px;
    font-size: 0.9em;
    outline: none;
    width: 150px; /* Default width */
    transition: width 0.3s ease;
}

.search-form input[type="text"]::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-form button {
    background: transparent;
    border: none;
    color: var(--header-text-color);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

.search-form button svg {
    width: 20px;
    height: 20px;
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--header-text-color);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.dark-mode-toggle:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

/* Navigation */
.main-nav {
    margin-top: 15px;
    width: 100%;
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.main-nav li {
    margin: 5px 10px;
}

.main-nav a {
    text-decoration: none;
    color: var(--header-text-color);
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-size: 1em;
}

.main-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Mobile Navigation */
.mobile-nav-toggle {
    display: block;
    background: transparent;
    border: none;
    color: var(--header-text-color);
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    height: 100vh;
    background-color: var(--mobile-menu-bg);
    z-index: 1000;
    transition: right 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    border-left: 1px solid var(--mobile-menu-border);
}

.mobile-nav-overlay.active {
    right: 0;
}

.mobile-nav-close {
    background: transparent;
    border: none;
    color: var(--header-text-color);
    font-size: 2em;
    cursor: pointer;
    float: right;
    margin-bottom: 20px;
}

.mobile-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav li {
    margin-bottom: 15px;
}

.mobile-nav a {
    color: var(--header-text-color);
    text-decoration: none;
    font-size: 1.2em;
    font-weight: bold;
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--mobile-menu-border);
}

/* Post Content Styles - Mobile First */
.post-body-content {
    font-size: 1.15em;
    line-height: 1.8;
    color: var(--text-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: color 0.3s ease;
}

.post-body-content p {
    margin-bottom: 1.2em;
}

/* Desktop heading hierarchy for post content */
.post-body-content h1 {
    font-size: 2.5em;
    line-height: 1.2;
    margin: 1.8em 0 1em 0;
    font-weight: 700;
}

.post-body-content h2 {
    font-size: 2em;
    line-height: 1.3;
    margin: 1.6em 0 0.8em 0;
    font-weight: 600;
}

.post-body-content h3 {
    font-size: 1.7em;
    line-height: 1.3;
    margin: 1.4em 0 0.7em 0;
    font-weight: 600;
}

.post-body-content h4 {
    font-size: 1.4em;
    line-height: 1.4;
    margin: 1.3em 0 0.6em 0;
    font-weight: 600;
}

.post-body-content h5 {
    font-size: 1.2em;
    line-height: 1.4;
    margin: 1.2em 0 0.5em 0;
    font-weight: 600;
}

.post-body-content h6 {
    font-size: 1.1em;
    line-height: 1.4;
    margin: 1.1em 0 0.5em 0;
    font-weight: 600;
}

.post-body-content img {
    max-width: 100% !important; /* Responsive: fit within container */
    width: auto !important; /* Override any inline width attributes */
    height: auto !important; /* Override any inline height attributes */
    display: block;
    margin: 1.2em auto;
}

/* Medium-style figure and image styling for blog posts */
.post-body-content figure {
    margin: 3em auto 3.5em;
    padding: 0;
    text-align: center;
    max-width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
}

.post-body-content figure img {
    margin: 0 auto;
    max-width: 100% !important; /* Responsive: fit within container */
    width: auto !important; /* Override any inline width attributes */
    height: auto !important; /* Override any inline height attributes */
    object-fit: contain; /* Preserve aspect ratio without cropping */
    border-radius: 0;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-body-content figure:hover img {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2), 0 6px 12px rgba(0, 0, 0, 0.15);
}

.post-body-content figcaption {
    margin-top: 1.5em;
    padding: 0 2em;
    font-size: 0.875rem;
    font-style: italic;
    color: #6b7280;
    line-height: 1.6;
    text-align: center;
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 0.01em;
}

.post-body-content figcaption a {
    color: #6b7280;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.post-body-content figcaption a:hover {
    color: var(--link-color);
    border-bottom-color: var(--link-color);
}

.post-detail-container {
    max-width: 728px;
    margin: 20px auto;
    padding: 0 15px;
}

.post-title-detail {
    font-size: 2.5em;
    line-height: 1.2;
    margin-bottom: 0.5em;
}

.post-description-detail {
    font-size: 1.3em;
    color: var(--post-description-color);
    margin-bottom: 1em;
}

.post-meta {
    font-size: 0.9em;
    color: var(--post-meta-color);
    margin-bottom: 1.5em;
}

/* Post Grid */
.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 30px;
}

.post-card {
    background-color: var(--post-card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--post-card-shadow);
    overflow: hidden;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.post-card h3 {
    font-size: 1.5em;
    padding: 6px 12px; /* Fixed pixel padding for consistent alignment */
    margin: 0;
}

.post-card .post-description {
    font-size: 1em;
    color: var(--post-description-color);
    padding: 6px 12px; /* Same pixel padding as title */
    margin: 0;
}

.post-category,
.post-meta-info {
    padding: 6px 12px; /* Same pixel padding as other post elements */
}

/* Post card image styles */
.post-card .post-image-placeholder {
    width: 100%;
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-card .post-image-placeholder img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* Medium-style Code Blocks */
.codehilite {
    background-color: #f3f4f6;
    padding: 20px 24px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 2em 0;
    border: 1px solid #e1e4e8;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-size: 0.95em !important;
    line-height: 1.6;
    color: #24292f;
    position: relative;
    box-shadow: none;
    letter-spacing: 0;
}

/* Override MarkdownX styles specifically */
.markdownx .markdownx-preview code,
.markdownx .markdownx-preview pre,
.markdownx .markdownx-preview .codehilite {
    font-size: 0.95em !important;
}

.markdownx .markdownx-preview .codehilite code,
.markdownx .markdownx-preview .codehilite pre {
    font-size: 0.95em !important;
}

/* Override MarkdownX image styles */
.markdownx .markdownx-preview img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* Syntax highlighting for code blocks */
.codehilite .k { color: #d73a49; } /* Keywords */
.codehilite .kd { color: #d73a49; } /* Keyword declarations */
.codehilite .kn { color: #d73a49; } /* Keyword namespace */
.codehilite .kp { color: #d73a49; } /* Keyword pseudo */
.codehilite .kr { color: #d73a49; } /* Keyword reserved */
.codehilite .kt { color: #d73a49; } /* Keyword type */
.codehilite .s { color: #032f62; } /* Strings */
.codehilite .s1 { color: #032f62; } /* String single */
.codehilite .s2 { color: #032f62; } /* String double */
.codehilite .sb { color: #032f62; } /* String backtick */
.codehilite .sc { color: #032f62; } /* String char */
.codehilite .sd { color: #032f62; } /* String doc */
.codehilite .se { color: #032f62; } /* String escape */
.codehilite .sh { color: #032f62; } /* String heredoc */
.codehilite .si { color: #032f62; } /* String interpol */
.codehilite .sx { color: #032f62; } /* String other */
.codehilite .sr { color: #032f62; } /* String regex */
.codehilite .ss { color: #032f62; } /* String symbol */
.codehilite .c { color: #6a737d; font-style: italic; } /* Comments */
.codehilite .c1 { color: #6a737d; font-style: italic; } /* Comment single */
.codehilite .cm { color: #6a737d; font-style: italic; } /* Comment multiline */
.codehilite .cp { color: #6a737d; font-style: italic; } /* Comment preproc */
.codehilite .cs { color: #6a737d; font-style: italic; } /* Comment special */
.codehilite .m { color: #005cc5; } /* Numbers */
.codehilite .mi { color: #005cc5; } /* Number integer */
.codehilite .mf { color: #005cc5; } /* Number float */
.codehilite .mh { color: #005cc5; } /* Number hex */
.codehilite .mo { color: #005cc5; } /* Number octal */
.codehilite .n { color: #24292f; } /* Names */
.codehilite .na { color: #6f42c1; } /* Name attribute */
.codehilite .nb { color: #005cc5; } /* Name builtin */
.codehilite .nc { color: #6f42c1; } /* Name class */
.codehilite .nd { color: #6f42c1; } /* Name decorator */
.codehilite .ne { color: #d73a49; } /* Name exception */
.codehilite .nf { color: #6f42c1; } /* Name function */
.codehilite .ni { color: #24292f; } /* Name entity */
.codehilite .nl { color: #24292f; } /* Name label */
.codehilite .nn { color: #24292f; } /* Name namespace */
.codehilite .no { color: #005cc5; } /* Name constant */
.codehilite .nt { color: #22863a; } /* Name tag */
.codehilite .nv { color: #e36209; } /* Name variable */
.codehilite .nx { color: #6f42c1; } /* Name other */
.codehilite .o { color: #d73a49; } /* Operators */
.codehilite .ow { color: #d73a49; } /* Operator word */
.codehilite .p { color: #24292f; } /* Punctuation */
.codehilite .py { color: #24292f; } /* Property */
.codehilite .w { color: #24292f; } /* Whitespace */

.codehilite pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    white-space: pre;
    word-wrap: normal;
}

/* Fallback styles for code blocks without .codehilite class */
pre {
    background-color: #f3f4f6;
    padding: 20px 24px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 2em 0;
    border: 1px solid #e1e4e8;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-size: 0.95em !important;
    line-height: 1.6;
    color: #24292f;
    box-shadow: none;
    letter-spacing: 0;
    white-space: pre;
    word-wrap: normal;
}

/* Medium-style inline code */
code {
    background-color: #f3f4f6;
    color: #e11d48;
    padding: 0.125em 0.375em;
    border-radius: 4px;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-size: 0.875em;
    border: none;
    letter-spacing: 0;
    font-weight: 500;
}

/* Dark mode code styles */
body.dark-mode .codehilite {
    background-color: #161b22;
    color: #e6edf3;
    border-color: #30363d;
}

body.dark-mode pre {
    background-color: #161b22;
    color: #e6edf3;
    border-color: #30363d;
}

body.dark-mode code {
    background-color: #262c36;
    color: #f97316;
}

/* Dark mode syntax highlighting */
body.dark-mode .codehilite .k { color: #ff7b72; } /* Keywords */
body.dark-mode .codehilite .kd { color: #ff7b72; }
body.dark-mode .codehilite .kn { color: #ff7b72; }
body.dark-mode .codehilite .kp { color: #ff7b72; }
body.dark-mode .codehilite .kr { color: #ff7b72; }
body.dark-mode .codehilite .kt { color: #ff7b72; }
body.dark-mode .codehilite .s { color: #a5d6ff; } /* Strings */
body.dark-mode .codehilite .s1 { color: #a5d6ff; }
body.dark-mode .codehilite .s2 { color: #a5d6ff; }
body.dark-mode .codehilite .sb { color: #a5d6ff; }
body.dark-mode .codehilite .sc { color: #a5d6ff; }
body.dark-mode .codehilite .sd { color: #a5d6ff; }
body.dark-mode .codehilite .se { color: #a5d6ff; }
body.dark-mode .codehilite .sh { color: #a5d6ff; }
body.dark-mode .codehilite .si { color: #a5d6ff; }
body.dark-mode .codehilite .sx { color: #a5d6ff; }
body.dark-mode .codehilite .sr { color: #a5d6ff; }
body.dark-mode .codehilite .ss { color: #a5d6ff; }
body.dark-mode .codehilite .c { color: #8b949e; font-style: italic; } /* Comments */
body.dark-mode .codehilite .c1 { color: #8b949e; font-style: italic; }
body.dark-mode .codehilite .cm { color: #8b949e; font-style: italic; }
body.dark-mode .codehilite .cp { color: #8b949e; font-style: italic; }
body.dark-mode .codehilite .cs { color: #8b949e; font-style: italic; }
body.dark-mode .codehilite .m { color: #79c0ff; } /* Numbers */
body.dark-mode .codehilite .mi { color: #79c0ff; }
body.dark-mode .codehilite .mf { color: #79c0ff; }
body.dark-mode .codehilite .mh { color: #79c0ff; }
body.dark-mode .codehilite .mo { color: #79c0ff; }
body.dark-mode .codehilite .n { color: #e6edf3; } /* Names */
body.dark-mode .codehilite .na { color: #d2a8ff; } /* Name attribute */
body.dark-mode .codehilite .nb { color: #79c0ff; } /* Name builtin */
body.dark-mode .codehilite .nc { color: #d2a8ff; } /* Name class */
body.dark-mode .codehilite .nd { color: #d2a8ff; } /* Name decorator */
body.dark-mode .codehilite .ne { color: #ff7b72; } /* Name exception */
body.dark-mode .codehilite .nf { color: #d2a8ff; } /* Name function */
body.dark-mode .codehilite .ni { color: #e6edf3; } /* Name entity */
body.dark-mode .codehilite .nl { color: #e6edf3; } /* Name label */
body.dark-mode .codehilite .nn { color: #e6edf3; } /* Name namespace */
body.dark-mode .codehilite .no { color: #79c0ff; } /* Name constant */
body.dark-mode .codehilite .nt { color: #7ee787; } /* Name tag */
body.dark-mode .codehilite .nv { color: #ffa657; } /* Name variable */
body.dark-mode .codehilite .nx { color: #d2a8ff; } /* Name other */
body.dark-mode .codehilite .o { color: #ff7b72; } /* Operators */
body.dark-mode .codehilite .ow { color: #ff7b72; } /* Operator word */
body.dark-mode .codehilite .p { color: #e6edf3; } /* Punctuation */
body.dark-mode .codehilite .py { color: #e6edf3; } /* Property */
body.dark-mode .codehilite .w { color: #e6edf3; } /* Whitespace */

/* Related Posts Section */
.related-posts-section {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.related-posts-section h2 {
    font-size: 2.8em;
    font-weight: bold;
    margin-bottom: 30px;
    text-align: left;
    color: var(--section-title-color);
}





.related-post-card {
    background-color: var(--post-card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--post-card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.related-post-image-placeholder {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.related-post-image-placeholder img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border: none;
}

.related-post-category,
.related-post-card h3,
.related-post-description,
.related-post-meta-info {
    padding: 0.25em 0.5em;
}

/* Author Section */
.author-logo {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    margin-right: 5px;
}

.author-description, .author-description * {
    font-size: 1em;
    line-height: 1.7;
}

.post-author, .post-author-detail, .related-post-author {
    padding: 0; /* Remove padding since .post-meta-info container already has padding */
}

/* Mobile: Single column */
.related-posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

/* Tablet/Desktop: Two columns */
@media (min-width: 768px) {
    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}.author-section {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.author-section h2 {
    font-size: 2.8em;
    font-weight: bold;
    margin-bottom: 30px;
    text-align: left;
    color: var(--section-title-color);
}

/* Footer */
.footer {
    margin-top: 60px;
    padding: 30px 0;
    border-top: 1px solid #eee;
    text-align: center;
    color: var(--footer-color);
}

/* Syntax highlighting styles removed - plain text code blocks */

/* Mobile Styles - Small screens */
@media (max-width: 767px) {
    body {
        font-size: 1em;
    }

    .container {
        padding: 20px 15px;
    }

    .top-bar .logo h1 {
        font-size: 2.2em;
    }

    .main-nav {
        display: none; /* Hide main nav on mobile, use mobile nav instead */
    }

    .mobile-nav-toggle {
        display: block;
    }

    .search-form input[type="text"] {
        width: 120px;
        font-size: 0.95em;
        padding: 4px;
    }

    .mobile-nav-overlay.active {
        width: 300px;
    }

    .mobile-nav a {
        font-size: 1.5em;
        padding: 0 10px;
    }

    .post-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .post-card h3 {
        font-size: 2em;
        padding: 6px 12px; /* Same pixel padding as desktop */
    }

    .post-card .post-description {
        font-size: 1.3em;
        padding: 6px 12px; /* Same pixel padding as desktop */
    }

    /* Mobile post card image styles */
    .post-card .post-image-placeholder {
        height: 180px; /* Slightly smaller on mobile */
    }

    .post-card .post-image-placeholder img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }

    .post-title-detail {
        font-size: 3.2em;
        line-height: 1.2;
    }

    .post-description-detail {
        font-size: 1.6em;
    }

    .post-detail-container {
        font-size: 1em !important;
    }

    .post-body-content {
        font-size: 1.05em !important; /* Medium.com-style article font size for mobile */
        line-height: 1.7 !important;
    }

    .post-body-content *, .post-body-content {
        font-size: 1.05em !important;
        line-height: 1.7 !important;
    }

    /* Mobile heading hierarchy for post content */
    .post-body-content h1 {
        font-size: 2.2em !important;
        line-height: 1.3 !important;
        margin: 1.5em 0 0.8em 0;
        font-weight: 700;
    }

    .post-body-content h2 {
        font-size: 1.8em !important;
        line-height: 1.4 !important;
        margin: 1.3em 0 0.7em 0;
        font-weight: 600;
    }

    .post-body-content h3 {
        font-size: 1.5em !important;
        line-height: 1.4 !important;
        margin: 1.2em 0 0.6em 0;
        font-weight: 600;
    }

    .post-body-content h4 {
        font-size: 1.3em !important;
        line-height: 1.4 !important;
        margin: 1.1em 0 0.5em 0;
        font-weight: 600;
    }

    .post-body-content h5 {
        font-size: 1.15em !important;
        line-height: 1.4 !important;
        margin: 1em 0 0.5em 0;
        font-weight: 600;
    }

    .post-body-content h6 {
        font-size: 1.05em !important;
        line-height: 1.4 !important;
        margin: 1em 0 0.5em 0;
        font-weight: 600;
    }

    .author-description, .author-description * {
        font-size: 1em !important;
        line-height: 1.7 !important;
    }

    /* Mobile code blocks now match desktop styling */
    /* Removed mobile-specific overrides to maintain consistency */
    
    /* Prevent inline code styling inside code blocks on mobile */
    .codehilite code {
        background: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        color: inherit !important;
        font-weight: inherit !important;
    }
    
    /* Mobile inline code */
    code {
        font-size: 0.95em !important;
        padding: 0.1em 0.25em !important;
        border-radius: 0 !important;
        letter-spacing: 0.1px !important;
    }
    
    /* Mobile MarkdownX overrides with higher specificity */
    .markdownx .markdownx-preview code,
    .markdownx .markdownx-preview pre,
    .markdownx .markdownx-preview .codehilite,
    .markdownx .markdownx-preview .codehilite code,
    .markdownx .markdownx-preview .codehilite pre {
        font-size: 0.95em !important;
    }
    
    /* Mobile code blocks */
    .codehilite,
    pre {
        font-size: 0.95em !important;
    }
    
    /* Dark mode mobile adjustments - removed border-left override to match desktop */
    
    /* Dark mode: prevent inline code styling inside code blocks on mobile */
    body.dark-mode .codehilite code {
        background: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        color: inherit !important;
        font-weight: inherit !important;
    }
    
    /* Mobile-specific figure styles */
    .post-body-content figure {
        margin: 2em auto 2.5em;
    }
    
    .post-body-content figure img {
        max-width: 100% !important; /* Responsive: fit within container */
        width: auto !important; /* Override any inline width attributes */
        height: auto !important; /* Override any inline height attributes */
        object-fit: contain; /* Preserve aspect ratio without cropping */
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    }
    
    .post-body-content figure:hover img {
        transform: translateY(-1px);
        box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    
    .post-body-content figcaption {
        margin-top: 1em;
        padding: 0 1em;
        font-size: 0.8rem;
    }
}

/* Desktop Styles - Medium and larger screens */
@media (min-width: 768px) {
    .mobile-nav-toggle {
        display: none;
    }

    .header-content {
        display: flex;
        flex-direction: row !important; /* Force horizontal layout */
        justify-content: space-between;
        align-items: center;
        padding: 15px 30px;
    }

    .logo {
        flex-shrink: 0;
    }

    .main-nav {
        flex: 1;
        display: flex;
        justify-content: center;
        margin: 0 20px;
        margin-top: 0;
    }

    .main-nav ul {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: nowrap;
    }

    .main-nav li {
        margin: 0 10px;
    }

    .header-right {
        flex-shrink: 0;
    }

    .search-form input[type="text"] {
        width: 200px;
    }

    .post-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 30px;
    }

    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .post-title-detail {
        font-size: 3.5em;
        line-height: 1.2;
    }

    .post-description-detail {
        font-size: 1.4em;
    }
}

/* Large Desktop Styles */
@media (min-width: 1200px) {
    .post-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }

    .search-form input[type="text"] {
        width: 250px;
    }
}