/* ========================================
   Base Styles & Variables
   ======================================== */

:root {
    /* Colors - Sober Academic Theme */
    --color-bg: #ffffff;
    --color-bg-alt: #f4f4f5;
    --color-text: #18181b;
    --color-text-muted: #52525b;
    --color-accent: #0f172a;
    /* Slate 900 - much darker, almost black/navy */
    --color-accent-hover: #334155;
    --color-border: #e4e4e7;
    --color-border-dark: #d4d4d8;

    /* Typography */
    --font-serif: 'Crimson Pro', 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Inter', 'Arial', Helvetica, sans-serif;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 5rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

/* ========================================
   Typography
   ======================================== */

h1,
h2,
h3 {
    font-family: var(--font-serif);
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--color-text);
    text-decoration: underline;
    transition: color var(--transition-fast);
}

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

/* ========================================
   Layout
   ======================================== */

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.section {
    padding: var(--space-xl) 0;
    border-bottom: 1px solid var(--color-border);
}

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

.section-title {
    font-size: 1.5rem;
    margin-bottom: var(--space-lg);
    color: var(--color-text);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-text);
    padding-bottom: var(--space-xs);
    display: inline-block;
}

.section-subtitle {
    color: var(--color-text-muted);
    margin-bottom: var(--space-xl);
    font-size: 1rem;
    font-style: italic;
}

/* ========================================
   Navigation
   ======================================== */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--color-text);
    z-index: 100;
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--space-sm) var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    border: 2px solid var(--color-text);
    padding: 2px 8px;
}

.nav-logo:hover {
    color: var(--color-bg);
    background: var(--color-text);
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
}

.nav-links a {
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 400;
    text-decoration: none;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-links a:hover {
    text-decoration: underline;
}

.lang-switch {
    padding: 4px 8px;
    border: 1px solid var(--color-text);
    font-weight: 400;
    text-decoration: none !important;
}

.lang-switch:hover {
    background-color: var(--color-text);
    color: var(--color-bg) !important;
}

/* ========================================
   Hero Section
   ======================================== */

.hero {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 100px;
    padding-bottom: var(--space-lg);
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.hero-content {
    max-width: 600px;
}

.hero-greeting {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
    font-family: var(--font-sans);
    text-transform: uppercase;
}

.hero-name {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.hero-tagline {
    font-size: 1.2rem;
    color: var(--color-text);
    font-weight: 400;
    margin-bottom: var(--space-xs);
    font-style: italic;
}

.hero-affiliation {
    font-size: 1rem;
    color: var(--color-text-muted);
    font-family: var(--font-sans);
}

.hero-roles {
    font-size: 0.9rem;
    color: var(--color-text);
    margin-top: var(--space-sm);
    font-weight: 400;
    font-family: var(--font-sans);
}

/* ========================================
   About Section
   ======================================== */

.about {
    background-color: var(--color-bg);
    padding-top: var(--space-lg);
}

.about-content {
    max-width: 700px;
}

.about-content p {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: var(--space-lg);
    text-align: justify;
}

.about-content strong {
    color: var(--color-text);
    font-weight: 700;
}

.about-links {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 16px;
    border: 1px solid var(--color-text);
    border-radius: 0;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 400;
    text-decoration: none;
    font-family: var(--font-sans);
    text-transform: uppercase;
    background: transparent;
    transition: all var(--transition-fast);
}

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

.link-btn svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Projects Section
   ======================================== */

.projects {
    background-color: var(--color-bg-alt);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.project-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.project-card:hover {
    border-color: var(--color-border-dark);
}

.project-image {
    display: none;
}

.project-content {
    padding: var(--space-md);
}

.project-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text);
    font-weight: 600;
}

.project-status {
    display: inline-block;
    margin-left: var(--space-sm);
    padding: 2px 6px;
    background: #fef3c7;
    border: 1px solid #d97706;
    color: #92400e;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-title {
    font-size: 1.25rem;
    margin: var(--space-xs) 0 var(--space-sm);
    color: var(--color-text);
}

.project-description {
    font-size: 0.95rem;
    color: var(--color-text);
    margin-bottom: var(--space-md);
    line-height: 1.5;
    text-align: justify;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.project-tech span {
    padding: 2px 8px;
    background: transparent;
    border: 1px solid var(--color-border-dark);
    border-radius: 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-family: var(--font-sans);
}

.project-link {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text);
    text-decoration: underline;
    text-transform: uppercase;
    transition: all var(--transition-fast);
}

.project-link:hover {
    color: var(--color-text);
    background: var(--color-bg-alt);
}

.project-link.disabled {
    color: var(--color-text-muted);
    cursor: default;
    text-decoration: none;
}

/* ========================================
   Contact Section
   ======================================== */

.contact {
    background-color: var(--color-bg);
    text-align: center;
}

.contact-text {
    font-size: 1.1rem;
    color: var(--color-text);
    max-width: 500px;
    margin: 0 auto;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    padding: var(--space-lg) 0;
    border-top: 1px solid var(--color-border);
    text-align: center;
    background: var(--color-bg);
}

.footer p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ========================================
   Teaching Section
   ======================================== */

.teaching {
    background-color: var(--color-bg-alt);
}

.lectures-content {
    max-width: 800px;
}

.lecture-item {
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-lg);
}

.lecture-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.lecture-title {
    font-size: 1.2rem;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
    font-family: var(--font-serif);
}

.lecture-context {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
    font-style: italic;
}

.lecture-description {
    font-size: 1rem;
    color: var(--color-text);
    line-height: 1.6;
    text-align: justify;
}

.lecture-links {
    margin-top: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.lecture-links a {
    margin-right: var(--space-xs);
}

.copyright-notice {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-left: var(--space-sm);
}

/* ========================================
   Certifications Section
   ======================================== */

.certifications {
    background-color: var(--color-bg);
}

.certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.cert-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 0;
    padding: var(--space-md);
    transition: all var(--transition-normal);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.cert-card:hover {
    border-color: var(--color-text);
    box-shadow: none;
    transform: translateY(-2px);
}

.cert-icon {
    font-size: 1.5rem;
    background: var(--color-bg);
    padding: 8px;
    border-radius: 0;
    border: 1px solid var(--color-border);
}

.cert-content {
    flex: 1;
}

.cert-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--color-text);
}

.cert-org {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
    font-style: italic;
}

.cert-link {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    text-decoration: underline;
}

.cert-link:hover {
    color: var(--color-text);
    text-decoration: none;
}

/* ========================================
   Responsive Design
   ======================================== */

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

    .nav-container {
        flex-direction: column;
        gap: var(--space-sm);
        padding-bottom: var(--space-sm);
    }

    .nav-links {
        gap: var(--space-xs);
        flex-wrap: wrap;
        justify-content: center;
        border-top: 1px solid var(--color-border);
        padding-top: var(--space-sm);
        width: 100%;
    }

    .nav-links a {
        font-size: 0.8rem;
        padding: 4px 8px;
        background: transparent;
        border-radius: 0;
    }

    .hero-name {
        font-size: 2.5rem;
    }

    .hero-tagline {
        font-size: 1.1rem;
    }

    .section {
        padding: var(--space-xl) 0;
    }

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

    /* Adjust top padding for taller mobile nav */
    .hero {
        padding-top: 180px;
    }

    .page-header {
        padding-top: 180px;
    }

    .lectures-container {
        padding-top: 180px;
    }
}

@media (max-width: 480px) {
    .hero-name {
        font-size: 2rem;
    }

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

    .link-btn {
        justify-content: center;
        width: 100%;
    }
}

/* ========================================
   Lectures Page
   ======================================== */

.lectures-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: var(--space-lg);
    padding-top: 120px;
    /* Adjusted to clear fixed nav */
    min-height: 80vh;
}

.lectures-sidebar {
    background: var(--color-bg-alt);
    padding: var(--space-md);
    border-radius: 0;
    border: 1px solid var(--color-border);
    height: fit-content;
    position: sticky;
    top: 100px;
    /* Stick below the nav */
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.course-group {
    margin-bottom: var(--space-lg);
}

.course-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text);
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-text);
}

.lecture-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    margin-bottom: 2px;
    border: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--color-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-serif);
}

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

.lecture-btn.active {
    background: var(--color-bg);
    border-color: var(--color-text);
    color: var(--color-text);
    font-weight: 700;
    box-shadow: none;
}

.lecture-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.preview-area {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.preview-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--color-text);
}

.preview-actions {
    display: flex;
    gap: var(--space-sm);
}

.action-btn {
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    background: var(--color-bg-alt);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.pdf-frame {
    width: 100%;
    height: 85vh;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #f4f4f4;
}

@media (max-width: 768px) {
    .lectures-container {
        grid-template-columns: 1fr;
        padding-top: 180px;
    }

    .lectures-sidebar {
        position: static;
        width: 100%;
        max-height: 250px;
        overflow-y: auto;
        margin-bottom: var(--space-md);
        border-bottom: 1px solid var(--color-border);
    }

    .pdf-frame {
        height: 60vh;
    }
}

/* ========================================
   Animations
   ======================================== */

.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: none;
}

/* Hero Staggered Animation */
.hero-content>* {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease-out forwards;
}

.hero-content>*:nth-child(1) {
    animation-delay: 0.1s;
}

.hero-content>*:nth-child(2) {
    animation-delay: 0.2s;
}

.hero-content>*:nth-child(3) {
    animation-delay: 0.3s;
}

.hero-content>*:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Hover Effects */
.project-card:hover {
    border-color: var(--color-border-dark);
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    transition: all var(--transition-normal);
}