/* blog.css - Blog-specific styles */

@import url('https://fonts.googleapis.com/css2?family=Playfair:ital,opsz,wght@0,5..1200,300..900;1,5..1200,300..900&display=swap');

/* Theme variables */
:root {
    --bg: #ffffff;
    --text: #111111;
    --text-muted: #666;
    --text-muted-2: #444;
    --link: #0000cc;
    --code-bg: #f4f4f4;
    --border: #eee;
    --border-strong: #ddd;
    --blockquote-border: #ccc;
    --blockquote-text: #555;
    --th-bg: #f4f4f4;
}

[data-theme="sepia"] {
    --bg: #f4ecd8;
    --text: #654321;
    --text-muted: #7a6348;
    --text-muted-2: #6b5440;
    --link: #b27c2c;
    --code-bg: #e8dcc4;
    --border: #ddd0b8;
    --border-strong: #c8b898;
    --blockquote-border: #b8a07a;
    --blockquote-text: #5a4530;
    --th-bg: #e8dcc4;
}

[data-theme="dark"] {
    --bg: #1a1a1a;
    --text: #d8d8d8;
    --text-muted: #999;
    --text-muted-2: #bbb;
    --link: #7ab8f5;
    --code-bg: #2b2b2b;
    --border: #333;
    --border-strong: #444;
    --blockquote-border: #555;
    --blockquote-text: #aaa;
    --th-bg: #2b2b2b;
}

body {
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

.post-body code,
.post-body pre,
.post-body blockquote,
.post-body th {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.container {
    width: 35%;
}


/* Breadcrumb navigation */
.blog-nav {
    font-size: 0.9em;
    margin-bottom: 30px;
    color: var(--text-muted);
}

.blog-nav-sep {
    margin: 0 6px;
    color: var(--text-muted);
}

/* Blog index listing */
.blog-index h2 {
    margin-top: 0;
    margin-bottom: 24px;
}

.post-listing {
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 24px;
    transition: border-color 0.3s ease;
}

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

.post-listing h3 {
    margin: 0 0 4px 0;
    font-size: 1.1em;
}

.post, .blog-nav, .blog-index {
    font-family: "Playfair", serif;
    font-optical-sizing: auto;
    font-weight: normal;
    font-style: normal;
    font-variation-settings:
      "wdth" 100;

    font-size: 12pt;
}

/* Date display */
.post-date {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* Post description on index */
.post-description {
    margin: 4px 0 0 0;
    font-size: 0.95em;
    color: var(--text-muted-2);
}

/* Individual post page */
.post-header {
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    transition: border-color 0.3s ease;
}

.post-header h1 {
    margin-bottom: 6px;
}

/* Post body typography */
.post-body {
    line-height: 1.7;
}

.post-body h2 {
    margin-top: 2em;
    font-size: 1.2em;
}

.post-body h3 {
    margin-top: 1.6em;
    font-size: 1.05em;
}

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

.post-body ul,
.post-body ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.post-body li {
    margin-bottom: 0.3em;
}

/* Inline code */
.post-body code {
    font-family: "Courier New", Courier, monospace;
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 2px 5px;
    border-radius: 3px;
}

/* Code blocks (fenced) */
.post-body pre {
    background: var(--code-bg);
    padding: 14px 16px;
    overflow-x: auto;
    border-radius: 4px;
    margin-bottom: 1em;
}

.post-body pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
}

/* Blockquotes */
.post-body blockquote {
    border-left: 3px solid var(--blockquote-border);
    margin: 0 0 1em 0;
    padding: 4px 16px;
    color: var(--blockquote-text);
}

/* Tables */
.post-body table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
    font-size: 0.9em;
}

.post-body th,
.post-body td {
    border: 1px solid var(--border-strong);
    padding: 8px 12px;
    text-align: left;
}

.post-body th {
    background: var(--th-bg);
}

.post-body p:has(> img) {
    display: block;
    width: 100%;
}

.post-body p > img {
    width: 60%;
    /* max-height: 500px; */
    display: flex;
    margin-left: auto;
    margin-right: auto;
}

/* Theme switcher */
.theme-switcher {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
}

.theme-btn {
    font-family: "Playfair", serif;
    font-size: 0.75em;
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: #ffffff;
    color: var(--text-muted);
    cursor: pointer;
}

.theme-btn[data-theme="sepia"] {
    background: #f4ecd8;
}

.theme-btn[data-theme="dark"] {
    background: #1a1a1a;
    color: #999;
}

.theme-btn:hover {
    border-color: var(--text-muted);
}

.theme-btn.active {
    border-color: var(--text);
}

.theme-btn[data-theme="dark"]:hover {
    color: #d8d8d8;
    border-color: #999;
}

.theme-btn[data-theme="dark"].active {
    color: #d8d8d8;
    border-color: #d8d8d8;
}

/* Media queries for responsive design */
@media screen and (max-width: 2000px) {
    .container {
        width: 50%;
    }
}

@media screen and (max-width: 768px) {
    .container {
        width: 100%;
        padding: 10px 20px;
        min-width: unset;
    }

    .tooltip::after,
    .tooltip::before,
    .filter-btn[data-tip]::after {
        display: none !important;
    }

}


/* Tooltips */
.tooltip {
    position: relative;
    text-decoration: none;
    border-bottom: 1px dotted var(--text);
}

.tooltip:hover {
    text-decoration: none;
}

.tooltip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 0.4em 0.7em;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: inherit;
    min-width: 300px;
    max-width: 1000px;
    white-space: normal;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    z-index: 100;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3), 0 1.5px 3px rgba(0, 0, 0, 0.10);
}

.tooltip:hover::after,
.tooltip:hover::before,
.tooltip:focus::after,
.tooltip:focus::before {
    opacity: 1;
}

.tooltip-footnotes {
    margin-top: 2em;
    font-size: 0.85em;
    color: var(--text-muted-2);
}

.tooltip-footnotes-rule {
    border: none;
    border-top: 1px solid var(--border);
    margin-bottom: 1em;
}

.tooltip-footnotes ol {
    padding-left: 1.5em;
    margin: 0;
}

.tooltip-footnotes li {
    margin-bottom: 0.5em;
    line-height: 1.5;
}

.tooltip-back {
    text-decoration: none;
    margin-left: 0.3em;
}

#expressions {
    display:block;
    margin: 0 auto 20px auto;
}

/* Category filters */
.category-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.filter-btn {
    font-family: "Playfair", serif;
    font-size: 0.75em;
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.filter-btn.active {
    border-color: var(--text);
    color: var(--text);
}

.filter-btn[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 0.4em 0.7em;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: inherit;
    white-space: nowrap;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    z-index: 100;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3), 0 1.5px 3px rgba(0, 0, 0, 0.10);
}

.filter-btn[data-tip]:hover::after {
    opacity: 1;
}

/* Post meta row (date + category badge) */
.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.post-listing .post-date {
    display: inline;
    margin-bottom: 0;
}

/* Category badge on index listings */
.post-category {
    font-size: 0.75em;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    padding: 1px 6px;
    transition: border-color 0.3s ease;
}