/* =========================================
   Elegant Academic Blog Theme
   Refined, minimal, sophisticated
   ========================================= */

/* CSS Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables - Light Theme */
:root {
    --bg-primary: #fcfcfc;
    --bg-secondary: #f7f7f5;
    --bg-card: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.03);
    --text-primary: #2d2d2d;
    --text-secondary: #5a5a5a;
    --text-tertiary: #7a7a7a;
    --text-muted: #999999;
    --accent-primary: #1a1a1a;
    --accent-secondary: #444444;
    --accent-warm: #8b7355;
    --border-light: rgba(0, 0, 0, 0.08);
    --border-medium: rgba(0, 0, 0, 0.12);
    --code-bg: #f5f5f3;
    --code-text: #b5544a;
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.06);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


/* Base Styles */
html {
    font-size: 17px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-primary);
    font-family: 'Source Serif Pro', 'Georgia', 'Times New Roman', serif;
    font-weight: 400;
    line-height: 1.75;
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Source Serif Pro', 'Georgia', serif;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2.4rem;
    margin-bottom: 0.6rem;
}

h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

h3 {
    font-size: 1.2rem;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

strong {
    font-weight: 600;
    color: var(--text-primary);
}

em {
    font-style: italic;
}

/* Elegant Links */
a {
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity var(--transition-smooth);
}

a:hover {
    opacity: 0.6;
}

/* =========================================
   Header & Navigation
   ========================================= */
header {
    position: sticky;
    top: 0;
    width: 100%;
    background: var(--bg-primary);
    z-index: 100;
    transition: background-color var(--transition-smooth);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.site-name {
    font-family: 'Source Serif Pro', 'Georgia', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.site-name:hover {
    opacity: 0.6;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

header nav a {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-tertiary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: color var(--transition-smooth);
}

header nav a:hover {
    color: var(--text-primary);
    opacity: 1;
}

header hr {
    display: none;
}

/* =========================================
   Dark Mode Toggle
   ========================================= */
.dark-mode-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 42px;
    height: 42px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-smooth);
    z-index: 99;
}

.dark-mode-toggle:hover {
    transform: scale(1.08);
    border-color: var(--border-medium);
}

/* =========================================
   Main Content
   ========================================= */
main {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   Homepage
   ========================================= */
.home {
    padding: 6rem 0 4rem;
    text-align: center;
}

.home h1 {
    font-size: 2.8rem;
    font-weight: 400;
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
}

.home h2 {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-tertiary);
    margin-bottom: 0.2rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.home .tagline {
    margin-top: 2rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.home .cta-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
}

.btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.9rem 2rem;
    border-radius: 2px;
    transition: all var(--transition-smooth);
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
    border: 1px solid var(--text-primary);
}

.btn-primary:hover {
    background: transparent;
    color: var(--text-primary);
    opacity: 1;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    border-color: var(--text-primary);
    opacity: 1;
}

/* =========================================
   About Page
   ========================================= */
.about {
    max-width: 600px;
    margin: 0 auto;
    padding-top: 2rem;
}

.about h1 {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.about p {
    font-size: 1.05rem;
    line-height: 1.85;
    margin-bottom: 1.75rem;
}

.about h3 {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-top: 3rem;
    margin-bottom: 1.25rem;
}

.interests {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.interest-tag {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 2px;
    transition: all var(--transition-smooth);
}

.interest-tag:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* =========================================
   Contact Page
   ========================================= */
.contact {
    max-width: 500px;
    margin: 0 auto;
    padding-top: 2rem;
}

.contact h1 {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 1rem;
}

.contact > p {
    font-size: 1.05rem;
    margin-bottom: 3rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-smooth);
}

.contact-item:first-child {
    border-top: 1px solid var(--border-light);
}

.contact-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 90px;
}

.contact-item a {
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* =========================================
   Blog List
   ========================================= */

.blog-list {
    max-width: 480px;
    margin: 0 auto;
    padding-top: 0.5rem;
}

.blog-list > p {
    color: var(--text-tertiary);
    font-style: italic;
    margin-bottom: 3rem;
    font-size: 1.05rem;
}


.blog-item {
    padding: 1.1rem 0 1.1rem 0;
    border-bottom: 1px solid var(--border-light);
    opacity: 0;
    animation: slideUp 0.5s ease-out forwards;
    margin: 0;
}

.blog-item:first-of-type {
    padding-top: 0;
}

.blog-item:last-child {
    border-bottom: none;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.blog-item h2 {
    font-size: 1.35rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.blog-item h2 a {
    color: var(--text-primary);
}

.blog-item h2 a:hover {
    opacity: 0.6;
}

.post-date {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.post-excerpt {
    color: var(--text-secondary);
    margin-top: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.7;
}

.tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.3rem 0.6rem;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: 2px;
}

/* =========================================
   Blog Post / Article
   ========================================= */
.page-article {
    max-width: 640px;
    margin: 0 auto;
}

.page-title {
    margin-bottom: 1.2rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border-light);
}

.page-title h1 {
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 0.75rem;
}

.page-content {
    font-size: 1.05rem;
    line-height: 1.9;
}

.page-content h2 {
    font-size: 1.4rem;
    font-weight: 500;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-content h3 {
    font-size: 1.15rem;
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}

.page-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.page-content ul,
.page-content ol {
    margin-bottom: 1.75rem;
    padding-left: 1.25rem;
    color: var(--text-secondary);
}

.page-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.page-content a {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-medium);
    transition: border-color var(--transition-smooth);
}

.page-content a:hover {
    border-color: var(--text-primary);
    opacity: 1;
}

/* =========================================
   Blockquotes
   ========================================= */
blockquote {
    margin: 2.5rem 0;
    padding: 0 0 0 1.5rem;
    border-left: 2px solid var(--border-medium);
}

blockquote p {
    font-style: italic;
    color: var(--text-tertiary);
    margin-bottom: 0;
}

blockquote cite {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-style: normal;
    color: var(--text-muted);
}

/* =========================================
   Code
   ========================================= */
code {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--code-text);
}

pre {
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 2rem 0;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* =========================================
   Tables
   ========================================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
}

table th,
table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

table th {
    font-weight: 600;
    color: var(--text-primary);
}

table tbody tr:hover {
    background: var(--bg-hover);
}

/* =========================================
   Math Equations
   ========================================= */
.katex-display,
.MathJax_Display {
    margin: 2rem 0 !important;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow-x: auto;
}

/* =========================================
   Figures
   ========================================= */
figure {
    margin: 2.5rem 0;
    text-align: center;
}

figure img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

figcaption {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

img {
    max-width: 100%;
    height: auto;
}

/* =========================================
   Footer
   ========================================= */
footer {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* =========================================
   Bibliography
   ========================================= */
.bibliography {
    list-style: none;
    padding: 0;
    margin: 2rem 0;
}

.bibliography li {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
    position: relative;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.bibliography li::before {
    content: "[" counter(list-item) "]";
    position: absolute;
    left: 0;
    font-weight: 500;
    color: var(--text-muted);
}

/* =========================================
   Footnotes
   ========================================= */
.footnotes {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.footnotes ol {
    padding-left: 1.25rem;
}

.footnotes li {
    margin-bottom: 0.5rem;
}

sup a {
    color: var(--text-muted);
    font-weight: 500;
}

:target {
    scroll-margin-top: 100px;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 640px) {
    html {
        font-size: 16px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem 1.25rem;
    }
    
    header nav ul {
        gap: 1.5rem;
    }
    
    main {
        padding: 1.5rem 1.25rem 3rem;
    }
    
    .home {
        padding: 4rem 0 3rem;
    }
    
    .home h1 {
        font-size: 2.2rem;
    }
    
    .home .cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
    
    .page-title h1 {
        font-size: 1.6rem;
    }
    
    .dark-mode-toggle {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 38px;
        height: 38px;
    }
}

/* Focus states */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* Print */
@media print {
    header, footer, .dark-mode-toggle {
        display: none;
    }
    
    body {
        font-size: 11pt;
        color: black;
        background: white;
    }
}
