/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent-primary: #ff6b4a;
    --accent-secondary: #ff9f7a;
    --accent-glow: rgba(255, 107, 74, 0.3);
    --border-color: #2a2a35;
    --card-bg: #15151f;
    --success-color: #4ade80;
    --font-display: 'Darker Grotesque', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --left-pane-width: 380px;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Light Mode ===== */
[data-theme="light"] {
    --bg-primary: #f8f7f4;
    --bg-secondary: #ffffff;
    --bg-tertiary: #edecea;
    --text-primary: #1a1a1f;
    --text-secondary: #4a4a55;
    --text-muted: #7a7a85;
    --accent-primary: #e85a3a;
    --accent-secondary: #ff6b4a;
    --accent-glow: rgba(232, 90, 58, 0.2);
    --border-color: #d8d7d4;
    --card-bg: #ffffff;
    --success-color: #22c55e;
}

[data-theme="light"] body::before {
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(232, 90, 58, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 107, 74, 0.04) 0%, transparent 50%);
}

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

html {
    scroll-behavior: smooth;
    /* Theme transition */
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: var(--font-display);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(255, 107, 74, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 159, 122, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

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

/* ===== Layout ===== */
.container {
    display: flex;
    min-height: 100vh;
}

/* ===== Left Pane ===== */
.left-pane {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--left-pane-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.profile-section {
    text-align: center;
    margin-bottom: 2rem;
}

.name {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ===== Puzzle Container ===== */
.puzzle-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 1rem 0;
}

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.puzzle-piece {
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    cursor: grab;
    transition: transform 0.2s var(--transition-smooth), 
                box-shadow 0.2s var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.puzzle-piece::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 74, 0.2);
    z-index: 10;
}

.puzzle-piece.dragging {
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(255, 107, 74, 0.4);
    z-index: 100;
    opacity: 0.9;
}

.puzzle-piece.correct {
    box-shadow: 0 0 15px var(--success-color);
}

.puzzle-piece.drag-over {
    transform: scale(0.95);
    border: 2px dashed var(--accent-primary);
}

/* Solved and Sad Images */
.solved-image,
.sad-image {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    border-radius: 8px;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s var(--transition-smooth), 
                transform 0.5s var(--transition-smooth);
    pointer-events: none;
}

.solved-image img,
.sad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.solved-image.visible,
.sad-image.visible {
    opacity: 1;
    transform: scale(1);
}

/* Puzzle Hint */
.puzzle-hint {
    text-align: center;
    font-size: 1.2rem;
    color: white;
    margin: 1rem 0;
    font-style: italic;
    transition: opacity 0.3s var(--transition-smooth);
    position: relative;
    display: inline-block;
    overflow: hidden;
    background: linear-gradient(90deg, 
        white 0%, 
        white 40%, 
        var(--accent-primary) 50%, 
        white 60%, 
        white 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s infinite;
}

[data-theme="light"] .puzzle-hint {
    background: linear-gradient(90deg, 
        #1a1a1f 0%, 
        #1a1a1f 40%, 
        var(--accent-primary) 50%, 
        #1a1a1f 60%, 
        #1a1a1f 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes shine {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.puzzle-hint.hidden {
    opacity: 0;
}

/* ===== No Fun Button ===== */
.no-fun-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
    margin-top: auto;
    margin-bottom: 1.5rem;
}

.no-fun-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(255, 107, 74, 0.1);
}

.no-fun-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== Social Links ===== */
.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.3s var(--transition-smooth);
}

.social-links a:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    transform: translateY(-3px);
}

.social-links svg {
    width: 20px;
    height: 20px;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--transition-smooth);
    color: var(--text-secondary);
}

.theme-toggle:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    transition: transform 0.4s var(--transition-smooth);
}

.theme-toggle:hover svg {
    transform: rotate(-15deg);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

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

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

/* ===== Right Pane ===== */
.right-pane {
    margin-left: var(--left-pane-width);
    flex: 1;
    padding: 3rem 4rem;
    max-width: 900px;
}

/* ===== Navigation ===== */
.navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-item {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s var(--transition-smooth), 
                transform 0.5s var(--transition-smooth);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width 0.3s var(--transition-smooth);
}

.nav-item:hover {
    color: var(--text-primary);
}

.nav-item:hover::after {
    width: 100%;
}

/* Scrambled state animation */
body.scrambled .nav-item {
    animation: scrambleWiggle 2s infinite;
}

@keyframes scrambleWiggle {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    75% { transform: translateY(2px); }
}

body:not(.scrambled) .nav-item {
    animation: none;
}

/* Scrambled text styling */
.scrambled-text {
    font-style: italic;
    letter-spacing: 0.02em;
    transition: all 0.3s var(--transition-smooth);
}

body.scrambled .section-title.scrambled-text::after {
    background: linear-gradient(90deg, var(--text-muted), var(--border-color));
}

body:not(.scrambled) .section-title::after {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: background 0.5s var(--transition-smooth);
}

/* ===== Sections ===== */
.section {
    margin-bottom: 5rem;
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.5s var(--transition-smooth),
                opacity 0.5s var(--transition-smooth);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
}

.section-content {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.section-content p {
    margin-bottom: 1rem;
}

/* ===== Cards ===== */
.project-card,
.publication-card,
.experience-card,
.blog-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s var(--transition-smooth),
                background-color 0.3s ease,
                border-color 0.3s ease;
}

.project-card:hover,
.publication-card:hover,
.experience-card:hover,
.blog-card:hover {
    border-color: var(--accent-primary);
    transform: translateX(8px);
    box-shadow: -4px 4px 20px rgba(255, 107, 74, 0.1);
}

.project-card h3,
.publication-card h3,
.experience-card h3,
.blog-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.project-card p,
.publication-card p,
.experience-card p,
.blog-card p {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

/* Tech Tags */
.tech-tags,
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tags span,
.skill-tags span {
    background: var(--bg-tertiary);
    color: var(--accent-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* Publication specific */
.pub-venue {
    color: var(--accent-primary) !important;
    font-weight: 600;
    font-size: 0.9rem !important;
}

/* Experience specific */
.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.exp-date {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-secondary);
}

.exp-company {
    color: var(--text-muted) !important;
    font-size: 0.95rem !important;
    margin-bottom: 0.5rem !important;
}

/* Blog specific */
.blog-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-primary);
    display: block;
    margin-bottom: 0.5rem;
}

/* Skills specific */
.skills-category {
    margin-bottom: 1.5rem;
}

.skills-category h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* Contact specific */
.contact-methods {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.contact-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.contact-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.contact-item a,
.contact-value {
    color: var(--accent-secondary);
    font-size: 1.1rem;
    transition: color 0.3s var(--transition-smooth);
}

.contact-item a:hover {
    color: var(--accent-primary);
}

/* Location in left pane */
.location {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
    text-align: center;
}

/* Resume Download Button */
.resume-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    transition: all 0.3s var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(255, 107, 74, 0.3);
}

.resume-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 107, 74, 0.4);
}

.resume-download-btn svg {
    width: 20px;
    height: 20px;
}

.resume-section-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 2.5rem 0 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-primary);
    letter-spacing: -0.01em;
}

.resume-section-title:first-of-type {
    margin-top: 0;
}

/* Publication coverage */
.pub-coverage {
    font-size: 0.9rem !important;
    color: var(--text-muted) !important;
    font-style: italic;
    margin-top: 0.5rem !important;
}

/* ===== Solved State Celebration ===== */
body.solved .puzzle-grid {
    animation: celebrateGlow 1s ease-out;
}

@keyframes celebrateGlow {
    0% { box-shadow: 0 0 0 rgba(255, 107, 74, 0); }
    50% { box-shadow: 0 0 50px var(--accent-glow), 0 0 100px var(--accent-glow); }
    100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    :root {
        --left-pane-width: 320px;
    }
    
    .right-pane {
        padding: 2rem 3rem;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .left-pane {
        position: relative;
        width: 100%;
        height: auto;
        padding: 2rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
    
    .right-pane {
        margin-left: 0;
        padding: 2rem;
    }
    
    .puzzle-container {
        width: 240px;
        height: 240px;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .navigation {
        gap: 0.5rem 1rem;
    }
    
    .nav-item {
        font-size: 1rem;
    }
    
    .puzzle-container {
        width: 200px;
        height: 200px;
    }
}

