/* =============================================================================
   COLOR VARIABLES
   ============================================================================= */

/* Light mode defaults and dark mode palette.
 *
 * The --dark-* variables define the colour values used in dark mode.  They are
 * declared here in :root so that the actual hex values appear only once.  Both
 * the @media fallback block (for browsers with JavaScript disabled) and the
 * [data-theme="dark"] block (used by theme.js when JavaScript is enabled)
 * reference these shared palette variables via var().
 *
 * To override dark mode colours in a custom stylesheet you only need to change
 * the --dark-* variables — the change will automatically apply to both dark
 * mode mechanisms.  See docs/theming.md for examples.
 */
:root {
    color-scheme: light;

    /* ---- Light mode active values ---- */
    --bg-color: #fff;
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #eee;
    --border-color-light: #f0f0f0;
    --link-color: #0066cc;
    --link-hover-color: #0052a3;
    --link-visited-color: #551a8b;
    --hover-color: #0066cc;
    --hover-color-dark: #0052a3;
    --code-bg: #f5f5f5;
    --tag-bg: #f0f0f0;
    --tag-hover-bg: #e0e0e0;
    --category-bg: #e8f4f8;
    --category-hover-bg: #d0e8f2;
    --category-text: #0066cc;
    --blockquote-border: #ddd;
    --table-border: #ddd;
    --table-header-bg: #f0f0f0;
    --table-stripe-bg: #fafafa;
    --admonition-note-title-color: #0969da;
    --admonition-tip-title-color: #1a7f37;
    --admonition-important-title-color: #8250df;
    --admonition-warning-title-color: #9a6700;
    --admonition-caution-title-color: #d1242f;
    --code-block-header-border: #e0e0e0;
    --code-lang-color: #888;
    --code-copy-color: #555;
    --code-copy-success-color: #1a7f37;
    --draft-title-color: #cc6600;
    --modified-date-color: var(--text-secondary);
    --kbd-bg: #f0f0f0;
    --kbd-border: #b4b4b4;
    --streak-cell-empty: #ebedf0;
    --streak-cell-l1: #9ecaf0;
    --streak-cell-l2: #5499d5;
    --streak-cell-l3: #2270bd;
    --streak-cell-l4: #0066cc;

    /* ---- Dark mode palette (shared by both dark mode selectors below) ---- */
    --dark-bg-color: #1a1a1a;
    --dark-text-color: #e0e0e0;
    --dark-text-secondary: #a0a0a0;
    --dark-border-color: #333;
    --dark-border-color-light: #2a2a2a;
    --dark-link-color: #6eb3ff;
    --dark-link-hover-color: #8cc5ff;
    --dark-link-visited-color: #b399ff;
    --dark-hover-color: #6eb3ff;
    --dark-hover-color-dark: #8cc5ff;
    --dark-code-bg: #2a2a2a;
    --dark-tag-bg: #2a2a2a;
    --dark-tag-hover-bg: #333;
    --dark-category-bg: #1a3a4a;
    --dark-category-hover-bg: #2a4a5a;
    --dark-category-text: #6eb3ff;
    --dark-blockquote-border: #444;
    --dark-table-border: #404040;
    --dark-table-header-bg: #2a2a2a;
    --dark-table-stripe-bg: #222222;
    --dark-admonition-note-title-color: #58a6ff;
    --dark-admonition-tip-title-color: #3fb950;
    --dark-admonition-important-title-color: #a371f7;
    --dark-admonition-warning-title-color: #d29922;
    --dark-admonition-caution-title-color: #f85149;
    --dark-code-block-header-border: #393932;
    --dark-code-lang-color: #999;
    --dark-code-copy-color: #bbb;
    --dark-code-copy-success-color: #3fb950;
    --dark-draft-title-color: #ffab40;
    --dark-modified-date-color: var(--dark-text-secondary);
    --dark-kbd-bg: #3a3a3a;
    --dark-kbd-border: #666;
    --dark-streak-cell-empty: #21262d;
    --dark-streak-cell-l1: #1a3b5c;
    --dark-streak-cell-l2: #1d5fa0;
    --dark-streak-cell-l3: #3487d8;
    --dark-streak-cell-l4: #6eb3ff;
}

/* Dark mode — applied by system preference (JavaScript disabled fallback).
 * Applies when the OS/browser prefers dark and no data-theme attribute has been
 * set (i.e. theme.js has not yet run or JavaScript is disabled entirely).
 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --bg-color: var(--dark-bg-color);
        --text-color: var(--dark-text-color);
        --text-secondary: var(--dark-text-secondary);
        --border-color: var(--dark-border-color);
        --border-color-light: var(--dark-border-color-light);
        --link-color: var(--dark-link-color);
        --link-hover-color: var(--dark-link-hover-color);
        --link-visited-color: var(--dark-link-visited-color);
        --hover-color: var(--dark-hover-color);
        --hover-color-dark: var(--dark-hover-color-dark);
        --code-bg: var(--dark-code-bg);
        --tag-bg: var(--dark-tag-bg);
        --tag-hover-bg: var(--dark-tag-hover-bg);
        --category-bg: var(--dark-category-bg);
        --category-hover-bg: var(--dark-category-hover-bg);
        --category-text: var(--dark-category-text);
        --blockquote-border: var(--dark-blockquote-border);
        --table-border: var(--dark-table-border);
        --table-header-bg: var(--dark-table-header-bg);
        --table-stripe-bg: var(--dark-table-stripe-bg);
        --admonition-note-title-color: var(--dark-admonition-note-title-color);
        --admonition-tip-title-color: var(--dark-admonition-tip-title-color);
        --admonition-important-title-color: var(--dark-admonition-important-title-color);
        --admonition-warning-title-color: var(--dark-admonition-warning-title-color);
        --admonition-caution-title-color: var(--dark-admonition-caution-title-color);
        --code-block-header-border: var(--dark-code-block-header-border);
        --code-lang-color: var(--dark-code-lang-color);
        --code-copy-color: var(--dark-code-copy-color);
        --code-copy-success-color: var(--dark-code-copy-success-color);
        --draft-title-color: var(--dark-draft-title-color);
        --modified-date-color: var(--dark-modified-date-color);
        --kbd-bg: var(--dark-kbd-bg);
        --kbd-border: var(--dark-kbd-border);
        --streak-cell-empty: var(--dark-streak-cell-empty);
        --streak-cell-l1: var(--dark-streak-cell-l1);
        --streak-cell-l2: var(--dark-streak-cell-l2);
        --streak-cell-l3: var(--dark-streak-cell-l3);
        --streak-cell-l4: var(--dark-streak-cell-l4);
    }
}

/* Dark mode — applied by theme toggle (JavaScript enabled).
 * theme.js sets data-theme="dark" when the user has selected dark mode or
 * when the system preference is dark.
 */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg-color: var(--dark-bg-color);
    --text-color: var(--dark-text-color);
    --text-secondary: var(--dark-text-secondary);
    --border-color: var(--dark-border-color);
    --border-color-light: var(--dark-border-color-light);
    --link-color: var(--dark-link-color);
    --link-hover-color: var(--dark-link-hover-color);
    --link-visited-color: var(--dark-link-visited-color);
    --hover-color: var(--dark-hover-color);
    --hover-color-dark: var(--dark-hover-color-dark);
    --code-bg: var(--dark-code-bg);
    --tag-bg: var(--dark-tag-bg);
    --tag-hover-bg: var(--dark-tag-hover-bg);
    --category-bg: var(--dark-category-bg);
    --category-hover-bg: var(--dark-category-hover-bg);
    --category-text: var(--dark-category-text);
    --blockquote-border: var(--dark-blockquote-border);
    --table-border: var(--dark-table-border);
    --table-header-bg: var(--dark-table-header-bg);
    --table-stripe-bg: var(--dark-table-stripe-bg);
    --admonition-note-title-color: var(--dark-admonition-note-title-color);
    --admonition-tip-title-color: var(--dark-admonition-tip-title-color);
    --admonition-important-title-color: var(--dark-admonition-important-title-color);
    --admonition-warning-title-color: var(--dark-admonition-warning-title-color);
    --admonition-caution-title-color: var(--dark-admonition-caution-title-color);
    --code-block-header-border: var(--dark-code-block-header-border);
    --code-lang-color: var(--dark-code-lang-color);
    --code-copy-color: var(--dark-code-copy-color);
    --code-copy-success-color: var(--dark-code-copy-success-color);
    --draft-title-color: var(--dark-draft-title-color);
    --modified-date-color: var(--dark-modified-date-color);
    --kbd-bg: var(--dark-kbd-bg);
    --kbd-border: var(--dark-kbd-border);
    --streak-cell-empty: var(--dark-streak-cell-empty);
    --streak-cell-l1: var(--dark-streak-cell-l1);
    --streak-cell-l2: var(--dark-streak-cell-l2);
    --streak-cell-l3: var(--dark-streak-cell-l3);
    --streak-cell-l4: var(--dark-streak-cell-l4);
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* =============================================================================
   LAYOUT COMPONENTS
   ============================================================================= */

/* Site container with sidebar layout */
.site-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar styles */
.sidebar {
    width: 280px;
    background: var(--bg-color);
    border-right: 2px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 30px 20px;
    z-index: 100;
}

/* Hide scrollbar for sidebar but keep functionality */
.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Mobile navigation bar - hidden on desktop */
.sidebar-mobile-bar {
    display: none;
}

.sidebar-mobile-title a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.2em;
    font-weight: 600;
    transition: color 0.2s ease;
}

.sidebar-mobile-title a:hover {
    color: var(--link-hover-color);
}

/* Burger menu button */
.burger-menu {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.4em;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s ease;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.burger-menu::before {
    content: '☰';
}

.burger-menu:hover {
    color: var(--link-hover-color);
}

.burger-menu:focus {
    outline: 2px solid var(--hover-color);
    outline-offset: 2px;
}

/* In expanded state, swap ☰ for ✕ */
.sidebar.sidebar-expanded .burger-menu::before {
    content: '✕';
}

.sidebar-header {
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    margin-bottom: 10px;
}

.sidebar-logo a {
    display: block;
}

.sidebar-logo img {
    max-width: 140px;
    max-height: 140px;
    width: auto;
    height: auto;
    border-radius: 50%;
}

.sidebar-title {
    text-align: center;
}

.sidebar-title h1 {
    font-size: 1.8em;
    margin: 0 0 10px 0;
    color: var(--text-color);
}

.sidebar-title h1 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sidebar-title h1 a:hover {
    color: var(--link-hover-color);
}

.sidebar-subtitle {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin: 0;
    font-weight: normal;
}

/* Sidebar pages section - no title, just links with separator below */
.sidebar-pages {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h2 {
    font-size: 1.2em;
    margin: 0 0 15px 0;
    color: var(--text-color);
}

.sidebar-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-links li {
    margin-bottom: 5px;
}

.sidebar-links a {
    color: var(--link-color);
    text-decoration: none;
    display: block;
    transition: color 0.2s ease;
}

.sidebar-links a:hover {
    color: var(--link-hover-color);
}

.sidebar-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.sidebar-socials a {
    color: var(--link-color);
    font-size: 1.44em;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
    text-decoration: none;
}

.sidebar-socials a i {
    color: inherit;
    display: inline-block;
    text-align: center;
    width: 1.25em;
}

.sidebar-socials a:hover {
    color: var(--link-hover-color);
    transform: scale(1.1);
}

/* Main wrapper - offset by sidebar width */
.main-wrapper {
    flex: 1;
    margin-left: 280px;
    max-width: calc(100vw - 280px - 40px);
    width: 100%;
    padding: 20px;
}

/* Optimal width for main content when there's enough space */
@media (min-width: 1120px) {
    .main-wrapper {
        max-width: 800px;
    }
}

/* When no sidebar, use original layout */
.site-container:not(:has(.sidebar)) .main-wrapper {
    margin-left: auto;
    margin-right: auto;
    max-width: 800px;
}

/* Mobile layout */
@media (max-width: 768px) {
    .site-container {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        padding: 12px 20px;
        order: -1;
    }

    /* Show the mobile bar (title + burger) */
    .sidebar-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .sidebar-mobile-spacer {
        width: 36px;
        flex-shrink: 0;
    }

    .sidebar-mobile-title {
        flex: 1;
        text-align: center;
    }

    /* Hide full sidebar content by default in mobile */
    .sidebar-content {
        display: none;
    }

    /* Show sidebar content when expanded */
    .sidebar.sidebar-expanded .sidebar-content {
        display: flex;
        gap: 20px;
        padding-top: 16px;
    }

    /* In expanded state: hide the title text only; keep the spacer so the
       button stays at the same position as in the collapsed state */
    .sidebar.sidebar-expanded .sidebar-mobile-title {
        display: none;
    }

    .sidebar-logo {
        padding-bottom: 15px;
    }

    .sidebar-logo img {
        max-width: 140px;
        max-height: 140px;
    }

    .sidebar-pages {
        padding-bottom: 12px;
    }

    .sidebar-section {
        padding-bottom: 12px;
    }

    .sidebar-section h2 {
        font-size: 1em;
        margin-bottom: 10px;
    }

    .sidebar-links li {
        display: inline-block;
        margin-right: 15px;
        margin-bottom: 5px;
    }

    .sidebar-socials {
        gap: 12px;
    }

    .sidebar-socials a {
        font-size: 1.5em;
    }

    .main-wrapper {
        margin-left: 0;
        max-width: 100%;
        padding: 15px;
    }

    header nav {
        flex-direction: column;
        gap: 15px;
    }

    header ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .post-header h1 {
        font-size: 1.8em;
    }
}

/* =============================================================================
   CONTENT STYLING
   ============================================================================= */

/* General link styles for content */
a {
    color: var(--link-color);
    text-decoration: underline;
}

a:hover {
    color: var(--link-hover-color);
}

a:visited {
    color: var(--link-visited-color);
}

header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 40px;
}

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

header h1 {
    margin: 0;
    font-size: 1.8em;
    line-height: 1;
}

header h1 a {
    color: var(--text-color);
    text-decoration: none;
}

header ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0;
    padding: 0;
}

header ul a {
    color: var(--text-secondary);
    text-decoration: none;
}

header ul a:hover {
    color: var(--text-color);
}

main {
    min-height: 60vh;
}

article.post {
    margin-bottom: 60px;
}

.post-header {
    margin-bottom: 30px;
}

.post-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.2em;
    line-height: 1.2;
}

.post-header time {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.modified-date {
    color: var(--modified-date-color);
    font-style: italic;
    font-size: 0.9em;
}

time a,
time a:link,
time a:visited {
    color: var(--text-secondary);
    text-decoration: none;
}

.category {
    margin-top: 10px;
}

.category-link {
    display: inline-block;
    background: var(--category-bg);
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 0.9em;
    text-decoration: none;
    color: var(--category-text);
    font-weight: 600;
}

.category-link:hover {
    background: var(--category-hover-bg);
    color: var(--hover-color-dark);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-top: 10px;
}

.tag {
    background: var(--tag-bg);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    text-decoration: none;
    color: var(--text-secondary);
}

.tag:hover {
    background: var(--tag-hover-bg);
    color: var(--text-color);
}

/* =============================================================================
   NAVIGATION & PAGINATION
   ============================================================================= */

/* Post navigation (previous/next links) */
.post-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
    padding: 0;
}

.post-navigation-top {
    margin-bottom: 20px;
    padding-bottom: 0;
}

.post-navigation-bottom {
    margin-top: 20px;
    padding-top: 0;
}

.post-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: var(--tag-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.85em;
    transition: all 0.2s ease;
    max-width: 45%;
}

.post-nav-link:hover {
    background: var(--tag-hover-bg);
    border-color: var(--hover-color);
    color: var(--hover-color);
    transform: translateY(-1px);
}

.post-nav-prev {
    margin-right: auto;
}

.post-nav-next {
    margin-left: auto;
}

.post-nav-label {
    font-weight: 500;
}

.post-nav-spacer {
    flex: 0 0 auto;
}

/* Responsive adjustments for post navigation */
@media (max-width: 768px) {
    .post-navigation {
        gap: 10px;
    }
    
    .post-nav-link {
        padding: 6px 10px;
        font-size: 0.8em;
        max-width: 48%;
    }
}

/* Pagination navigation (archive, category, tag, index pages) */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: var(--tag-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.85em;
    transition: all 0.2s ease;
    min-width: 2.5em;
}

.pagination-link:hover {
    background: var(--tag-hover-bg);
    border-color: var(--hover-color);
    color: var(--hover-color);
    transform: translateY(-1px);
}

.pagination-prev,
.pagination-next {
    min-width: auto;
    padding: 8px 16px;
}

.pagination-current {
    background: var(--hover-color);
    border-color: var(--hover-color);
    color: var(--bg-color);
    font-weight: 600;
    cursor: default;
    pointer-events: none;
}

.pagination-current:hover {
    transform: none;
}

.pagination-ellipsis {
    color: var(--text-secondary);
    padding: 0 4px;
    font-size: 0.85em;
}

@media (max-width: 768px) {
    .pagination-link {
        padding: 6px 10px;
        font-size: 0.8em;
        min-width: 2em;
    }

    .pagination-prev,
    .pagination-next {
        padding: 6px 12px;
    }
}

/* =============================================================================
   BACKLINKS (References & mentions)
   ============================================================================= */

/* Container for the "References & mentions" section on individual post pages. */
.backlinks {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.backlinks-heading {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.backlinks-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.backlink-item {
    padding: 0.75rem 1rem;
    background: var(--tag-bg);
    border: 1px solid var(--border-color-light);
    border-radius: 6px;
}

.backlink-meta {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.backlink-title {
    font-weight: 600;
    text-decoration: none;
    color: var(--link-color);
}

.backlink-title:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

.backlink-date {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.backlink-snippet {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0;
    font-style: italic;
    line-height: 1.5;
}

.backlink-link-text {
    color: var(--text-color);
    font-style: normal;
    font-weight: 600;
}

/* Container for the comment invitation section on individual post pages. */
.comment-invite {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.comment-invite-content {
    padding: 0.75rem 1rem;
    background: var(--tag-bg);
    border: 1px solid var(--border-color-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 0;
}

.comment-invite-link {
    color: var(--link-color);
    text-decoration: none;
}

.comment-invite-link:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

.post-content {
    font-size: 1.05em;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

/* Heading anchor links — visible on hover, hidden otherwise */
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    position: relative;
}

.heading-anchor {
    opacity: 0;
    transition: opacity 0.15s ease;
    margin-left: 0.35em;
    font-size: 0.7em;
    font-weight: normal;
    color: var(--link-color);
    text-decoration: none;
    user-select: none;
    vertical-align: middle;
}

.post-content h2:hover .heading-anchor,
.post-content h3:hover .heading-anchor,
.post-content h4:hover .heading-anchor,
.post-content h5:hover .heading-anchor,
.post-content h6:hover .heading-anchor {
    opacity: 1;
}

.post-content code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.post-content kbd {
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-border);
    border-bottom-width: 2px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85em;
    padding: 1px 5px;
    white-space: nowrap;
}

.post-content pre {
    background: var(--code-bg);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
}

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

.post-content img {
    max-width: 100%;
    height: auto;
}

/* Images with #centre on the end of the URL get centred. */
img[src*="#centre"] {
    display: block;
    margin: auto;
}

.post-content blockquote {
    border-left: 4px solid var(--blockquote-border);
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
}

/* Tables */
.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5em 0;
    font-size: 0.95em;
    overflow-x: auto;
    display: block;
}

.post-content table th,
.post-content table td {
    border: 1px solid var(--table-border);
    padding: 8px 14px;
    text-align: left;
    vertical-align: top;
}

.post-content table thead th {
    background: var(--table-header-bg);
    font-weight: 600;
}

.post-content table tbody tr:nth-child(even) {
    background: var(--table-stripe-bg);
}

/* =============================================================================
   ADMONITIONS & FOOTNOTES
   ============================================================================= */

/* GitHub-style admonitions */
.post-content .admonition {
    margin: 1.5em 0;
    padding: 0;
    border-left: 4px solid;
    border-radius: 4px;
    background-color: var(--code-bg);
}

.post-content .admonition-title {
    padding: 8px 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-content .admonition-content {
    padding: 8px 12px 12px 12px;
}

.post-content .admonition-content > *:first-child {
    margin-top: 0;
}

.post-content .admonition-content > *:last-child {
    margin-bottom: 0;
}

/* Note admonition - blue */
.post-content .admonition-note {
    border-left-color: #0969da;
}

.post-content .admonition-note .admonition-title {
    color: var(--admonition-note-title-color);
}

/* Tip admonition - green */
.post-content .admonition-tip {
    border-left-color: #1a7f37;
}

.post-content .admonition-tip .admonition-title {
    color: var(--admonition-tip-title-color);
}

/* Important admonition - purple */
.post-content .admonition-important {
    border-left-color: #8250df;
}

.post-content .admonition-important .admonition-title {
    color: var(--admonition-important-title-color);
}

/* Warning admonition - orange */
.post-content .admonition-warning {
    border-left-color: #9a6700;
}

.post-content .admonition-warning .admonition-title {
    color: var(--admonition-warning-title-color);
}

/* Caution admonition - red */
.post-content .admonition-caution {
    border-left-color: #d1242f;
}

.post-content .admonition-caution .admonition-title {
    color: var(--admonition-caution-title-color);
}

/* Footnotes */
.post-content .footnote {
    font-size: 0.85em;
}

.post-summary {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.post-summary:last-child {
    border-bottom: none;
}

.post-summary h2 {
    margin: 0 0 10px 0;
    font-size: 1.6em;
}

.post-summary h2 a {
    color: var(--text-color);
    text-decoration: none;
}

.post-summary h2 a:hover {
    color: var(--hover-color);
}

.post-summary.draft-post h2 a,
.post.draft-post .post-header h1 {
    color: var(--draft-title-color);
}

.post-summary time {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.post-list {
    list-style: none;
    padding: 0;
}

.post-list li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color-light);
}

.post-list li:last-child {
    border-bottom: none;
}

.post-list time {
    display: inline-block;
    min-width: 100px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.post-list a {
    color: var(--text-color);
    text-decoration: none;
}

.post-list a:hover {
    color: var(--hover-color);
}

footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
}

footer a {
    color: var(--text-secondary);
}

footer a:hover {
    color: var(--text-color);
}

/* =============================================================================
   THEME TOGGLE
   ============================================================================= */

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.theme-toggle:hover {
    opacity: 1;
    background: var(--tag-bg);
}

.theme-toggle:focus {
    outline: 2px solid var(--hover-color);
    outline-offset: 2px;
    opacity: 1;
}

/* Icons for theme toggle */
.theme-toggle .icon {
    font-size: 1em;
    line-height: 1;
}

/* Hide the text label */
.theme-toggle .theme-label {
    display: none;
}

/* Hide appropriate icon based on theme */
/* By default (light mode), show dark icon (moon) to indicate "switch to dark" */
.theme-toggle .light-icon {
    display: none;
}

.theme-toggle .dark-icon {
    display: inline;
}

/* In dark mode, show light icon (sun) to indicate "switch to light" */
[data-theme="dark"] .theme-toggle .light-icon {
    display: inline;
}

[data-theme="dark"] .theme-toggle .dark-icon {
    display: none;
}

/* When system prefers dark and no manual override, show light icon */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-toggle .light-icon {
        display: inline;
    }
    
    :root:not([data-theme]) .theme-toggle .dark-icon {
        display: none;
    }
}

/* ==========================================================================
   Syntax Highlighting
   ========================================================================== */

/* Structural layout for .highlight wrapper; colour rules are in code.css. */
.highlight {
    border-radius: 5px;
    overflow-x: auto;
    position: relative;
}

.highlight pre {
    background: inherit;
    margin: 0;
    padding: 10px 15px;
    line-height: 125%;
    overflow-x: auto;
}

/* Code block header bar: language label (left) + copy button (right).
   The background is always taken from the site's --code-bg CSS variable so
   the header follows the site's light/dark theme regardless of the Pygments
   code style in use.  The code content area inherits its background from the
   Pygments rules in code.css. */
.code-block-header {
    background: var(--code-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 4px 12px;
    border-bottom: 1px solid var(--code-block-header-border);
}

.code-block-lang {
    font-size: 0.72em;
    color: var(--code-lang-color);
    font-family: monospace;
    user-select: none;
}

.code-block-copy {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--code-copy-color);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.85em;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.code-block-copy:hover {
    opacity: 1;
}

.code-block-copy.copied {
    color: var(--code-copy-success-color);
    opacity: 1;
}

