/* General Reset & Base Styles */
:root {
    /* Light Mode Colors */
    --primary-color: #007bff; /* Bright Blue */
    --primary-dark-color: #0056b3; /* Darker Primary */
    --secondary-color: #6c757d; /* Muted Grey */
    --accent-color: #3fd361; /* Success Green */

    --bg-body: #ffffff; /* White background */
    --bg-light: #f8f9fa; /* Light grey background */
    --bg-dark: #343a40; /* Dark grey for sections/footer */

    --text-heading: #212529; /* Dark grey for headings */
    --text-body: #495057; /* Medium grey for body text */
    --text-light: #f8f9fa; /* Light text on dark backgrounds */
    --text-links: #007bff; /* Blue for links */
    --text-links-hover: #0056b3;

    --border-color: rgba(0,0,0,0.1); /* Light borders */
    --shadow-color: rgba(0,0,0,0.05); /* Light shadows */
    --card-border-color: var(--primary-color); /* Card top border */

    /* General Spacing & Radius */
    --spacing-lg: 80px;
    --spacing-md: 40px;
    --spacing-sm: 20px;
    --border-radius: 8px;
    --transition-speed: 0.3s;

    --primary-color-hero: #007bff; /* Lighter Purple-Blue */
    --primary-dark-color-hero: #3fd361; /* Darker Primary in dark mode */
}

/* Dark Mode Colors */
body.dark-mode {
    --primary-color: #8c9eff; /* Lighter Purple-Blue */
    --primary-dark-color: #5c6bc0; /* Darker Primary in dark mode */
    --secondary-color: #a0a0a0; /* Lighter grey for secondary */
    --accent-color: #69f0ae; /* Brighter Green */

    --bg-body: #1a1a2e; /* Deep dark blue */
    --bg-light: #2c2c4d; /* Slightly lighter dark blue */
    --bg-dark: #121226; /* Even darker blue for contrast */

    --text-heading: #e0e0e0; /* Light grey for headings */
    --text-body: #b0b0b0; /* Medium grey for body text */
    --text-light: #f8f9fa; /* Remains light text */
    --text-links: #8c9eff; /* Dark mode link color */
    --text-links-hover: #5c6bc0;

    --border-color: rgba(255,255,255,0.1); /* Dark borders */
    --shadow-color: rgba(0,0,0,0.3); /* Darker shadows */
    --card-border-color: var(--accent-color); /* Card border changes */

    --primary-color-hero: #776b6b; /* Lighter Purple-Blue */
    --primary-dark-color-hero: #1a214a; /* Darker Primary in dark mode */
}


/* Base Styles using Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-body); /* Use body text color */
    background-color: var(--bg-body); /* Use body background color */
    scroll-behavior: smooth;
    overflow-x: hidden;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease; /* Smooth transition for dark mode */
}

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

.section-padding {
    padding: var(--spacing-lg) 0;
}

.section-title {
    font-size: 2.8em;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-lg);
    color: var(--text-heading); /* Use heading text color */
}

.text-center { text-align: center; }
.text-white { color: var(--text-light) !important; } /* Force light text on dark bg */
.bg-light { background-color: var(--bg-light); }
.bg-dark { background-color: var(--bg-dark); }
.mt-4 { margin-top: var(--spacing-md); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 30px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    border: none;
    cursor: pointer;
}

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

.primary-btn:hover {
    background-color: var(--primary-dark-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 15px var(--shadow-color);
}

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

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 15px var(--shadow-color);
}

/* Header */
.main-header {
    background-color: var(--bg-body); /* Header uses body background */
    padding: var(--spacing-sm) 0;
    box-shadow: 0 2px 15px var(--shadow-color);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: background-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Roboto Mono', monospace; /* Techy font for logo */
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

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

.nav-links li {
    margin-left: var(--spacing-md);
}

.nav-links a {
    text-decoration: none;
    color: var(--text-links); /* Link color */
    font-weight: 600;
    transition: color var(--transition-speed) ease;
}

.nav-links a:hover {
    color: var(--text-links-hover); /* Link hover color */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm); /* Spacing between toggle and menu button */
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    background: none;
    border: none;
    font-size: 1.6em;
    color: var(--text-heading); /* Icon color */
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.dark-mode-toggle:hover {
    background-color: rgba(0,0,0,0.05); /* Subtle hover */
}

body.dark-mode .dark-mode-toggle:hover {
    background-color: rgba(255,255,255,0.08);
}


.menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    font-size: 1.8em;
    color: var(--primary-color);
    cursor: pointer;
}


/* Hero Section */
.hero-section {
    /* CHANGED: New vibrant gradient blending primary and accent colors */
    background: linear-gradient(135deg, var(--primary-color-hero) 0%, var(--primary-dark-color-hero) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light); /* Always light text on hero */
    text-align: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.hero-content {
    max-width: 800px;
    z-index: 1;
}

.hero-section h1 {
    font-size: 3em;
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
    line-height: 1.1;
    color: white; /* Always white */
}

.hero-section p {
    font-size: 1.4em;
    margin-bottom: var(--spacing-md);
    opacity: 0.9;
}

.hero-bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Subtle background texture/pattern */
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><defs><radialGradient id="g" cx="50%" cy="50%" r="50%"><stop offset="0%" stop-color="%23ffffff" stop-opacity="0.1"/><stop offset="100%" stop-color="%23000000" stop-opacity="0.2"/></radialGradient></defs><rect x="0" y="0" width="100%" height="100%" fill="url(%23g)"/></svg>') no-repeat center center/cover;
    z-index: 0;
    opacity: 0.1;
    /* Add more complex animations here with SVG, JS particles, etc. */
}


/* Services Grid */
.services-grid, .benefits-grid, .portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
}

.service-card, .benefit-item, .portfolio-item, .testimonial-card {
    background-color: var(--bg-body); /* Card background matches body */
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow-color);
    text-align: center;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease, background-color var(--transition-speed) ease;
    border-top: 5px solid var(--card-border-color); /* Dynamic card border color */
}

.service-card:hover, .benefit-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px var(--shadow-color);
}

.service-icon, .benefit-icon {
    font-size: 3em;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.service-card h3, .benefit-item h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--text-heading);
}

.service-card p, .benefit-item p {
    font-size: 1em;
    color: var(--text-body);
}

/* Portfolio */
.portfolio-item {
    padding: 0;
    overflow: hidden;
    border-top: none;
    border-bottom: 5px solid var(--card-border-color);
}

.portfolio-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    transition: transform var(--transition-speed) ease;
}

.portfolio-item:hover img {
    transform: scale(1.05);
}

.portfolio-info {
    padding: var(--spacing-sm);
    text-align: left;
}

.portfolio-info h3 {
    font-size: 1.4em;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.portfolio-info p {
    font-size: 0.95em;
    color: var(--text-body);
    margin-bottom: 15px;
}

.view-project-link {
    color: var(--text-links);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-speed) ease;
}

.view-project-link:hover {
    color: var(--text-links-hover);
}


/* Testimonials */
.testimonials-section {
    background-color: var(--bg-dark);
    color: var(--text-light);
}

.testimonial-carousel {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.testimonial-card {
    background-color: var(--bg-body); /* Testimonial card bg, contrasts with section bg */
    color: var(--text-body);
    border-top: 5px solid var(--accent-color);
    max-width: 500px;
    padding: var(--spacing-md);
}

.testimonial-card .quote {
    font-size: 1.2em;
    font-style: italic;
    margin-bottom: var(--spacing-sm);
    line-height: 1.8;
}

.client-info {
    display: flex;
    align-items: center;
    text-align: left;
    margin-top: var(--spacing-sm);
}

.client-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    border: 3px solid var(--accent-color);
}

.client-name {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 3px;
    color: var(--text-heading);
}

.client-title {
    font-size: 0.9em;
    color: var(--text-body);
}


/* CTA Section */
.cta-section {
    background: linear-gradient(45deg, var(--bg-light), var(--bg-body));
    padding: var(--spacing-lg) 0;
}

.cta-section h2 {
    color: var(--text-heading);
}

.cta-section p {
    font-size: 1.2em;
    margin-bottom: var(--spacing-md);
    color: var(--text-body);
}


/* Footer */
.main-footer {
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: var(--spacing-md) 0;
    font-size: 0.9em;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.footer-brand, .footer-contact, .footer-social {
    flex: 1;
    min-width: 250px;
    margin-bottom: var(--spacing-sm);
}

.footer-brand h3 {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.6em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.footer-contact h4, .footer-social h4 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--text-light);
}

.footer-contact p {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    color: var(--text-light);
    opacity: 0.8;
}

.footer-contact i {
    margin-right: 10px;
    color: var(--accent-color);
}

.footer-social a {
    color: var(--text-light);
    font-size: 1.5em;
    margin-right: 15px;
    transition: color var(--transition-speed) ease;
}

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

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-sm);
    flex-wrap: wrap;
}

.footer-bottom p {
    color: var(--text-light);
    opacity: 0.6;
}

.footer-links {
    list-style: none;
    display: flex;
}

.footer-links li {
    margin-left: var(--spacing-sm);
}

.footer-links a {
    color: var(--text-light);
    opacity: 0.6;
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

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


/* Animations (unchanged from previous version) */

/* Hero Text Reveal Animation */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-text-reveal {
    opacity: 0; /* Hidden by default */
    animation: slideInFromTop 0.8s ease forwards;
}

.animate-text-reveal.delay-1 { animation-delay: 0.4s; }
.animate-text-reveal.delay-2 { animation-delay: 0.8s; }

/* General Fade-In Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}
.animate-fade-in.delay-0\.5 { animation-delay: 0.5s; }


/* Scroll-Triggered Animations (handled by JS, but defined in CSS) */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* Responsive Design */
@media (max-width: 992px) {
    .section-title {
        font-size: 2.2em;
        margin-bottom: var(--spacing-md);
    }

    .hero-section h1 {
        font-size: 3em;
    }

    .hero-section p {
        font-size: 1.2em;
    }

    .nav-links {
        display: none; /* Hide nav links on smaller screens */
        flex-direction: column;
        width: 100%;
        background-color: var(--bg-body); /* Uses body bg for consistency */
        position: absolute;
        top: 100%; /* Position below header */
        left: 0;
        padding: var(--spacing-sm) 0;
        box-shadow: 0 4px 10px var(--shadow-color);
    }

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

    .nav-links li {
        margin: 10px 0;
        text-align: center;
    }

    .menu-toggle {
        display: block; /* Show menu toggle button */
    }

    .footer-content {
        flex-direction: column;
        align-items: center;
    }

    .footer-brand, .footer-contact, .footer-social {
        min-width: unset;
        text-align: center;
    }

    .footer-contact p {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5em;
    }

    .hero-section p {
        font-size: 1em;
    }

    .section-padding {
        padding: var(--spacing-md) 0;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }

    .hero-section h1 {
        font-size: 2em;
    }

    .hero-section p {
        font-size: 0.9em;
    }

    .btn {
        padding: 12px 25px;
        font-size: 0.9em;
    }

    .main-header {
        padding: 10px 0;
    }

    .logo {
        font-size: 1.5em;
    }

    .service-card, .benefit-item, .portfolio-item, .testimonial-card {
        padding: var(--spacing-sm);
    }
}

.popup-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.popup-box {
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  text-align: left;
  position: relative;
}

.popup-box h2 {
  margin-top: 0;
  font-size: 1.5em;
}

.popup-box input,
.popup-box textarea {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
}

.popup-box button {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 20px;
  cursor: pointer;
  color: #999;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.tech-card:hover {
  transform: translateY(-5px);
}

/* Update this existing rule */
.technologies-section {
    /* Use a background variable that changes with dark mode */
    background-color: var(--bg-body); /* Or var(--bg-body) if you prefer white for light mode */
    text-align: center;
    /* Add transition for smooth color change */
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.portfolio-section{
    background-color: var(--bg-light);
}

/* Update this existing rule */
.tech-card {
    /* Use a background variable that changes with dark mode */
    background: var(--bg-body); /* This will be white in light, dark blue in dark */
    padding: 25px;
    border-radius: 10px;
    /* Use a variable for the shadow color */
    box-shadow: 0 6px 15px var(--shadow-color);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease, background-color var(--transition-speed) ease;
    /* Ensure text color adapts */
    color: var(--text-body);
}

/* Update this existing rule for the icon color */
.tech-icon {
    font-size: 40px;
    /* Use primary color which changes with dark mode */
    color: var(--primary-color);
    margin-bottom: 10px;
    transition: color var(--transition-speed) ease;
}

/* Ensure headings inside tech cards also adapt */
.tech-card h3 {
    color: var(--text-heading);
    transition: color var(--transition-speed) ease;
}