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

:root {
    /* Dark Mode Color Palette */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #666666;
    --accent-primary: #00ff88;
    --accent-secondary: #0088ff;
    --accent-hover: #00cc6a;
    --border-color: #2a2a2a;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    
    /* Spacing */
    --section-padding: 120px;
    --container-max: 1200px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

section {
    padding: var(--section-padding) 0;
    border-bottom: 1px solid var(--border-color);
}

section:last-of-type {
    border-bottom: none;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.2;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

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

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

/* Hero Section */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(ellipse at top, rgba(0, 255, 136, 0.05), transparent 50%),
                radial-gradient(ellipse at bottom, rgba(0, 136, 255, 0.05), transparent 50%);
    border-bottom: 1px solid var(--border-color);
}

.hero-content {
    text-align: center;
    max-width: 900px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.hero-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

.hero-meta .dot {
    color: var(--accent-primary);
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: inline-block;
    border: 2px solid transparent;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 255, 136, 0.3);
}

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

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Section Headers */
.section-header {
    margin-bottom: 4rem;
}

.section-label {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

/* Story Section */
#story {
    background-color: var(--bg-secondary);
}

.story-content {
    max-width: 800px;
}

.story-lead {
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    font-weight: 500;
    line-height: 1.6;
}

.story-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.credentials {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.credential {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.credential-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.credential-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.credential-text span {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* ============================================
   Work Section — Scroll-Driven Video Showcase
   ============================================ */

#work {
    position: relative;
    padding: 0;
    border-bottom: none;
    overflow: visible;
}

/* Fixed video background — visible only within #work bounds */
.work-video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.work-video-bg.visible {
    opacity: 1;
}

.work-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.work-video.work-video-active {
    opacity: 1;
}

.work-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.7);
    z-index: 1;
}

.work-gradient-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 0;
    background-size: 400% 400%;
    animation: gradientDrift 15s ease infinite;
}

.work-gradient-fallback.active {
    opacity: 1;
}

/* Work container sits above video */
.work-container {
    position: relative;
    z-index: 2;
}

.work-section-header {
    padding-top: var(--section-padding);
    padding-bottom: 2rem;
}

/* Projects — vertical scroll slides */
.projects {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.project-card {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    opacity: 0.3;
    transition: opacity 0.6s ease, transform 0.6s ease;
    transform: translateY(20px);
    position: relative;
}

.project-card.active {
    opacity: 1;
    transform: translateY(0);
}

.project-inner {
    max-width: 800px;
    width: 100%;
    background: rgba(17, 17, 17, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem;
    transition: all 0.4s ease;
}

.project-card.active .project-inner {
    border-color: rgba(0, 255, 136, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 255, 136, 0.05);
}

.project-card.featured .project-inner {
    border: 2px solid var(--accent-primary);
    background: rgba(0, 255, 136, 0.03);
}

.project-card.featured.active .project-inner {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 255, 136, 0.1);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.project-header h3 {
    margin: 0;
    font-size: 2.5rem;
}

.project-tag {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.tech-badge {
    padding: 6px 14px;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

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

.project-link {
    color: var(--accent-primary);
    font-weight: 600;
    transition: all 0.2s ease;
}

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

/* Scroll Indicator */
.scroll-indicator {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.scroll-indicator.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-dots {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.scroll-dot.active {
    background: var(--accent-primary);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
    transform: scale(1.3);
}

.scroll-arrow {
    color: var(--text-tertiary);
    font-size: 1.2rem;
    animation: bounceDown 2s ease infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(6px); opacity: 1; }
}

/* Last card — add bottom padding so it scrolls out */
.project-card:last-child {
    margin-bottom: 4rem;
}

/* Writing Section - Blog Gallery */
#writing {
    background: var(--bg-secondary);
    overflow: hidden;
}

.blog-gallery-wrapper {
    position: relative;
    margin: 0 -40px;
    padding: 2rem 0;
}

.blog-gallery {
    display: flex;
    gap: 2rem;
    padding: 0 40px;
    animation: scrollGallery 40s linear infinite;
    will-change: transform;
}

.blog-gallery:hover {
    animation-play-state: paused;
}

@keyframes scrollGallery {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-350px * 6 - 2rem * 6));
    }
}

.blog-card {
    flex-shrink: 0;
    width: 350px;
    height: 250px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    perspective: 1000px;
}

/* Full-bleed banner background */
.blog-card-bg {
    position: absolute;
    inset: 0;
    background-image: var(--card-bg);
    background-size: cover;
    background-position: center;
    z-index: 0;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease;
    opacity: 0.55;
}

.blog-card:hover .blog-card-bg {
    transform: scale(1.08);
    opacity: 0.35;
}

/* Dark gradient overlay for text readability */
.blog-card-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(10, 10, 10, 0.95) 0%,
        rgba(10, 10, 10, 0.7) 40%,
        rgba(10, 10, 10, 0.3) 100%
    );
    z-index: 1;
}

.blog-card-inner {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
}

.blog-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-primary);
    box-shadow: 0 20px 40px rgba(0, 255, 136, 0.15);
}

.blog-card:hover .blog-teaser {
    opacity: 1;
}

.blog-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.blog-subtitle {
    font-size: 0.95rem;
    color: var(--accent-primary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.blog-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}

.blog-teaser {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.blog-gallery-footer {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.blog-more-link {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-primary);
    transition: all 0.2s ease;
}

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

@keyframes gradientDrift {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

/* Open Source Section */
#opensource {
    background: var(--bg-secondary);
}

/* Open Source Section - Selectable Cards */
.opensource-card.active {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.15), inset 0 0 0 1px rgba(0, 255, 136, 0.1);
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.08) 0%, rgba(0, 255, 136, 0.02) 100%);
}

.opensource-card {
    cursor: pointer;
    user-select: none;
    border: 2px solid var(--border-color);
}

.opensource-card.featured-repo {
    border: 2px solid var(--accent-primary);
}

/* Open Source Section */
.opensource-category {
    margin-bottom: 4rem;
}

.opensource-category:last-child {
    margin-bottom: 0;
}

.category-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.opensource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.opensource-card {
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    display: block;
}

.opensource-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 255, 136, 0.1);
}

.opensource-card.featured-repo {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.05) 0%, transparent 100%);
    border: 2px solid var(--accent-primary);
}

.opensource-card h4 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.opensource-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.stars {
    font-size: 0.85rem;
    color: var(--accent-primary);
    font-weight: 600;
    font-family: var(--font-sans);
}

.repo-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.fork-count {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

/* Contact Section */
#contact {
    background: radial-gradient(ellipse at center, rgba(0, 255, 136, 0.05), transparent 70%);
}

.contact-content {
    max-width: 700px;
    text-align: center;
    margin: 0 auto;
}

.contact-content h2 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.contact-description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    line-height: 1.7;
}

.contact-cta {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.btn-schedule {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 18px 36px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.2);
}

.btn-schedule:hover {
    background: var(--accent-hover);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 255, 136, 0.4);
}

.schedule-icon {
    font-size: 1.5rem;
}

.contact-methods {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.contact-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 14px 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.2s ease;
}

.contact-button:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
}

.contact-icon {
    font-size: 1.25rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.social-links a {
    color: var(--text-tertiary);
}

.social-links a:hover {
    color: var(--accent-primary);
}

.social-links .dot {
    color: var(--border-color);
}

/* Floating Schedule Button */
.floating-schedule {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 16px 24px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 1rem;
    border-radius: 50px;
    box-shadow: 0 6px 25px rgba(0, 255, 136, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
}

.floating-schedule.visible {
    opacity: 1;
    transform: translateY(0);
}

.floating-schedule:hover {
    background: var(--accent-hover);
    transform: translateY(-4px);
    box-shadow: 0 10px 35px rgba(0, 255, 136, 0.5);
}

.floating-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.floating-text {
    font-weight: 600;
}

/* Footer */
footer {
    padding: 3rem 0;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --section-padding: 80px;
    }
    
    .container {
        padding: 0 24px;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .hero-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .hero-cta {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    .section-header {
        margin-bottom: 2.5rem;
    }
    
    .story-lead {
        font-size: 1.15rem;
    }
    
    .credentials {
        grid-template-columns: 1fr;
    }
    
    .project-card {
        min-height: 70vh;
        padding: 2rem 0;
    }
    
    .project-inner {
        padding: 1.5rem;
    }
    
    .project-header h3 {
        font-size: 1.5rem;
    }
    
    .project-description {
        font-size: 0.95rem;
    }
    
    .tech-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
    
    .scroll-indicator {
        right: 16px;
    }
    
    .scroll-dot {
        width: 6px;
        height: 6px;
    }
    
    /* Blog Gallery Mobile */
    .blog-gallery-wrapper {
        margin: 0 -24px;
    }
    
    .blog-gallery {
        padding: 0 24px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        animation: none;
    }
    
    .blog-card {
        scroll-snap-align: start;
        width: 280px;
        height: 220px;
        padding: 1.5rem;
    }
    
    .blog-title {
        font-size: 1rem;
    }
    
    .blog-gallery-footer {
        margin-top: 2rem;
    }
    
    .contact-content h2 {
        font-size: 2rem;
    }
    
    .contact-methods {
        flex-direction: column;
    }
    
    .contact-button {
        width: 100%;
        justify-content: center;
    }
    
    .btn-schedule {
        width: 100%;
        justify-content: center;
        font-size: 1rem;
        padding: 16px 28px;
    }
    
    .floating-schedule {
        bottom: 20px;
        right: 20px;
        padding: 14px 20px;
        font-size: 0.9rem;
    }
    
    .floating-text {
        display: none;
    }
    
    .floating-schedule {
        border-radius: 50%;
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
    }
    
    .floating-icon {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .project-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection */
::selection {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

::-moz-selection {
    background: var(--accent-primary);
    color: var(--bg-primary);
}
