/* Custom CSS optimized for PWA, performance, and SEO */

:root {
    --gap: clamp(16px, 2vw, 24px);
    --content-gap: clamp(20px, 3vw, 32px);
    --nav-width: min(1024px, 95vw);
    --main-width: min(900px, 95vw);
    --header-height: 60px;
    --footer-height: 40px;
    --radius: 10px;
    /* Light palette (neutral, not greenish) */
    --theme: #f5f7fb; /* page background */
    --entry: #ffffff; /* card background */
    --primary: #1f2937; /* text */
    --secondary: #6b7280; /* secondary text */
    --tertiary: #94a3b8; /* subtle */
    --content: #1f2937;
    --hljs-bg: #f6f7f9; /* code block bg */
    --code-bg: #f6f7f9; /* align with page to avoid tint */
    --border: #e6eaf0;
    --font-scale: clamp(1rem, 2vw, 1.2rem);
    --spacing-unit: max(1rem, 2vw);
    --serif-fonts: "Georgia", "Times New Roman", "Times", serif;
    --monospace-fonts:
        "SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono",
        "Courier New", monospace;
    --base-font-size: clamp(1.06rem, 0.9rem + 0.5vw, 1.25rem);
    --base-line-height: 1.6;
}

.dark {
    /* Dark palette (Twitter X "Lights Out") */
    --theme: #000000; /* page background */
    --entry: #16181c; /* card background */
    --primary: #e7e9ea; /* text */
    --secondary: #8b98a5; /* secondary text */
    --tertiary: #2f3336; /* subtle/borders */
    --content: #e7e9ea;
    --hljs-bg: #0b0d0f; /* code block bg */
    --code-bg: #0b0d0f; /* code inline/bg */
    --border: #2f3336; /* borders */
}

/* Ensure list pages use page background color (not code-bg) */
.list {
    background: var(--theme) !important;
}

/* Link colors (dark mode: match X accent) */
.dark .post-content a,
.dark .entry-content a,
.dark .footer a {
    color: #1d9bf0;
}
@media (hover: hover) and (pointer: fine) {
    .dark .post-content a:hover,
    .dark .entry-content a:hover,
    .dark .footer a:hover {
        color: #8ecbff;
    }
}

/* Base styles */
body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Ubuntu",
        "Cantarell", "Noto Sans", "Helvetica Neue", "Arial", sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: var(--base-font-size);
    line-height: var(--base-line-height);
    background: var(--theme);
    color: var(--primary);
    margin: 0;
    padding: 0;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.main {
    position: relative;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    max-width: var(--nav-width);
    margin-inline: auto;
    padding-inline: var(--gap);
    padding-block-start: calc(var(--header-height) + var(--gap));
}

/* Header and Navigation */
.header {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    z-index: 100;
    background-color: var(--theme);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Ensure consistent box-sizing for all elements */
* {
    box-sizing: border-box;
}

/* General Styles for nav */
nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    max-width: var(--nav-width);
    margin-inline: auto;
    padding-inline: var(--gap);
    height: var(--header-height);
    align-items: center;
    position: relative;
}

.nav a {
    color: var(--primary);
    text-decoration: none;
    margin: 0;
}

.logo a {
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    font-size: 20px;
}

/* Skip to main content link - Visually hide until focused */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--primary);
    color: #fff;
    padding: 0.5em 1em;
    z-index: 200;
    border-radius: var(--radius);
    font-size: 1rem;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
}
.skip-link:focus {
    transform: translateY(0);
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Hamburger menu styles */
#hamburger-menu {
    cursor: pointer;
    position: absolute;
    right: var(--gap);
    top: 50%;
    transform: translateY(-50%);
    /* background-color: var(--theme); /* Removed background from icon */
    padding: 5px; /* Optional: keep padding for touch area if needed */
    border-radius: 4px; /* Optional: adjust icon styling if needed */
    /* Add styles for your hamburger icon here */
}
#hamburger-menu:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
#hamburger-input {
    position: absolute;
    left: -9999px;
}
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.4);
    z-index: 99;
}
.overlay.active {
    display: block;
}
.menu.active {
    display: flex !important;
}

/* Menu styles */
.menu {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.menu li {
    margin-left: 20px;
}

/* Mobile and Tablet Styles (up to 1024px to include iPads) */
@media screen and (max-width: 1024px) {
    nav {
        flex-direction: column;
        align-items: flex-start;
    }

    #hamburger-menu {
        display: block;
    }

    .menu {
        display: none;
        flex-direction: column;
        width: 100%;
        text-align: center;
        padding: 10px 0;
        background-color: var(
            --theme
        ); /* Added background to the opened menu */
        /* Optional: Add a slight shadow or border if desired */
        /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); */
        /* border-top: 1px solid var(--border); */
    }

    .menu.active {
        display: flex;
    }

    .menu li {
        margin: 10px 0;
    }
}

/* Desktop Styles (above 1024px) */
@media screen and (min-width: 1025px) {
    #hamburger-menu {
        display: none;
    }

    .menu {
        display: flex;
    }
}

/* Responsive font sizes for logo */
@media screen and (max-width: 375px) {
    .logo a {
        font-size: 16px;
    }
}

@media screen and (min-width: 376px) and (max-width: 414px) {
    .logo a {
        font-size: 17px;
    }
}

@media screen and (min-width: 415px) and (max-width: 768px) {
    .logo a {
        font-size: 18px;
    }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
    .logo a {
        font-size: 20px;
    }
}

@media screen and (min-width: 1025px) and (max-width: 1366px) {
    .logo a {
        font-size: 22px;
    }
}

@media screen and (min-width: 1367px) {
    .logo a {
        font-size: 24px;
    }
}

/* High-resolution mobile devices */
@media screen and (max-width: 1024px) and (min-resolution: 2dppx) {
    #hamburger-menu {
        display: block;
    }
    .menu {
        display: none;
    }
    .menu.active {
        display: flex;
    }
}

/* Ensure menu visibility for all screen sizes */
@media screen {
    #hamburger-menu,
    .menu {
        visibility: visible;
    }
}

/* Hover effects for non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .nav a {
        transition: color 0.3s;
    }
    .nav a:hover {
        color: var(--secondary);
    }

    .post-entry {
        transition:
            transform 0.2s,
            box-shadow 0.3s;
    }

    .post-entry:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    }

    .post-tags a,
    .pagination a,
    .terms-tags a {
        transition:
            background-color 0.3s,
            color 0.3s,
            transform 0.2s;
    }

    .post-tags a:hover,
    .pagination a:hover,
    .terms-tags a:hover {
        background: var(--border);
        transform: translateY(-2px);
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--serif-fonts);
    line-height: 1.2;
    margin-block: 1.5em 0.5em;
}

h1 {
    font-size: 2.5rem;
}
h2 {
    font-size: 2.2rem;
}
h3 {
    font-size: 2rem;
}
h4 {
    font-size: 1.8rem;
}
h5 {
    font-size: 1.6rem;
}
h6 {
    font-size: 1.4rem;
}

.page-header h1,
.post-title {
    font-size: 2.5rem;
    margin-block-end: 0.5em;
    text-align: center;
}

.post-description {
    font-size: var(--base-font-size);
    line-height: var(--base-line-height);
    color: var(--secondary);
    margin-block: -0.5em 1em;
    text-align: center;
}

.post-meta {
    color: var(--secondary);
    font-size: 0.95rem;
    text-align: center;
    margin-block-end: 1em;
}

.post-content {
    margin-block-start: 1.5em;
    font-size: var(--base-font-size);
    line-height: var(--base-line-height);
}

/* Content Elements */
.post-content p,
.post-content ul,
.post-content ol {
    margin-block-end: 1.2em;
}

.post-content ul,
.post-content ol {
    padding-inline-start: 1.5em;
}

.post-content li {
    margin-block-end: 0.5em;
}

.post-content blockquote {
    margin-block: 1.5em;
    padding: 0.5em 1em;
    border-inline-start: 4px solid var(--border);
    background-color: var(--code-bg);
    color: var(--secondary);
    font-style: italic;
}

.post-content img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.08);
}

.post-content code {
    font-family: var(--monospace-fonts);
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

.post-content pre {
    background: var(--hljs-bg);
    padding: 1em;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.9em;
}

.post-content pre code {
    background: none;
    padding: 0;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media screen and (max-width: 640px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (min-width: 641px) and (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (min-width: 1025px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.post-entry {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--entry);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.post-entry .entry-cover {
    margin: 0;
    padding: 0;
}

.post-entry .entry-cover img {
    border-radius: var(--radius);
    width: 100%;
    height: auto;
    object-fit: cover;
}

.entry-header,
.entry-content,
.entry-footer {
    padding: 1em;
}

.entry-header h2 {
    font-size: clamp(1.05rem, 0.95rem + 0.3vw, 1.2rem);
    margin-block: 0 0.3em;
    text-align: center;
}

.entry-content {
    flex-grow: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.entry-footer {
    color: var(--tertiary);
    font-size: 0.75rem;
    text-align: center;
    padding: 0.5em 0.6em;
}

.post-entry .post-date {
    display: block;
    text-align: center;
    color: var(--secondary);
    font-size: 0.95rem;
    margin-bottom: 0.5em;
}

/* Single Post */
.post-single {
    background: var(--entry);
    border-radius: var(--radius);
    padding: var(--content-gap);
    margin-block-end: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    max-width: var(--main-width);
    margin-inline: auto;
}

.post-single .post-cover {
    margin: 1em auto;
    text-align: center;
    max-width: 768px; /* Adjust this value as needed */
}

.post-single .post-cover img {
    border-radius: var(--radius);
    max-width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    object-fit: cover;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Reduced padding for titles in single pages, tags, categories, and about pages */
.page-header,
.post-header {
    margin: 6px auto var(--content-gap);
}

/* Tags styling for single post pages */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-block: 1em;
}

.post-tags a {
    display: inline-block;
    padding: 0.3em 0.6em;
    margin: 0.2em;
    background: var(--entry);
    border-radius: var(--radius);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    margin-block-start: var(--gap);
}

.pagination a {
    color: var(--primary);
    background: var(--entry);
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius);
    font-size: 1rem;
    transition:
        background-color 0.3s,
        color 0.3s,
        transform 0.2s;
}

.pagination a:hover {
    background: var(--border);
    color: var(--primary);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    max-width: var(--nav-width);
    margin-inline: auto;
    margin-top: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    color: var(--secondary);
    font-size: 0.9rem;
    text-align: center;
    border-block-start: 1px solid var(--border);
}

/* Utility: ensure .hidden class exists (used by spinner) */
.hidden {
    display: none !important;
}

/* Infinite Scroll Styles */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary, #1f2937);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    margin: 1rem 0;
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: var(--radius, 4px);
    color: #c33;
    font-size: 0.9rem;
    text-align: center;
}

.error-message .retry-button {
    padding: 0.5rem 1rem;
    background-color: #c33;
    color: white;
    border: none;
    border-radius: var(--radius, 4px);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.error-message .retry-button:hover {
    background-color: #a22;
}

.dark .error-message {
    background-color: #4a2a2a;
    border-color: #8b3a3a;
    color: #f87171;
}

.dark .error-message .retry-button {
    background-color: #dc2626;
}

.dark .error-message .retry-button:hover {
    background-color: #b91c1c;
}

/* Tags and Categories Pages */
.terms-tags {
    text-align: center;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8em;
}

.terms-tags li {
    margin: 0.4em;
}

.terms-tags a {
    display: inline-block;
    padding: 0.5em 1em;
    background: var(--entry);
    border-radius: var(--radius);
    color: var(--primary);
    text-decoration: none;
    font-size: 1rem;
}

.terms-tags sup {
    color: var(--secondary);
    font-size: 0.8em;
    margin-inline-start: 2px;
}

/* Dark/Light toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    body {
        font-size: var(--base-font-size);
    }

    .post-content,
    .post-description {
        font-size: var(--base-font-size);
    }

    .nav {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding-inline: var(--gap);
    }

    .nav ul {
        display: flex;
        padding: 0;
        margin: 0;
    }

    .nav li {
        margin-inline: 10px;
    }

    .theme-toggle {
        margin-inline-start: 10px;
    }

    .post-entry {
        padding: 0.5em;
    }

    .entry-header,
    .entry-content,
    .entry-footer {
        padding: 0.5em;
    }

    .main {
        padding-inline: 0.5em;
    }

    .post-single {
        padding: 1em;
        margin-inline: 0;
        max-width: 100%;
    }

    .posts-grid {
        gap: 0.5em;
    }
}

@media screen and (max-width: 480px) {
    .entry-footer {
        flex-direction: column;
        align-items: center;
    }

    .entry-footer > * {
        margin-block: 0.25em;
    }

    .post-entry {
        padding: 0.3em;
        margin-block-end: 0.3em;
    }

    .entry-header,
    .entry-content,
    .entry-footer {
        padding: 0.3em;
    }

    .main {
        padding-inline: 0.3em;
    }

    .post-single {
        padding: 0.5em;
        margin-inline: 0;
        max-width: 100%;
    }

    .posts-grid {
        gap: 0.3em;
    }

    .post-content {
        padding: 0.3em;
    }
}

/* Styles for very small screens */
@media screen and (max-width: 360px) {
    .main {
        padding-inline: 0.2em;
    }

    .post-entry {
        padding: 0.2em;
    }

    .entry-header,
    .entry-content,
    .entry-footer {
        padding: 0.2em;
    }

    .post-single {
        padding: 0.3em;
    }

    .post-content,
    .post-description {
        font-size: var(--base-font-size);
    }

    h1,
    .page-header h1,
    .post-title {
        font-size: 2rem;
    }

    .pagination a {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* PWA Optimizations */
@media (display-mode: standalone) {
    body {
        padding-block-start: env(safe-area-inset-top);
        padding-block-end: env(safe-area-inset-bottom);
        padding-inline-start: env(safe-area-inset-left);
        padding-inline-end: env(safe-area-inset-right);
    }

    .header {
        padding-block-start: env(safe-area-inset-top);
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .pagination {
        display: none;
    }

    body {
        font-size: 12pt;
    }

    .main {
        max-width: 100%;
        padding: 0;
    }
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Use :is() for simplified selectors */
:is(.post-tags, .pagination, .terms-tags) a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Ensure proper contrast for dark mode */
@media (prefers-color-scheme: dark) {
    :focus-visible {
        outline-color: var(--secondary);
    }
}

/* Post Navigation Styles */
.post-navigation-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: var(--main-width);
    margin-inline: auto;
    margin-top: 1rem;
    margin-bottom: 1rem;
    gap: var(--gap);
}

.post-nav-item {
    flex-basis: calc(50% - (var(--gap) / 2));
    max-width: calc(50% - (var(--gap) / 2));
    background: var(--entry);
    border-radius: var(--radius);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.08);
    transition:
        transform 0.2s,
        box-shadow 0.3s;
    overflow: hidden;
}

.post-nav-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.post-nav-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: var(--primary);
}

.post-nav-cover {
    width: 100%;
    padding-top: 100%;
    position: relative;
    overflow: hidden;
}

.post-nav-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius) var(--radius) 0 0;
}

.post-nav-info {
    padding: calc(var(--gap) / 2);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: center;
}

.post-nav-label {
    font-size: 0.8rem;
    color: var(--secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-nav-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

@media screen and (max-width: 768px) {
    .post-navigation-container {
        flex-direction: column;
    }

    .post-nav-item {
        flex-basis: 100%;
        max-width: 100%;
        margin-bottom: calc(var(--gap) / 2);
    }
}

/* Lazy Loading Styles */
img.lazyload {
    opacity: 0;
    transition: opacity 0.3s;
}

img.lazyloaded {
    opacity: 1;
}

/* Styles for the Takeaways Box */
.takeaways-box {
    background-color: #f0f8ff; /* Light blue background, adjust as needed */
    border: 1px solid #add8e6; /* Light blue border */
    border-radius: var(--radius, 8px); /* Use theme radius if available */
    padding: clamp(15px, 2vw, 20px); /* Responsive padding */
    margin-block: 1.5em 1.5em; /* Space above and below the box */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* Subtle shadow */
}

.takeaways-box h2 {
    /* Style the heading inside the box */
    margin-top: 0;
    margin-bottom: 0.75em; /* Space below heading */
    font-size: 1.4rem; /* Slightly larger heading */
    color: #005a87; /* Darker blue for heading */
    border-bottom: 1px solid var(--border, #e0e6ed); /* Separator line */
    padding-bottom: 0.4em; /* Space below separator */
}

.takeaways-box ul {
    /* Style the list inside */
    padding-left: 20px; /* Indentation for list */
    margin-bottom: 0; /* Remove default bottom margin */
    list-style-type: "✅ "; /* Use checkmark as bullet */
}

.takeaways-box ul li {
    /* Style list items */
    margin-bottom: 0.6em; /* Space between items */
    line-height: var(
        --base-line-height,
        1.6
    ); /* Ensure consistent line height */
}

/* Optional: Adjust for dark mode if needed */
.dark .takeaways-box {
    background-color: #2a3b4d; /* Darker background for dark mode */
    border-color: #4a5568; /* Darker border */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dark .takeaways-box h2 {
    color: #a0cff7; /* Lighter heading color for dark mode */
    border-bottom-color: #4a5568;
}

.dark .takeaways-box ul {
    list-style-type: "✅ "; /* Ensure checkmark is visible in dark mode */
}

/* Styles for the Disclaimer Box */
.disclaimer-box {
    border: 1px solid #f0ad4e; /* Warning yellow border */
    background-color: #fcf8e3; /* Light yellow background */
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--radius, 4px);
    color: var(--content); /* Use theme text color */
}

.disclaimer-box strong {
    color: #c09853; /* Darker yellow for the heading text */
}

/* Dark Mode Styles for Disclaimer Box */
.dark .disclaimer-box {
    background-color: #4a412a; /* Darker background for dark mode */
    border-color: #a88c4f; /* Adjusted border color for dark mode */
    color: var(--content); /* Ensure text color adapts */
}

.dark .disclaimer-box strong {
    color: #f0ad4e; /* Lighter yellow for heading in dark mode */
}

/* ... rest of existing css ... */

/* Dark mode refinements to match X Lights Out */
.dark .header {
    background-color: var(--theme);
    border-bottom: 1px solid var(--tertiary);
    box-shadow: none;
}

.dark .footer {
    border-top: 1px solid var(--tertiary);
}

.dark .post-entry {
    border-color: var(--tertiary);
    box-shadow: none;
}

.dark .pagination a {
    background: var(--entry);
    border: 1px solid var(--tertiary);
}

.dark .pagination a:hover {
    background: var(--tertiary);
}

.dark :focus-visible {
    outline-color: #1d9bf0; /* X accent */
}

.dark ::selection {
    background-color: rgba(29, 155, 240, 0.35);
    color: #e7e9ea;
}

::selection {
    background-color: rgba(17, 24, 39, 0.15);
}

/* Additional X dark mode mirroring */
/* Links: X uses blue, no underline by default; underline on hover */
.dark .post-content a,
.dark .entry-content a,
.dark .footer a,
.dark a {
    color: #1d9bf0;
}
.dark .post-content a,
.dark .toc a:hover {
    border-bottom: none;
}
@media (hover: hover) and (pointer: fine) {
    .dark a:hover {
        text-decoration: underline;
        color: #8ecbff;
    }
}
.dark a:visited {
    color: #1d9bf0;
}

/* Inputs and form controls */
.dark input,
.dark textarea,
.dark select {
    background-color: #16181c;
    color: #e7e9ea;
    border: 1px solid #2f3336;
}
.dark input:focus,
.dark textarea:focus,
.dark select:focus {
    outline: 2px solid #1d9bf0;
    outline-offset: 0;
    border-color: #1d9bf0;
}
.dark ::placeholder {
    color: #71767b;
    opacity: 1;
}

/* Buttons */
.dark button,
.dark .btn,
.dark input[type="button"],
.dark input[type="submit"],
.dark .pagination a.primary {
    background-color: #1d9bf0;
    color: #0f1419;
    border: 1px solid #1d9bf0;
}
@media (hover: hover) and (pointer: fine) {
    .dark button:hover,
    .dark .btn:hover,
    .dark input[type="button"]:hover,
    .dark input[type="submit"]:hover,
    .dark .pagination a.primary:hover {
        background-color: #1a8cd8;
        border-color: #1a8cd8;
    }
}

/* Overlays and menus */
.dark .overlay {
    background: rgba(0, 0, 0, 0.65);
}

/* Progress bar */
#progressBar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--scrollAmount, 0%);
    height: 3px;
    background-color: #1d9bf0;
    z-index: 1000;
    transition: width 0.2s ease;
}

.dark #progressBar {
    background-color: #1d9bf0;
}

/* Tables and borders */
.dark table,
.dark th,
.dark td,
.dark hr,
.dark .post-content table th,
.dark .post-content table td {
    border-color: #2f3336;
}

/* Code blocks and inline code */
.dark .post-content pre {
    background: #0b0d0f;
}
.dark .post-content code {
    background: #0b0d0f;
    color: #e7e9ea;
}

/* Tags/pills */
.dark .post-tags a,
.dark .terms-tags a {
    background: #16181c;
    border: 1px solid #2f3336;
    color: #e7e9ea;
}

/* Breadcrumbs, meta, muted text */
.dark .post-meta,
.dark .breadcrumbs,
.dark .entry-footer,
.dark .post-entry .post-date {
    color: #8b98a5;
}

/* Nav adjustments */
.dark .nav a,
.dark .logo a {
    color: #e7e9ea;
}
