/* ===========================
   CSS Variables - Kinfolk Aesthetic
   =========================== */
:root {
    --primary-color: #3d2817;
    --primary-hover: #2a1a0f;
    --text-color: #3d2817;
    --text-light: #7a6456;
    --text-lighter: #9d8976;
    --bg-color: #fafaf8;
    --secondary-bg: #f5f5f3;
    --border-color: #e8e8e6;
    --accent-color: #3d2817;
    --max-width: 920px;
    --spacing-xs: 0.75rem;
    --spacing-sm: 1.5rem;
    --spacing-md: 2.5rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;
    --border-radius: 0;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', 'Georgia', 'Palatino Linotype', serif;
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    letter-spacing: 0.01em;
}

/* ===========================
   Typography
   =========================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
    letter-spacing: -0.01em;
}

h1 {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    font-weight: 300;
}
h2 {
    font-size: 1.75rem;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.875rem;
    color: var(--text-light);
}

.about-content h2 {
    margin-top: 0;
}
h3 {
    font-size: 1.5rem;
    font-weight: 400;
}
h4 { font-size: 1.125rem; }

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    padding-bottom: 1px;
}

a:hover {
    border-bottom-color: var(--text-color);
}

ul {
    list-style-position: inside;
    margin-bottom: var(--spacing-sm);
}

code {
    background-color: var(--secondary-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* ===========================
   Layout
   =========================== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

main {
    min-height: calc(100vh - 200px);
}

main.container {
    padding-top: calc(var(--spacing-xl));
    padding-bottom: calc(var(--spacing-xl));
}

/* ===========================
   Navigation
   =========================== */
#nav-placeholder {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-bottom-color 0.3s ease;
}

.navbar.menu-open {
    background-color: transparent;
    border-bottom-color: transparent;
}

.navbar.menu-open .nav-brand {
    color: #c85a3f;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
}

.nav-brand {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-color);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: none;
    line-height: 1;
}

.nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #d4c5b0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 1.5rem;
    list-style: none;
    transform: translateY(-100%);
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 999;
    padding-left: var(--spacing-md);
    padding-top: calc(var(--spacing-xl) + var(--spacing-lg));
}

.nav-links.active {
    transform: translateY(0);
}

.nav-links li {
    border: none;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.nav-links.active li {
    opacity: 1;
    transform: translateY(0);
}

.nav-links.active li:nth-child(1) { transition-delay: 0.1s; }
.nav-links.active li:nth-child(2) { transition-delay: 0.15s; }
.nav-links.active li:nth-child(3) { transition-delay: 0.2s; }
.nav-links.active li:nth-child(4) { transition-delay: 0.25s; }
.nav-links.active li:nth-child(5) { transition-delay: 0.3s; }

.nav-links a {
    display: block;
    color: #c85a3f;
    font-weight: 400;
    text-decoration: none;
    padding: 0;
    border: none;
    transition: var(--transition);
    font-size: 2.5rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.nav-links a:hover,
.nav-links a.active {
    color: rgba(200, 90, 63, 0.7);
}

.nav-links .menu-contact {
    margin-top: auto;
    margin-bottom: var(--spacing-xl);
    font-size: 0.875rem;
    color: #c85a3f;
    line-height: 1.4;
}

.nav-links .menu-contact a {
    font-size: 0.875rem;
    color: #c85a3f;
}

.nav-links .menu-contact a:hover {
    color: rgba(200, 90, 63, 0.7);
}

.nav-links .menu-contact .social-links {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.nav-links .menu-contact .social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c85a3f;
    opacity: 0.7;
    transition: var(--transition);
}

.nav-links .menu-contact .social-links a:hover {
    opacity: 1;
    color: #c85a3f;
}

.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2.25rem;
    height: 0.5rem;
    position: relative;
    z-index: 1001;
    align-self: center;
}

.mobile-menu-toggle span {
    display: block;
    width: 2.25rem;
    height: 1.5px;
    background-color: var(--text-color);
    transition: all 0.3s cubic-bezier(0.77, 0, 0.175, 1);
    line-height: 0;
    position: absolute;
    left: 0;
}

.mobile-menu-toggle span:first-child {
    top: 0;
}

.mobile-menu-toggle span:last-child {
    bottom: 0;
}

.mobile-menu-toggle.active span {
    background-color: #c85a3f;
}

.mobile-menu-toggle.active span:first-child {
    transform: rotate(45deg);
    top: 50%;
    margin-top: -0.75px;
}

.mobile-menu-toggle.active span:last-child {
    transform: rotate(-45deg);
    bottom: 50%;
    margin-bottom: -0.75px;
}

/* ===========================
   Hero Section
   =========================== */
.hero {
    padding: var(--spacing-md) 0;
    padding-top: 0;
    padding-bottom: 0;
}

.hero .social-links {
    display: flex;
    gap: var(--spacing-sm);
}

.hero .social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    background-color: transparent;
    color: var(--text-lighter);
    transition: var(--transition);
    border: none;
    padding: 0;
}

.hero .social-links a:hover {
    background-color: transparent;
    color: var(--text-color);
    opacity: 1;
}

/* Profile photo in About section */
.about .profile-photo {
    width: 180px;
    height: 240px;
    object-fit: cover;
    border: none;
    filter: grayscale(0%);
    flex-shrink: 0;
    margin-top: 4.1rem; /* Align with paragraph text (h2 height + h2 bottom margin) */
}

/* ===========================
   Sections
   =========================== */
section {
    margin-bottom: var(--spacing-xl);
}

.about {
    background-color: transparent;
    padding: 0;
    margin-top: 0;
    display: flex;
    gap: var(--spacing-lg);
    align-items: flex-start;
}

.about-content {
    flex: 1;
}

.contact {
    background-color: transparent;
    padding: 0;
    margin-top: var(--spacing-md);
}

/* ===========================
   News Section
   =========================== */
.recent-news {
    background-color: transparent;
    padding: 0;
    margin-top: var(--spacing-lg);
}

.news-list {
    list-style: none;
    margin-bottom: var(--spacing-lg);
}

.news-list li {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.news-list li:last-child {
    border-bottom: none;
}

.news-header {
    display: flex;
    gap: var(--spacing-md);
    align-items: baseline;
}

.news-date {
    font-weight: 400;
    color: var(--text-lighter);
    min-width: 90px;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.news-title {
    flex: 1;
    color: var(--text-color);
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-content {
    color: var(--text-light);
    line-height: 1.8;
    margin-left: calc(90px + var(--spacing-md));
}

.more-link {
    display: inline-block;
    margin-top: var(--spacing-md);
    font-weight: 400;
    color: var(--text-light);
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* News page timeline */
.news-timeline {
    margin-top: var(--spacing-lg);
}

.news-item {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

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

.news-date-large {
    font-weight: 400;
    color: var(--text-lighter);
    min-width: 120px;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.news-content-large h3 {
    margin-bottom: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-content-large p {
    color: var(--text-light);
    line-height: 1.8;
}

.pin-icon {
    width: 16px;
    height: 16px;
    stroke: var(--text-color);
    flex-shrink: 0;
    opacity: 0.6;
    margin-right: 0.25rem;
}

/* ===========================
   Papers
   =========================== */
.page-description {
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
    line-height: 1.8;
}

.year-group {
    margin-bottom: 1rem;
    display: flex;
    gap: var(--spacing-lg);
    align-items: baseline;
}

.year-group:last-child {
    margin-bottom: 0;
}

.year-header {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--text-lighter);
    letter-spacing: -0.01em;
    text-transform: none;
    min-width: 90px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--spacing-lg) + 60px);
    line-height: 1.5;
}

.year-publications {
    flex: 1;
}

.year-publications .publication:first-child {
    margin-top: 0;
}

.year-publications .publication:last-child {
    margin-bottom: 0;
}

.publication {
    background-color: transparent;
    padding: 0;
    padding-bottom: 0;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    border: none;
}

.publication:hover {
    opacity: 0.8;
}

.pub-title {
    font-size: 1.125rem;
    font-weight: 400;
    margin-bottom: 0.15rem;
    color: var(--text-color);
    cursor: pointer;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.pub-title:hover {
    color: var(--text-color);
}

.pub-authors {
    color: var(--text-light);
    margin-bottom: 0.15rem;
    font-size: 0.9375rem;
}

.author-highlight {
    font-weight: 400;
    color: var(--text-color);
}

.pub-venue {
    color: var(--text-lighter);
    font-style: normal;
    margin-bottom: 0.15rem;
    font-size: 0.875rem;
}

.pub-links {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: 0.15rem;
}

.pub-link, .pub-abstract-toggle {
    display: inline-block;
    padding: 0;
    background-color: transparent;
    color: var(--text-light);
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    font-weight: 400;
    transition: var(--transition);
    cursor: pointer;
    letter-spacing: 0.01em;
}

.pub-link:hover, .pub-abstract-toggle:hover {
    background-color: transparent;
    color: var(--text-color);
    border-bottom-color: var(--text-color);
}

.pub-abstract {
    margin-top: var(--spacing-md);
    padding: 0;
    padding-top: var(--spacing-md);
    background-color: transparent;
    border-top: 1px solid var(--border-color);
    display: none;
}

.pub-abstract.show {
    display: block;
    animation: fadeIn 0.4s ease;
}

.pub-abstract p {
    margin: 0;
    color: var(--text-light);
    line-height: 1.8;
    font-size: 0.9375rem;
}

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

.loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-light);
}

/* ===========================
   CV Page
   =========================== */
.cv-download {
    margin-bottom: var(--spacing-xl);
}

.btn-primary {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-weight: 400;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

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

.cv-content {
    margin-bottom: var(--spacing-md);
}

.cv-section {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.cv-section:last-child {
    border-bottom: none;
}

.cv-item {
    margin-bottom: var(--spacing-md);
    padding: 0;
    padding-bottom: 0;
    background-color: transparent;
}

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

.cv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.cv-date {
    color: var(--text-lighter);
    font-weight: 400;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.cv-detail {
    color: var(--text-light);
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
    line-height: 1.6;
}

.cv-item p {
    margin-bottom: 0.35rem;
}

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

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.skill-category h3 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
}

.skill-category ul {
    list-style: none;
}

.skill-category li {
    padding: 0.25rem 0;
    color: var(--text-light);
}

.cv-pdf-viewer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.note {
    background-color: var(--secondary-bg);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    color: var(--text-light);
}

/* ===========================
   Footer
   =========================== */
footer {
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-xl);
}

footer p {
    text-align: center;
    color: var(--text-light);
    margin: 0;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    :root {
        --max-width: 100%;
        --spacing-md: 1.5rem;
        --spacing-lg: 2.5rem;
        --spacing-xl: 3.5rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 0.875rem; }
    h3 { font-size: 1.125rem; }

    .about {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .about .profile-photo {
        width: 120px;
        height: 160px;
    }

    .news-item {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .news-date-large {
        min-width: auto;
    }

    .year-group {
        flex-direction: column;
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-lg);
    }

    .year-header {
        position: static;
        min-width: auto;
        margin-bottom: var(--spacing-sm);
    }

    .cv-item-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .pub-links {
        flex-direction: column;
    }

    .pub-link, .pub-abstract-toggle {
        text-align: center;
    }
}
