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

:root {
    /* Improved color palette with better contrast ratios */
    --primary-green: #047857;
    --light-green: #10b981;
    --dark-green: #065f46;
    --mint-green: #6ee7b7;
    --sage-green: #84cc16;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* Remove focus outline for navigation links, keep underline */
.nav-links a:focus {
    outline: none;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-green);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1001;
    transition: top 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.skip-link:focus {
    top: 6px;
    opacity: 1;
    visibility: visible;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-green), var(--sage-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-green);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.mobile-menu-toggle:hover {
    background-color: rgba(16, 185, 129, 0.1);
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:hover,
.nav-links a:focus {
    color: var(--primary-green);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-green);
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a:focus::after {
    width: 100%;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 6rem 2rem 2rem;
    background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    background: url('data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><defs><pattern id="simple" x="0" y="0" width="150" height="150" patternUnits="userSpaceOnUse"><g><circle cx="30" cy="50" r="2" fill="%23047857" opacity="0.6"/><circle cx="30" cy="75" r="2" fill="%23047857" opacity="0.6"/><circle cx="30" cy="100" r="2" fill="%23047857" opacity="0.6"/><circle cx="75" cy="60" r="2" fill="%2310b981" opacity="0.6"/><circle cx="75" cy="85" r="2" fill="%2310b981" opacity="0.6"/><circle cx="120" cy="75" r="2" fill="%2384cc16" opacity="0.6"/><line x1="32" y1="75" x2="73" y2="85" stroke="%23047857" stroke-width="0.5" opacity="0.5"/><line x1="77" y1="85" x2="118" y2="75" stroke="%2310b981" stroke-width="0.5" opacity="0.5"/><text x="20" y="30" fill="%23047857" opacity="0.5" font-size="11" font-family="serif">e^(iπ)+1=0</text><circle cx="100" cy="30" r="8" fill="none" stroke="%2310b981" stroke-width="1" opacity="0.4"/><text x="45" y="130" fill="%2384cc16" opacity="0.5" font-size="10" font-family="serif">∇f(x)</text></g></pattern></defs><rect width="300" height="300" fill="url(%23simple)"/></svg>') !important;
    opacity: 0.6;
    z-index: -2;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

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

.hero-text .subtitle {
    font-size: 1.3rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-weight: 400;
}

.hero-text p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-size: 1rem;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover,
.btn-primary:focus {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -3px rgba(5, 150, 105, 0.3), 0 8px 10px -2px rgba(5, 150, 105, 0.1);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: var(--primary-green);
    color: white;
    transform: translateY(-2px);
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.matrix-animation {
    width: 400px;
    height: 300px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(132, 204, 22, 0.1));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.matrix-content {
    font-family: 'Courier New', monospace;
    color: var(--primary-green);
    text-align: center;
    z-index: 2;
}

.matrix-symbols {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.3;
}

.symbol {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

/* F1 Racing Cars */
.f1-car {
    position: absolute;
    width: 40px;
    height: 20px;
    z-index: -1;
    transition: transform 0.1s linear;
    opacity: 0.8;
}

.f1-car svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Individual car colors */
.car1 svg { color: #ff0000; } /* Red */
.car2 svg { color: #0066ff; } /* Blue */
.car3 svg { color: #0a5f38; } /* British Racing Green */
.car4 svg { color: #ff6600; } /* Orange */
.car5 svg { color: #6b46c1; } /* Medium Dark Purple */

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

/* Section navigation offsets */
#about,
#services,
#portfolio,
#contact {
    scroll-margin-top: 100px; /* Account for fixed navigation */
}

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

h2 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.section-intro {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 4rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-light);
}

.about-text p {
    margin-bottom: 1.5rem;
}

/* Neural Network Styles */
.neural-network-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.neural-network {
    width: 90%; /* 100% - 10% = 90% */
    height: 400px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(132, 204, 22, 0.05));
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(16, 185, 129, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: rotate(-90deg);
    transform-origin: center;
}

.neural-network svg {
    width: 100%;
    height: 100%;
}

.neural-node {
    fill: var(--primary-green);
    stroke: var(--white);
    stroke-width: 2;
    transition: all 0.3s ease;
    cursor: pointer;
}

.neural-node:hover {
    fill: var(--light-green);
    stroke-width: 3;
}

.neural-node.highlighted {
    fill: #4169E1; /* Royal Blue */
    stroke: #1E3A8A;
    stroke-width: 3;
    filter: drop-shadow(0 0 8px rgba(65, 105, 225, 0.6));
}

.neural-connection {
    stroke: rgba(16, 185, 129, 0.4);
    stroke-width: 1.5;
    fill: none;
    transition: all 0.3s ease;
}

.neural-connection.highlighted {
    stroke: #4169E1; /* Royal Blue */
    stroke-width: 3;
    filter: drop-shadow(0 0 4px rgba(65, 105, 225, 0.4));
}


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

.skill-item {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.skill-item:hover {
    transform: translateY(-5px);
}

.skill-item h3 {
    color: var(--primary-green);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

/* Services Section */
.services {
    background: var(--gray-50);
}

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

.service-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.service-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: white;
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

/* Portfolio Section */
#portfolio {
    scroll-margin-top: 100px; /* Account for fixed navigation */
}

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

.portfolio-item {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}

.portfolio-content h3 {
    color: var(--primary-green);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.portfolio-content p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.portfolio-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

 .tag {
     background: linear-gradient(135deg, var(--primary-green), var(--light-green));
     color: white;
     padding: 0.3rem 0.8rem;
     border-radius: 20px;
     font-size: 0.8rem;
     font-weight: 500;
 }

 .portfolio-actions {
     margin-top: 1rem;
 }

 .portfolio-actions .btn {
     padding: 0.5rem 1rem;
     font-size: 0.9rem;
     min-width: auto;
 }

 /* Success Message Styles */
 .success-message {
     text-align: center;
     padding: 2rem;
 }

 .success-content h3 {
     color: var(--primary-green);
     margin-bottom: 1rem;
     font-size: 1.5rem;
 }

 .success-content p {
     color: var(--text-light);
     margin-bottom: 2rem;
     font-size: 1.1rem;
     line-height: 1.6;
 }

/* Contact Section */
.contact-container {
    background: var(--white);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.contact-form {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    display: grid;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    font-weight: 600;
    color: var(--text-dark);
}

input,
textarea,
select {
    padding: 1rem;
    border: 2px solid var(--gray-100);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: var(--gray-50);
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-green);
    background: var(--white);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Form validation styles */
.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: #dc2626;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-group.success input,
.form-group.success textarea,
.form-group.success select {
    border-color: var(--primary-green);
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.loading {
    position: relative;
    color: transparent;
}

.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
footer {
    background: var(--text-dark);
    color: white;
    text-align: center;
    padding: 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.social-links a {
    color: white;
    font-size: 1.5rem;
    transition: color 0.3s ease;
    padding: 0.5rem;
    border-radius: 4px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover,
.social-links a:focus {
    color: var(--mint-green);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Racing Elements */
.racing-stripe {
    height: 4px;
    background: linear-gradient(90deg, var(--primary-green), var(--sage-green), var(--light-green));
    margin: 2rem 0;
    border-radius: 2px;
    background-size: 200% 100%;
    transition: background-position 0.5s ease;
}

.racing-stripe:hover {
    background-position: 100% 0;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-green);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover,
.back-to-top:focus {
    transform: translateY(-2px);
    background: var(--dark-green);
}



/* Responsive Design */
@media (max-width: 768px) {
    .skip-link {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 2rem;
        box-shadow: var(--shadow);
        border-top: 1px solid rgba(16, 185, 129, 0.1);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        margin: 0.5rem 0;
    }

    .nav-container {
        padding: 0 1rem;
    }

    .hero {
        padding: 8rem 1rem 2rem;
        min-height: 90vh;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .hero-text h1 {
        font-size: 2.2rem;
        line-height: 1.2;
    }

    .hero-text .subtitle {
        font-size: 1.1rem;
    }

    .hero-text p {
        font-size: 1rem;
    }

    .cta-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        min-width: 140px;
    }

    .matrix-animation {
        width: 280px;
        height: 200px;
        margin: 0 auto;
    }

    .f1-car {
        width: 40px;
        height: 20px;
    }

    section {
        padding: 3rem 1rem;
    }

    .container {
        padding: 0 1rem;
    }

    h2 {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .section-intro {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-text {
        font-size: 1rem;
        order: 1;
    }

    .neural-network {
        height: 300px;
        order: 2;
        transform: rotate(-90deg);
        transform-origin: center;
    }

    .neural-network-container {
        order: 2;
    }

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

    .skill-item {
        padding: 1.2rem;
    }

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

    .service-card {
        padding: 2rem;
    }

    .service-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

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

    .portfolio-item {
        padding: 1.5rem;
    }

    .contact-container {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    input,
    textarea,
    select {
        padding: 0.8rem;
        font-size: 1rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 0 1rem;
    }

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

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }


}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .f1-car {
        display: none;
    }

    .symbol {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
}

/* Print styles */
@media print {
    nav,
    .f1-car,
    .matrix-animation,
    .back-to-top {
        display: none !important;
    }

    .hero {
        min-height: auto;
        padding: 2rem 0;
    }

    .btn {
        border: 1px solid #000;
        background: none;
        color: #000;
    }
}


