/* Dark theme (default) */
:root,
[data-theme="dark"] {
    --bg-primary: #0c0c0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #8b5cf6;
    --accent-secondary: #06b6d4;
    --accent-tertiary: #f472b6;
    --accent-glow: rgba(139, 92, 246, 0.2);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --tag-bg: rgba(139, 92, 246, 0.12);
    --tag-text: #c4b5fd;
    --gradient-text: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 50%, #f472b6 100%);
    --gradient-accent: linear-gradient(135deg, #8b5cf6, #06b6d4);
    --gradient-card: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 0%, rgba(6, 182, 212, 0.03) 100%);
    --shadow-soft: 0 4px 24px -4px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 60px -10px var(--accent-glow);
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #fafbfc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #7c3aed;
    --accent-secondary: #0891b2;
    --accent-tertiary: #ec4899;
    --accent-glow: rgba(124, 58, 237, 0.15);
    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.1);
    --tag-bg: rgba(124, 58, 237, 0.08);
    --tag-text: #7c3aed;
    --gradient-text: linear-gradient(135deg, #7c3aed 0%, #0891b2 50%, #ec4899 100%);
    --gradient-accent: linear-gradient(135deg, #7c3aed, #0891b2);
    --gradient-card: linear-gradient(135deg, rgba(124, 58, 237, 0.02) 0%, rgba(8, 145, 178, 0.02) 100%);
    --shadow-soft: 0 4px 24px -4px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 60px -10px var(--accent-glow);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Subtle background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 20%, var(--accent-glow) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    backdrop-filter: blur(12px);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(15deg) scale(1.05);
    box-shadow: var(--shadow-glow);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

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

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 5rem 2.5rem;
}

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

a:hover {
    color: var(--accent-secondary);
}

/* Hero Section */
.hero {
    margin-bottom: 7rem;
    position: relative;
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.hero-text {
    flex: 1;
}

.profile-photo {
    width: 280px;
    height: 280px;
    border-radius: 28px;
    object-fit: cover;
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
                var(--gradient-accent) border-box;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.profile-photo:hover {
    transform: translateY(-8px) rotate(2deg);
    box-shadow:
        var(--shadow-soft),
        0 0 80px -10px var(--accent-glow),
        0 20px 40px -20px rgba(0, 0, 0, 0.3);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 0.75rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.hero .tagline {
    font-size: 1.4rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hero .tagline::before {
    content: '';
    width: 24px;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: 2px;
}

.hero .location {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.hero .intro {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

.hero .intro strong {
    color: var(--accent);
    font-weight: 600;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.contact-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.contact-item:hover {
    border-color: transparent;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px -8px var(--accent-glow);
}

.contact-item:hover::before {
    opacity: 1;
}

.contact-item span {
    position: relative;
    z-index: 1;
}

.contact-item .icon {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

.contact-item:hover .icon {
    color: white;
}

/* Sections */
.section {
    margin-bottom: 6rem;
}

.section h2 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}

/* Job Card */
.job {
    background: var(--gradient-card);
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.job::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.job:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-soft);
}

.job:hover::before {
    opacity: 1;
}

.job-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.job-header .company {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.job-header .company:hover {
    color: var(--accent-secondary);
}

.job-header .location {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.job-header .period {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.motto {
    color: var(--text-secondary);
    padding: 1.25rem 1.5rem;
    background: var(--tag-bg);
    border-radius: 14px;
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
    position: relative;
    border-left: 3px solid var(--accent);
}

.motto::before {
    content: '"';
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    font-size: 2.5rem;
    color: var(--accent);
    opacity: 0.3;
    font-family: Georgia, serif;
    line-height: 1;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.timeline-item {
    padding-left: 2rem;
    border-left: 2px solid var(--border);
    position: relative;
    transition: all 0.3s ease;
    padding-bottom: 0.5rem;
}

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

.timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    background: var(--bg-primary);
    border: 3px solid var(--accent);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.timeline-item:hover::before {
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    transform: scale(1.1);
}

.timeline-period {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.timeline-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tag:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
}

.timeline-item > p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.75;
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
}

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

.skill-category:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-soft);
}

.skill-category h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-category h3::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--gradient-accent);
    border-radius: 3px;
}

.skill-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.skill-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.25rem 0;
}

.skill-name {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
}

.skill-years {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Talks */
.talks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.talk {
    display: flex;
    gap: 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.talk:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateX(8px);
    box-shadow: -4px 0 0 var(--accent);
}

.talk time {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--accent);
    min-width: 50px;
    font-weight: 600;
}

.talk-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.talk-content h4 a {
    color: var(--text-primary);
}

.talk-content h4 a:hover {
    color: var(--accent);
}

.talk-venue {
    font-size: 0.85rem;
    color: var(--accent-secondary);
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

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

/* Activities */
.activity {
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    transition: all 0.3s ease;
}

.activity:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-soft);
}

.activity h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.activity .period {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--accent-secondary);
    background: rgba(6, 182, 212, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.activity p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.75;
}

/* OSS */
.oss-projects h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.oss-projects h3::before {
    content: '<>';
    font-family: 'SF Mono', monospace;
    font-size: 0.9rem;
    color: var(--accent);
}

.oss-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.oss-item {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.oss-item::after {
    content: '→';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    opacity: 0;
    color: var(--accent);
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.oss-item:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
    padding-right: 2.5rem;
}

.oss-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.oss-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.oss-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
}

/* Footer */
footer {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

footer p::before,
footer p::after {
    content: '✦';
    font-size: 0.6rem;
    color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 42px;
        height: 42px;
    }

    .container {
        padding: 3.5rem 1.5rem;
    }

    .hero {
        margin-bottom: 5rem;
    }

    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
        gap: 2.5rem;
    }

    .hero .tagline::before {
        display: none;
    }

    .hero .intro {
        max-width: 100%;
    }

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

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero .tagline {
        font-size: 1.2rem;
        justify-content: center;
    }

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

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

    .talk {
        flex-direction: column;
        gap: 0.5rem;
    }

    .talk:hover {
        transform: translateX(0) translateY(-2px);
        box-shadow: 0 4px 0 var(--accent);
    }

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

    .section {
        margin-bottom: 4rem;
    }

    .job {
        padding: 1.75rem;
        border-radius: 20px;
    }

    .activity {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 2.5rem 1.25rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero .tagline {
        font-size: 1rem;
    }

    .profile-photo {
        width: 160px;
        height: 160px;
        border-radius: 20px;
    }

    .job {
        padding: 1.25rem;
        border-radius: 16px;
    }

    .skill-category {
        padding: 1.25rem;
    }

    .skill-item {
        flex-direction: column;
        gap: 0.2rem;
    }

    .contact-links {
        flex-direction: column;
    }

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