:root {
    --bg: #f4f4f4;
    --surface: #ffffff;
    --surface-strong: #8c3da0;
    --text: #333333;
    --text-inverse: #ffffff;
    --border: #dddddd;
    --shadow: rgba(0, 0, 0, 0.08);
    --accent: #f33de4;
    --title-background: #ffffff;
    --title-text: #222222;
    --title-text-shadow: #ffffff;
}

/* Blog CSS - Mobile first, responsive */

/* Base styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

.blog-title {
    background-image: url(../images/banner.png);
    background-position: center;
    background-color: var(--title-background);
    color: var(--title-text);
}

/* Title bar */
.title-bar {
    background-color: var(--title-background);
    color: var(--title-text);
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    position: relative;
}

.title-bar h1 {
    margin: 0;
    font-size: 2rem;
    flex-grow: 3;
    text-shadow: 0 0 5px var(--title-text-shadow);
    text-align: start;
}

.blog-title h1 {
    margin: 0;
    font-size: 2rem;
    flex-grow: 3;
    text-shadow: 0 0 5px var(--title-text-shadow);
    text-align: center;
}

.hamburger {
    display: block;
    background: none;
    border: none;
    color: var(--title-text);
    font-size: 2rem;
    text-shadow: 0 0 5px var(--title-text-shadow);
    cursor: pointer;
}

.atom-link {
    color: var(--title-text);
    text-decoration: none;
    margin-left: auto;
}

img.icon {
    width: 2rem;
}

.about-button,
.home-link {
    /* display: inline-flex; */
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    /*    border: 1px solid var(--border);
    border-radius: 4px; */
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 0.75rem;
    border-width: 0px;
}

.about-button img.icon {
    width: 1rem;
}

.about-button:hover,
.home-link:hover {
    border-color: var(--accent);
}

/* Sidebar */
.sidebar {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    overflow-y: auto;
    z-index: 1000;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
    ;
}

.sidebar.show {
    display: block;
}

.collapsed:before {
    content: "🢒";
    margin-right: 1em;
}

.expanded:before {
    content: "🢓";
    margin-right: 1em;
}

.about-popover {
    display: none;
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem;
}

.about-popover.show {
    display: block;
}

/* Overlay for mobile */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.overlay.show {
    display: block;
}

/* Main content */
.main-content {
    padding: 1rem;
    background-color: var(--surface);
    margin: auto;
    border-radius: 5px;
    box-shadow: 0 2px 5px var(--shadow);
}

.article-content {
    max-width: 800px;
    margin: 0 auto;
}

.latest-article {
    margin-bottom: 2rem;
}

.article-meta {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.article-body {
    margin-bottom: 1.5rem;
}

/* tables */
table {
    table-layout: fixed;
    width: 80%;
    border-collapse: collapse;
}

thead {
    font-weight: bold;
    background-color: #f9f9f9;
}

th,
td {
    width: 33.33%;
    padding: 4px;
    text-align: left;
    border: 1px solid #ddd;
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* admonitions */
.admonition {
    display: block;
    background-color: var(--bg);
    padding-left: 1em;
    padding-right: 1em;
}

.admonition-title {
    font-weight: bold;
}

/* Images */
img.small {
    width: 25%;
    display: block;
    margin: 1rem auto;
}

img.medium {
    width: 50%;
    display: block;
    margin: 1rem auto;
}

img.large {
    width: 100%;
    display: block;
    margin: 1rem auto;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    background-color: var(--surface-strong);
    color: var(--text-inverse);
}

/* Responsive */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-contrast: more) {
    :root {
        --bg: #000000;
        --surface: #111111;
        --surface-strong: #222222;
        --text: #ffffff;
        --text-inverse: #ffffff;
        --border: #ffffff;
        --accent: #88c0d0;
        --shadow: rgba(255, 255, 255, 0.08);
    }
}

@media (min-width: 768px) {
    .hamburger {
        display: none;
    }

    .sidebar {
        display: block;
        position: static;
        width: auto;
        height: auto;
        box-shadow: none;
        padding-left: 2rem;
    }

    .overlay {
        display: none;
    }

    .main-content {
        display: flex;
    }

    .article-content {
        flex: 1;
        padding-right: 2rem;
    }

    .sidebar {
        width: 300px;
    }
}

/* Code highlighting */
.codehilite {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 0.5rem;
    overflow-x: auto;
}

/* Mermaid */
.mermaid {
    text-align: center;
}

/* Tags and archive (hidden data) */
.tag-data,
.archive-data {
    display: none;
}

/* Search */
.search-input {
    /* width: 100%; */
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
}

/* Archive tree */
.archive-tree ul {
    list-style: none;
    padding-left: 1rem;
}

.archive-tree .year {
    font-weight: bold;
}

.archive-tree .month {
    font-weight: normal;
}

/* Popover */
.popover {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 0.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1001;
}

.popover.show {
    display: block;
}