themes/default/styles.css
/* Base styles and variables */
:root {
    /* Light theme variables */
    --content-width: 700px;
    --font-body:
        "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Arial, sans-serif;
    --font-heading: var(--font-body);
    --text-color: #000;
    --text-secondary: #646464;
    --bg-color: #f9f9f9;
    --border-color: #e0e0e0;
    --gray-3: #f0f0f0;
    --link-color: #3a6ea5;
    --link-hover-color: #1c4c7a;
    --link-bg: rgba(75, 121, 161, 0.1);
    --link-bg-hover: rgba(75, 121, 161, 0.2);
    --info-bg: #e8f4fd;
    --info-color: #0c5460;
    --warning-bg: #fff3cd;
    --warning-color: #856404;
    --success-bg: #dff0d8;
    --success-color: #3c763d;
    --error-bg: #f8d7da;
    --error-color: #721c24;
    --blockquote-border: #9e9e9e;
    --horizontal-padding: 20px;
    --spacing-1: 4px;
    --spacing-2: 8px;
    --spacing-3: 12px;
    --spacing-4: 16px;
    --spacing-5: 20px;
    --primary-text-color: var(--text-color);
    --primary-bg-color: #ffffff;
    --primary-box-shadow-color: rgba(0, 0, 0, 0.2);
    --header-height: 48px;
    --header-bg-color: #ffffff;
    --header-border-color: var(--border-color);

    /* Default SiYuan colors */
    --b3-theme-primary: #3573f0;
    --b3-theme-primary-light: rgba(53, 115, 240, 0.72);
    --b3-theme-primary-lighter: rgba(53, 115, 240, 0.48);
    --b3-theme-primary-lightest: rgba(53, 115, 240, 0.24);
    --b3-theme-secondary: #f3a92f;
    --b3-theme-background: #1e1e1e;
    --b3-theme-background-light: rgba(255, 255, 255, 0.075);
    --b3-theme-surface: #262626;
    --b3-theme-surface-light: rgba(41, 42, 45, 0.86);
    --b3-theme-surface-lighter: rgba(230, 230, 230, 0.06);
    --b3-theme-error: #d23f31;
    --b3-theme-success: #65b84d;
    --b3-theme-on-primary: #fff;
    --b3-theme-on-secondary: #fff;
    --b3-theme-on-background: #dadada;
    --b3-theme-on-surface: #9aa0a6;
    --b3-theme-on-surface-light: #bababa;
    --b3-theme-on-error: #fff;
    /* Background colors */
    --b3-font-background5: #e2e3e4;
    --b3-font-background6: #acd0fc;
    --b3-font-background7: #fddaab;
    --b3-font-background8: #ffb0a9;
    --b3-font-background9: #fdbfff;
    --b3-font-background10: #b1ffff;
    --b3-font-background11: #affad1;
    --b3-font-background12: #fff88f;
    --b3-font-color1: #3573f0;
    --b3-font-color2: var(--b3-card-warning-color);
    --b3-font-color3: var(--b3-card-info-color);
    --b3-font-color4: var(--b3-card-success-color);
    --b3-font-color5: #9aa0a6;
    --b3-font-color6: #3573f0;
    --b3-font-color7: #f3a92f;
    --b3-font-color8: #d23f31;
    --b3-font-color9: #f5539e;
    --b3-font-color10: #00eeff;
    --b3-font-color11: #74ff00;
    --b3-font-color12: #fff200;
}

/* Dark theme using prefers-color-scheme */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e8e6e3;
        --text-secondary: #a9a196;
        --bg-color: #181a1b;
        --border-color: #393d40;
        --gray-3: #202325;
        --link-color: #7ab6ff;
        --link-hover-color: #a8cfff;
        --link-bg: rgba(60, 97, 129, 0.1);
        --link-bg-hover: rgba(60, 97, 129, 0.2);
        --info-bg: #0c3440;
        --info-color: #8ebad9;
        --warning-bg: #3d3012;
        --warning-color: #e2cc8f;
        --success-bg: #1e3a1e;
        --success-color: #9fd09f;
        --error-bg: #430c11;
        --error-color: #e1868f;
        --blockquote-border: #4a5056;
        --primary-text-color: var(--text-color);
        --primary-bg-color: #242729;
        --primary-box-shadow-color: rgba(0, 0, 0, 0.5);
        --header-bg-color: #242729;
        --header-border-color: #393d40;
        /* Default SiYuan colors */
        --b3-theme-primary: #3573f0;
        --b3-theme-primary-light: rgba(53, 115, 240, 0.72);
        --b3-theme-primary-lighter: rgba(53, 115, 240, 0.48);
        --b3-theme-primary-lightest: rgba(53, 115, 240, 0.24);
        --b3-theme-secondary: #f3a92f;
        --b3-theme-background: #1e1e1e;
        --b3-theme-background-light: rgba(255, 255, 255, 0.075);
        --b3-theme-surface: #262626;
        --b3-theme-surface-light: rgba(41, 42, 45, 0.86);
        --b3-theme-surface-lighter: rgba(230, 230, 230, 0.06);
        --b3-theme-error: #d23f31;
        --b3-theme-success: #65b84d;
        --b3-theme-on-primary: #fff;
        --b3-theme-on-secondary: #fff;
        --b3-theme-on-background: #dadada;
        --b3-theme-on-surface: #9aa0a6;
        --b3-theme-on-surface-light: #bababa;
        --b3-theme-on-error: #fff;
        /* Background colors */
        --b3-font-background5: #4c5257;
        --b3-font-background6: #08296c;
        --b3-font-background7: #593905;
        --b3-font-background8: #541812;
        --b3-font-background9: #843473;
        --b3-font-background10: #329096;
        --b3-font-background11: #568b2a;
        --b3-font-background12: #8d8829;
        --b3-font-color1: #3573f0;
        --b3-font-color2: var(--b3-card-warning-color);
        --b3-font-color3: var(--b3-card-info-color);
        --b3-font-color4: var(--b3-card-success-color);
        --b3-font-color5: #9aa0a6;
        --b3-font-color6: #3573f0;
        --b3-font-color7: #f3a92f;
        --b3-font-color8: #d23f31;
        --b3-font-color9: #f5539e;
        --b3-font-color10: #00eeff;
        --b3-font-color11: #74ff00;
        --b3-font-color12: #fff200;
    }
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Hide the checkbox input */
.toc-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toc-toggle-input:focus {
    outline: none;
}

/* TOC Sidebar Styles */
.toc-sidebar {
    position: fixed;
    right: -300px;
    top: 0;
    width: 300px;
    height: 100%;
    background-color: var(--bg-color);
    border-left: 1px solid var(--border-color);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease;
    padding: 5px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    will-change: right;
    overscroll-behavior: contain;
}

#toc-sidebar::-webkit-scrollbar {
    width: 6px;
}

#toc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#toc-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

/* When checkbox is checked, show the sidebar */
.toc-toggle-input:checked ~ .toc-sidebar {
    right: 0;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 2;
    padding-top: 5px;
}

.toc-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.toc-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.header-icon {
    cursor: pointer;
}

.toc-close-btn:hover {
    color: var(--primary-color);
    background-color: var(--border-color);
}

.toc-nav {
    padding-bottom: 20px;
    position: relative;
}

.toc-footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.toc-list {
    list-style: none;
    padding-left: 0;
}

.toc-item {
    margin-bottom: 10px;
    line-height: 1.4;
    position: relative;
}

.toc-item.active .toc-link {
    color: var(--primary-color);
    font-weight: 500;
}

.toc-subitem {
    padding-left: 20px;
}

.toc-link {
    text-decoration: none;
    color: var(--text-color);
    display: block;
    padding: 5px 0;
    transition: color 0.2s;
}

.toc-link:hover {
    color: var(--primary-color);
}

#toc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    overscroll-behavior: contain;
}

/* Mobile styles */
@media (max-width: 768px) {
    /* Show overlay on mobile when TOC is open */
    .toc-toggle-input:checked ~ #toc-overlay {
        display: block;
        opacity: 1;
    }
}

.content-wrapper {
    transition: margin-right 0.3s ease;
    position: relative;
    min-height: 100vh;
    z-index: 1;
}

/* Improve TOC toggle label behavior */
label[for="toc-toggle"] {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* For keyboard accessibility - focus styles */
.toc-toggle-input:focus-visible + label {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* When sidebar is open, adjust content margin */
.toc-toggle-input:checked ~ .content-wrapper {
    margin-right: 300px;
    transition: margin-right 0.3s ease;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    /* On mobile, content doesn't shift */
    .toc-toggle-input:checked ~ .content-wrapper {
        margin-right: 0;
        transition: none;
    }

    body {
        overflow-x: hidden;
    }
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-anchor: auto;
    scroll-padding-top: 0;
}

body {
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

/* Figure and caption styling */
figure.image-with-caption {
    margin: 1em 0;
    display: inline-block;
    max-width: fit-content;
    clear: both;
}

figure.image-with-caption img {
    max-width: 100%;
    height: auto;
    display: block;
}

figcaption {
    margin-top: 0.5em;
    font-size: 0.9em;
    color: var(--color-text-light);
    font-style: italic;
    text-align: center;
    width: 100%;
    display: block;
}

/* Image alignment classes */
.article-content p img {
    margin-bottom: 16px;
}

/* Center-aligned images through parent div or paragraph */
.article-content p[style*="text-align: center"] img,
.article-content p[style*="text-align: center"] figure.image-with-caption {
    margin-left: auto;
    margin-right: auto;
}

/* Right-aligned images through parent div or paragraph */
.article-content p[style*="text-align: right"] img,
.article-content p[style*="text-align: right"] figure.image-with-caption {
    margin-left: auto;
    margin-right: 0;
}

/* Image container with parent styles */
.article-content p div {
    margin-bottom: 16px;
}

/* Add space between images and other content */
.article-content figure {
    margin-bottom: 1.5em;
}

/* Additional spacing for figures in article content */
.article-content figure.image-with-caption {
    margin-bottom: 1.5em;
}

/* Header styles */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: linear-gradient(
        to bottom,
        var(--bg-color) 60%,
        transparent 100%
    );
    border-bottom: none;
    z-index: 1000;
}

.header-content {
    max-width: 100%;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--horizontal-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-weight: 500;
    font-size: 16px;
    color: var(--text-color);
    font-family: var(--font-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-title:hover {
    color: var(--link-color);
}

.toc-title {
    font-weight: 500;
    font-size: 16px;
    color: var(--text-color);
    font-family: var(--font-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
}

.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    padding: 6px;
    border-radius: 6px;
}

.header-icon:hover {
    color: var(--text-color);
    background-color: var(--gray-3);
}

.header-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
}

/* Container */
.container {
    max-width: var(--content-width);
    width: 100%;
    margin: 0 auto;
    padding-top: calc(var(--header-height) + 64px);
    padding-bottom: 112px; /* 28 * 4 */
    display: flex;
    flex-direction: column;
}

/* Links */
a {
    color: inherit;
    text-decoration: none;
}

/* Links in article content */
.article-content a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

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

.link a {
    /* Specific link styling */
}

.tag a {
    text-decoration: none;
    color: var(--text-color);
    padding: 1px 2px;
    border-radius: 2px;
    border-bottom: 2px dotted var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag a:hover {
    border-bottom-color: var(--link-color);
    color: var(--link-color);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    margin: var(--spacing-3) 0;
}

.back-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
    color: var(--link-color);
    font-size: 14px;
    margin-bottom: var(--spacing-3);
    width: max-content;
    flex-direction: row-reverse;
    transition: color 0.2s;
    text-decoration: none;
}

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

.back-link svg {
    width: 16px;
    height: 16px;
}

/* Article header */
.article-header {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-2);
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: var(--spacing-4);
}

/* Header Image */
.header-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    margin-bottom: var(--spacing-3);
}

.title-container {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: var(--spacing-1);
    position: relative;
}

.article-title {
    font-size: 20px;
    line-height: 1.4;
    font-weight: 500;
    font-family: var(--font-heading);
}

.article-meta {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.article-meta.tag-cloud {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 13px;
    background-color: var(--background-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.meta-tag a {
    text-decoration: none;
    color: inherit;
}

.meta-tag:hover {
    background-color: var(--background-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.meta-tag.date-tag {
    background-color: var(--background-light);
    color: var(--text-primary);
}

.article-meta .meta-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    opacity: 0.8;
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
    margin-top: 6px;
}

/* Article content */
.article-content {
    width: 100%;
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.7;
}

/* Centered content helper class */
.article-content .center-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.article-content h2 {
    font-size: 20px;
    margin-bottom: 16px;
    font-weight: 500;
    font-family: var(--font-heading);
}

.article-content p {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.article-content p:last-of-type {
    margin-bottom: 0;
}

/* Lists */
.article-content ul,
.article-content ol {
    margin-bottom: 16px;
    padding-left: 24px; /* Keep bullets/numbers within content area */
    color: var(--text-secondary);
}

.article-content li {
    margin-bottom: 8px;
}

.article-content li:last-child {
    margin-bottom: 0;
}

/* Tables */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 14px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-color);
    position: relative;
}

/* Custom scrollbars for tables */
.article-content table::-webkit-scrollbar {
    height: 8px;
    background-color: var(--bg-color);
}

.article-content table::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.article-content table::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.article-content table::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-color);
}

.article-content th,
.article-content td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.article-content th {
    font-weight: 500;
    color: var(--text-color);
    background-color: var(--gray-3);
}

.article-content tr:nth-child(even) {
    background-color: var(--gray-3);
}

.article-content td {
    color: var(--text-secondary);
    min-width: 100px; /* Prevent cells from becoming too narrow */
}

/* Additional mobile styles */
@media (max-width: 640px) {
    .article-content table {
        border-radius: 4px;
        white-space: nowrap; /* Prevent text wrapping on mobile */
        box-shadow: 0 0 2px rgba(0, 0, 0, 0.1); /* Subtle shadow to indicate scrollable area */
        margin-bottom: 12px; /* Make room for scrollbar */
    }

    .header-icons {
        gap: var(--spacing-2);
    }

    .header-icon {
        padding: 4px;
    }

    /* TOC sidebar mobile styles */
    .toc-sidebar {
        width: 80%;
        right: -80%;
    }

    /* Already covered above */
}

/* Blockquotes */
.article-content blockquote {
    background-color: var(--gray-3);
    border-left: 4px solid var(--blockquote-border);
    border-radius: 2px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-style: italic;
}

.article-content blockquote p {
    margin-bottom: 0;
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

.article-content blockquote cite {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    text-align: right;
    font-style: normal;
}

/* Code blocks and inline code */
.article-content pre {
    background-color: var(--gray-3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    overflow-x: auto;
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 14px;
    line-height: 1.5;
}

.article-content code {
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 14px;
    background-color: var(--gray-3);
    padding: 2px 4px;
    border-radius: 3px;
}

.article-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

/* Keyboard keys */
.article-content kbd {
    background-color: var(--gray-3);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.85em;
    line-height: 1;
    padding: 2px 4px;
    white-space: nowrap;
}

/* Info boxes - block level */
.article-content .info-box,
.article-content .success-box,
.article-content .warning-box,
.article-content .error-box,
.article-content .custom-box {
    padding: 6px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.article-content .info-box {
    background-color: var(--info-bg);
    color: var(--info-color);
}

.article-content .warning-box {
    background-color: var(--warning-bg);
    color: var(--warning-color);
}

.article-content .success-box {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.article-content .error-box {
    background-color: var(--error-bg);
    color: var(--error-color);
}

/* Inline colored text styles */
.article-content span.info-box,
.article-content span.inline-info-box,
.article-content strong.inline-info-box {
    background-color: var(--info-bg);
    color: var(--info-color);
    margin: 0;
    display: inline;
}

.article-content span.success-box,
.article-content span.inline-success-box,
.article-content strong.inline-success-box {
    background-color: var(--success-bg);
    color: var(--success-color);
    margin: 0;
    display: inline;
}

.article-content span.warning-box,
.article-content span.inline-warning-box,
.article-content strong.inline-warning-box {
    background-color: var(--warning-bg);
    color: var(--warning-color);
    margin: 0;
    display: inline;
}

.article-content span.error-box,
.article-content span.inline-error-box,
.article-content strong.inline-error-box {
    background-color: var(--error-bg);
    color: var(--error-color);
    margin: 0;
    display: inline;
}

/* Navigation links */
.navigation-links {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
    font-size: 12px;
    color: var(--link-color);
    transition: color 0.2s;
    flex-direction: row-reverse;
    text-decoration: none;
}

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

.nav-link svg {
    width: 16px;
    height: 16px;
}

/* Task list styling */
.task-list {
    list-style-type: none;
    padding-left: 5px;
}

.task-list li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 30px;
    list-style: none;
}

.task-checkbox-unchecked {
    position: absolute;
    left: 0;
    top: 2px;
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-color);
    border-radius: 2px;
}

.task-checkbox-checked {
    position: absolute;
    left: 0;
    top: 2px;
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: var(--link-color);
    border-color: var(--border-color);
    border-radius: 2px;
}

/* Ensure no list-style behavior */
.task-checkbox-unchecked::marker,
.task-checkbox-checked::marker {
    display: none;
    content: none;
}

.task-checkbox-checked {
    background-color: #3498db;
    border-color: #3498db;
}

/* Adjust checkbox color in dark mode */
@media (prefers-color-scheme: dark) {
    .task-checkbox-checked {
        background-color: #2980b9;
        border-color: #2980b9;
    }
}

.task-checkbox-checked:after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.task-complete {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* Transcluded block styles */
.transcluded-block {
    position: relative;
    border: 1px dashed var(--blockquote-border);
    padding: 10px;
    margin: 10px 0;
    border-radius: 7px;
}

.transcluded-block:hover {
    border: 1px dashed #3498db;
    border-radius: 7px;
}

.source-link {
    position: absolute;
    top: 2px;
    right: 2px;
    display: none;
    background: #3498db;
    color: white !important;
    border: none;
    border-radius: 5px;
    padding: 2px 5px;
    font-size: 12px;
    text-decoration: none !important;
}

.transcluded-block:hover .source-link {
    display: block;
}

/* Margin info numbers styles (transcluded references and linked mentions) */
.block-with-indicator {
    position: relative;
    /* Ensure text content maintains same width as other elements */
    max-width: var(--content-width);
    /* No margin on the container itself - indicator goes outside */
}

.margin-infonumber {
    position: absolute;
    top: 0;
    z-index: 10;
}

.margin-infonumber.transcluded {
    right: -30px;
}

.margin-infonumber.linked {
    right: -55px;
}

.margin-infonumber.page-mentions {
    position: absolute;
    top: 0;
    right: -30px;
    z-index: 10;
}

.margin-infonumber-count {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    background-color: var(--background-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    min-width: 16px;
    line-height: 14px;
}

.margin-infonumber-tooltip {
    position: absolute;
    top: 30px;
    right: 0;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    min-width: 150px;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.margin-infonumber-tooltip::before {
    content: "";
    position: absolute;
    top: -5px;
    right: 5px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #333;
}

.margin-infonumber-tooltip-title {
    font-weight: bold;
    margin-bottom: 4px;
    border-bottom: 1px solid #555;
    padding-bottom: 4px;
    display: block;
}

.margin-infonumber-tooltip-title:not(:first-child) {
    margin-top: 8px;
    padding-top: 4px;
    border-top: 1px solid #555;
}

.margin-infonumber-tooltip-content {
    display: block;
}

.margin-infonumber-tooltip-content a {
    color: #87ceeb !important;
    text-decoration: none;
    display: block;
    margin: 2px 0;
}

.margin-infonumber-tooltip-content a:hover {
    color: #add8e6 !important;
    text-decoration: underline;
}

.margin-infonumber:hover .margin-infonumber-tooltip {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Hide all margin notes on mobile */
    .margin-infonumber {
        display: none;
    }

    .margin-infonumber.transcluded {
        right: -25px;
    }

    .margin-infonumber.linked {
        right: -45px;
    }

    .margin-infonumber.page-mentions {
        right: -25px;
    }

    .margin-infonumber-tooltip {
        left: auto;
        right: 10px;
        min-width: 120px;
        max-width: calc(100vw - 60px);
    }

    .margin-infonumber-tooltip::before {
        left: auto;
        right: 15px;
    }
}

/* SuperBlock styles */
.superblock {
    display: flex;
    width: 100%;
}

.superblock-col {
    flex-direction: column;
}

.superblock-row {
    flex-direction: row;
    gap: 20px; /* Space between items in a row */
}

/* Direct children of row superblocks get equal width */
.superblock-row > * {
    flex: 1;
    min-width: 0; /* Prevent overflow issues */
}

/* Make nested superblocks take full width of their container */
.superblock .superblock {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* First superblock in content doesn't need top margin */
.article-content > .superblock:first-child {
    margin-top: 0;
}

/* Heading and paragraph spacing within superblocks */
.superblock h2,
.superblock h3,
.superblock h4,
.superblock h5,
.superblock h6 {
    margin-top: 0; /* Remove default top margin to keep content tight within blocks */
}

/* Tooltip styles */
.tooltip {
    display: inline;
    position: relative;
    text-align: left;
}

.tooltip bottom {
    display: none;
}

.tooltip .right {
    min-width: 200px;
    max-width: 500px;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    color: white;
    background: #333;
    font-weight: normal;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 6px;
    position: absolute;
    z-index: 1000;
    box-sizing: border-box;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    display: none;
    letter-spacing: 0.01em;
    white-space: normal;
}

.tooltip:hover .right {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.tooltip .right::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #333;
}

.tooltip .right i {
    display: none;
}

.right .tooltip-title {
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
    color: white;
    line-height: 1.4;
    border-bottom: 1px solid #555;
    padding-bottom: 4px;
}

.right .tooltip-excerpt {
    display: block;
    color: white;
    line-height: 1.5;
    margin-top: 0;
}

.right .tooltip-reference {
    font-size: 13px;
    display: block;
    color: var(--text-secondary);
    line-height: 1.4;
    font-style: italic;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
}

.right .tooltip-excerpt a {
    color: #87ceeb !important;
    text-decoration: none;
}

.right .tooltip-excerpt a:hover {
    color: #add8e6 !important;
    text-decoration: underline;
}

/* Memo highlighting styles */
.memo-highlight {
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(255, 193, 7, 0.3) 90%
    );
    color: inherit;
    padding: 1px 2px;
    border-bottom: 1.5px dashed #ffc107;
    cursor: help;
    transition: all 0.2s ease;
    position: relative;
}

.memo-highlight:hover {
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(23, 162, 184, 0.3) 90%
    );
    border-bottom-color: #17a2b8;
}

/* Dark mode memo highlighting */
@media (prefers-color-scheme: dark) {
    .memo-highlight {
        background: linear-gradient(
            to bottom,
            transparent 60%,
            rgba(255, 193, 7, 0.2) 60%
        );
        border-bottom-color: #ffc107;
    }

    .memo-highlight:hover {
        background: linear-gradient(
            to bottom,
            transparent 60%,
            rgba(23, 162, 184, 0.2) 60%
        );
        border-bottom-color: #17a2b8;
    }

    .tag a {
        border-bottom-color: var(--text-secondary);
    }

    .tag a:hover {
        border-bottom-color: var(--link-color);
        color: var(--link-color);
    }
}

.memo-text {
    /* Wrapper for the memo text content */
    display: inline;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .container {
        padding-top: calc(var(--header-height) + 32px);
        width: calc(100% - 40px);
        transition:
            transform 0.3s ease,
            opacity 0.3s ease;
    }

    .header-content {
        padding: 0 var(--spacing-3);
    }

    .superblock-row {
        flex-direction: column;
        gap: 10px;
    }

    .superblock-row > * {
        width: 100%;
    }

    /* Mobile tooltip adjustments */
    .tooltip .right {
        min-width: 150px;
        max-width: 350px;
        left: 50%;
        transform: translateX(-50%);
        white-space: normal;
    }

    .tooltip .right::before {
        left: 50%;
        transform: translateX(-50%);
    }
}
