/* ========================================
   CSS Variables & Theme
   ======================================== */
:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

    --nav-height: 64px;
    --container-max: 1100px;
    --section-padding: 100px;
}

[data-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --border: #2a2a3a;
    --border-light: #1e1e2e;
    --text-primary: #e8e8ef;
    --text-secondary: #9090a8;
    --text-muted: #606078;
    --accent: #6c8cff;
    --accent-soft: rgba(108, 140, 255, 0.12);
    --accent-glow: rgba(108, 140, 255, 0.25);
    --gradient-start: #6c8cff;
    --gradient-end: #a78bfa;
    --tag-bg: rgba(108, 140, 255, 0.1);
    --tag-border: rgba(108, 140, 255, 0.2);
    --tag-text: #8ba4ff;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
    --nav-bg: rgba(10, 10, 15, 0.85);
}

[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: #f0f0f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f5fa;
    --border: #e0e0ea;
    --border-light: #eaeaf0;
    --text-primary: #1a1a2e;
    --text-secondary: #5a5a78;
    --text-muted: #8888a0;
    --accent: #4a6cf7;
    --accent-soft: rgba(74, 108, 247, 0.08);
    --accent-glow: rgba(74, 108, 247, 0.15);
    --gradient-start: #4a6cf7;
    --gradient-end: #7c5cfc;
    --tag-bg: rgba(74, 108, 247, 0.06);
    --tag-border: rgba(74, 108, 247, 0.15);
    --tag-text: #4a6cf7;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.1);
    --nav-bg: rgba(250, 250, 250, 0.85);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background 0.4s var(--ease-out), color 0.3s var(--ease-out);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

a:hover { opacity: 0.85; }

::selection {
    background: var(--accent-soft);
    color: var(--accent);
}

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

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

.nav.scrolled {
    box-shadow: var(--shadow);
}

.nav-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.nav-logo .accent {
    color: var(--accent);
}

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

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background: var(--accent-soft);
    opacity: 1;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

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

.btn-lang {
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lang:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-menu-toggle {
    display: none;
}

/* ========================================
   Hero
   ======================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-top: var(--nav-height);
}

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

.grid-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border-light) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.4;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--gradient-start);
    top: -100px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--gradient-end);
    bottom: -50px;
    left: -100px;
    animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

.hero-content {
    position: relative;
    text-align: center;
    padding: 40px 0;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 100px;
    border: 1px solid var(--tag-border);
    background: var(--tag-bg);
    color: var(--tag-text);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 32px;
    animation: fadeInDown 0.8s var(--ease-out) both;
}

.hero-greeting {
    display: block;
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 8px;
    animation: fadeInDown 0.8s var(--ease-out) 0.1s both;
}

.hero-title {
    margin-bottom: 16px;
}

.hero-name {
    display: block;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInDown 0.8s var(--ease-out) 0.2s both;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    color: var(--accent);
    font-weight: 500;
    min-height: 2em;
    margin-bottom: 20px;
    animation: fadeInDown 0.8s var(--ease-out) 0.3s both;
}

.typed-cursor {
    animation: blink 1s step-end infinite;
    color: var(--accent);
}

@keyframes blink {
    50% { opacity: 0; }
}

.hero-description {
    max-width: 600px;
    margin: 0 auto 32px;
    color: var(--text-secondary);
    font-size: 1.05rem;
    animation: fadeInDown 0.8s var(--ease-out) 0.4s both;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 48px;
    animation: fadeInDown 0.8s var(--ease-out) 0.5s both;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s var(--ease-out);
    cursor: pointer;
    border: none;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--accent-glow);
    color: #fff;
    opacity: 1;
}

.btn-outline {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
}

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

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    animation: fadeInUp 0.8s var(--ease-out) 0.6s both;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.stat-plus {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.scroll-indicator {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* ========================================
   Sections
   ======================================== */
.section {
    padding: var(--section-padding) 0;
}

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

.section-title {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 48px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
}

/* ========================================
   About
   ======================================== */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

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

.about-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.detail {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail svg {
    color: var(--accent);
    flex-shrink: 0;
}

.about-highlights {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.highlight-card {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.3s var(--ease-out);
}

.highlight-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.highlight-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.highlight-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.highlight-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ========================================
   Skills
   ======================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.skill-category {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.3s var(--ease-out);
}

.skill-category:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.skill-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.skill-category-header svg {
    color: var(--accent);
}

.skill-category-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

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

.skill-tag {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--tag-bg);
    color: var(--tag-text);
    border: 1px solid var(--tag-border);
    transition: all 0.2s;
}

.skill-tag:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

/* ========================================
   Timeline (Experience)
   ======================================== */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent), var(--border));
    border-radius: 1px;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -28px;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-content {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.3s var(--ease-out);
}

.timeline-content:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.timeline-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.timeline-org {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
    white-space: nowrap;
    padding: 4px 12px;
    border-radius: 8px;
    background: var(--accent-soft);
}

.timeline-details {
    list-style: none;
}

.timeline-details li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.timeline-details li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.5;
}

.timeline-details li:last-child {
    margin-bottom: 0;
}

/* ========================================
   Projects
   ======================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.project-card {
    padding: 28px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    transition: all 0.3s var(--ease-out);
}

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

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: var(--accent);
}

.project-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.project-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.project-subtitle {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    flex: 1;
    margin-bottom: 16px;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.project-tags span {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-mono);
    background: var(--tag-bg);
    color: var(--tag-text);
    border: 1px solid var(--tag-border);
}

.project-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.project-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}

.project-wip-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 180, 50, 0.12);
    color: #e0a030;
    font-weight: 500;
    border: 1px solid rgba(255, 180, 50, 0.2);
}

/* ========================================
   Publications
   ======================================== */
.publications-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pub-item {
    display: flex;
    align-items: baseline;
    gap: 24px;
    padding: 20px 24px;
    border-radius: 12px;
    transition: background 0.2s;
}

.pub-item:hover {
    background: var(--bg-card);
}

.pub-year {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    min-width: 48px;
}

.pub-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

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

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

.pub-abstract {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.6;
}

.pub-links {
    margin-top: 6px;
    font-size: 0.82rem;
}

.section-see-more {
    text-align: center;
    margin-top: 32px;
}

.pub-links a {
    font-weight: 500;
}

/* ========================================
   Education
   ======================================== */
.education-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.edu-card {
    display: flex;
    gap: 24px;
    padding: 28px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.3s var(--ease-out);
}

.edu-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.edu-year {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 80px;
}

.edu-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.edu-org {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.edu-thesis {
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-style: italic;
    margin-bottom: 6px;
}

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

/* ========================================
   Contact
   ======================================== */
.contact-container {
    text-align: center;
}

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

.contact-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.3s var(--ease-out);
    font-weight: 500;
    font-size: 0.9rem;
}

.contact-card svg {
    color: var(--accent);
}

.contact-card:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: var(--accent);
    opacity: 1;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border-light);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-nav {
    display: flex;
    gap: 20px;
}

.footer-nav a {
    color: var(--text-muted);
    transition: color 0.2s;
}

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

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   Mobile Menu
   ======================================== */
.nav-links.open {
    display: flex;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 900px) {
    :root {
        --section-padding: 72px;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--nav-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border);
        gap: 4px;
    }

    .nav-links.open {
        display: flex;
    }

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

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

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

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

    .hero-stats {
        gap: 24px;
    }

    .timeline-header {
        flex-direction: column;
        gap: 8px;
    }

    .edu-card {
        flex-direction: column;
        gap: 12px;
    }

    .contact-links {
        flex-direction: column;
        align-items: center;
    }

    .pub-item {
        flex-direction: column;
        gap: 6px;
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-stats {
        flex-direction: column;
        gap: 16px;
    }

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