/* Custom footer styles */
.md-footer {
    background-color: #f8f8f8;
    border-top: 1px solid #e0e0e0;
}

.md-footer-meta {
    background-color: #f8f8f8;
}

.md-copyright {
    color: #333 !important;
    font-size: 0.7rem !important;
    opacity: 1 !important;
    text-align: left;
    padding: 1rem;
}

.md-copyright__highlight {
    color: #333 !important;
    font-size: 0.7rem !important;
    opacity: 1 !important;
}

.md-copyright a {
    color: #0066cc !important;
    text-decoration: underline;
    opacity: 1 !important;
}

.md-copyright a:hover {
    color: #004499 !important;
}

/* Enhanced typography for better readability */
:root {
    /* Modern font stack with beautiful monospace and sans-serif fonts */
    --md-text-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    --md-code-font: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", "Source Code Pro", "Fira Code", "Consolas", "Liberation Mono", "Menlo", "Courier New", monospace;
    
    /* Enhanced spacing for better readability */
    --md-typeset-line-height: 1.8;
    --md-typeset-paragraph-spacing: 1.2rem;
    --md-typeset-mark-margin: 0.2em;
    --md-typeset-del-margin: 0.2em;
    --md-typeset-ins-margin: 0.2em;
    --md-typeset-sub-sup-margin: 0.3em;
    
    /* Letter spacing improvements */
    --md-text-letter-spacing: 0.01em;
    --md-typeset-letter-spacing: 0.01em;
}

/* Apply enhanced typography to body */
.md-content {
    font-family: var(--md-text-font);
    line-height: var(--md-typeset-line-height);
    letter-spacing: var(--md-text-letter-spacing);
    color: var(--md-default-fg-color);
}

/* Enhanced paragraph styling */
.md-content p {
    margin-bottom: var(--md-typeset-paragraph-spacing);
    line-height: var(--md-typeset-line-height);
    letter-spacing: var(--md-typeset-letter-spacing);
    text-align: justify;
    text-justify: inter-ideograph;
    hyphens: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Enhanced code block styling */
.md-content pre {
    font-family: var(--md-code-font);
    letter-spacing: 0.02em;
    line-height: 1.6;
    margin: 1em 0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.md-content code {
    font-family: var(--md-code-font);
    letter-spacing: 0.01em;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    background-color: rgba(0, 0, 0, 0.05);
    font-size: 0.9em;
}

/* Enhanced heading styling */
.md-content h1,
.md-content h2,
.md-content h3,
.md-content h4,
.md-content h5,
.md-content h6 {
    font-family: var(--md-text-font);
    letter-spacing: -0.01em;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.md-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
}

.md-content h2 {
    font-size: 1.8rem;
    font-weight: 600;
}

.md-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Enhanced list styling */
.md-content ul,
.md-content ol {
    margin-bottom: var(--md-typeset-paragraph-spacing);
    line-height: var(--md-typeset-line-height);
    letter-spacing: var(--md-typeset-letter-spacing);
}

.md-content li {
    margin-bottom: 0.5rem;
    line-height: var(--md-typeset-line-height);
}

/* Enhanced blockquote styling */
.md-content blockquote {
    border-left: 4px solid var(--md-primary-fg-color);
    padding-left: 1.2rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--md-default-fg-color--light);
    letter-spacing: 0.01em;
    line-height: var(--md-typeset-line-height);
}

/* Enhanced table styling */
.md-content table {
    margin: 1.5rem 0;
    border-collapse: collapse;
    width: 100%;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.md-content th,
.md-content td {
    padding: 0.8rem 1rem;
    border: 1px solid var(--md-default-fg-color--lightest);
    line-height: var(--md-typeset-line-height);
}

.md-content th {
    background-color: var(--md-default-fg-color--lightest);
    font-weight: 600;
}

/* Enhanced link styling */
.md-content a {
    color: var(--md-primary-fg-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.md-content a:hover {
    color: var(--md-accent-fg-color);
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    :root {
        --md-typeset-line-height: 1.7;
        --md-typeset-paragraph-spacing: 1rem;
        --md-text-letter-spacing: 0.005em;
    }
    
    .md-content h1 {
        font-size: 1.8rem;
    }
    
    .md-content h2 {
        font-size: 1.5rem;
    }
    
    .md-content h3 {
        font-size: 1.3rem;
    }
}

/* Print optimization */
@media print {
    :root {
        --md-typeset-line-height: 1.6;
        --md-text-letter-spacing: 0em;
    }
    
    .md-content {
        font-size: 12pt;
    }
}

/* Mermaid diagram responsive styling */
.mermaid {
    background-color: transparent;
    text-align: center;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
}

.mermaid svg {
    max-width: 100%;
    height: auto;
}

/* Mobile responsive for Mermaid diagrams */
@media (max-width: 768px) {
    .mermaid {
        transform: scale(0.85);
        transform-origin: top center;
        width: 118%;
        margin-left: -9%;
        overflow-x: auto;
        overflow-y: hidden;
        background-color: #fafafa;
        padding: 1rem 0;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .mermaid svg {
        min-width: 600px;
    }
}

/* Medium screen optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .mermaid {
        transform: scale(0.92);
        transform-origin: top center;
        width: 109%;
        margin-left: -4.5%;
        overflow-x: auto;
    }
    
    .mermaid svg {
        min-width: 800px;
    }
}

/* Enhanced clickable cursor for interactive elements */
.mermaid {
    cursor: pointer;
    transition: all 0.3s ease;
}

.mermaid:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Container for scrollable diagrams */
.mermaid-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 1.5rem 0;
    border-radius: 8px;
    background-color: #fafafa;
    padding: 1rem;
}

@media (max-width: 768px) {
    .mermaid-container {
        padding: 0.5rem;
        background-color: transparent;
        box-shadow: none;
    }
}