:root {
    --bg: #fafafa;
    --fg: #1a1a1a;
    --muted: #555;
    --accent: #2563eb;
    --border: #e0e0e0;
    --card-bg: #f5f5f0;
    --code-bg: #f0f0f0;
    --highlight: #fffbeb;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.8;
    font-size: 17px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==================== NAVIGATION ==================== */
.site-header {
    border-bottom: 1px solid var(--border);
    background: #fff;
    padding: 0 24px;
}

.header-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.site-title {
    font-family: Georgia, serif;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--fg);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.site-title:hover {
    color: var(--accent);
    text-decoration: none;
}

.site-nav a {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.88em;
    color: var(--muted);
    text-decoration: none;
    margin-left: 24px;
    letter-spacing: 0.02em;
}

.site-nav a:hover {
    color: var(--accent);
    text-decoration: none;
}

.site-nav a.active {
    color: var(--accent);
    font-weight: 600;
}

/* ==================== FOOTER ==================== */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 80px;
    padding: 24px 0;
    color: var(--muted);
    font-size: 0.82em;
    text-align: center;
}

.site-footer a {
    color: var(--muted);
}

.site-footer a:hover {
    color: var(--accent);
}

/* ==================== PAGE CONTENT ==================== */
.page-content {
    padding: 48px 24px 0;
    max-width: 720px;
    margin: 0 auto;
}

/* ==================== HEADINGS ==================== */
h1 {
    font-size: 2em;
    line-height: 1.3;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.4em;
    margin-top: 56px;
    margin-bottom: 16px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

h3 {
    font-size: 1.15em;
    margin-top: 36px;
    margin-bottom: 12px;
}

h4 {
    font-size: 1.05em;
    margin-top: 28px;
    margin-bottom: 10px;
}

h5 {
    font-size: 0.95em;
    margin-top: 20px;
    margin-bottom: 8px;
    font-weight: 600;
}

p { margin-bottom: 16px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ==================== ABOUT PAGE ==================== */
.about-header {
    margin-bottom: 32px;
}

.about-header h1 {
    margin-bottom: 4px;
}

.about-header .subtitle {
    color: var(--muted);
    font-size: 1em;
    font-style: italic;
    margin-bottom: 0;
}

.about-content {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
}

.about-text {
    flex: 1;
}

.about-photo {
    flex: 0 0 180px;
}

.about-photo img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.about-photo .address {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.82em;
    color: var(--muted);
    margin-top: 8px;
    text-align: center;
}

@media (max-width: 600px) {
    .about-content {
        flex-direction: column-reverse;
    }
    .about-photo {
        flex: none;
        text-align: center;
    }
    .about-photo img {
        width: 160px;
    }
}

/* ==================== NEWS TABLE ==================== */
.news {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding-top: 24px;
}

.news h2 {
    margin-top: 0;
    font-size: 1.2em;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 16px;
}

.news table {
    width: 100%;
    border-collapse: collapse;
}

.news table td {
    padding: 8px 0;
    vertical-align: top;
    border: none;
    border-bottom: 1px solid #f0f0f0;
}

.news table .date {
    width: 120px;
    color: var(--muted);
    font-size: 0.88em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    white-space: nowrap;
    padding-right: 16px;
}

.news table .announcement {
    font-size: 0.95em;
}

/* ==================== SOCIAL ICONS ==================== */
.social {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding-top: 24px;
    text-align: center;
}

.social .contacticon {
    display: block;
    font-size: 48px;
    margin-bottom: 8px;
}

.social .contacticon a {
    color: var(--muted);
    margin: 0 6px;
    transition: color 0.15s;
}

.social .contacticon a:hover {
    color: var(--accent);
    text-decoration: none;
}

.social .caption {
    color: var(--muted);
    font-size: 0.85em;
}

/* ==================== BLOG LISTING ==================== */
.blog-header {
    margin-bottom: 40px;
}

.blog-header h1 {
    margin-bottom: 4px;
}

.blog-header .subtitle {
    color: var(--muted);
    font-size: 1em;
    font-style: italic;
}

.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.post-list > li {
    /* padding: 24px 0; */
    border-bottom: 1px solid #f0f0f0;
}

.post-list > li:first-child {
    padding-top: 0;
}

.post-list .post-title {
    font-size: 1.2em;
    line-height: 1.4;
    margin-bottom: 4px;
    font-weight: 600;
    margin-top: 0;
}

.post-list .post-title a {
    color: var(--fg);
}

.post-list .post-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

.post-list .post-meta {
    color: var(--muted);
    font-size: 0.85em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-bottom: 4px;
}

.post-list .post-desc {
    color: var(--muted);
    font-size: 0.92em;
}

/* ==================== BLOG POST ==================== */
.post-header {
    margin-bottom: 40px;
}

.post-header h1 {
    font-size: 1.8em;
}

.post-header .post-meta {
    color: var(--muted);
    font-size: 0.9em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.post-content h2 {
    font-size: 1.3em;
}

.post-content h3 {
    font-size: 1.1em;
}

.post-content h4 {
    font-size: 1em;
    font-weight: 600;
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 12px 20px;
    margin: 20px 0;
    color: var(--muted);
    background: #f8f8f6;
    border-radius: 0 6px 6px 0;
}

.post-content blockquote p {
    font-style: italic;
    margin-bottom: 8px;
}

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

/* ==================== PUBLICATIONS ==================== */
.publications-header {
    margin-bottom: 32px;
}

.publications-header h1 {
    margin-bottom: 4px;
}

.publications-header .subtitle {
    color: var(--muted);
    font-size: 0.95em;
    font-style: italic;
}

.year {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--accent);
    margin-top: 40px;
    margin-bottom: 16px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.bibliography {
    list-style: none;
    padding: 0;
    margin: 0 0 32px 0;
}

.bibliography li {
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
}

.bibliography li span {
    display: block;
}

.bibliography li .title {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 1em;
}

.bibliography li .author {
    color: var(--muted);
    font-size: 0.9em;
    margin-bottom: 4px;
}

.bibliography li .author em {
    font-style: normal;
    font-weight: 600;
    color: var(--fg);
}

.bibliography li .author a {
    color: var(--muted);
    border-bottom: 1px dashed var(--accent);
}

.bibliography li .author a:hover {
    color: var(--accent);
    text-decoration: none;
    border-bottom-style: solid;
}

.bibliography li .periodical {
    font-size: 0.88em;
    color: var(--muted);
    margin-bottom: 6px;
}

.bibliography li .periodical em {
    font-style: normal;
    font-weight: 600;
    color: var(--accent);
}

.bibliography li .links {
    font-size: 0.85em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.bibliography li .links a {
    display: inline-block;
    padding: 2px 8px;
    background: #f0f4ff;
    border-radius: 3px;
    margin-right: 6px;
    font-size: 0.92em;
}

.bibliography li .links a:hover {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.bibliography li .hidden {
    font-size: 0.88em;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.bibliography li .hidden.open {
    max-height: 100em;
}

.bibliography li .hidden p {
    margin: 10px 0;
    line-height: 1.6;
}

.bibliography li .hidden pre {
    font-size: 0.92em;
    line-height: 1.4;
    padding: 10px;
}

/* ==================== PROJECTS ==================== */
.projects-header {
    margin-bottom: 32px;
}

.projects-header h1 {
    margin-bottom: 4px;
}

.projects-header .subtitle {
    color: var(--muted);
    font-size: 0.95em;
    font-style: italic;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.project-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.15s;
}

.project-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.project-card a {
    display: block;
    text-decoration: none;
    color: var(--fg);
}

.project-card a:hover {
    text-decoration: none;
}

.project-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.project-card .project-info {
    padding: 12px 16px;
}

.project-card .project-info h3 {
    font-size: 1em;
    margin: 0 0 4px;
}

.project-card .project-info p {
    font-size: 0.85em;
    color: var(--muted);
    margin: 0;
}

/* ==================== CODE ==================== */
code {
    font-family: 'SF Mono', 'Fira Code', 'Source Code Pro', Consolas, monospace;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.88em;
}

pre {
    margin: 16px 0;
    padding: 16px;
    background: #f8f8f6;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow-x: auto;
    line-height: 1.5;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.85em;
}

/* Syntax highlighting */
.highlight { background: #f8f8f6; }
.highlight .c, .highlight .cs, .highlight .cm, .highlight .cp, .highlight .c1 { color: #6a737d; font-style: italic; }
.highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kt, .highlight .kp { color: #d73a49; }
.highlight .na, .highlight .nb, .highlight .nc, .highlight .no, .highlight .nd, .highlight .ni, .highlight .ne, .highlight .nf, .highlight .nl, .highlight .nn, .highlight .nx { color: #6f42c1; }
.highlight .mi, .highlight .il { color: #005cc5; }
.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .s3, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .s1 { color: #032f62; }
.highlight .o { color: #d73a49; }
.highlight .p { font-size: 1em; }
.highlight .bp { color: #005cc5; }
.highlight .mf { color: #005cc5; }
.highlight .err { color: #d73a49; }

/* ==================== TABLES (GENERIC) ==================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95em;
}

th, td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

th { background: var(--card-bg); font-weight: 600; }

/* ==================== LISTS ==================== */
ol, ul {
    margin-bottom: 16px;
    padding-left: 28px;
}

li { margin-bottom: 8px; }

/* ==================== BLOG POST COMPONENTS ==================== */
.subtitle {
    color: var(--muted);
    font-size: 1.05em;
    margin-bottom: 40px;
    font-style: italic;
}

.note {
    background: #f3f0ff;
    border-left: 3px solid #7c5cbf;
    padding: 16px 20px;
    margin: 24px 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.95em;
}

.note strong { color: #4c3a8a; }

.warning {
    background: var(--highlight);
    border-left: 3px solid #d97706;
    padding: 16px 20px;
    margin: 24px 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.95em;
}

.warning strong { color: #92400e; }

.diagram {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    margin: 24px 0;
    overflow-x: auto;
    text-align: center;
}

.diagram svg {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.eq-block {
    margin: 20px 0;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow-x: auto;
}

.eq-label {
    font-size: 0.82em;
    color: var(--muted);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-bottom: 4px;
}

.step {
    counter-increment: step-counter;
    padding-left: 36px;
    position: relative;
    margin-bottom: 28px;
}

.step::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 2px;
    width: 26px;
    height: 26px;
    background: #f0f4ff;
    color: #1e40af;
    border: 1.5px solid #2563eb;
    border-radius: 50%;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.steps { counter-reset: step-counter; }

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 48px 0;
}

.toc {
    background: var(--card-bg);
    padding: 20px 28px;
    border-radius: 8px;
    margin-bottom: 40px;
}

.toc h3 { margin-top: 0; font-size: 1em; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.toc ol { margin-bottom: 0; }
.toc li { margin-bottom: 4px; font-size: 0.95em; }

/* ==================== IMAGES ==================== */
.center-image {
    display: block;
    margin: 16px auto;
}

/* ==================== UTILITY ==================== */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
