:root {
    /* Colors - Deep Premium Dark Theme */
    --bg-color: #0a0a0a;
    --bg-secondary: #0f1115;

    /* Neon & Accents - Subtle & Refined */
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #10b981;

    /* Text Colors */
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* Gradients */
    --gradient-main: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    --gradient-glow: radial-gradient(circle at center, rgba(59, 130, 246, 0.15), transparent 70%);

    /* Cards & Glass */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

    /* Typography */
    --font-main: 'Outfit', sans-serif;
    --font-code: 'Fira Code', monospace;

    /* Spacing & Layout */
    --section-max-width: 1200px;
    --section-padding: 120px 20px;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Glow Effect */
.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
    z-index: -2;
    pointer-events: none;
}

/* Noise Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.05;
    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.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

/* Utilities */
.section-padding {
    padding: var(--section-padding);
    max-width: var(--section-max-width);
    margin: 0 auto;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    transition: transform var(--transition-smooth), border-color var(--transition-smooth);
}

.glass:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: 0.02em;
}

.btn.primary {
    background: var(--gradient-main);
    color: white;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    border: none;
}

.btn.primary:hover {
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
}

.btn.secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.btn.secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.05);
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(to right, #fff, #9ca3af);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.line {
    width: 60px;
    height: 4px;
    background: var(--gradient-main);
    margin: 0 auto;
    border-radius: 4px;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 24px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    z-index: 1000;
    transition: all var(--transition-smooth);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.logo span {
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    gap: 40px;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 30px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.nav-links li a {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    position: relative;
    padding: 5px 0;
}

.nav-links li a:hover {
    color: var(--text-primary);
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width var(--transition-fast);
}

.nav-links li a:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    margin: 6px auto;
    transition: all 0.3s ease;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    position: relative;
    overflow: hidden;
}

.hero-content {
    flex: 1;
    z-index: 2;
    padding-top: 60px;
}

.greeting {
    font-family: var(--font-code);
    font-size: 1rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
    display: block;
    letter-spacing: 0.1em;
}

.name {
    font-size: 7rem;
    font-weight: 800;
    line-height: 0.9;
    margin-bottom: 20px;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

.outline-text {
    color: transparent;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.3);
    transition: all var(--transition-smooth);
    position: relative;
}

.outline-text::before {
    content: 'Gitonga';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    color: var(--text-primary);
    overflow: hidden;
    transition: width 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    -webkit-text-stroke: 0;
}

.hero:hover .outline-text::before {
    width: 100%;
}

.title {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-weight: 400;
}

.description {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 48px;
    font-weight: 300;
    max-width: 400px;
}

.cta-buttons {
    display: flex;
    gap: 24px;
    margin-bottom: 48px;
}

.social-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.social-links a {
    font-size: 1.4rem;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.social-links a:hover {
    color: var(--brand-primary);
    /* Fallback */
    color: var(--accent-primary);
    transform: translateY(-3px);
}

.hero-visual {
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    z-index: 1;
}

#constellationCanvas {
    width: 100%;
    height: 100%;
}

.visual-placeholder {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.circle {
    position: absolute;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0.5;
    animation: pulse 4s infinite alternate;
}

.code-card {
    position: relative;
    padding: 30px;
    width: 350px;
    z-index: 2;
    transform: rotate(-5deg);
    transition: transform 0.3s;
}

.code-card:hover {
    transform: rotate(0deg) scale(1.05);
}

.code-header {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.red {
    background: #ff5f56;
}

.yellow {
    background: #ffbd2e;
}

.green {
    background: #27c93f;
}

pre {
    color: #d4d4d4;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}


/* About Section */
.about-content {
    display: flex;
    justify-content: flex-start;
    /* Asymmetry */
    padding-left: 5%;
    animation: fadeUp 1s ease-out forwards;
    opacity: 0;
    animation-delay: 0.2s;
    /* Delay check needed via JS intersection observer ideally, but keeping css simple */
}

/* Note: In real scenarios, opacity: 0 and animation forwards should be controlled by a class added via JS. 
   I will set default opacity to 1 here to avoid invisibility if JS fails, and rely on JS to add .hidden classes or similar.
   For this specific request, I'll add utility classes below. 
*/

.about-text {
    padding: 60px;
    max-width: 800px;
    /* Reduced width for editorial look */
    text-align: left;
    /* Left align for magazine feel */
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.philosophy {
    font-size: 2rem;
    font-weight: 300;
    font-style: italic;
    color: var(--text-primary);
    margin-bottom: 40px;
    line-height: 1.4;
    border-left: 3px solid var(--accent-primary);
    padding-left: 24px;
}

.about-text p:not(.philosophy) {
    margin-bottom: 24px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.about-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item {
    text-align: left;
}

.stat-item .number {
    display: block;
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-primary);
    /* Solid white over gradient for cleaner look */
    margin-bottom: 8px;
    line-height: 1;
}

.stat-item .label {
    color: var(--accent-primary);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
}

/* Education Section */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.edu-card {
    display: flex;
    gap: 24px;
    padding: 32px;
    align-items: flex-start;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
}

.edu-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.03);
}

.edu-icon {
    font-size: 1.5rem;
    color: var(--accent-primary);
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.edu-details h3 {
    font-size: 1.25rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.edu-details .institution {
    color: var(--accent-secondary);
    font-size: 0.95rem;
    margin-bottom: 8px;
    font-family: var(--font-code);
}

.edu-details .year {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.edu-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.cert-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    margin-top: auto;
    transition: color 0.2s;
}

.cert-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Skills Section */
.skills-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.skills-chart {
    padding: 20px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (max-width: 968px) {
    .skills-layout {
        grid-template-columns: 1fr;
    }
}

/* Projects Section */
/* Project Cards with Images */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    /* Force equal height in grid */
}

.project-image {
    width: 100%;
    height: 200px;
    /* Fixed height for uniformity */
    background-color: #1a1a1a;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* This checks "ugly" un-uniform images to fill space */
    object-position: top center;
    /* Focus on top of screenshots usually better */
    transition: transform 0.5s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}

.project-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Pushes button to bottom if content varies */
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

/* Social Icons */
.hero-socials {
    display: flex;
    gap: 1.5rem;
    margin-top: 2rem;
    align-items: center;
}

.hero-socials a {
    color: var(--text-secondary);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-socials a:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.contact-socials {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.contact-socials a {
    color: var(--text-secondary);
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.contact-socials a:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.project-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.project-type {
    font-family: var(--font-code);
    color: var(--accent-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Reduced size for massive grid */
.project-impact,
.project-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1;
}

.tech-stack {
    margin-top: auto;
    /* Push to bottom */
    margin-bottom: 20px;
    padding-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 0;
}

.tech-stack span {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    color: var(--text-muted);
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    padding-bottom: 4px;
}

.btn-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 1px;
    background: var(--accent-primary);
    transition: width 0.3s;
}

.btn-link:hover {
    color: var(--accent-primary);
}

.btn-link:hover::after {
    width: 100%;
}

/* Contact Section */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 0;
    overflow: hidden;
}

.contact-info {
    padding: 60px;
    background: rgba(59, 130, 246, 0.03);
    /* Extremely subtle */
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.contact-info h3 {
    font-size: 2rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.contact-info p {
    color: var(--text-secondary);
    margin-bottom: 48px;
    font-size: 1.1rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.detail-item i {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.contact-form {
    padding: 60px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 18px;
    background: rgba(10, 10, 10, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(10, 10, 10, 0.5);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--bg-secondary);
}

/* Media Queries */
@media (max-width: 968px) {
    .contact-container {
        grid-template-columns: 1fr;
    }

    .contact-info {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .hero {
        padding-top: 140px;
        flex-direction: column-reverse;
        /* Stack visual on top of content? Or reverse as before? */
        /* Let's keep reverse for mobile usually */
        flex-direction: column;
        text-align: center;
        gap: 40px;
    }

    .hero-content {
        align-items: center;
        display: flex;
        flex-direction: column;
    }

    .hero-visual {
        justify-content: center;
        width: 100%;
    }

    .name {
        font-size: 3.5rem;
    }

    .cta-buttons {
        justify-content: center;
    }

    .social-links {
        justify-content: center;
    }

    .navbar {
        padding: 20px;
    }

    .nav-links {
        position: fixed;
        right: -100%;
        top: 0;
        height: 100vh;
        flex-direction: column;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(20px);
        width: 80%;
        /* not full width */
        max-width: 300px;
        padding: 100px 40px;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0;
        gap: 24px;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .nav-links.active {
        right: 0;
    }

    .hamburger {
        display: block;
        z-index: 1001;
        /* Above nav menu */
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
        background: white;
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
        background: white;
    }
}

@media (max-width: 480px) {
    .name {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .btn {
        padding: 12px 24px;
        width: 100%;
    }

    .cta-buttons {
        flex-direction: column;
        width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.05);
        opacity: 0.7;
    }
}

/* Utility Animations */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: none;
}