@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables for Themes */
:root {
    --bg-color: #faf9f6; /* Warm paper white */
    --text-primary: #1e293b; /* Slate 800 */
    --text-secondary: #576574; /* Slate 600 */
    --text-muted: #8395a7;
    --accent-color: #1b2a4a; /* Deep navy */
    --accent-interactive: #2563eb; /* Royal blue */
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Georgia, serif;
    --font-mono: 'JetBrains Mono', Fira Code, monospace;
    --transition-speed: 0.25s;
}

[data-theme="dark"] {
    --bg-color: #0f172a; /* Dark slate */
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #cbd5e1; /* Slate 300 */
    --text-muted: #64748b;
    --accent-color: #93c5fd; /* Soft light blue */
    --accent-interactive: #60a5fa;
    --border-color: #1e293b;
    --card-bg: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    height: 100%;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.7;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
    flex-grow: 1;
}

/* Header & Navigation */
header {
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 0;
    transition: border-color var(--transition-speed) ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    text-decoration: none;
    color: var(--text-primary);
}

.logo-text {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    transition: color var(--transition-speed) ease;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

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

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    padding: 0.2rem 0;
    transition: color var(--transition-speed) ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--text-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after, .nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease, color var(--transition-speed) ease, transform 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
    transform: scale(1.05);
}

.theme-toggle-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Footer styling */
footer {
    border-top: 1px solid var(--border-color);
    padding: 2.5rem 0;
    margin-top: 5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: border-color var(--transition-speed) ease;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

.footer-link:hover {
    color: var(--text-primary);
}

/* Main Content Styling */
main {
    padding: 4rem 0;
}

h1, h2, h3, h4 {
    font-family: var(--font-serif);
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.8rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    transition: border-color var(--transition-speed) ease;
}

h3 {
    font-size: 1.3rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

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

/* Homepage Hero Section */
.profile-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    align-items: start;
}

.profile-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.avatar-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: border-color var(--transition-speed) ease;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.profile-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* Custom list for Working Papers */
.research-list {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.research-list-item {
    position: relative;
    padding-left: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.research-list-item::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-interactive);
    font-weight: bold;
    font-size: 1.2rem;
    top: -2px;
}

.contact-list {
    list-style: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 100%;
    transition: all var(--transition-speed) ease;
}

.contact-item a:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.contact-item svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Timeline/Updates on Home Page */
.timeline {
    position: relative;
    border-left: 1px solid var(--border-color);
    margin: 2.5rem 0;
    padding-left: 1.5rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: calc(-1.5rem - 4.5px);
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease, transform 0.2s ease;
}

.timeline-item:hover::before {
    border-color: var(--accent-interactive);
    background-color: var(--accent-interactive);
    transform: scale(1.3);
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-interactive);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-content {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Research Publications List */
.pub-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.pub-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.pub-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    border-color: var(--accent-interactive);
}

.pub-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background-color: var(--border-color);
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.pub-title {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.pub-authors {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.pub-authors .author-self {
    font-weight: 700;
    color: var(--text-primary);
}

.pub-venue {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.pub-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    transition: all var(--transition-speed) ease;
}

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

.pub-link-btn svg {
    width: 0.9rem;
    height: 0.9rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Collapsible Abstract */
.abstract-container {
    margin-top: 1rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
}

.abstract-toggle {
    background: none;
    border: none;
    color: var(--accent-interactive);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0;
}

.abstract-toggle:hover {
    text-decoration: underline;
}

.abstract-toggle svg {
    width: 0.9rem;
    height: 0.9rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform 0.2s ease;
}

.abstract-toggle.active svg {
    transform: rotate(180deg);
}

.abstract-text {
    display: none;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-color);
    border-radius: 4px;
    border-left: 2px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}

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

/* Teaching Courses & Statement section */
.statement-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-speed) ease;
}

.statement-card:hover {
    border-color: var(--accent-interactive);
}

.statement-content {
    flex-grow: 1;
    padding-right: 1.5rem;
}

.statement-content p {
    margin-bottom: 0;
}

.courses-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.course-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    background-color: var(--card-bg);
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.course-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-interactive);
}

.course-code {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.course-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.course-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.course-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* CV Page Timeline styling */
.cv-section {
    margin-bottom: 3rem;
}

.cv-download-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 3rem;
    box-shadow: var(--card-shadow);
    transition: border-color var(--transition-speed) ease;
}

.cv-download-section:hover {
    border-color: var(--accent-interactive);
}

.cv-download-text h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.cv-download-text p {
    margin-bottom: 0;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--text-primary);
    color: var(--bg-color);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    border: 1px solid var(--text-primary);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.cv-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cv-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.cv-date {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-interactive);
    font-size: 0.85rem;
    padding-top: 0.15rem;
}

.cv-detail h4 {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.cv-institution {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.cv-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Animations & Fade-ins */
.fade-in {
    animation: pageFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* Responsive Breakpoints */
@media (max-width: 768px) {
    main {
        padding: 2rem 0;
    }

    .profile-section {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .profile-sidebar {
        max-width: 320px;
        margin: 0 auto;
    }

    .courses-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .cv-item {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .cv-date {
        font-size: 0.85rem;
        margin-bottom: 0.1rem;
    }

    .statement-card, .cv-download-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .statement-content {
        padding-right: 0;
    }
}

@media (max-width: 576px) {
    .header-container {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .nav-controls {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    nav {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }

    .footer-container {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}

/* Audio Brief Card styles (NotebookLM summary container) */
.audio-brief-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    box-shadow: var(--card-shadow);
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.audio-brief-card:hover {
    border-color: var(--accent-interactive);
}

.audio-brief-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.audio-brief-icon {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: var(--accent-interactive);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.audio-brief-player {
    border-radius: 6px;
    overflow: hidden;
    height: 100px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
}

.audio-brief-player iframe {
    border: none;
    display: block;
    width: 100%;
    height: 100%;
}

/* Dark mode SoundCloud invert trick */
[data-theme="dark"] .audio-brief-player iframe {
    filter: invert(0.9) hue-rotate(180deg);
}

[data-theme="dark"] .audio-brief-card {
    background-color: rgba(30, 41, 59, 0.4);
    border-color: rgba(255, 255, 255, 0.06);
}
