/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark mode (default) */
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --accent: #007aff;
    --accent-hover: #0051d5;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --nav-bg: rgba(0, 0, 0, 0.8);
}

[data-theme="light"] {
    /* Light mode */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #e8e8ed;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --accent: #007aff;
    --accent-hover: #0051d5;
    --border: rgba(0, 0, 0, 0.1);
    --shadow: rgba(0, 0, 0, 0.1);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --nav-bg: rgba(255, 255, 255, 0.8);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 0;
}

html, body {
    overflow-x: hidden;
    scroll-behavior: smooth;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth transitions for theme changes - applied to key elements */
.navbar, .btn, .work-item, .publication-card, 
.about-text, .section-title, .nav-link {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease,
                box-shadow 0.3s ease,
                transform 0.3s ease;
}

/* Ensure animations and transitions work on desktop by default */
@media (min-width: 769px) {
    html {
        scroll-behavior: smooth !important;
    }
    
    /* Explicitly enable animations for all elements on desktop - override mobile restrictions */
    body *,
    body *::before,
    body *::after {
        animation-duration: revert !important;
        animation-iteration-count: revert !important;
        transition-duration: revert !important;
        transition-delay: revert !important;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    padding-left: max(40px, calc(240px + 40px)); /* More space for navbar on desktop */
    margin-left: 0; /* Ensure it shifts right */
}

@media (min-width: 769px) {
    .container {
        margin-left: 0; /* Shift all content to the right */
    }
}

@media (max-width: 1024px) {
    .container {
        padding-left: max(32px, calc(220px + 30px));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 20px;
        padding-left: 20px; /* Normal padding on mobile */
    }
}

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

/* Navigation - Floating Vertical Menu */
.navbar {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    min-width: 200px;
    background: transparent;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Responsive navigation positioning */
@media (max-width: 1024px) {
    .navbar {
        left: 16px;
    }
}

@media (max-width: 768px) {
    .navbar {
        left: -280px;
    }
}

.nav-container {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 8px;
}

/* Floating Section Indicator Pill */
.section-indicator {
    position: fixed;
    left: 40px;
    top: 40px;
    z-index: 999;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.section-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-indicator.updating {
    transform: scale(0.95);
}

.indicator-text {
    display: inline-block;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    list-style: none;
    gap: 4px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    transition: all 0.2s ease-out;
    position: relative;
    padding: 10px 16px;
    border-radius: 20px;
    display: block;
    background: transparent;
    opacity: 0.4;
    transform: translateX(-20px);
}

.nav-link.home-icon {
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
}

.nav-link.home-icon:hover {
    background: transparent !important;
}

.nav-link.home-icon.active {
    background: transparent !important;
}

.nav-link.home-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}


.nav-link.visible {
    opacity: 1;
    transform: translateX(0);
}

.nav-link.pop-out {
    animation: popOut 0.3s ease-out !important;
}

@keyframes popOut {
    0% {
        transform: translateX(-20px) scale(0.9) !important;
        opacity: 0.4 !important;
    }
    100% {
        transform: translateX(0) scale(1) !important;
        opacity: 1 !important;
    }
}

.nav-link:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    opacity: 1;
    transform: translateX(0);
}

.nav-link:focus {
    outline: none;
}

.nav-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 20px;
    padding: 0 16px;
}

.theme-toggle {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    outline: none;
    z-index: 10;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
    border-color: var(--accent);
    transform: scale(1.1);
    background: var(--bg-secondary);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:focus,
.theme-toggle:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.theme-icon {
    font-size: 16px;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: block;
    line-height: 1;
    transform: rotate(0deg) scale(1);
    user-select: none;
}

[data-theme="light"] .theme-icon {
    transform: rotate(360deg) scale(1);
}

/* Sunrise / sunset theme flash from toggle */
html {
    --theme-flash-x: 50%;
    --theme-flash-y: 0%;
    --theme-flash-color: #ffb347;
}

html.theme-flash::before {
    content: '';
    position: fixed;
    inset: -30%;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle at var(--theme-flash-x) var(--theme-flash-y),
        var(--theme-flash-color) 0%,
        transparent 55%);
    opacity: 0;
    transform: scale(0.6);
    transform-origin: center;
    z-index: 999;
    animation: themeFlash 1.1s ease-out forwards;
}

@keyframes themeFlash {
    0% {
        opacity: 0.0;
        transform: scale(0.25);
    }
    25% {
        opacity: 0.65;
        transform: scale(0.9);
    }
    60% {
        opacity: 0.45;
        transform: scale(1.4);
    }
    100% {
        opacity: 0;
        transform: scale(2.2);
    }
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.hamburger span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 100px 40px 60px;
    text-align: center;
    background-color: var(--bg-primary);
    overflow: hidden;
    z-index: 200; /* Much higher than sections (50) to ensure hero stays visible */
}

/* Responsive hero padding */
@media (max-width: 1024px) {
    .hero {
        padding: 100px 32px 60px;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 100px 20px 60px;
        min-height: auto;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 80px 16px 40px;
    }
}

.neuron-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Above hero background, below content */
    pointer-events: none;
    background-color: var(--bg-primary);
    opacity: 1; /* Ensure canvas is visible */
    visibility: visible; /* Ensure canvas is visible */
}


.hero-content {
    max-width: 800px;
    animation: fadeInUp 1s ease;
    position: relative;
    z-index: 201; /* Higher than hero (200) to ensure content appears above canvas */
    width: 100%;
    padding: 0 20px;
    margin-left: auto;
    margin-right: auto;
    padding-left: max(20px, calc(240px + 40px)); /* More space for navbar on desktop */
    padding-right: 40px;
    pointer-events: auto; /* Ensure content is clickable */
}

@media (min-width: 769px) {
    .hero-content {
        margin-left: 0; /* Shift hero content to the right */
    }
}

/* Adjust hero content padding on smaller screens */
@media (max-width: 1024px) {
    .hero-content {
        padding-left: max(20px, calc(200px + 30px));
        padding-right: 30px;
    }
}

@media (max-width: 768px) {
    .hero-content {
        padding-left: 20px; /* Normal padding on mobile */
        padding-right: 20px;
    }
}

@media (max-width: 768px) {
    .hero-content {
        padding: 0 10px;
    }
}

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

.hero-title {
    margin-bottom: 24px;
    position: relative;
    z-index: 101; /* Ensure title is visible */
    pointer-events: auto;
}

.title-line {
    display: block;
    font-size: clamp(18px, 3vw, 40px);
    font-weight: 300;
    letter-spacing: -3px;
    line-height: 1.05;
    margin-bottom: 8px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.title-main {
    font-weight: 400;
    color: var(--text-primary);
    font-size: clamp(28px, 5vw, 60px);
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: inline-block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 101; /* Ensure subtitle is visible */
    pointer-events: auto;
    line-height: 1.4;
}

.hero-subtitle.typing-cursor::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 20px;
    background: var(--text-secondary);
    margin-left: 4px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.hero-profile {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    margin-bottom: 16px;
    position: relative;
    z-index: 101; /* Ensure profile image is visible */
    pointer-events: auto;
}

.profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-image:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 12px 32px rgba(0, 122, 255, 0.2) !important;
}

.hero-resume {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    margin-top: 8px;
    position: relative;
    z-index: 1002; /* Higher than navbar to ensure buttons are clickable */
    pointer-events: auto;
}

.hero-resume .btn {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    background: var(--accent);
    color: var(--text-primary);
    border: 2px solid var(--accent);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
    transition: all 0.3s ease;
}

.hero-resume .btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.5);
}

.hero-description {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--text-primary);
    max-width: 680px;
    margin: 0 auto 16px;
    line-height: 1.7;
    font-weight: 500;
    letter-spacing: -0.2px;
    opacity: 0;
    animation: fadeInUp 1s ease-out 1.5s forwards;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 101; /* Ensure description is visible */
    pointer-events: auto;
}

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

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 20px;
    position: relative;
    z-index: 1002; /* Higher than navbar to ensure buttons are clickable */
    pointer-events: auto;
}

.btn {
    padding: 14px 32px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    border: 1px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
    z-index: 1001; /* Higher than navbar (1000) to ensure buttons are always visible */
}

.btn-small {
    padding: 8px 18px;
    font-size: 14px;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.btn-primary:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--text-primary);
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--text-primary);
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="light"] .btn-secondary:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

.mouse {
    width: 26px;
    height: 42px;
    border: 2px solid var(--text-secondary);
    border-radius: 16px;
    position: relative;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.mouse:hover {
    opacity: 1;
}

.mouse::before {
    content: '';
    width: 4px;
    height: 10px;
    background: var(--text-secondary);
    border-radius: 2px;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll 2s infinite;
    opacity: 0.8;
}

/* Section Styles */
section {
    padding: 80px 0;
    position: relative;
    z-index: 10; /* Much lower than hero (200) to ensure hero stays visible when scrolling */
}

/* Work section - ensure it doesn't cover hero buttons */
#work {
    position: relative;
    z-index: 10; /* Lower than hero */
}

/* Ensure all sections respect navbar space on desktop */
@media (min-width: 769px) {
    section {
        margin-left: 0; /* Content shifts right */
    }
}

/* Responsive section padding - reduced to prevent overlapping */
@media (max-width: 1024px) {
    section {
        padding: 70px 0;
    }
}

@media (max-width: 768px) {
    section {
        padding: 60px 0;
    }
}

@media (max-width: 480px) {
    section {
        padding: 50px 0;
    }
}


/* About Section */
.about {
    background: var(--bg-secondary);
    position: relative;
    z-index: 10; /* Much lower than hero (200) to ensure hero buttons stay visible */
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
}

/* Responsive about content */
@media (max-width: 1024px) {
    .about-content {
        gap: 60px;
    }
}

@media (max-width: 768px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }
}

.about-meta {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.about-image {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.about-text {
    font-size: clamp(16px, 2vw, 18px);
    line-height: 1.8;
    color: var(--text-secondary);
}

.about-text p {
    margin-bottom: 20px;
}

.about-intro {
    font-size: clamp(18px, 2.5vw, 22px);
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 30px !important;
}

.about-publications h3 {
    font-size: 24px;
    margin-bottom: 40px;
    font-weight: 600;
}

.publications-scroller {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding: 20px 0 30px 0;
    margin-bottom: 20px;
}

.publications-scroller::-webkit-scrollbar {
    height: 6px;
}

.publications-scroller::-webkit-scrollbar-track {
    background: transparent;
}

.publications-scroller::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.publications-scroller::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.publications-track {
    display: flex;
    gap: 40px;
    padding: 0 40px 20px 0;
}

/* Responsive publications track */
@media (max-width: 768px) {
    .publications-track {
        gap: 24px;
        padding: 0 20px 20px 0;
    }
}

@media (max-width: 480px) {
    .publications-track {
        gap: 20px;
        padding: 0 16px 20px 0;
    }
}

.publication-card {
    min-width: 400px;
    max-width: 450px;
    padding: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* Responsive publication card */
@media (max-width: 1024px) {
    .publication-card {
        min-width: 350px;
        max-width: 400px;
        padding: 32px;
    }
}

@media (max-width: 768px) {
    .publication-card {
        min-width: 280px;
        max-width: 100%;
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .publication-card {
        min-width: 0;
        padding: 20px;
    }
    
    .publication-title {
        font-size: 20px;
    }
    
    .publication-authors {
        font-size: 14px;
    }
    
    .publication-venue {
        font-size: 13px;
    }
}

.publication-card:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.15) !important;
}

.publication-year {
    display: inline-block;
    padding: 8px 16px;
    background: var(--accent);
    color: var(--text-primary);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}

.publication-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.5;
    letter-spacing: -0.4px;
}

.publication-authors {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.7;
}

.publication-venue {
    font-size: 15px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
    font-style: italic;
    line-height: 1.6;
}

.publication-link {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.publication-link:hover {
    color: var(--accent-hover);
    transform: translateX(4px);
}

.scroll-hint {
    text-align: center;
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: 15px;
    opacity: 0.6;
}

/* Work Section */
.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
}

/* Responsive work grid */
@media (max-width: 1024px) {
    .work-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 32px;
    }
}

@media (max-width: 768px) {
    .work-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

.work-item,
.work-item-link {
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s ease;
    border: 1px solid var(--border);
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 1001; /* Higher than navbar to ensure work items are visible */
}

.work-item-link {
    cursor: pointer;
}

.work-item:hover,
.work-item-link:hover {
    transform: translateY(-10px) !important;
    box-shadow: 0 20px 60px var(--shadow) !important;
    border-color: var(--accent) !important;
    text-decoration: none;
    color: inherit;
}

.work-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

/* Responsive work image */
@media (max-width: 768px) {
    .work-image {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .work-image {
        height: 180px;
    }
}

.work-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.work-item:hover .work-image img {
    transform: scale(1.05) !important;
}

.work-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 16px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.work-content {
    padding: 30px;
}

.work-title {
    font-size: clamp(20px, 3vw, 24px);
    font-weight: 600;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

.work-description {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
    font-size: clamp(14px, 1.8vw, 16px);
}

.work-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

/* Responsive work tags */
@media (max-width: 480px) {
    .work-tags {
        gap: 8px;
    }
}

.tag {
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.work-links {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* Responsive work links */
@media (max-width: 480px) {
    .work-links {
        gap: 16px;
        flex-direction: column;
        align-items: flex-start;
    }
}

.work-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: all 0.25s ease;
}

/* Links are always clickable, cards are never clickable */

.work-link::after {
    content: '↗';
    font-size: 16px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0.8;
}

.work-link:hover {
    color: var(--accent-hover);
    transform: translateX(4px);
}

.work-link:hover::after {
    transform: translateX(4px);
    opacity: 1;
}

/* Blog Section */
.blog {
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
    z-index: 10; /* Much lower than hero (200) to ensure hero buttons stay visible */
}

/* Ensure blog section container doesn't overflow on mobile */
@media (max-width: 768px) {
    .blog .container {
        overflow: visible;
    }
    
    .blog {
        overflow: visible;
    }
}

.blog-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.blog-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 60px 0;
    position: relative;
    z-index: 2;
    width: 100%;
    overflow: hidden;
}

/* Desktop: reduce left padding since container already has padding */
@media (min-width: 769px) {
    .blog-content {
        padding-left: 0; /* Container already handles the spacing */
    }
}

@media (max-width: 768px) {
    .blog-content {
        padding-left: 20px; /* Normal padding on mobile */
    }
}

/* Responsive blog content */
@media (max-width: 768px) {
    .blog-content {
        padding: 40px 0;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .blog-content {
        padding: 30px 0;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
}

.blog-link {
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    pointer-events: auto;
    cursor: pointer;
    display: inline-block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Responsive blog link */
@media (max-width: 768px) {
    .blog-link {
        text-align: center;
        width: 100%;
        max-width: 100%;
    }
}

.blog-text {
    font-size: 64px;
    font-weight: 700;
    letter-spacing: 4px;
    transition: color 0.3s ease;
    color: var(--text-primary);
    position: relative;
    z-index: 2;
    display: inline-block;
    white-space: nowrap;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Responsive blog text */
@media (max-width: 1024px) {
    .blog-text {
        font-size: 48px;
        letter-spacing: 3px;
    }
}

@media (max-width: 768px) {
    .blog-text {
        font-size: clamp(24px, 8vw, 36px);
        letter-spacing: 1px;
        white-space: normal;
        line-height: 1.2;
        word-break: break-word;
    }
    
    .blog-hint {
        font-size: 14px;
        display: block;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .blog-text {
        font-size: clamp(20px, 7vw, 28px);
        letter-spacing: 0.5px;
        white-space: normal;
        line-height: 1.3;
        word-break: break-word;
    }
    
    .blog-hint {
        font-size: 12px;
        display: block;
        margin-top: 6px;
        line-height: 1.4;
    }
}

.blog-hint {
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 1px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    margin-left: 0px;
    display: inline;
}

/* Responsive blog hint */
@media (max-width: 768px) {
    .blog-hint {
        display: block;
        margin-top: 8px;
        white-space: normal;
    }
}

@media (max-width: 480px) {
    .blog-hint {
        display: block;
        margin-top: 6px;
        white-space: normal;
    }
}

.emoji-container {
    display: inline-block;
    margin-left: 2px;
}

.emoji-rotate {
    display: inline-block;
    transform: rotate(90deg);
    transform-origin: center;
}

.mouth {
    display: inline-block;
    animation: mouthBlink var(--mouth-duration, 12s) ease-in-out infinite;
    transform-origin: center;
}

@keyframes mouthBlink {
    0%, 90% {
        transform: scaleX(1) scaleY(1);
    }
    92% {
        transform: scaleX(0.1) scaleY(1);
    }
    94% {
        transform: scaleX(1) scaleY(1);
    }
    100% {
        transform: scaleX(1) scaleY(1);
    }
}

.blog-link:hover .blog-text {
    color: #ffd700 !important; /* Yellow on hover */
}

.blog-link:hover .blog-hint {
    color: #ffd700 !important; /* Yellow on hover */
}

/* More projects link under work grid */
.work-more {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.work-more-link {
    font-size: 16px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    text-underline-offset: 4px;
    cursor: pointer;
    letter-spacing: 0.03em;
    position: relative;
    padding-bottom: 2px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.work-more-link:hover {
    color: var(--accent-hover);
    transform: translateX(2px);
}

/* Languages Section */
.languages {
    background: var(--bg-secondary);
}

/* Skills & Languages – inline emoji / flags */
.skill-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.skill-emoji {
    display: inline-flex;
    align-items: center;
    opacity: 0;
    transform: translateY(2px) scale(0.9);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.flag-icon {
    width: 18px;
    height: 12px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
    display: block;
    margin-right: 4px;
}

.skill-secondary {
    font-size: 12px;
    color: var(--text-tertiary);
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.skill-item:hover .skill-emoji,
.skill-item:hover .skill-secondary {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 24px;
}

.skill-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skill-bar {
    display: none; /* Hide progress bars */
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 1s ease;
}

.about-skills h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Responsive skills grid */
@media (min-width: 768px) {
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.languages .section-header {
    text-align: left;
}

.section-title {
    font-size: clamp(32px, 5vw, 48px);
    margin-bottom: 16px;
}

/* Responsive section title */
@media (max-width: 768px) {
    .section-header {
        margin-bottom: 32px;
    }
}

.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px 24px;
    margin-top: 24px;
}

.language-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.language-name {
    font-weight: 500;
    color: var(--text-primary);
}

.language-level {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Contact Section */
.contact {
    background: var(--bg-secondary);
    position: relative;
    z-index: 10; /* Much lower than hero (200) to ensure hero buttons stay visible */
}

.contact-intro {
    text-align: center;
    font-size: 20px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 60px;
    line-height: 1.8;
}

.contact-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
}

/* Responsive contact content */
@media (max-width: 768px) {
    .contact-content {
        padding: 40px 0;
    }
}

@media (max-width: 480px) {
    .contact-content {
        padding: 30px 0;
    }
}

.social-icons {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: center;
}

.social-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.social-icon svg {
    width: 24px;
    height: 24px;
}

.social-icon:hover {
    transform: translateY(-4px) scale(1.1) !important;
    background: var(--bg-secondary);
    border-color: var(--accent);
    box-shadow: 0 8px 24px var(--shadow) !important;
    color: var(--accent);
}

.social-icon:active {
    transform: translateY(-2px) scale(1.05);
}

/* Footer */
.footer {
    background: var(--bg-primary);
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer p {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

@keyframes scroll {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(15px);
    }
}

@keyframes fillBar {
    from {
        width: 0;
    }
}

/* Responsive Design */

/* Tablet and Medium Screens (1024px and below) */
@media (max-width: 1024px) {
    .section-indicator {
        left: 24px;
        top: 24px;
    }
    
    .publication-card {
        min-width: 350px;
        max-width: 400px;
    }
    
    .work-item {
        min-width: 0;
    }
}

/* Mobile and Small Tablets (768px and below) */
@media (max-width: 768px) {
    body {
        padding-left: 0;
    }

    .navbar {
        position: fixed;
        left: -280px;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        min-width: 200px;
        background: var(--nav-bg);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        padding: 24px;
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
        transition: left 0.3s ease, transform 0.3s ease;
    }

    .navbar.active {
        left: 20px;
        transform: translateY(-50%);
    }

    .nav-container {
        gap: 8px;
    }

    .nav-logo {
        margin-bottom: 20px;
        font-size: 16px;
        padding: 0;
    }

    .nav-menu {
        gap: 4px;
    }

    .nav-link {
        padding: 10px 16px;
    }

    .nav-actions {
        margin-top: 20px;
        padding: 0;
    }

    .hamburger {
        display: flex;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1001;
        background: var(--bg-tertiary);
        padding: 12px;
        border-radius: 8px;
        border: 1px solid var(--border);
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* Overlay when menu is open */
    .navbar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
        backdrop-filter: blur(4px);
    }

    .section-indicator {
        left: 20px;
        top: 20px;
        font-size: 12px;
        padding: 8px 16px;
    }

    .about-text {
        font-size: 16px;
    }
    
    .about-intro {
        font-size: 20px;
    }

    .publication-card {
        min-width: 280px;
        max-width: 100%;
        padding: 24px;
    }

    .publications-track {
        gap: 24px;
        padding: 0 16px 20px 0;
    }

    .scroll-hint {
        display: none;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .work-content {
        padding: 24px;
    }
    
    .work-title {
        font-size: 22px;
    }
    
    .work-description {
        font-size: 15px;
    }
    
    .profile-image {
        width: 100px;
        height: 100px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .hero-description {
        font-size: 16px;
    }
    
    .social-icons {
        flex-wrap: wrap;
        gap: 20px;
    }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.1s !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }
    
    .work-item:hover,
    .work-item-link:hover,
    .publication-card:hover,
    .social-icon:hover,
    .profile-image:hover,
    .btn-primary:hover,
    .btn-secondary:hover,
    .hero-resume .btn:hover,
    .work-link:hover,
    .nav-link:hover:not(.active) {
        transform: none !important;
    }
    
    .fade-in {
        opacity: 1 !important;
        transform: none !important;
    }
    
    .hero-content {
        transform: none !important;
        opacity: 1 !important;
    }
    
    .scroll-indicator,
    .mouse::before,
    .hero-subtitle.typing-cursor::after,
    .mouth,
    .nav-link.pop-out {
        animation: none !important;
    }
    
    html.theme-flash::before {
        animation: none !important;
        opacity: 0 !important;
    }
    
    .skill-progress {
        transition: none !important;
    }
}

/* Reduce animations on mobile devices ONLY */
@media (max-width: 768px) {
    /* Disable or reduce animations on mobile only */
    html {
        scroll-behavior: auto !important;
    }
    
    /* Apply animation restrictions only on mobile */
    body *,
    body *::before,
    body *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.1s !important;
        transition-delay: 0s !important;
    }
    
    /* Disable transform animations on mobile only */
    .work-item:hover,
    .work-item-link:hover {
        transform: none !important;
    }
    
    .work-item:hover .work-image img {
        transform: none !important;
    }
    
    .publication-card:hover {
        transform: none !important;
    }
    
    .social-icon:hover {
        transform: none !important;
    }
    
    .profile-image:hover {
        transform: none !important;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none !important;
    }
    
    .hero-resume .btn:hover {
        transform: none !important;
    }
    
    .work-link:hover {
        transform: none !important;
    }
    
    .nav-link:hover:not(.active) {
        transform: none !important;
    }
    
    /* Reduce fade-in animations on mobile */
    .fade-in {
        opacity: 1 !important;
        transform: none !important;
    }
    
    /* Disable parallax on mobile */
    .hero-content {
        transform: none !important;
        opacity: 1 !important;
    }
    
    /* Reduce scroll indicator animation on mobile */
    .scroll-indicator {
        animation: none !important;
    }
    
    .mouse::before {
        animation: none !important;
    }
    
    /* Reduce typing animation on mobile */
    .hero-subtitle.typing-cursor::after {
        animation: none !important;
    }
    
    /* Reduce mouth animation on mobile */
    .mouth {
        animation: none !important;
    }
    
    /* Disable theme flash animation on mobile */
    html.theme-flash::before {
        animation: none !important;
        opacity: 0 !important;
    }
    
    /* Reduce pop-out animations on mobile */
    .nav-link.pop-out {
        animation: none !important;
    }
    
    /* Disable skill bar animations on mobile */
    .skill-progress {
        transition: none !important;
    }
}

/* Ensure desktop animations are fully enabled (above 768px) - MUST come after mobile rules */
@media (min-width: 769px) {
    /* Explicitly enable all animations and transitions on desktop */
    html {
        scroll-behavior: smooth !important;
    }
    
    /* Remove any animation restrictions for desktop - explicitly restore normal values */
    .work-item,
    .work-item-link,
    .work-item *,
    .publication-card,
    .publication-card *,
    .btn,
    .btn *,
    .nav-link,
    .nav-link *,
    .social-icon,
    .social-icon *,
    .fade-in,
    .scroll-indicator,
    .mouse,
    .mouse::before,
    .hero-subtitle,
    .hero-subtitle::after,
    .mouth,
    .skill-progress,
    .work-image img {
        /* Remove animation restrictions - explicitly restore normal values */
        animation-duration: revert !important;
        animation-iteration-count: revert !important;
        transition-duration: revert !important;
        transition-delay: revert !important;
    }
    
    /* Explicitly set transitions for interactive elements */
    .work-item,
    .work-item-link {
        transition: all 0.4s ease !important;
    }
    
    .work-image img {
        transition: transform 0.4s ease !important;
    }
    
    .publication-card {
        transition: all 0.3s ease !important;
    }
    
    .btn {
        transition: all 0.3s ease !important;
    }
    
    .social-icon {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    .profile-image {
        transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    }
    
    .nav-link {
        transition: all 0.2s ease-out !important;
    }
    
    .work-link {
        transition: all 0.25s ease !important;
    }
    
    /* Restore all hover animations on desktop */
    .work-item:hover,
    .work-item-link:hover {
        transform: translateY(-10px) !important;
        box-shadow: 0 20px 60px var(--shadow) !important;
        border-color: var(--accent) !important;
    }
    
    .work-item:hover .work-image img {
        transform: scale(1.05) !important;
    }
    
    .publication-card:hover {
        transform: translateY(-4px) !important;
        box-shadow: 0 8px 24px rgba(0, 122, 255, 0.15) !important;
    }
    
    .social-icon:hover {
        transform: translateY(-4px) scale(1.1) !important;
    }
    
    .profile-image:hover {
        transform: scale(1.05) !important;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: translateY(-2px) !important;
    }
    
    .hero-resume .btn:hover {
        transform: translateY(-2px) !important;
    }
    
    .work-link:hover {
        transform: translateX(4px) !important;
    }
    
    .nav-link:hover:not(.active) {
        transform: translateX(4px) !important;
    }
    
    /* Ensure fade-in animations work on desktop */
    .fade-in {
        opacity: 0 !important;
        transform: translateY(30px) !important;
        transition: opacity 0.6s ease, transform 0.6s ease !important;
    }
    
    .fade-in.visible {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
    
    /* Restore scroll indicator animation on desktop */
    .scroll-indicator {
        animation: bounce 2s infinite !important;
    }
    
    .mouse::before {
        animation: scroll 2s infinite !important;
    }
    
    /* Restore typing animation on desktop */
    .hero-subtitle.typing-cursor::after {
        animation: blink 1s infinite !important;
    }
    
    /* Restore mouth animation on desktop */
    .mouth {
        animation: mouthBlink var(--mouth-duration, 12s) ease-in-out infinite !important;
    }
    
    /* Restore theme flash animation on desktop */
    html.theme-flash::before {
        animation: themeFlash 1.1s ease-out forwards !important;
    }
    
    /* Restore pop-out animations on desktop */
    .nav-link.pop-out {
        animation: popOut 0.3s ease-out !important;
    }
    
    /* Restore skill bar animations on desktop */
    .skill-progress {
        transition: width 1s ease !important;
    }
    
    /* Ensure hero content animation works on desktop */
    .hero-content {
        animation: fadeInUp 1s ease !important;
    }
    
    /* Ensure transitions work properly on desktop */
    .work-item,
    .work-item-link {
        transition: all 0.4s ease !important;
    }
    
    .publication-card {
        transition: all 0.3s ease !important;
    }
    
    .social-icon {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    .profile-image {
        transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    }
    
    .btn,
    .work-link,
    .nav-link {
        transition: all 0.3s ease !important;
    }
    
    .work-image img {
        transition: transform 0.4s ease !important;
    }
}

/* Small Mobile Devices (480px and below) */
@media (max-width: 480px) {
    .nav-container {
        padding: 15px 20px;
    }

    .hamburger {
        top: 16px;
        left: 16px;
        padding: 10px;
    }
    
    .navbar.active {
        left: 16px;
    }

    .section-indicator {
        left: 16px;
        top: 16px;
        font-size: 11px;
        padding: 6px 12px;
    }

    .title-line {
        font-size: clamp(32px, 12vw, 48px);
        letter-spacing: -2px;
    }
    
    .hero-subtitle {
        font-size: 16px;
        letter-spacing: 1px;
    }
    
    .hero-description {
        font-size: 15px;
        line-height: 1.6;
    }

    .profile-image {
        width: 80px;
        height: 80px;
    }
    
    .hero-resume .btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 14px;
    }

    .social-icons {
        gap: 16px;
        flex-wrap: wrap;
    }
    
    .social-icon {
        width: 50px;
        height: 50px;
    }
    
    .social-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .about-text {
        font-size: 15px;
    }
    
    .about-intro {
        font-size: 18px;
    }
    
    .work-content {
        padding: 20px;
    }
    
    .work-title {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .work-description {
        font-size: 14px;
        margin-bottom: 16px;
    }
    
    .work-link {
        font-size: 16px;
    }
    
    .tag {
        font-size: 12px;
        padding: 5px 12px;
    }
    
    .section-title {
        font-size: 32px;
    }
    
    .contact-content {
        padding: 40px 0;
    }
}

/* Smooth scroll reveal */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

