/* ===== CSS Custom Properties ===== */
:root {
    /* Dark theme (default) — deep navy + teal, academic rather than "startup" */
    --bg-primary: #0b1220;
    --bg-secondary: #101a2c;
    --bg-card: #16233a;
    --bg-card-hover: #1c2c47;
    --text-primary: #eef1f6;
    --text-secondary: #a8b3c7;
    --text-muted: #6b7890;
    --accent: #2dd4bf;
    --accent-light: #5eead4;
    --accent-glow: rgba(45, 212, 191, 0.22);
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.14);
    --nav-bg: rgba(11, 18, 32, 0.85);
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --gradient-1: #14b8a6;
    --gradient-2: #c9a227;
    --gradient-3: #2563eb;
}

[data-theme="light"] {
    --bg-primary: #faf8f3;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f2e9;
    --text-primary: #14213d;
    --text-secondary: #44506b;
    --text-muted: #8a93a6;
    --accent: #0f766e;
    --accent-light: #14b8a6;
    --accent-glow: rgba(15, 118, 110, 0.12);
    --border: rgba(20, 33, 61, 0.08);
    --border-hover: rgba(20, 33, 61, 0.16);
    --nav-bg: rgba(250, 248, 243, 0.9);
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3,
.logo-text,
.hero-title,
.section-title,
.project-title,
.pub-title {
    font-family: 'Source Serif 4', Georgia, serif;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}

input,
textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ===== Utilities ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.highlight {
    color: var(--accent);
}

/* ===== Navigation ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: padding 0.3s ease, background 0.4s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
    padding: 10px 0;
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.3s ease, background 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
    background: var(--accent-glow);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

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

[data-theme="dark"] .icon-sun {
    display: block;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

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

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

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 28px;
    padding: 4px 0;
}

.mobile-menu-btn span {
    display: block;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===== Hero Section ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 120px 0 80px;
}

.hero-bg-effects {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.22;
    animation: float 8s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--gradient-1);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--gradient-2);
    bottom: -50px;
    left: -50px;
    animation-delay: -3s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: var(--gradient-3);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.8;
}

.hero-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-outline {
    border: 2px solid var(--border);
    color: var(--text-primary);
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

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

/* ===== Scroll Indicator ===== */
.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.mouse {
    width: 24px;
    height: 38px;
    border: 2px solid var(--text-muted);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.wheel {
    width: 3px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 2px;
    animation: scroll-wheel 2s ease-in-out infinite;
}

@keyframes scroll-wheel {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(10px); opacity: 0; }
}

/* ===== Sections ===== */
.section {
    padding: 100px 0;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent);
    display: block;
    margin-bottom: 12px;
}

.section-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.section-line {
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border-radius: 2px;
    margin: 0 auto;
}

/* ===== About Section ===== */
.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 60px;
    align-items: center;
}

.about-text p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.about-intro {
    font-size: 1.15rem !important;
    color: var(--text-primary) !important;
    font-weight: 500;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.about-image {
    display: flex;
    justify-content: center;
}

.image-frame {
    position: relative;
    width: 280px;
    height: 340px;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent);
    position: relative;
    z-index: 1;
}

.frame-decoration {
    position: absolute;
    inset: -8px;
    border: 2px solid var(--accent);
    border-radius: 24px;
    opacity: 0.3;
    z-index: 0;
}

/* ===== Skills Section ===== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.skill-category {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.skill-category:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.skill-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-glow);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 20px;
}

.skill-category h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.skill-list li {
    color: var(--text-secondary);
    padding: 6px 0;
    font-size: 0.95rem;
    position: relative;
    padding-left: 16px;
}

.skill-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.6;
}

/* ===== Projects Section ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.project-image {
    position: relative;
    height: 200px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.project-placeholder {
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-placeholder {
    opacity: 0.2;
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(108, 99, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.project-link {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.3s ease, transform 0.2s ease;
}

.project-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.project-info {
    padding: 24px;
}

.project-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 16px;
    line-height: 1.6;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 4px 12px;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== Publications Section ===== */
.pub-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pub-card {
    display: flex;
    gap: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 32px;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.pub-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.pub-year {
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
    min-width: 56px;
}

.pub-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
}

.pub-authors {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 4px;
}

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

.pub-more {
    text-align: center;
    margin-top: 40px;
}

.pub-sync-note {
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Contact Section ===== */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

.contact-intro {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.8;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    transition: border-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.contact-item:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateX(4px);
}

.contact-item svg {
    flex-shrink: 0;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-status {
    font-size: 0.9rem;
    min-height: 1.2em;
}

.form-status-success {
    color: #4ade80;
}

.form-status-error {
    color: #f87171;
}

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

/* ===== Animations ===== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay for grid items */
.skills-grid .skill-category:nth-child(1) { transition-delay: 0s; }
.skills-grid .skill-category:nth-child(2) { transition-delay: 0.1s; }
.skills-grid .skill-category:nth-child(3) { transition-delay: 0.2s; }
.skills-grid .skill-category:nth-child(4) { transition-delay: 0.3s; }

.projects-grid .project-card:nth-child(1) { transition-delay: 0s; }
.projects-grid .project-card:nth-child(2) { transition-delay: 0.15s; }
.projects-grid .project-card:nth-child(3) { transition-delay: 0.3s; }

/* ===== Responsive Design ===== */
@media (max-width: 968px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .about-image {
        order: -1;
    }

    .image-frame {
        width: 220px;
        height: 270px;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .pub-card {
        flex-direction: column;
        gap: 8px;
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: 100px 32px 32px;
        gap: 8px;
        transition: right 0.3s ease;
        border-left: 1px solid var(--border);
    }

    .nav-links.open {
        right: 0;
    }

    .nav-link {
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
    }

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

    .hero {
        padding: 100px 0 60px;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .section {
        padding: 70px 0;
    }

    .about-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

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

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

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

    .hero-cta {
        flex-direction: column;
    }

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

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

    .about-stats {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

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

    html {
        scroll-behavior: auto;
    }

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 4px;
}
