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

:root {
    /* Colors */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --accent-color: #60a5fa;
    --bg-color: #ffffff;
    --bg-alt: #f8fafc;
    --bg-dark: #0f172a;
    --text-color: #1e293b;
    --text-light: #64748b;
    --text-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    --spacing-3xl: 6rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-color);
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

p {
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ===================================
   Container & Layout
   =================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

section {
    padding: var(--spacing-3xl) 0;
}

/* ===================================
   Header & Navigation
   =================================== */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

#header.scrolled {
    box-shadow: var(--shadow-md);
    background-color: rgba(255, 255, 255, 0.98);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    transition: color var(--transition-fast);
}

.logo a:hover {
    color: var(--primary-dark);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-color);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 0.5rem;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 2px;
    background-color: var(--primary-color);
    transition: transform var(--transition-fast);
}

.nav-link:hover::after {
    transform: translateX(-50%) scaleX(1);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
}

.menu-toggle span {
    width: 1.5rem;
    height: 2px;
    background-color: var(--text-color);
    transition: all var(--transition-fast);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(0.4rem, 0.4rem);
}

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

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(0.4rem, -0.4rem);
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(59, 130, 246, 0.1) 100%);
    padding-top: 80px;
    text-align: center;
}

.hero-content {
    animation: fadeInUp 1s ease;
}

.profile-image-container {
    margin-bottom: var(--spacing-lg);
    display: inline-block;
    position: relative;
}

.profile-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--bg-color);
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
}

.profile-image-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    z-index: 0;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.hero-title {
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.hero-description {
    max-width: 700px;
    margin: 0 auto var(--spacing-xl);
    font-size: 1.125rem;
    color: var(--text-light);
    line-height: 1.8;
}

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

/* ===================================
   Buttons
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    font-size: 1rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--text-white);
}

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

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

/* ===================================
   Section Titles
   =================================== */
.section-title {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    position: relative;
    padding-bottom: var(--spacing-md);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

/* ===================================
   About Section
   =================================== */
.about {
    background-color: var(--bg-color);
}

.about-content {
    max-width: 900px;
    margin: 0 auto;
}

.about-text p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
}

.about-text strong {
    color: var(--text-color);
    font-weight: 600;
}

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

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.skill-card {
    background-color: var(--bg-color);
    padding: var(--spacing-xl);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.skill-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.skill-icon i {
    font-size: 1.75rem;
    color: var(--text-white);
}

.skill-card h3 {
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tag:hover {
    background-color: var(--primary-color);
    color: var(--text-white);
    transform: scale(1.05);
}

/* ===================================
   Experience Section
   =================================== */
.experience {
    background-color: var(--bg-color);
}

.timeline {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
}

.timeline-item {
    position: relative;
    padding-left: 80px;
    margin-bottom: var(--spacing-xl);
}

.timeline-marker {
    position: absolute;
    left: 20px;
    top: 0;
    width: 20px;
    height: 20px;
    background-color: var(--primary-color);
    border: 4px solid var(--bg-color);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.timeline-content {
    background-color: var(--bg-alt);
    padding: var(--spacing-lg);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.timeline-content:hover {
    box-shadow: var(--shadow-lg);
    transform: translateX(5px);
}

.timeline-period {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--primary-color);
    color: var(--text-white);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.timeline-content h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.timeline-content h4 {
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.timeline-content ul {
    list-style: none;
    padding-left: 0;
}

.timeline-content li {
    position: relative;
    padding-left: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    color: var(--text-light);
}

.timeline-content li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* ===================================
   Projects Section
   =================================== */
.projects {
    background-color: var(--bg-alt);
}

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

.project-card {
    background-color: var(--bg-color);
    padding: var(--spacing-xl);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.project-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.project-icon i {
    font-size: 1.75rem;
    color: var(--text-white);
}

.project-card h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.project-card p {
    color: var(--text-light);
    flex-grow: 1;
    margin-bottom: var(--spacing-md);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--primary-color);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.project-link:hover {
    gap: var(--spacing-sm);
}

/* ===================================
   Education Section
   =================================== */
.education {
    background-color: var(--bg-color);
}

.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.education-card {
    background-color: var(--bg-alt);
    padding: var(--spacing-xl);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.education-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.education-card.full-width {
    grid-column: 1 / -1;
}

.education-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.education-icon i {
    font-size: 1.75rem;
    color: var(--text-white);
}

.education-card h3 {
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.education-item {
    margin-bottom: var(--spacing-md);
}

.education-item h4 {
    color: var(--text-color);
    font-size: 1.125rem;
    margin-bottom: var(--spacing-xs);
}

.education-item p {
    color: var(--text-light);
    margin-bottom: 0;
}

.courses-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.course-tag {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.course-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* ===================================
   Contact Section
   =================================== */
.contact {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(59, 130, 246, 0.1) 100%);
}

.contact-subtitle {
    text-align: center;
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
}

.contact-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    max-width: 1000px;
    margin: 0 auto;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    align-items: center;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--bg-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    /* make items center and responsive: allow a sensible max width but take full width of parent */
    width: 100%;
    max-width: 600px;
}

.contact-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.contact-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-top: 0.25rem;
}

.contact-item h4 {
    font-size: 1rem;
    margin-bottom: var(--spacing-xs);
    color: var(--text-color);
}

.contact-item a {
    color: var(--text-light);
    word-break: break-word;
}

.contact-item a:hover {
    color: var(--primary-color);
}

/* Contact Form */
.contact-form {
    background-color: var(--bg-color);
    padding: var(--spacing-xl);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

/* ===================================
   Footer
   =================================== */
.footer {
    background-color: var(--bg-dark);
    color: var(--text-white);
    padding: var(--spacing-xl) 0;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    margin-bottom: var(--spacing-sm);
    color: rgba(255, 255, 255, 0.8);
}

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

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-white);
    transition: all var(--transition-fast);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.footer-tagline {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    /* Navigation */
    .menu-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: var(--bg-color);
        flex-direction: column;
        padding: var(--spacing-xl);
        gap: var(--spacing-md);
        transition: left var(--transition-normal);
        box-shadow: var(--shadow-lg);
        align-items: flex-start;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        width: 100%;
        padding: var(--spacing-md);
        font-size: 1.125rem;
    }
    
    /* Hero */
    .hero {
        padding: var(--spacing-3xl) var(--spacing-md);
        min-height: auto;
    }
    
    .profile-image {
        width: 150px;
        height: 150px;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Sections */
    section {
        padding: var(--spacing-2xl) 0;
    }
    
    /* Skills */
    .skills-grid {
        grid-template-columns: 1fr;
    }
    
    /* Timeline */
    .timeline::before {
        left: 10px;
    }
    
    .timeline-item {
        padding-left: 50px;
    }
    
    .timeline-marker {
        left: 0;
    }
    
    /* Projects */
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    /* Education */
    .education-grid {
        grid-template-columns: 1fr;
    }
    
    /* Contact */
    .contact-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-xl: 2rem;
        --spacing-2xl: 3rem;
        --spacing-3xl: 4rem;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .skill-card,
    .project-card,
    .education-card,
    .timeline-content,
    .contact-form {
        padding: var(--spacing-md);
    }
}

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

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
