/* ==========================================================================
   CSS VARIABLES
   ========================================================================== */
   :root {
    /* Colors */
    --bg-base: #08090B;
    --bg-surface: #0D1012;
    --bg-elevated: #121517;
    
    --accent-primary: #B6FF3B;
    --accent-hover: #caff5e;
    --accent-dark: rgba(182, 255, 59, 0.1);
    --accent-horror: #301111;
    
    --text-primary: #F0F2F5;
    --text-secondary: #9AA0A6;
    --text-muted: #5F6368;
    
    --border-color: #202428;
    
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    
    /* Layout */
    --nav-height: 80px;
    --container-width: 1200px;
    --section-pad: 120px;
    
    /* Transitions */
    --trans-fast: 0.2s ease;
    --trans-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
}

::selection {
    background: var(--accent-primary);
    color: var(--bg-base);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--trans-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.section-padding {
    padding: var(--section-pad) 5%;
}

.mt-sm { margin-top: 1rem; }
.mt-md { margin-top: 2rem; }
.mt-lg { margin-top: 4rem; }

.tech-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: inline-block;
}

.tech-label.accent {
    color: var(--accent-primary);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 2rem;
}

.accent-dot {
    color: var(--accent-primary);
}

/* ==========================================================================
   GLOBAL EFFECTS
   ========================================================================== */
.noise {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 50;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.scanlines {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 49;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.1) 50%,
        rgba(0,0,0,0.1)
    );
    background-size: 100% 4px;
    opacity: 0.3;
}

/* ==========================================================================
   IMAGE PLACEHOLDER SYSTEM
   ========================================================================== */
.image-wrapper {
    position: relative;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-text {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    z-index: 1;
}

.image-wrapper img {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: opacity var(--trans-fast), transform var(--trans-slow);
}

.image-wrapper img.failed {
    opacity: 0;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all var(--trans-fast);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: var(--bg-base);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 15px var(--accent-dark);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-disabled {
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    border-color: var(--border-color);
    cursor: not-allowed;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 100;
    background: rgba(8, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    transition: transform var(--trans-fast);
}

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 5%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.nav-links a:hover {
    color: var(--accent-primary);
}

.mobile-menu-btn {
    display: none;
    width: 30px;
    height: 20px;
    position: relative;
    z-index: 101;
}

.hamburger, .hamburger::before, .hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: all var(--trans-fast);
}

.hamburger { top: 9px; left: 0; }
.hamburger::before { top: -9px; }
.hamburger::after { top: 9px; }

.mobile-menu-btn.active .hamburger { background-color: transparent; }
.mobile-menu-btn.active .hamburger::before { transform: translateY(9px) rotate(45deg); }
.mobile-menu-btn.active .hamburger::after { transform: translateY(-9px) rotate(-45deg); }

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: calc(var(--nav-height) + 4rem);
}

.hero-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-title {
    font-size: clamp(3rem, 5vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    margin: 1rem 0;
    letter-spacing: -0.03em;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 2rem;
}

.hero-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin-bottom: 2.5rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.hero-image-wrapper {
    aspect-ratio: 4/5;
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.visual-overlay {
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 100px rgba(8, 9, 11, 0.8);
    pointer-events: none;
    z-index: 3;
    border-radius: 4px;
}

.hero-image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(182, 255, 59, 0.1);
    z-index: 4;
    pointer-events: none;
    border-radius: 4px;
}

/* ==========================================================================
   CORE CONCEPT
   ========================================================================== */
.core-concept {
    background-color: var(--bg-surface);
    text-align: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.core-container {
    max-width: 800px;
    margin: 0 auto;
}

.concept-math {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.concept-word {
    color: var(--text-primary);
}

.concept-operator {
    color: var(--accent-primary);
}

.concept-arrow {
    margin: 2rem 0;
    font-size: 2rem;
    color: var(--text-muted);
}

.concept-result {
    font-size: 2rem;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
    margin-bottom: 1.5rem;
}

.concept-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   PIXELFORGE SECTION
   ========================================================================== */
.pixelforge-header {
    max-width: 700px;
    margin: 0 auto 5rem;
    text-align: center;
}

.pixelforge-header .section-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.features-grid {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background-color: var(--bg-surface);
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-left: 2px solid var(--border-color);
    transition: all var(--trans-fast);
}

.feature-card:hover {
    border-left-color: var(--accent-primary);
    background-color: var(--bg-elevated);
}

.feature-header {
    margin-bottom: 1rem;
}

.feature-header h4 {
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* ==========================================================================
   GALLERY SHOWCASE
   ========================================================================== */
.gallery {
    background-color: var(--bg-surface);
}

.gallery-header {
    max-width: var(--container-width);
    margin: 0 auto 2rem;
}

.gallery-grid {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.gallery-item {
    cursor: pointer;
    border-radius: 4px;
}

.gallery-item:nth-child(1) { grid-column: span 12; aspect-ratio: 21/9; }
.gallery-item:nth-child(2) { grid-column: span 6; aspect-ratio: 16/9; }
.gallery-item:nth-child(3) { grid-column: span 6; aspect-ratio: 16/9; }
.gallery-item:nth-child(4) { grid-column: span 4; height: 100%; }
.gallery-item:nth-child(5) { grid-column: span 8; aspect-ratio: 16/9; }

.gallery-item img {
    filter: brightness(0.8) contrast(1.1);
}

.gallery-item:hover img,
.gallery-item:focus img {
    transform: scale(1.02);
    filter: brightness(1) contrast(1.1);
}

.gallery-item:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--trans-fast);
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 9, 11, 0.95);
    backdrop-filter: blur(8px);
}

.lightbox-content {
    position: relative;
    z-index: 1001;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-height: 90vh;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    border: 1px solid var(--border-color);
}

.lightbox-loader {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
}

.lightbox-close {
    position: absolute;
    top: 2rem; right: 2rem;
    z-index: 1002;
    color: var(--text-primary);
    font-size: 3rem;
    line-height: 1;
    opacity: 0.5;
    transition: opacity var(--trans-fast);
}

.lightbox-close:hover {
    opacity: 1;
    color: var(--accent-primary);
}

/* ==========================================================================
   PROJECTS
   ========================================================================== */
.projects-container {
    max-width: 800px;
    margin: 0 auto;
}

.project-list {
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.project-row {
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.project-title {
    font-size: 1.5rem;
    margin: 0.5rem 0;
}

.project-desc {
    color: var(--text-secondary);
}

.status-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    white-space: nowrap;
}

.project-placeholder {
    padding: 2rem;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.02) 10px,
        rgba(255,255,255,0.02) 20px
    );
    border: 1px dashed var(--border-color);
    text-align: center;
}

.project-placeholder p {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ==========================================================================
   ABOUT
   ========================================================================== */
.about {
    background-color: var(--bg-surface);
}

.about-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 5rem;
    align-items: center;
}

.about-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.about-stats {
    display: flex;
    gap: 3rem;
}

.stat-block {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.avatar-wrapper {
    aspect-ratio: 1/1;
    border-radius: 50%;
    max-width: 400px;
    margin: 0 auto;
}

.avatar-decor {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid var(--accent-dark);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 3;
}

.avatar-wrapper::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px dashed var(--border-color);
    pointer-events: none;
    animation: rotate 60s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   CONTACT
   ========================================================================== */
.contact-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.contact-text {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.contact-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
}

.contact-link:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-elevated);
}

.link-text {
    font-size: 1.125rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-base);
    padding: 3rem 5%;
}

.footer-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-info {
    display: flex;
    flex-direction: column;
}

.footer-name {
    font-weight: 700;
    letter-spacing: 0.05em;
}

.footer-role {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--accent-primary);
}

/* ==========================================================================
   ANIMATIONS & ACCESSIBILITY
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }

:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   SHADER COMPARISON (BEFORE / AFTER)
   ========================================================================== */
.showcase { background-color: var(--bg-surface); }
.showcase-header { max-width: var(--container-width); margin: 0 auto 2rem; width: 100%; }

.compare-grid {
    max-width: var(--container-width);
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.compare-container {
    position: relative;
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    aspect-ratio: 16/9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-base);
    overflow: hidden;
}

.compare-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.compare-top {
    z-index: 2;
    clip-path: polygon(0 0, var(--pos) 0, var(--pos) 100%, 0 100%);
}

.compare-label {
    position: absolute;
    bottom: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    background: rgba(8, 9, 11, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    pointer-events: none;
    z-index: 5;
}

.label-left { left: 1.5rem; z-index: 6; }
.label-right { right: 1.5rem; color: var(--accent-primary); border-color: var(--accent-dark); }

.compare-divider {
    position: absolute;
    top: 0; bottom: 0;
    left: var(--pos);
    width: 2px;
    background-color: var(--accent-primary);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 15px var(--accent-dark);
}

.compare-handle {
    position: absolute;
    top: 50%; left: var(--pos);
    transform: translate(-50%, -50%);
    width: 40px; height: 30px;
    background-color: var(--bg-base);
    border: 2px solid var(--accent-primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 11;
}

.handle-arrows {
    color: var(--accent-primary);
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: -2px;
}

.compare-slider {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 20;
    margin: 0;
}

/* ==========================================================================
   YOUTUBE VIDEOS
   ========================================================================== */
.video-grid {
    max-width: var(--container-width);
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-base);
    width: 100%;
}

.video-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
    .video-grid { grid-template-columns: 1fr; }
    .compare-label { font-size: 0.75rem; bottom: 1rem; }
    .label-left { left: 1rem; }
    .label-right { right: 1rem; }
    .hero-container,
    .about-container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .hero-image-wrapper {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .gallery-item:nth-child(n) {
        grid-column: span 12;
        aspect-ratio: 16/9;
    }
    
    .concept-math {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    :root {
        --section-pad: 80px;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    /* Mobile Menu */
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        width: 100%;
        background-color: var(--bg-surface);
        flex-direction: column;
        align-items: center;
        padding: 2rem 0;
        gap: 2rem;
        border-bottom: 1px solid var(--border-color);
        transform: translateY(-150%);
        transition: transform var(--trans-slow);
        z-index: 99;
    }
    
    .nav-links.active {
        transform: translateY(0);
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .project-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}