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

:root {
    --primary-color: #374151;
    --secondary-color: #4b5563;
    --accent-color: #3730a3;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --code-bg: #1f2937;
    --code-text: #e5e7eb;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    transition: all 0.3s ease;
}

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

.nav-brand {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    position: relative;
    padding: 0.5rem 0;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

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

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 72px;
    background: var(--bg-primary);
}

.hero-content {
    text-align: center;
}

.hero-title {
    font-size: 3.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-taglines {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-light);
}

.tagline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.0625rem;
    padding: 0.5rem 0;
}

.tagline-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9375rem;
}

.tagline-text {
    color: var(--text-primary);
    font-weight: 600;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    line-height: 1.8;
}

.hero-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    background: var(--primary-color);
    transform: translateY(-1px);
}

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

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

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

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

/* Hero Stats */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Sections */
section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Projects Section */
.projects {
    background: var(--bg-secondary);
}

.project-grid {
    display: grid;
    gap: 2rem;
    margin-top: 3rem;
}

.project-card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.project-card.featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .project-card.featured {
        grid-template-columns: 1fr;
        grid-column: span 1;
    }
}

@media (min-width: 768px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Project Visuals */
.project-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-screenshot {
    width: 100%;
}

.project-image {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.image-caption {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

.project-image-small {
    margin-bottom: 1rem;
}

.project-image-small img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

/* Terminal Window Style */
.terminal-window {
    background: var(--code-bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    font-family: 'JetBrains Mono', monospace;
}

.terminal-header {
    background: #374151;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }

.terminal-content {
    padding: 1.5rem;
    color: var(--code-text);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
    overflow-x: auto;
}

/* Code Window Style */
.code-window {
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.code-header {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.code-filename {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.code-content {
    padding: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
    overflow-x: auto;
}

.code-comment {
    color: var(--text-muted);
}

.code-output {
    display: block;
    margin-top: 1rem;
    color: var(--accent-color);
    white-space: pre-wrap;
}

/* Project Info */
.project-info {
    display: flex;
    flex-direction: column;
}

.project-header h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Project Stats */
.project-stats {
    display: flex;
    gap: 2rem;
    margin: 1.5rem 0;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.project-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid var(--border-light);
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}


.project-links {
    display: flex;
    gap: 1rem;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.project-link:hover {
    gap: 0.75rem;
    color: var(--text-primary);
}

/* Writing Section */
.writing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (max-width: 1024px) {
    .writing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .writing-grid {
        grid-template-columns: 1fr;
    }
}

.article-card {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.article-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

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

.article-card:hover .article-image img {
    transform: scale(1.05);
}

.article-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.article-date {
    color: var(--text-muted);
}

.article-category {
    color: var(--accent-color);
    font-weight: 500;
}

.article-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.article-link:hover {
    color: var(--accent-color);
}

.article-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.substack-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.substack-link:hover {
    text-decoration: underline;
}

.writing-cta {
    text-align: center;
}

/* Talks Section */
.talks {
    background: var(--bg-secondary);
}

.talks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.talk-card {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.talk-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.talk-video {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.talk-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.talk-content {
    padding: 1.5rem;
}

.talk-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.talk-venue {
    color: var(--accent-color);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.talk-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.talks-additional {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.talks-additional h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.talks-additional ul {
    list-style: none;
    padding: 0;
}

.talks-additional li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.talks-additional li:last-child {
    border-bottom: none;
}

.talks-additional strong {
    color: var(--text-primary);
}

/* Experience Timeline */
.experience {
    background: var(--bg-primary);
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 3rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 0;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
}

.timeline-date {
    color: var(--accent-color);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.timeline-content h3 {
    margin-bottom: 0.25rem;
}

.timeline-content h4 {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.timeline-content p {
    color: var(--text-secondary);
}

/* Contact Section */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    max-width: 1000px;
    margin: 0 auto;
}

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

.contact-form {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.1);
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.contact-item a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1.125rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--text-primary);
    color: white;
    transform: translateY(-2px);
}

/* Footer */
.footer {
    background: var(--bg-tertiary);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

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

.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

.project-card,
.timeline-item,
.article-card,
.talk-card {
    opacity: 0;
    transform: translateY(30px);
}

/* Active nav link */
.nav-link.active {
    color: var(--primary-color);
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-color);
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

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

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

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

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .hero-taglines {
        gap: 0.75rem;
    }
    
    .tagline {
        font-size: 1rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: var(--shadow-lg);
        flex-direction: column;
        padding: 1rem;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .project-grid {
        grid-template-columns: 1fr;
    }
}