/* App-wide styling */
body {
    background-color: #ffffff;
    color: #1f2937;
    /* 优先使用 Iowan Old Style BT，如果没有则回退 Georgia 与系统衬线 */
    font-family: var(--font-serif, "Iowan Old Style BT", Georgia, serif);
    margin: 20px;
    color-scheme: light;
    font-size: 15px; /* serif 更适合略大字号 */
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#hero {
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#links {
    width: 400px;
    text-align: left;
    font-size: x-large;
    color: #1f2937;
    display: flex;
    flex-direction: column;
}

#links a {
    color: #1f2937;
    text-decoration: none;
    margin-top: 20px;
    margin: 10px 0px;
    border: #1f2937 1px solid;
    border-radius: 5px;
    padding: 10px;
}

#links a:hover {
    background-color: #f3f4f6;
    cursor: pointer;
}

#header {
    max-width: 1200px;
}

/* Theme Variables */
:root {
    --primary-color: #2d3748;
    --accent-color: #3182ce;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --background-primary: #ffffff;
    --background-secondary: #f7fafc;
    --background-tertiary: #edf2f7;
    --border-light: #e2e8f0;
    --border-medium: #cbd5e0;
    --code-background: #1a202c;
    --code-text: #e2e8f0;
    --code-border: #2d3748;
    --link-color: #3182ce;
    --link-hover: #2c5aa0;
    /* 字体栈变量 */
    --font-serif: "Iowan Old Style BT", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Academic Blog Article Styling */
.prose {
    font-family: var(--font-serif);
    line-height: 1.7;
    color: var(--text-primary);
    max-width: none;
    font-size: 15.5px; /* 衬线正文稍加 0.5px 更舒适 */
    font-variant-ligatures: common-ligatures;
}

/* Headings with academic hierarchy */
.prose h1 {
    font-size: 2rem;
    font-weight: 600; /* Old Style serif 通常稍降权重更优雅 */
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1.15rem;
    letter-spacing: -0.01em; /* 减少负字距避免衬线拥挤 */
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.prose h2 {
    font-size: 1.55rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 0.85rem;
    letter-spacing: -0.012em;
    position: relative;
    /* padding-left: 0.75rem; */
}

.prose h3 {
    font-size: 1.28rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 1.7rem;
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
}

.prose h4 {
    font-size: 1.125rem;  /* 从 1.25rem 减小到 1.125rem */
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Paragraphs with academic spacing */
.prose p {
    margin-top: 1rem;
    margin-bottom: 1rem;
    text-align: justify;
    font-size: 1rem;     /* 从 1.125rem 减小到 1rem */
    line-height: 1.7;    /* 从 1.8 减小到 1.7 */
}

/* Enhanced blockquotes */
.prose blockquote {
    font-style: italic;
    border-left: 4px solid var(--border-light);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    background-color: var(--background-secondary);
    padding: 1.25rem;
    border-radius: 0 8px 8px 0;
    position: relative;
    font-size: 0.95rem;   /* 从 1.1rem 减小到 0.95rem */
    color: var(--text-secondary);
}

.prose blockquote::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    font-size: 3rem;
    color: var(--border-medium);
    font-family: serif;
    line-height: 1;
}

/* Professional code blocks */
.prose pre {
    background-color: var(--code-background);
    color: var(--code-text);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--code-border);
    position: relative;
}

.prose pre::before {
    content: "Code";
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-size: 0.6875rem;  /* 从 0.75rem 减小到 0.6875rem */
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prose code {
    background-color: var(--background-tertiary);
    color: var(--primary-color);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;     /* 从 0.9em 减小到 0.85em */
    font-weight: 500;
}

.prose pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 0.8125rem;  /* 从 0.875rem 减小到 0.8125rem */
}

/* Academic table styling - minimalist with horizontal lines only */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem auto;
    background-color: var(--background-primary);
    border-top: 1px solid var(--primary-color);
    border-bottom: 1px solid var(--primary-color);
}

.prose thead {
    background-color: transparent;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-medium);
}

.prose th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: transparent;
    border: none;
}

.prose td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border: none;
}

.prose tbody tr {
    background-color: transparent;
    border-bottom: 1px solid var(--border-light);
}

.prose tbody tr:last-child {
    border-bottom: none;
}

.prose tbody tr:hover {
    background-color: transparent;
}

/* Enhanced lists */
.prose ul, .prose ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.prose li {
    margin: 0.75rem 0;
    line-height: 1.7;
    padding-left: 0.5rem;
}

/* Unordered list styling */
.prose ul {
    list-style-type: disc;
}

.prose ul li {
    position: relative;
    padding-left: 0.75rem;
}

.prose ul li::marker {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.1em;
}

/* Nested unordered lists */
.prose ul ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    list-style-type: circle;
}

.prose ul ul li::marker {
    color: var(--text-secondary);
    font-size: 1em;
}

.prose ul ul ul {
    list-style-type: square;
}

.prose ul ul ul li::marker {
    color: var(--text-muted);
}

/* Ordered list styling */
.prose ol {
    list-style-type: decimal;
}

.prose ol li::marker {
    color: var(--accent-color);
    font-weight: bold;
}

/* Links with academic styling */
.prose a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
}

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

/* Emphasis and strong text */
.prose em {
    font-style: italic;
    color: var(--text-secondary);
}

.prose strong,
.prose b {
    font-weight: 800;
    color: var(--primary-color);
}

/* Article header styling */
.prose header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.prose header h1 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 1rem;
    font-size: 2rem;      /* 从 2.5rem 减小到 2rem */
}

.prose img {
    margin: auto;
}

/* Metadata styling */
.prose header .text-sm {
    color: var(--text-muted);
    font-size: 0.875rem;  /* 从 0.95rem 减小到 0.875rem */
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* Tag styling */
.prose header span[class*="bg-gray"] {
    background-color: var(--background-tertiary) !important;
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.8125rem; /* 从 0.875rem 减小到 0.8125rem */
    padding: 0.3rem 0.625rem;
    border-radius: 5px;
    border: 1px solid var(--border-light);
}

/* Article content wrapper */
.prose > div[class*="dangerous_inner_html"] {
    margin-top: 2rem;
}

/* Print styles for academic papers */
@media print {
    .prose {
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
    }

    .prose h1, .prose h2, .prose h3 {
        color: #000;
        page-break-after: avoid;
    }

    .prose pre, .prose blockquote {
        page-break-inside: avoid;
    }
}
