/* Basic Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Color Palette - Customize these! */
    --primary-color: #007bff; /* A vibrant blue for accents and primary CTAs */
    --secondary-color: #6c757d; /* A subtle grey for secondary elements */
    --accent-color: #ffc107; /* A bright yellow for highlights */

    /* Light Mode Variables */
    --text-color-light: #343a40; /* Darker text for readability */
    --bg-color-light: #f8f9fa; /* Light background */
    --card-bg-light: #ffffff; /* White cards */
    --border-color-light: #e9ecef; /* Light grey borders */
    --shadow-color-light: rgba(0, 0, 0, 0.08);

    /* Dark Mode Variables */
    --text-color-dark: #e0e0e0;
    --bg-color-dark: #1a202c; /* Deep charcoal */
    --card-bg-dark: #2d3748; /* Slightly lighter charcoal for cards */
    --border-color-dark: #4a5568;
    --shadow-color-dark: rgba(0, 0, 0, 0.3);

    /* Current Theme Variables (Controlled by JS) */
    --current-text-color: var(--text-color-light);
    --current-bg-color: var(--bg-color-light);
    --current-card-bg: var(--card-bg-light);
    --current-border-color: var(--border-color-light);
    --current-shadow-color: var(--shadow-color-light);

    /* Typography */
    --font-family-primary: 'Poppins', sans-serif;
    --font-family-heading: 'Playfair Display', serif;
    --font-size-base: 1.1rem;
    --line-height-base: 1.7;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 3rem;
    --spacing-xl: 6rem; /* Generous section padding */

    /* Border Radius */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
}

/* Base Body Styles */
body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--current-text-color);
    background-color: var(--current-bg-color);
    transition: background-color 0.4s ease, color 0.4s ease; /* Smooth theme transition */
    scroll-behavior: smooth; /* Smooth scrolling for anchor links */
    -webkit-font-smoothing: antialiased; /* Better font rendering */
    -moz-osx-font-smoothing: grayscale;
}

/* Dark Mode Class (added by JavaScript) */
body.dark-mode {
    --current-text-color: var(--text-color-dark);
    --current-bg-color: var(--bg-color-dark);
    --current-card-bg: var(--card-bg-dark);
    --current-border-color: var(--border-color-dark);
    --current-shadow-color: var(--shadow-color-dark);
}

/* General Link Styles */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
    color: var(--current-text-color);
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
    font-weight: 700;
}

h1 { font-size: 3.8rem; }
h2 { font-size: 2.8rem; margin-top: var(--spacing-lg); text-align: center; }
h3 { font-size: 1.8rem; }

/* Section Divider */
.section-divider {
    border: none;
    border-top: 1px solid var(--current-border-color);
    width: 80%;
    margin: var(--spacing-xl) auto;
    opacity: 0.7;
}

/* Container for Centering Content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Section Styling */
section {
    padding: var(--spacing-xl) 0;
    position: relative;
    overflow: hidden; /* Important for any background animations or elements */
}

/* Header Section */
.main-header {
    /* RGB values for transparency in rgba() are hardcoded here for simplicity,
       in a preprocessor like Sass or a more complex CSS setup,
       these might be derived dynamically from --current-bg-color */
    background-color: rgba(248, 249, 250, 0.9); /* Light mode default */
    backdrop-filter: blur(8px); /* Frosted glass effect */
    -webkit-backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: var(--spacing-sm) 0;
    box-shadow: 0 4px 15px var(--current-shadow-color);
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

/* Dynamic background color for header based on theme */
body.dark-mode .main-header {
    background-color: rgba(26, 32, 44, 0.9); /* Dark mode */
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-family-heading);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: var(--spacing-lg); /* More spacing for desktop nav */
}

.nav-links li a {
    color: var(--current-text-color);
    font-weight: 600;
    padding: 0.5rem 0;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px; /* Thicker underline */
    background-color: var(--accent-color); /* Use accent color for underline */
    transform: translateX(-101%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smooth cubic-bezier */
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
    transform: translateX(0%);
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.8rem;
    padding: 0.3rem;
    color: var(--current-text-color);
    transition: transform 0.2s ease, color 0.3s ease;
    outline: none; /* Remove focus outline */
}
#theme-toggle:hover {
    transform: scale(1.15);
    color: var(--accent-color);
}

/* Hamburger menu for mobile */
.hamburger-menu {
    display: none; /* Hidden by default on desktop */
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
    z-index: 1001; /* Ensure it's above other elements */
}

.hamburger-menu .bar {
    width: 25px;
    height: 3px;
    background-color: var(--current-text-color);
    transition: all 0.3s ease-in-out;
    border-radius: 2px;
}

/* Active state for hamburger menu (toggled by JS) */
.hamburger-menu.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger-menu.active .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Mobile Navigation Overlay */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* Hide standard nav on mobile */
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%; /* Start off-screen */
        width: 70%;
        height: 100vh;
        background-color: var(--current-bg-color);
        padding-top: var(--spacing-xl);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
        transition: right 0.4s ease-in-out;
        justify-content: flex-start;
        align-items: center;
        gap: var(--spacing-lg);
    }

    .nav-links.active {
        right: 0; /* Slide in */
    }

    .nav-links li a {
        font-size: 1.5rem;
        padding: var(--spacing-sm) 0;
    }

    .hamburger-menu {
        display: flex;
    }
}


/* Buttons */
.btn {
    display: inline-flex; /* Use flex for alignment with icons */
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.9rem 2.2rem; /* Slightly larger padding */
    border-radius: var(--border-radius-lg); /* More rounded buttons */
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    font-size: 1rem;
    box-shadow: 0 5px 15px var(--current-shadow-color);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: color-mix(in srgb, var(--primary-color) 92%, black); /* A more modern way to darken in CSS */
    transform: translateY(-4px); /* More pronounced lift */
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

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

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
}

.btn-download {
    background-color: var(--current-card-bg);
    color: var(--primary-color);
    border: 1px solid var(--current-border-color);
    box-shadow: 0 2px 8px var(--current-shadow-color);
}
.btn-download:hover {
    box-shadow: 0 6px 15px var(--current-shadow-color);
    transform: translateY(-2px);
}

.btn-demo, .btn-code {
    padding: 0.7rem 1.4rem; /* Slightly smaller for project cards */
    font-size: 0.95rem;
    margin-right: var(--spacing-xs);
    border-radius: var(--border-radius-md);
    box-shadow: none; /* No extra shadow on these small buttons */
}
.btn-demo { background-color: var(--primary-color); color: white; }
.btn-code { background-color: var(--secondary-color); color: white; }
.btn-demo:hover, .btn-code:hover { opacity: 0.9; transform: translateY(-2px); }


/* Hero Section */
.hero-section {
    min-height: 90vh; /* Takes up most of the viewport height */
    display: flex;
    flex-direction: column; /* Stack content and graphic */
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, var(--current-bg-color), var(--current-card-bg)); /* Subtle gradient */
    padding: var(--spacing-xl) var(--spacing-md);
}

.hero-content {
    max-width: 900px;
    z-index: 2;
    padding-bottom: var(--spacing-lg); /* Space between content and graphic */
}

.hero-content .greeting {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
}

.hero-content h1 {
    font-size: clamp(3rem, 8vw, 5rem); /* Responsive font size */
    line-height: 1.1;
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(to right, var(--primary-color), var(--accent-color)); /* Text gradient */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textGradientPulse 3s infinite alternate; /* Subtle pulse animation */
}

.hero-content .tagline {
    font-size: clamp(1.2rem, 3vw, 1.8rem) ;
    margin-bottom: var(--spacing-md);
    color: var(--current-text-color);
    opacity: 0.9;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    margin-top: var(--spacing-lg);
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    justify-content: center;
    gap: var(--spacing-md);
}

.hero-graphic {
    width: 100%;
    max-width: 600px;
    margin-top: var(--spacing-lg);
    z-index: 1; /* Below content */
}
.hero-illustration {
    width: 100%;
    height: auto;
    animation: float 4s ease-in-out infinite alternate; /* Example animation */
}


/* About Section */
.about-section {
    background-color: var(--current-card-bg);
    border-bottom: 1px solid var(--current-border-color);
}

.about-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    align-items: center;
    text-align: center;
    margin-top: var(--spacing-xl);
}

@media (min-width: 768px) {
    .about-grid {
        flex-direction: row;
        text-align: left;
    }
    .profile-picture {
        flex: 0 0 350px; /* Fixed width for image */
        margin-right: var(--spacing-lg);
    }
    .about-text {
        flex: 1;
    }
}

.profile-picture img {
    max-width: 100%;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 30px var(--current-shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-picture img:hover {
    transform: scale(1.02) rotate(1deg); /* Slight zoom and tilt on hover */
    box-shadow: 0 15px 40px var(--current-shadow-color);
}


/* Skills Section */
.skills-section {
    background-color: var(--current-bg-color);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.skill-item {
    background-color: var(--current-card-bg);
    padding: var(--spacing-lg) var(--spacing-md);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 20px var(--current-shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    border: 1px solid var(--current-border-color);
}

.skill-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px var(--current-shadow-color);
}

.skill-item img {
    width: 70px;
    height: 70px;
    margin-bottom: var(--spacing-sm);
    /* For drop-shadow with variable colors, you'd need to define RGB values for your colors.
       Here, I'm providing a generic example. */
    filter: drop-shadow(0 2px 5px rgba(0, 123, 255, 0.3)); /* Subtle glow with a blue example */
}

.skill-item h3 {
    font-size: 1.4rem;
    margin-bottom: var(--spacing-xs);
    color: var(--primary-color);
}

.skill-item p {
    font-size: 1rem;
    color: var(--current-text-color);
    opacity: 0.85;
}


/* Projects Section */
.projects-section {
    background-color: var(--current-card-bg);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.project-card {
    background-color: var(--current-card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 12px 30px var(--current-shadow-color);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--current-border-color);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px var(--current-shadow-color);
}

.project-card img {
    width: 100%;
    height: 250px; /* Consistent height for images */
    object-fit: cover;
    border-bottom: 1px solid var(--current-border-color);
}

.project-card .card-content {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow content to grow */
}

.project-card h3 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.project-card .project-description {
    font-size: 1rem;
    color: var(--current-text-color);
    opacity: 0.9;
    margin-bottom: var(--spacing-sm);
    flex-grow: 1; /* Allow description to take available space */
}

.project-card .project-tech-stack {
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.project-card .project-tech-stack span {
    display: inline-block;
    background-color: color-mix(in srgb, var(--primary-color) 85%, white); /* A subtle background for tags */
    color: var(--primary-color);
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius-sm);
    margin-right: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.project-card .project-links {
    margin-top: auto; /* Push links to the bottom */
    display: flex;
    justify-content: flex-start;
    gap: var(--spacing-sm);
    padding-top: var(--spacing-sm); /* Padding above links */
    border-top: 1px solid var(--current-border-color); /* Separator */
}
.project-card .project-links .btn {
    width: fit-content; /* Only take needed width */
}


/* Contact Section */
.contact-section {
    background-color: var(--current-bg-color);
    text-align: center;
}

.contact-section p {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-lg);
    color: var(--current-text-color);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.contact-info {
    margin-top: var(--spacing-xl);
}

.contact-info p {
    font-size: 1.3rem;
    margin-bottom: var(--spacing-md);
}

.contact-info a {
    display: inline-block; /* Keep on same line */
    color: var(--primary-color);
    font-weight: 600;
    transition: color 0.3s ease, transform 0.2s ease;
}
.contact-info a:hover {
    color: var(--accent-color);
    transform: translateX(5px);
}

/* Contact Form (if implemented) */
.contact-form {
    margin-top: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: var(--spacing-lg);
    background-color: var(--current-card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 30px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
}
.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid var(--current-border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--current-bg-color);
    color: var(--current-text-color);
    font-family: var(--font-family-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 80%, transparent);
}
.contact-form button {
    align-self: flex-start; /* Align button to start */
}


/* Footer Section */
.main-footer {
    background-color: color-mix(in srgb, var(--current-bg-color) 95%, black); /* Slightly darker footer */
    color: var(--text-color-dark); /* Ensure text is visible in both modes */
    text-align: center;
    padding: var(--spacing-md) 0;
    border-top: 1px solid var(--current-border-color);
    font-size: 0.9rem;
}

.footer-social-links {
    margin-top: var(--spacing-sm);
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.footer-social-links img {
    width: 30px;
    height: 30px;
    /* Invert colors of SVG icons for dark mode: 0 for light mode, 1 for dark mode */
    filter: invert(var(--current-theme-is-dark, 0));
    transition: transform 0.3s ease;
}
/* Helper for invert filter - JavaScript will set --current-theme-is-dark */
body:not(.dark-mode) .footer-social-links img { --current-theme-is-dark: 0; }
body.dark-mode .footer-social-links img { --current-theme-is-dark: 1; }

.footer-social-links img:hover {
    transform: scale(1.15) rotate(5deg);
}


/* Animations */
/* Text Gradient Pulse */
@keyframes textGradientPulse {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}
.hero-content h1 {
    background-size: 200% auto; /* For gradient animation */
}

/* Floating animation for hero graphic */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* Simple Reveal-on-Scroll (Requires JavaScript to add/remove 'revealed' class) */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}


/* Responsive Adjustments */
@media (max-width: 992px) {
    h1 { font-size: clamp(2.5rem, 7vw, 4rem); }
    h2 { font-size: 2.2rem; }
    .nav-links { gap: var(--spacing-md); }
    .hero-content .tagline { font-size: clamp(1rem, 2.5vw, 1.5rem); }
    .hero-section { min-height: 70vh; }
    .projects-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
    .project-card img { height: 200px; }
    section { padding: var(--spacing-lg) 0; }
    .section-divider { margin: var(--spacing-lg) auto; }
}

@media (max-width: 768px) {
    .main-header { padding: var(--spacing-sm) var(--spacing-md); }
    h1 { font-size: clamp(2rem, 6vw, 3rem); }
    h2 { font-size: 2rem; }
    .about-grid { flex-direction: column; text-align: center; }
    .profile-picture { margin-right: 0; margin-bottom: var(--spacing-md); }
    .about-text { padding: 0 var(--spacing-md); }
    .cta-buttons { flex-direction: column; gap: var(--spacing-sm); }
    .btn { width: 100%; max-width: 250px; } /* Full width for smaller screens */
    .hero-graphic { margin-top: var(--spacing-md); }
}

@media (max-width: 480px) {
    body { font-size: 1rem; }
    h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
    h2 { font-size: 1.8rem; }
    .container { padding: 0 var(--spacing-sm); }
    .nav-links li a { font-size: 1.2rem; }
    .btn { padding: 0.8rem 1.5rem; }
    .project-card .project-links { flex-direction: column; }
    .project-card .project-links .btn { width: 100%; }
}