/* Google Fonts - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

/* --- CSS Variables for Theming --- */
:root {
    /* Light Theme Defaults */
    --background-color: #f8f8f8;
    --text-color: #333;
    --primary-color: #007bff; /* Blue */
    --primary-hover-color: #0056b3;
    --secondary-color: #6c757d; /* Gray */
    --secondary-hover-color: #5a6268;
    --accent-color: #28a745; /* Green for highlights */
    --border-color: #eee;
    --card-background: #ffffff;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --header-background: #ffffff;
    --footer-background: #333;
    --footer-text-color: #f8f8f8;
    --link-color: #007bff;
    --link-hover-color: #0056b3;
    --button-text-color: #ffffff;
    --input-background: #ffffff;
    --input-border: #ddd;
}

/* Dark Theme Overrides */
body.dark-theme {
    --background-color: #1a1a2e;
    --text-color: #e0e0e0;
    --primary-color: #64ffda; /* Teal-ish */
    --primary-hover-color: #00a887;
    --secondary-color: #8892b0;
    --secondary-hover-color: #667290;
    --accent-color: #f9d342; /* Yellow for highlights */
    --border-color: #333;
    --card-background: #232946;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --header-background: #232946;
    --footer-background: #12121e;
    --footer-text-color: #e0e0e0;
    --link-color: #64ffda;
    --link-hover-color: #00a887;
    --button-text-color: #1a1a2e; /* Primary button text in dark mode */
    --input-background: #33395c;
    --input-border: #444;
}

/* --- Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover-color);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
}

/* --- Header & Navigation --- */
header {
    background-color: var(--header-background);
    /* Shorter top bar: reduce padding and potentially min-height if needed */
    padding: 0.7rem 0; /* Reduced from 1rem 0 */
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

header .container {
    display: flex;
    justify-content: space-between; /* Pushes logo to left, nav and theme button to right */
    align-items: center;
    /* Optional: add a min-height if padding isn't enough to define the bar's height */
    min-height: 50px; /* Example: adjust as needed */
}

.logo a {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 25px;
    margin-left: auto; /* Pushes the nav links to the right as much as possible */
    margin-right: 20px; /* Add some space between nav and theme toggle */
}

.nav-links a {
    font-size: 1.1rem;
    color: var(--text-color);
    position: relative;
    padding-bottom: 5px;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease-in-out;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-color);
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    /* No specific margin-left needed here as nav-links margin-left: auto; handles the push */
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-theme .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle img {
    width: 24px; /* Ensure consistent icon size */
    height: 24px;
    vertical-align: middle; /* Align icon better */
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none; /* Ensure no underline */
}

.primary-btn {
    background-color: var(--primary-color);
    color: var(--button-text-color);
    border: 2px solid var(--primary-color);
}

.primary-btn:hover {
    background-color: var(--primary-hover-color);
    border-color: var(--primary-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.2);
}

.secondary-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: var(--button-text-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.1);
}

.small-btn {
    padding: 8px 18px;
    font-size: 0.9rem;
}

/* --- Sections --- */
.section {
    padding: 60px 0;
    margin-bottom: 40px;
    background-color: var(--background-color);
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

.section:last-of-type {
    margin-bottom: 0;
}

.section h1, .section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    position: relative;
}

.section h1::after, .section h2::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 4px;
    background-color: var(--primary-color);
    left: 50%;
    transform: translateX(-50%);
    bottom: -10px;
    border-radius: 2px;
}

.intro-text {
    text-align: center;
    max-width: 800px;
    margin: -2rem auto 3rem auto;
    font-size: 1.1rem;
    color: var(--secondary-color);
}


/* --- Hero Section --- */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
    text-align: center; /* Center content on small screens */
}

.hero-content {
    flex: 1;
    min-width: 300px; /* Ensure content doesn't get too squished */
    margin-right: 40px;
    text-align: left; /* Align text to left for larger screens */
}

.hero-section h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-align: left; /* Keep hero heading left-aligned */
}

.hero-section h1::after {
    display: none; /* No underline for hero heading */
}

.hero-content .tagline {
    font-size: 1.4rem;
    color: var(--secondary-color);
    margin-bottom: 2rem;
    text-align: left;
}

.highlight {
    color: var(--accent-color);
}

.hero-buttons {
    display: flex;
    gap: 15px;
    margin-top: 2rem;
    flex-wrap: wrap;
    justify-content: flex-start; /* Align buttons to the left */
}

.hero-image {
    flex: 1;
    min-width: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
}

.hero-image img:hover {
    transform: scale(1.03);
}

/* Adjust hero section for smaller screens */
@media (max-width: 768px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
    }

    .hero-content {
        margin-right: 0;
        margin-bottom: 40px;
        text-align: center;
    }

    .hero-section h1,
    .hero-content .tagline {
        text-align: center;
    }

    .hero-buttons {
        justify-content: center; /* Center buttons on small screens */
    }
}


/* --- Project Grid --- */
.project-grid, .blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 2rem;
}

.project-grid.large-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.project-card, .blog-card {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover, .blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

body.dark-theme .project-card:hover, body.dark-theme .blog-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.project-card h3, .blog-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.project-card .technologies, .blog-card .blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.project-card .technologies span {
    background-color: var(--border-color);
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.85rem;
    color: var(--text-color);
    white-space: nowrap; /* Prevent breaking on small screens */
}

.project-card .btn {
    margin-top: auto; /* Push button to bottom */
}

.center-btn {
    text-align: center;
    margin-top: 40px;
}

.project-image {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    height: 200px; /* Fixed height for consistency */
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area, crop if necessary */
    transition: transform 0.3s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}


/* --- About Section --- */
.about-content {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-bottom: 50px;
}

.about-text {
    flex: 2;
    min-width: 300px;
}

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.about-image {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 250px;
}

.about-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
}

.skills-section h2 {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 2rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 2rem;
}

.skill-category {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s ease;
}

.skill-category:hover {
    transform: translateY(-5px);
}

.skill-category h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.skill-category ul {
    list-style: none;
}

.skill-category li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
    color: var(--text-color);
}

.skill-category li:last-child {
    border-bottom: none;
}


/* --- Blog Section --- */
.blog-card {
    border-radius: 10px;
    overflow: hidden;
    padding: 0; /* Remove default card padding */
}

.blog-thumbnail {
    width: 100%;
    height: 200px; /* Fixed height for thumbnails */
    overflow: hidden;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-thumbnail img {
    transform: scale(1.05);
}

.blog-content {
    padding: 25px;
}

.blog-content h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.blog-content h3 a {
    color: var(--text-color);
}

.blog-content h3 a:hover {
    color: var(--primary-color);
}

.blog-meta {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.read-more {
    display: inline-block;
    margin-top: 15px;
    font-weight: 600;
    color: var(--primary-color);
    transition: transform 0.2s ease;
}

.read-more:hover {
    transform: translateX(5px);
    color: var(--primary-hover-color);
}

/* --- Contact Section --- */
.social-links-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px; /* Space between social links */
    margin-top: 3rem;
}

.social-link {
    background-color: var(--card-background);
    color: var(--text-color);
    text-decoration: none;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column; /* Stack icon and text */
    align-items: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
    min-width: 150px; /* Minimum width for each link card */
    max-width: 200px;
    text-align: center;
}

.social-link:hover {
    transform: translateY(-5px);
    background-color: var(--primary-color);
    color: var(--background-color); /* Text color changes on hover for better contrast */
}

.social-link i {
    font-size: 3rem; /* Size of the icon */
    margin-bottom: 15px;
    color: var(--primary-color); /* Icon color */
    transition: color 0.3s ease;
}

.social-link:hover i {
    color: var(--background-color); /* Icon color changes on hover */
}

.social-link span {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .social-links-container {
        flex-direction: column;
        align-items: center;
    }

    .social-link {
        width: 80%; /* Make cards take up more width on smaller screens */
        padding: 15px 20px;
    }

    .social-link i {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }

    .social-link span {
        font-size: 1rem;
    }
}

/* --- CTA Section --- */
.cta-section {
    text-align: center;
    background-color: var(--primary-color);
    color: var(--button-text-color);
    padding: 60px 0;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
}

.cta-section h2 {
    color: var(--button-text-color);
    margin-bottom: 1.5rem;
}

.cta-section h2::after {
    background-color: var(--button-text-color); /* Underline for CTA */
}

.cta-section p {
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-section .btn {
    background-color: var(--button-text-color);
    color: var(--primary-color);
    border: 2px solid var(--button-text-color);
}

.cta-section .btn:hover {
    background-color: var(--primary-hover-color);
    color: var(--button-text-color);
    border-color: var(--primary-hover-color);
    box-shadow: none; /* Remove extra shadow on hover */
}


/* --- Footer --- */
footer {
    background-color: var(--footer-background);
    color: var(--footer-text-color);
    padding: 30px 0;
    text-align: center;
    font-size: 0.95rem;
    margin-top: 60px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

footer p {
    margin: 0;
}

.social-links a {
    color: var(--footer-text-color);
    margin-left: 20px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-color);
}

@media (max-width: 600px) {
    footer .container {
        flex-direction: column;
        gap: 15px;
    }
    .social-links {
        margin-top: 10px;
    }
    .social-links a {
        margin: 0 10px;
    }
}


/* --- Responsive Design --- */
@media (max-width: 992px) {
    .nav-links {
        gap: 15px;
    }
    .project-grid.large-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    /* Hide nav links for small screens, consider a hamburger menu */
    /* .nav-links {
        display: none;
    } */
    /* For smaller screens, we will keep the logo, nav links, and theme toggle in one row.
       To achieve this, we make the nav-links take up less space and allow wrapping. */
    header .container {
        flex-wrap: wrap; /* Allow items to wrap to next line if space is tight */
        justify-content: center; /* Center items when wrapped */
        padding: 0.5rem 20px; /* Adjust padding for shorter bar on small screens */
        min-height: unset; /* Remove fixed min-height for more flexibility */
    }

    .logo {
        flex-basis: 100%; /* Take full width on small screens to center the logo */
        text-align: center;
        margin-bottom: 10px; /* Space between logo and nav/toggle */
    }

    .nav-links {
        margin-left: 0; /* Remove auto margin for small screens */
        margin-right: 0;
        justify-content: center; /* Center nav links */
        flex-basis: 100%; /* Take full width for nav links */
        gap: 10px; /* Reduce gap between nav items */
        margin-bottom: 10px; /* Space between nav and theme toggle */
    }

    .theme-toggle {
        order: 1; /* Keep the theme toggle on the same line as logo/nav or allow it to wrap as needed */
        margin-left: auto; /* Push to right if space allows, otherwise wraps */
        margin-right: 0; /* Remove existing right margin */
    }

    .logo a {
        font-size: 1.5rem;
    }
    .hero-section h1 {
        font-size: 2.5rem;
    }
    .hero-content .tagline {
        font-size: 1.2rem;
    }
    .hero-buttons {
        justify-content: center;
    }
    .section {
        padding: 40px 0;
    }
    .section h1, .section h2 {
        font-size: 2rem;
        margin-bottom: 2rem;
    }
    .about-content {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    .about-text {
        min-width: unset;
    }
    .about-image img {
        max-width: 80%;
    }
    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    .contact-methods {
        flex-direction: column;
        gap: 30px;
    }
    .contact-info, .contact-form-container {
        min-width: unset;
        padding: 30px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
    .hero-content .tagline {
        font-size: 1rem;
    }
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }
    .btn {
        width: 100%;
    }
    .project-grid, .blog-grid, .skills-grid {
        grid-template-columns: 1fr;
    }
    .project-card, .blog-card, .skill-category {
        padding: 20px;
    }
    .project-image, .blog-thumbnail {
        height: 180px;
    }
    .contact-info, .contact-form-container {
        padding: 20px;
    }

    /* Further refine header for very small screens */
    header .container {
        flex-direction: column; /* Stack logo, nav, and toggle */
        padding: 0.5rem 10px; /* More padding adjustment */
    }
    .logo {
        margin-bottom: 5px; /* Less space needed when stacked */
    }
    .nav-links {
        margin-bottom: 5px;
    }
    .theme-toggle {
        margin-left: 0; /* Remove auto margin when stacked vertically */
    }
}

/* --- Animations (Basic) --- */
.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);
}

/* Button hover animations are defined directly on the .btn classes */
