/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lato', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #212121;
    background-color: #ffffff;
}

a {
    color: #1a7c1a;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #155515;
    text-decoration: underline;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
header {
    background-color: #224422;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

header h1 .name-link {
    color: white;
    text-decoration: none;
}

header h1 .name-link:hover {
    text-decoration: none;
    opacity: 0.9;
}

header h1 .pledge-diamond {
    font-size: 0.55em;
    vertical-align: middle;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

header h1 .pledge-diamond:hover {
    transform: scale(1.2);
}

header h1 .pause-icon {
    display: inline-block;
    vertical-align: middle;
    text-decoration: none;
    transition: transform 0.2s ease;
}

header h1 .pause-icon img {
    width: 22px;
    height: 22px;
    display: block;
}

header h1 .pause-icon:hover {
    text-decoration: none;
    transform: scale(1.2);
}

nav {
    display: flex;
    gap: 0.5rem;
}

nav a {
    color: white;
    font-weight: 500;
    padding: 0.5rem 0.55rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

nav a:hover,
nav a.active {
    background-color: rgba(255, 255, 255, 0.15);
    text-decoration: none;
}

/* Main Content */
main {
    padding-top: 2rem;
}

section {
    padding: 2rem 0;
}

h2 {
    font-size: 1.8rem;
    color: #224422;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #224422;
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.4rem;
    color: #336633;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

h4 {
    font-size: 1.1rem;
    color: #224422;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* Hero Section */
.hero {
    background-color: #f5f5f5;
    padding: 3rem 0;
}

.intro p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

/* Research Interests */
.research-interests {
    background-color: white;
}

.research-interests ul {
    list-style: none;
    padding-left: 0;
}

.research-interests li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.research-interests li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #224422;
    font-weight: bold;
}

/* Awards Section */
.awards {
    background-color: #f5f5f5;
}

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

.awards li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.awards li:before {
    content: "★";
    position: absolute;
    left: 0;
    color: #224422;
}

/* Contact Section */
.contact {
    background-color: white;
}

.contact-info {
    margin-bottom: 1.5rem;
}

.contact-info p {
    margin-bottom: 0.5rem;
}

.links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.links a {
    background-color: #224422;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.links a:hover {
    background-color: #336633;
    text-decoration: none;
}

/* Publications Page */
.publications {
    background-color: white;
}

.pub-stats {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
}

.pub-stats p {
    margin-bottom: 0.5rem;
}

.pub-list {
    counter-reset: pub-counter;
    list-style: none;
    padding-left: 0;
}

.pub-list li {
    counter-increment: pub-counter;
    margin-bottom: 1.5rem;
    padding-left: 2.5rem;
    position: relative;
}

.pub-list li:before {
    content: "[" counter(pub-counter) "]";
    position: absolute;
    left: 0;
    font-weight: bold;
    color: #224422;
}

/* Talks & Posters Page */
.talks-note {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    border-left: 4px solid #224422;
}

.talk-list {
    margin-bottom: 2rem;
}

.talk-item {
    background-color: #f5f5f5;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid #224422;
}

.talk-item h4 {
    margin-top: 0;
    color: #224422;
}

.talk-item .venue {
    font-style: italic;
    color: #555;
    margin-bottom: 0.3rem;
}

.talk-item .date {
    font-weight: 600;
    color: #336633;
    margin-bottom: 0.3rem;
}

.talk-item .type {
    display: inline-block;
    background-color: #224422;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.talk-item .authors {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

.talk-item .slides {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Teaching Page */
.teaching-position {
    margin-bottom: 2rem;
}

.institution {
    font-style: italic;
    color: #555;
    margin-bottom: 0.5rem;
}

.period {
    font-weight: 600;
    color: #224422;
    margin-bottom: 1rem;
}

.teaching ul {
    margin-top: 0.5rem;
}

.intl-experience {
    display: grid;
    gap: 1.5rem;
    margin-top: 1rem;
}

.experience-item {
    background-color: #f5f5f5;
    padding: 1.5rem;
    border-radius: 4px;
}

.skills {
    background-color: #f5f5f5;
    padding: 1.5rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.skills p {
    margin-bottom: 0.5rem;
}

/* CV Page */
.cv-download {
    text-align: center;
    margin: 2rem 0;
}

.download-button {
    display: inline-block;
    background-color: #224422;
    color: white;
    padding: 1rem 2rem;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.download-button:hover {
    background-color: #336633;
    text-decoration: none;
}

.cv-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.cv-section p {
    margin-bottom: 1rem;
}

.cv-section p:last-child {
    margin-bottom: 0;
}

.cv-section ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}

.cv-section li {
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    background-color: #224422;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

footer .pledge-notice {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

footer .pledge-notice a {
    color: #90EE90;
    text-decoration: underline;
}

footer .pledge-notice a:hover {
    color: white;
}

footer .pledge-notice.highlight {
    animation: pulse-glow 0.5s ease-in-out 3;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.9;
        text-shadow: none;
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(144, 238, 144, 0.8);
    }
}

/* Software Page */
.software-package {
    background-color: white;
}

.package-info {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.package-info p {
    margin-bottom: 0.3rem;
}

.package-info p:last-child {
    margin-bottom: 0;
}

.software-package ul {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.software-package li {
    margin-bottom: 0.3rem;
}

.download-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.download-button.secondary {
    background-color: #f5f5f5;
    color: #224422;
    border: 2px solid #224422;
}

.download-button.secondary:hover {
    background-color: #e8e8e8;
    color: #336633;
}

.code-section {
    background-color: #f5f5f5;
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.code-section h4 {
    margin-top: 1.5rem;
}

.code-section h4:first-child {
    margin-top: 0;
}

pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0.5rem 0 1rem 0;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: #e8e8e8;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

pre code {
    background-color: transparent;
    padding: 0;
}

.function-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 1rem 0;
}

.function-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #ddd;
}

.function-table td:first-child {
    width: 45%;
}

.math-formula {
    background-color: #fafafa;
    border-left: 4px solid #224422;
    padding: 1rem;
    margin: 1rem 0;
    font-family: 'Times New Roman', serif;
    font-size: 1.1rem;
    overflow-x: auto;
}

.references {
    padding-left: 1.5rem;
}

.references li {
    margin-bottom: 1rem;
}

.acknowledgment {
    font-size: 0.95rem;
    color: #555;
    font-style: italic;
}

/* Writing Page (list) */
.writing-note {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    border-left: 4px solid #224422;
}

/* Essay Pages */
.essay-back {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.essay-date {
    font-weight: 600;
    color: #336633;
    margin-bottom: 1rem;
}

.essay-crosspost {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    border-left: 4px solid #224422;
    font-size: 0.95rem;
}

.essay-lead {
    font-style: italic;
    color: #444;
    margin-bottom: 1.5rem;
}

.essay p {
    margin-bottom: 1rem;
}

.essay ul, .essay ol {
    margin: 0 0 1rem 1.5rem;
}

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

.essay-figure {
    margin: 1.5rem 0;
    text-align: center;
}

.essay-figure img {
    max-width: 100%;
    border-radius: 4px;
}

.essay-figure figcaption {
    font-size: 0.9rem;
    color: #555;
    margin-top: 0.5rem;
}

.essay hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 2rem 0;
}

.essay-series-note {
    font-style: italic;
    color: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    nav {
        gap: 1rem;
    }

    nav a {
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    .intro p {
        font-size: 1rem;
    }
}
