:root {
    --primary: #2d6cdf;
    --background: #fff;
    --text: #222;
    --header-bg: #f5f5f5;
    --footer-bg: #f5f5f5;
    --accent: #eaf1fb;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    background: var(--background);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
}

header {
    background: var(--header-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.avatar {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.2rem;
    margin: 0;
    padding: 0;
}

nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: color 0.2s, background-color 0.2s;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    display: block;
}

nav a:hover, nav a:focus {
    color: #fff;
    background: var(--primary);
    outline: none;
}

#theme-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    margin-left: 1rem;
    color: var(--primary);
    transition: color 0.2s;
}

#theme-toggle:hover {
    color: #111;
}

main {
    max-width: 800px;
    margin: 2.5rem auto 1.5rem auto;
    padding: 0 1rem;
}

main > section { /* Apply to direct children sections of main */
    margin-bottom: 2.5rem; /* Keep existing margin */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

main > section.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero {
    background: var(--accent);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    margin-bottom: 2.5rem;
    text-align: center; /* This centers the text content of h1, h2, p */
}

.profile-photo {
    width: 140px; /* Or your desired width */
    height: 140px; /* Or your desired height */
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 1.2rem; /* Space below the photo */
    border: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);

    /* Key styles for centering the image itself: */
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.hero h1 {
    font-size: 2.1rem;
    margin-bottom: 0.5rem;
}

.hero h2 {
    font-size: 1.2rem;
    font-weight: 400;
    color: #555;
    margin-bottom: 1.2rem;
}

.highlight {
    color: var(--primary);
}

section {
    margin-bottom: 2.5rem;
}

section h2 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
}

.skills-grid div {
    background: var(--accent);
    border-radius: 8px;
    padding: 1.2rem;
    min-height: 140px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.skills-grid div:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.skills-grid h3 {
    margin-bottom: 0.8rem;
    color: var(--primary);
    font-size: 1.1rem;
}

.skills-grid p {
    line-height: 1.5;
    color: var(--text);
    margin: 0;
}

.experience-list {
    list-style: none;
    padding: 0;
}

.experience-list li {
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid #e0e0e0;
}

.experience-list strong {
    font-size: 1.1em;
    color: var(--primary);
}

.experience-list em {
    font-style: italic;
    color: #555;
}

.experience-list span {
    display: block;
    color: #666;
    font-size: 0.97em;
    margin-top: 0.2em;
}

.contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-list li {
    margin-bottom: 0.5em;
    font-size: 1.05em;
}

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

a:hover, a:focus {
    text-decoration: underline;
}

footer {
    background: var(--footer-bg);
    text-align: center;
    padding: 1rem 0;
    font-size: 0.95rem;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

body.dark-mode {
    --background: #181c25;
    --text: #f5f5f5;
    --header-bg: #23283a;
    --footer-bg: #23283a;
    --accent: #23283a;
}

/* Scroll-to-top Button */
#scrollTopBtn {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1000; /* Ensure it's above other content */
    border: none;
    outline: none;
    background-color: var(--primary);
    color: white;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s, opacity 0.3s;
}

#scrollTopBtn:hover {
    background-color: #0056b3; /* A darker shade of your primary color */
}

.executive-summary {
    background: var(--accent);
    padding: 1.2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary);
}

.experience-timeline {
    position: relative;
}

.experience-item {
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.experience-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--accent);
}

.experience-header h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.duration {
    color: #666;
    font-style: italic;
    font-size: 1rem;
    display: block;
    font-weight: 500;
}

.projects-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.project-card {
    background: var(--accent);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-header h4 {
    color: var(--primary);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.project-duration {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

.project-details p {
    margin: 0.5rem 0;
    line-height: 1.5;
}

.responsibilities {
    margin: 1rem 0;
}

.responsibilities ul {
    margin: 0.5rem 0;
    padding-left: 1.2rem;
}

.responsibilities li {
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.tech-stack {
    margin-top: 1rem;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background: var(--primary);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Blog Section */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.blog-post {
    background: var(--accent);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.blog-post:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.blog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.blog-post h3 {
    color: var(--primary);
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    flex: 1;
}

.blog-date {
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
    white-space: nowrap;
}

.blog-content p {
    line-height: 1.6;
    margin-bottom: 1rem;
    color: var(--text);
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.blog-tag {
    background: var(--primary);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.blog-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.blog-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Blog Page Specific Styles */
.blog-hero {
    background: var(--accent);
    border-radius: 12px;
    padding: 3rem 2rem;
    margin-bottom: 3rem;
    text-align: center;
}

.blog-hero h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.blog-hero p {
    font-size: 1.2rem;
    color: var(--text);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.blog-section {
    margin-bottom: 3rem;
}

/* Active navigation link */
.nav-brand a.active,
nav ul a.active {
    background: var(--primary);
    color: white;
}

/* Smooth scrolling for navigation */
html {
    scroll-behavior: smooth;
}

/* Adjust scroll offset for fixed header */
section {
    scroll-margin-top: 100px; /* Increase this value */
    padding-top: 20px; /* Add some padding */
}

/* Ensure proper section spacing */
section {
    scroll-margin-top: 100px;
    margin-bottom: 3rem;
    min-height: 200px; /* Ensure sections have minimum height */
}

/* Special handling for contact section */
#contact {
    padding-bottom: 4rem; /* Add extra padding at bottom */
}

/* Special case for hero section */
.hero {
    scroll-margin-top: 80px;
}

/* Responsive design */
@media (max-width: 768px) {
    .experience-item {
        padding: 1rem;
    }
    
    .project-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .tech-tags {
        gap: 0.3rem;
    }
    
    .tag {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .blog-post {
        padding: 1.2rem;
    }
    
    .blog-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 700px) {
    nav {
        flex-direction: column;
        gap: 0.7rem;
        padding: 1rem;
    }
    .skills-grid {
        grid-template-columns: 1fr;
    }
    main {
        padding: 0 0.5rem;
    }
}