/* Reset default styles and set up variables */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --background-color: #fff;
    --accent-color: #e74c3c;
    --spacing-unit: 1rem;
    --border-radius: 4px;
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

/* Typography */
h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-unit);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

/* Header and Navigation */
header {
    background-color: var(--primary-color);
    padding: var(--spacing-unit);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 2rem;
    top: 1rem;
}

.hamburger span {
    width: 2rem;
    height: 0.25rem;
    background: var(--background-color);
    border-radius: 10px;
    transition: all 0.3s linear;
    transform-origin: 1px;
}

.hamburger.active span:first-child {
    transform: rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg);
}

nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 2rem;
}

nav a {
    color: var(--background-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

nav a:hover,
nav a:focus {
    color: var(--secondary-color);
    outline: none;
}

/* Main content sections */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-unit);
}

section {
    margin: 4rem 0;
    padding: 2rem;
    border-radius: var(--border-radius);
    background-color: #f8f9fa;
}

/* About Me Section */
.about-content {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.profile-image {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
}

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

.project-card {
    background: var(--background-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-unit);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

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

.project-card img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Skills Section */
.skills-container ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    list-style: none;
}

.skills-container li {
    padding: 0.5rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid var(--primary-color);
}

/* Contact Form */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.contact-fallback {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.email-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.email-link:hover,
.email-link:focus {
    color: var(--primary-color);
    text-decoration: underline;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

input,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: inherit;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn:hover,
.btn:focus {
    background-color: #2980b9;
    outline: none;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--background-color);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.close-lightbox {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
}

/* Form Validation Styles */
.validation-message {
    display: block;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.validation-message.invalid {
    color: var(--accent-color);
}

.validation-message.valid {
    color: #2ecc71;
}

input.invalid,
textarea.invalid {
    border-color: var(--accent-color);
}

input.valid,
textarea.valid {
    border-color: #2ecc71;
}

.form-message {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--border-radius);
    text-align: center;
}

.form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Media Queries for Responsive Design */
@media screen and (max-width: 768px) {
    /* Navigation */
    .hamburger {
        display: flex;
    }

    nav ul {
        display: none;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        width: 100%;
        padding: 1rem 0;
    }

    nav ul.active {
        display: flex;
    }

    /* About section */
    .about-content {
        flex-direction: column;
        text-align: center;
    }

    /* Projects grid */
    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Skills grid */
    .skills-container ul {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Cross-browser compatibility */
@supports (-webkit-appearance: none) or (-moz-appearance: none) {
    input,
    textarea,
    button {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
}

/* Ensure smooth scrolling across browsers */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Print styles */
@media print {
    header {
        position: static;
    }
    
    .btn {
        display: none;
    }
}
