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

html {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #8b0000;
    --accent-color: #2c5f8d;
    --text-color: #2d2d2d;
    --light-bg: #f9f7f4;
    --border-color: #d4c5b9;
    --link-color: #2c5f8d;
    --link-hover: #8b0000;
}

body {
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, 'Times New Roman', serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--light-bg);
    font-size: 14px;
    padding-top: 180px;
    padding-bottom: 70px;
    position: relative;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
    border-bottom: 1px solid transparent;
}

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

/* Header */
header {
    background-color: var(--light-bg);
    border-bottom: 3px double var(--border-color);
    padding: 20px 0 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-direction: column;
}

.logo {
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
}

.logo h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    font-variant: small-caps;
}

.logo h1 a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: none;
}

.logo h1 a:hover {
    color: var(--secondary-color);
    border-bottom: none;
}

.logo .subtitle {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 400;
    line-height: 1.4;
    font-style: italic;
}

.logo .subtitle a {
    color: var(--text-color);
    text-decoration: none;
    border-bottom: none;
}

.logo .subtitle a:hover {
    color: var(--secondary-color);
    border-bottom: none;
}

/* Desktop Navigation */
.desktop-nav {
    width: 100%;
    text-align: center;
}

.desktop-nav ul {
    list-style: none;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
}

.desktop-nav li {
    position: relative;
}

.desktop-nav li:not(:last-child)::after {
    content: '|';
    margin-left: 20px;
    color: var(--border-color);
}

.desktop-nav a {
    color: var(--link-color);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: color 0.3s ease;
    padding: 0 15px;
    border-bottom: none;
}

.desktop-nav a:hover,
.desktop-nav a.active {
    color: var(--secondary-color);
    border-bottom: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 2px;
    background-color: var(--primary-color);
    margin: 3px 0;
    transition: 0.3s;
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    background-color: var(--light-bg);
    border-bottom: 3px double var(--border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    top: 105px;
    left: 0;
    right: 0;
    z-index: 999;
    width: 100%;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav ul {
    list-style: none;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.mobile-nav li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav li:last-child {
    border-bottom: none;
}

.mobile-nav a {
    color: var(--link-color);
    font-size: 16px;
    font-weight: 500;
    display: block;
    padding: 10px;
    letter-spacing: 0.3px;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 40px 50px 40px;
    background-color: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.08);
    position: relative;
    z-index: 1;
}

/* Extra top padding for non-index pages to achieve 200px total */
.publications-page,
.books-page,
.about-page,
.caplab-page {
    padding-top: 50px;
}

/* Hero Section */
.hero {
    padding: 20px 0;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
}

.hero h1 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.3;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 8px;
}

.hero h2 {
    font-size: 16px;
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 25px;
    letter-spacing: 0.3px;
    font-style: italic;
}

.positions {
    margin-top: 0;
}

.positions ul {
    list-style: none;
    margin-bottom: 20px;
    border-left: 3px solid var(--secondary-color);
    padding-left: 20px;
}

.positions li {
    padding: 6px 0;
    color: var(--text-color);
    line-height: 1.8;
    font-size: 16px;
}

.affiliations {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.affiliations li {
    padding: 5px 0;
    color: var(--text-color);
    font-size: 15px;
    line-height: 1.8;
}

.hero-image img {
    width: 100%;
    max-width: 320px;
    height: auto;
    border: 5px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.publications-list {
    line-height: 1.85;
}

.publication-item {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

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

.publication-item p {
    margin-bottom: 5px;
}

.pub-short {
    margin-bottom: 3px;
}

.expand-btn {
    color: var(--accent-color);
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.expand-btn:hover {
    color: var(--secondary-color);
}

.pdf-link {
    color: #c41e3a;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    margin-left: 8px;
    padding: 2px 6px;
    border: 1px solid #c41e3a;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: inline-block;
}

.pdf-link:hover {
    background-color: #c41e3a;
    color: white;
    border-bottom: 1px solid #c41e3a;
}

.pub-apa {
    display: none;
    background-color: #f5f5f5;
    border-left: 4px solid var(--accent-color);
    padding: 10px 15px;
    margin-top: 8px;
    border-radius: 4px;
}

.pub-apa p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.pub-apa p:first-child {
    font-weight: 600;
    margin-bottom: 6px;
}

/* Legacy support for old button style */
.apa-toggle {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: background-color 0.3s ease;
    margin-top: 5px;
    display: inline-block;
}

.apa-toggle:hover {
    background-color: var(--secondary-color);
}

.apa-toggle.active {
    background-color: var(--secondary-color);
}

.apa-citation {
    background-color: #f5f5f5;
    border-left: 4px solid var(--accent-color);
    padding: 15px 20px;
    margin-top: 10px;
    border-radius: 4px;
}

.apa-citation p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

/* Publications Page */
.publications-page h1 {
    font-size: 26px;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.pdf-item {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    padding: 18px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.pdf-item:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.pdf-icon {
    font-size: 2.8em;
    margin-bottom: 12px;
    color: var(--secondary-color);
}

.pdf-item p {
    font-size: 13px;
    color: var(--text-color);
    word-wrap: break-word;
    line-height: 1.5;
}

.publications-list {
    margin-top: 30px;
}

.publications-list p {
    margin-bottom: 15px;
    line-height: 1.5;
    font-size: 14px;
    text-align: justify;
}

.publications-list strong {
    color: var(--secondary-color);
    font-weight: 600;
}

.publications-list em {
    font-style: italic;
}

.publications-list a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--link-color);
}

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

/* About Page */
.about-page h1 {
    font-size: 26px;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
}

.about-content {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 45px;
    margin-top: 30px;
}

.about-image img {
    width: 100%;
    height: auto;
    border: 5px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.about-text h2 {
    font-size: 20px;
    color: var(--secondary-color);
    margin-top: 30px;
    margin-bottom: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.about-text ul {
    list-style: disc;
    margin-left: 25px;
    margin-bottom: 20px;
}

.about-text li {
    margin-bottom: 12px;
    line-height: 1.85;
    font-size: 16px;
}

.cv-download {
    margin-top: 35px;
}

.btn-download {
    display: inline-block;
    background-color: var(--secondary-color);
    color: #fff;
    padding: 14px 32px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.5px;
    font-size: 15px;
    transition: all 0.3s ease;
    border: 2px solid var(--secondary-color);
    border-bottom: none;
}

.btn-download:hover {
    background-color: #6b0000;
    border-color: #6b0000;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

/* Books and CAP Lab Pages */
.books-page h1,
.caplab-page h1 {
    font-size: 26px;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.books-content,
.caplab-content {
    line-height: 1.5;
    font-size: 14px;
}

/* Book Entry Styles */
.book-entry {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 2px solid var(--border-color);
    overflow: auto;
}

.book-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.book-image {
    float: left;
    width: 180px;
    margin-right: 25px;
    margin-bottom: 15px;
}

.book-image img {
    width: 100%;
    height: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
}

.book-details {
    overflow: auto;
}

.book-details h3 {
    font-size: 20px;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
}

.book-authors {
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 15px;
    font-style: italic;
}

.book-details h4 {
    font-size: 16px;
    color: var(--secondary-color);
    margin-top: 15px;
    margin-bottom: 8px;
    font-weight: 600;
}

.book-details p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.learn-more {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--accent-color);
    color: white !important;
    border-radius: 4px;
    margin-top: 12px;
    transition: background-color 0.3s ease;
    border-bottom: none !important;
    font-size: 14px;
}
}

.learn-more:hover {
    background-color: var(--secondary-color);
}

@media (max-width: 768px) {
    .book-entry {
        padding-bottom: 40px;
        margin-bottom: 40px;
    }
    
    .book-image {
        float: none;
        width: 150px;
        margin: 0 auto 20px auto;
        display: block;
    }
    
    .book-details h3 {
        font-size: 20px;
    }
}

/* Footer */
footer {
    background-color: var(--light-bg);
    border-top: 3px double var(--border-color);
    padding: 20px 40px;
    text-align: center;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

footer p {
    color: var(--text-color);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    font-style: italic;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .logo {
        text-align: left;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 35px;
    }

    .hero-image {
        text-align: center;
    }

    .hero-image img {
        max-width: 280px;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .about-image {
        text-align: center;
    }

    .about-image img {
        max-width: 300px;
    }

    .pdf-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .container {
        padding: 30px 20px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero h2 {
        font-size: 16px;
    }

    .publications-page h1,
    .books-page h1,
    .caplab-page h1,
    .about-page h1 {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 22px;
    }

    .logo .subtitle {
        font-size: 14px;
    }

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

    .hero h1 {
        font-size: 24px;
    }

    .publications-page h1,
    .books-page h1,
    .caplab-page h1,
    .about-page h1 {
        font-size: 24px;
    }

    .container {
        padding: 20px 15px;
    }
}
