:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a25;
    --border: #1e1e2e;
    --border-glow: #2d2d44;
    --text: #e4e4eb;
    --text-muted: #8888a0;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-secondary: #22d3ee;
    --gradient-start: #6366f1;
    --gradient-end: #8b5cf6;
    --focus-outline: #22d3ee;
    --nav-bg: rgba(10, 10, 15, 0.8);
    --accent-bg: rgba(99, 102, 241, 0.1);
    --accent-border: rgba(99, 102, 241, 0.2);
    --accent-bg-subtle: rgba(99, 102, 241, 0.08);
    --accent-border-subtle: rgba(99, 102, 241, 0.15);
    --accent-border-strong: rgba(99, 102, 241, 0.3);
    --secondary-bg: rgba(34, 211, 238, 0.1);
    --secondary-border: rgba(34, 211, 238, 0.2);
    --shadow-heavy: rgba(0, 0, 0, 0.5);
    --shadow-medium: rgba(0, 0, 0, 0.3);
    --gradient-bg-top: rgba(99, 102, 241, 0.1);
    --gradient-bg-corner: rgba(139, 92, 246, 0.08);
}

[data-theme="light"] {
    --bg-dark: #f5f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #eeeef4;
    --border: #c8cad8;
    --border-glow: #a0a3b8;
    --text: #111127;
    --text-muted: #3b3b54;
    --accent: #4338ca;
    --accent-glow: rgba(67, 56, 202, 0.2);
    --accent-secondary: #0e7490;
    --gradient-start: #4338ca;
    --gradient-end: #6d28d9;
    --focus-outline: #0e7490;
    --nav-bg: rgba(245, 245, 249, 0.9);
    --accent-bg: rgba(67, 56, 202, 0.1);
    --accent-border: rgba(67, 56, 202, 0.25);
    --accent-bg-subtle: rgba(67, 56, 202, 0.07);
    --accent-border-subtle: rgba(67, 56, 202, 0.18);
    --accent-border-strong: rgba(67, 56, 202, 0.35);
    --secondary-bg: rgba(14, 116, 144, 0.1);
    --secondary-border: rgba(14, 116, 144, 0.25);
    --shadow-heavy: rgba(0, 0, 0, 0.12);
    --shadow-medium: rgba(0, 0, 0, 0.08);
    --gradient-bg-top: rgba(67, 56, 202, 0.05);
    --gradient-bg-corner: rgba(109, 40, 217, 0.04);
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: none;
}

/* Focus visible styles for accessibility */
*:focus-visible {
    outline: 3px solid var(--focus-outline);
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--focus-outline);
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    line-height: 1.7;
    background: var(--bg-dark);
    background-image:
        radial-gradient(ellipse at top, var(--gradient-bg-top) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, var(--gradient-bg-corner) 0%, transparent 50%);
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--accent-secondary);
    text-shadow: 0 0 20px var(--accent-glow);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    padding: 80px 0 60px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

[data-theme="light"] header::before {
    opacity: 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 50px;
    position: relative;
    z-index: 1;
}

.profile-photo {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-glow);
    box-shadow:
        0 0 40px var(--accent-glow),
        0 20px 60px var(--shadow-heavy);
    flex-shrink: 0;
    transition: all 0.4s ease;
}

.profile-photo:hover {
    transform: scale(1.02);
    box-shadow:
        0 0 60px var(--accent-glow),
        0 20px 60px var(--shadow-heavy);
}

.header-text h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-text .title {
    font-size: 1.2rem;
    color: var(--accent);
    margin-bottom: 12px;
    font-weight: 500;
}

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

.contact-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 24px;
    font-size: 0.9rem;
}

.contact-bar a, .contact-bar span {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.contact-bar a:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 20px var(--accent-glow);
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.social-link:hover {
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

.social-link svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Visually hidden but accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-dark: #000000;
        --bg-card: #0a0a0a;
        --bg-card-hover: #1a1a1a;
        --border: #ffffff;
        --border-glow: #ffffff;
        --text: #ffffff;
        --text-muted: #e0e0e0;
        --accent: #6699ff;
        --accent-secondary: #66ffff;
    }

    a {
        text-decoration: underline;
    }

    .project-card,
    .software-item,
    .award-item,
    .talk-item,
    .alumni-card,
    .student,
    .service-item,
    .interest-tag {
        border-width: 2px;
    }
}

/* Ensure focus is visible in high contrast mode */
@media (forced-colors: active) {
    *:focus-visible {
        outline: 3px solid CanvasText;
        outline-offset: 2px;
    }

    .skip-link:focus {
        background: Canvas;
        color: CanvasText;
        border: 2px solid CanvasText;
    }
}

/* Awards */
.award-list {
    display: grid;
    gap: 12px;
    list-style: none;
}

.award-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.award-item:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
}

.award-icon {
    font-size: 1.5rem;
}

.award-info {
    flex: 1;
}

.award-info .title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.award-info .venue {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Talks */
.talk-list {
    display: grid;
    gap: 12px;
    list-style: none;
}

.talk-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    gap: 16px;
}

.talk-item:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
}

.talk-info .title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.talk-info .venue {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.talk-links {
    display: flex;
    gap: 8px;
}

.talk-link {
    padding: 6px 12px;
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--accent);
    transition: all 0.3s ease;
}

.talk-link:hover {
    background: var(--accent);
    color: white;
}

/* Publication links */
.pub-links {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
    align-self: center;
}

.pub-link {
    padding: 6px 12px;
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--accent);
    transition: all 0.3s ease;
}

.pub-link:hover {
    background: var(--accent);
    color: white;
}

/* Project links */
.project-papers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.project-papers-label {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.project-papers a {
    padding: 3px 8px;
    background: var(--accent-bg-subtle);
    border: 1px solid var(--accent-border-subtle);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent);
    transition: all 0.3s ease;
}

.project-papers a:hover {
    background: var(--accent);
    color: white;
}

.project-links {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.project-link {
    padding: 6px 12px;
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--accent);
    transition: all 0.3s ease;
}

.project-link:hover {
    background: var(--accent);
    color: white;
}

/* Student links */
.alumni-card .name a {
    color: var(--text);
}

.alumni-card .name a:hover {
    color: var(--accent);
}

/* Navigation */
nav[role="navigation"] {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav[role="navigation"] ul {
    display: flex;
    list-style: none;
    gap: 4px;
    padding: 12px 0;
    overflow-x: auto;
}

nav[role="navigation"] a {
    color: var(--text-muted);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

nav[role="navigation"] a:hover {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
    text-shadow: none;
}

nav[role="navigation"] a.active {
    color: var(--accent);
    background: var(--accent-bg);
    border-color: var(--accent-border-strong);
}

/* Main Content */
main {
    padding: 60px 0;
}

section {
    margin-bottom: 80px;
    scroll-margin-top: 70px;
}

section:last-child {
    margin-bottom: 0;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

h2::before {
    content: '';
    width: 4px;
    height: 28px;
    background: linear-gradient(180deg, var(--gradient-start), var(--gradient-end));
    border-radius: 2px;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 32px 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
}

p {
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Research Interests */
.interests {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
}

.interest-tag {
    background: var(--bg-card);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.interest-tag:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

/* Projects */
.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.project-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid var(--border);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glow);
    box-shadow: 0 20px 40px var(--shadow-medium);
}

.project-card:hover::before {
    opacity: 1;
}

.project-card h4 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.project-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.6;
}

.project-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
}

.project-card .tag {
    background: var(--accent-bg);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid var(--accent-border);
}

/* Software */
.software-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    list-style: none;
}

.software-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    color: var(--text);
}

.software-item:hover {
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
    transform: translateY(-2px);
}

.software-item .icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.software-item .info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.software-item .info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Students */
.student-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
}

.student {
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    color: var(--text);
}

.student:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* Teaching */
.course-list {
    list-style: none;
}

.course-list li {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.course-list li:hover {
    padding-left: 8px;
}

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

.course-code {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

/* Service */
.service-section {
    margin-bottom: 28px;
}

.service-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.service-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
}

.service-item {
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    color: var(--text);
    transition: all 0.3s ease;
}

.service-item:hover {
    border-color: var(--accent);
}

/* Past Students */
.alumni-grid {
    display: grid;
    gap: 12px;
    list-style: none;
}

.alumni-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    gap: 16px;
    transition: all 0.3s ease;
}

.alumni-card:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
}

.alumni-card .name {
    font-weight: 600;
    color: var(--text);
}

.alumni-card .details {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.alumni-card .position {
    font-size: 0.85rem;
    color: var(--accent-secondary);
    background: var(--secondary-bg);
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
    border: 1px solid var(--secondary-border);
}

/* Publications */
.pub-list {
    list-style: none;
}

.pub-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 16px;
    align-items: center;
    transition: all 0.3s ease;
}

.pub-info {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.pub-authors {
    width: 100%;
    padding-left: 111px;
    font-size: 0.82rem;
    color: var(--text-muted);
    opacity: 0.7;
}

@media (max-width: 640px) {
    .pub-authors {
        padding-left: 0;
    }
}

.pub-item:hover {
    padding-left: 8px;
}

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

.pub-venue {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 95px;
    text-align: center;
    white-space: nowrap;
}

.pub-title {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.pub-award {
    font-size: 0.75rem;
    color: #f59e0b;
    white-space: nowrap;
}

.pub-award::before {
    content: '\1F3C6';
    margin-right: 4px;
}

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

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

/* Footer */
footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .profile-photo {
        width: 180px;
        height: 180px;
    }

    .header-text h1 {
        font-size: 2.2rem;
    }

    .contact-bar {
        justify-content: center;
    }

    nav ul {
        justify-content: flex-start;
    }

    .software-list,
    .project-grid {
        grid-template-columns: 1fr;
    }

    .alumni-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Theme toggle */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 20px var(--accent-glow);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.nav-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-inner ul {
    flex: 1;
    min-width: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-glow);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
