/* --- CSS Variables for easy theme changes --- */
:root {
    --primary-color: #3498db; /* A vibrant blue */
    --secondary-color: #2c3e50; /* Dark blue-grey */
    --accent-color: #e67e22; /* Warm orange */
    --text-dark: #333;
    --text-light: #ecf0f1;
    --background-light: #f9f9f9;
    --background-medium: #eef1f6;
    --border-color: #ddd;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.15);

    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Open Sans', sans-serif;

    --border-radius-soft: 8px;
    --transition-speed: 0.3s ease;
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--background-light);
    scroll-behavior: smooth;
    overflow-x: hidden; /* Prevent horizontal scroll on mobile */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--secondary-color);
    margin-bottom: 20px;
    font-weight: 700;
}

h2 {
    font-size: 2.8em;
    text-align: center;
    position: relative;
    padding-bottom: 15px;
    margin-top: 50px;
    margin-bottom: 60px;
}

h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

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

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

ul {
    list-style: none;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

section {
    padding: 60px 0;
    background-color: #ffffff;
    margin: 30px 0;
    border-radius: var(--border-radius-soft);
    box-shadow: 0 5px 20px var(--shadow-light);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

section:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

/* --- Hero Section (Header) --- */
.hero-section {
    background: #f3815a url('portfolio_bg.jpg') center center / cover no-repeat;
    position: relative;
    color: var(--text-light);
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    z-index: 1;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 62, 80, 0.7); /* Dark semi-transparent overlay */
    background-image: linear-gradient(to bottom, rgba(44, 62, 80, 0.8), rgba(52, 152, 219, 0.6)); /* Subtle gradient */
    z-index: -1; /* Behind content */
}

.hero-content {
    position: relative; /* Ensure content is above overlay */
    z-index: 2;
}

.hero-section h1 {
    font-size: 4.5rem;
    margin: 20px 0 10px;
    color: #fff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);
}

.hero-section .tagline {
    font-size: 1.8rem;
    margin-bottom: 40px;
    padding: 10px 20px;
    border: 2px solid var(--text-light);
    border-radius: 50px;
    display: inline-block;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.2); /* Slight background for readability */
}

/* --- Navigation --- */
nav {
    position: absolute;
    top: 25px;
    right: 25px;
    z-index: 1000;
}

nav ul {
    display: flex;
    gap: 25px;
}

nav a {
    color: var(--text-light);
    font-weight: 600;
    font-size: 1.05em;
    padding: 8px 15px;
    border-radius: 25px;
    transition: background-color var(--transition-speed), color var(--transition-speed), transform 0.2s;
}

nav a:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Hamburger Menu */
.hamburger {
    display: none; /* Hidden by default on desktop */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 25px;
    cursor: pointer;
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 1001; /* Above nav */
}

.hamburger .bar {
    width: 100%;
    height: 3px;
    background-color: var(--text-light);
    border-radius: 2px;
    transition: all var(--transition-speed);
}

.hamburger.open .bar:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.hamburger.open .bar:nth-child(2) {
    opacity: 0;
}

.hamburger.open .bar:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

/* --- Call to Action Buttons --- */
.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 15px 30px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1em;
    transition: background var(--transition-speed), transform 0.2s, box-shadow var(--transition-speed);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.cta-button:hover {
    background: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    color: #fff;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #6c7a89; /* A neutral grey */
    color: #fff;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95em;
    transition: background var(--transition-speed), transform 0.2s, box-shadow var(--transition-speed);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    margin-top: 15px;
}

.secondary-button:hover {
    background: #5a6572;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
}

/* --- About Section --- */
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-top: 40px;
}

#profile-picture {
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 50%;
    border: 6px solid var(--primary-color);
    box-shadow: 0 8px 20px var(--shadow-medium);
}

.about-text-content {
    font-size: 1.1em;
    line-height: 1.8;
    max-width: 850px;
    text-align: center;
    color: #555;
    background-color: var(--background-medium);
    padding: 30px;
    border-left: 6px solid var(--accent-color);
    border-radius: var(--border-radius-soft);
    box-shadow: 0 4px 15px var(--shadow-light);
}

.about-text-content p {
    margin-bottom: 15px;
}
.about-text-content p:last-child {
    margin-bottom: 0;
}
.about-text-content strong {
    color: var(--secondary-color);
}

/* --- Skills Section --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 40px;
    padding: 0 20px; /* Add some horizontal padding */
}

.skill-item {
    background-color: #ffffff;
    padding: 25px;
    border-radius: var(--border-radius-soft);
    box-shadow: 0 4px 15px var(--shadow-light);
    text-align: center;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.skill-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-medium);
}

.skill-item i {
    font-size: 3.5em;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.skill-item h3 {
    font-size: 1.4em;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.skill-item p {
    font-size: 0.95em;
    color: #666;
    line-height: 1.5;
}

/* --- Portfolio Section --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
    padding: 0 20px; /* Add some horizontal padding */
}

.project-card {
    background-color: #ffffff;
    border-radius: var(--border-radius-soft);
    box-shadow: 0 5px 20px var(--shadow-light);
    overflow: hidden;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px var(--shadow-medium);
}

.project-card img {
    width: 100%;
    height: 220px; /* Fixed height for consistency */
    object-fit: cover; /* Ensures images cover the area */
    display: block;
    border-bottom: 1px solid var(--border-color);
    transition: transform 0.4s ease;
}

.project-card:hover img {
    transform: scale(1.05);
}

.project-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allows it to expand */
}

.project-info h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.project-info p {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 15px;
    flex-grow: 1; /* Pushes link to bottom */
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1em;
}

.project-link:hover {
    color: var(--accent-color);
}

/* --- Services Section --- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 40px;
    padding: 0 20px; /* Add some horizontal padding */
}

.service-card {
    background-color: #ffffff;
    padding: 30px;
    border-radius: var(--border-radius-soft);
    box-shadow: 0 4px 15px var(--shadow-light);
    text-align: center;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-medium);
}

.service-card i {
    font-size: 3.8em;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.service-card h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.service-card p {
    font-size: 0.95em;
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
}

/* --- Testimonials Section --- */
.testimonial-carousel-wrapper {
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    margin: 40px auto 0;
    position: relative;
    box-sizing: border-box;
    border-radius: var(--border-radius-soft);
    box-shadow: 0 5px 20px var(--shadow-light);
    background-color: #ffffff;
}

.testimonial-carousel {
    display: flex;
    transition: transform 0.6s ease-in-out;
    width: 100%; /* Ensure track takes full width */
    flex-wrap: nowrap;
}

.testimonial-slide {
    flex: 0 0 100%;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Vertically center content */
    min-height: 400px; /* Ensure consistent height for slides */
}

.testimonial-slide img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 5px solid var(--primary-color);
    object-fit: cover;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.testimonial-slide blockquote {
    font-size: 1.3em;
    font-style: italic;
    color: var(--secondary-color);
    margin-bottom: 15px;
    max-width: 600px;
    line-height: 1.6;
    quotes: "“" "”" "‘" "’";
}
.testimonial-slide blockquote::before {
    content: open-quote;
    font-size: 1.5em;
    color: var(--accent-color);
    margin-right: 5px;
}
.testimonial-slide blockquote::after {
    content: close-quote;
    font-size: 1.5em;
    color: var(--accent-color);
    margin-left: 5px;
}


.testimonial-slide .client-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1em;
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(44, 62, 80, 0.7); /* Using RGB values for transparency */
    color: white;
    border: none;
    padding: 12px 18px;
    cursor: pointer;
    border-radius: var(--border-radius-soft);
    z-index: 1001;
    font-size: 1.3em;
    transition: background-color var(--transition-speed), transform 0.2s;
    backdrop-filter: blur(5px); /* Modern blur effect */
}

.carousel-button:hover {
    background-color: var(--primary-color);
    transform: translateY(-50%) scale(1.05);
}

.carousel-button.left {
    left: 15px;
}

.carousel-button.right {
    right: 15px;
}

/* --- Certifications Section --- */
#certifications .section-content {
    text-align: center;
    padding: 0 20px;
}

#certifications p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Resume Section --- */
#resume {
    text-align: center;
    padding: 60px 20px;
}

#resume p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    margin-bottom: 30px;
}

.download-button {
    background-color: #28a745; /* Green for download */
}

.download-button:hover {
    background-color: #218838; /* Darker green */
}

/* --- Contact Section --- */
.contact-intro {
    font-size: 1.1em;
    color: #555;
    text-align: center;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-form {
    display: flex;
    flex-direction: column;
    max-width: 600px;
    margin: 0 auto 30px auto;
    background-color: var(--background-medium);
    padding: 35px;
    border-radius: var(--border-radius-soft);
    box-shadow: 0 4px 15px var(--shadow-light);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.95em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: var(--font-body);
    font-size: 1em;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

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

.send-message-btn {
    align-self: center; /* Center the button within the form */
    margin-top: 15px;
}

.contact-info-list {
    text-align: center;
    margin-top: 40px;
}

.contact-info-list p {
    font-size: 1.1em;
    margin-bottom: 10px;
    color: #555;
}

.contact-info-list a {
    color: var(--primary-color);
    font-weight: 600;
}

.contact-info-list i {
    margin-right: 10px;
    color: var(--accent-color);
}


/* --- Footer --- */
footer {
    text-align: center;
    padding: 30px 20px;
    background: var(--secondary-color);
    color: var(--text-light);
    font-size: 0.95em;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
}

footer p {
    margin-bottom: 15px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 25px;
}

.social-links a {
    color: var(--text-light);
    font-size: 1.8em;
    transition: color var(--transition-speed), transform 0.2s;
}

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

/* --- Scroll to Top Button --- */
#scrollToTopBtn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: background-color var(--transition-speed), transform 0.2s, opacity var(--transition-speed);
    z-index: 999;
    opacity: 0; /* Hidden by default */
    pointer-events: none; /* Disable interaction when hidden */
}

#scrollToTopBtn:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px) scale(1.05);
}

#scrollToTopBtn.show {
    opacity: 1;
    pointer-events: auto;
}

/* --- Fade In Section Animation --- */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
    .hero-section h1 {
        font-size: 3.5rem;
    }
    .hero-section .tagline {
        font-size: 1.5rem;
    }
    h2 {
        font-size: 2.2em;
    }
    .projects-grid, .services-grid, .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 768px) {
    /* Mobile nav (hamburger) styles */
    nav {
        display: flex; /* Ensure flex for column layout when open */
        flex-direction: column;
        width: 70%;
        max-width: 250px;
        background-color: rgba(44, 62, 80, 0.95);
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        padding-top: 80px;
        transform: translateX(100%); /* Start hidden off-screen */
        transition: transform 0.4s ease-out;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    }

    nav.nav-open {
        transform: translateX(0); /* Slide in when open */
    }

    /* Important: Hide nav on mobile if not open, without relying on JS `display: none` */
    /* This ensures it's not interactive or visible before it slides in */
    nav:not(.nav-open) {
        pointer-events: none;
    }


    nav ul {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }

    nav li {
        width: 100%;
        margin-bottom: 15px;
    }

    nav a {
        display: block;
        width: 100%;
        padding: 12px 20px;
        font-size: 1.1em;
        text-align: left;
        background-color: transparent;
        border-radius: 5px;
    }
    nav a:hover {
        background-color: var(--primary-color);
        transform: none;
    }

    .hamburger {
        display: flex; /* Show hamburger on mobile */
    }

    .hero-section {
        padding-top: 80px;
    }
    .hero-section h1 {
        font-size: 2.8rem;
    }
    .hero-section .tagline {
        font-size: 1.3rem;
        padding: 8px 15px;
    }
    .cta-button {
        padding: 12px 25px;
        font-size: 1em;
    }
    .profile-card {
        flex-direction: column;
    }
    .about-text-content {
        padding: 25px;
    }
    .testimonial-slide {
        padding: 20px;
        min-height: 350px;
    }
    .testimonial-slide img {
        width: 100px;
        height: 100px;
    }
    .testimonial-slide blockquote {
        font-size: 1.1em;
    }
    .carousel-button {
        padding: 10px 15px;
        font-size: 1.1em;
    }
    .contact-form {
        padding: 25px;
    }

    /* Fallback for fade-in sections on mobile */
    /* This ensures content is visible immediately, even if JS doesn't kick in */
    .fade-in-section {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 2.2rem;
    }
    .hero-section .tagline {
        font-size: 1.1rem;
        padding: 6px 12px;
    }
    h2 {
        font-size: 1.8em;
        margin-bottom: 40px;
    }
    section {
        padding: 40px 0;
        margin: 20px 0;
    }
    .profile-card {
        gap: 20px;
    }
    #profile-picture {
        width: 180px;
        height: 180px;
    }
    .about-text-content {
        font-size: 1em;
        padding: 20px;
    }
    .skills-grid, .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 15px;
    }
    /* ** Refined Fix for Portfolio Grid on small screens ** */
    .projects-grid {
        display: grid; /* Explicitly ensure grid display */
        grid-template-columns: minmax(0, 1fr); /* Allow columns to shrink to 0 if needed, but grow to 1fr */
        gap: 20px;
        padding: 0 15px;
    }

    .project-card {
        min-width: 0; /* Allow card to shrink if necessary */
        width: 100%; /* Ensure card takes full available width */
    }

    .project-card img {
        height: 180px; /* Adjust image height for smaller screens */
    }

    .skill-item, .project-card, .service-card {
        padding: 20px;
    }
    .skill-item i {
        font-size: 3em;
    }
    .service-card i {
        font-size: 3.2em;
    }
    .testimonial-slide {
        min-height: 300px;
    }
    .testimonial-slide img {
        width: 80px;
        height: 80px;
    }
    .testimonial-slide blockquote {
        font-size: 1em;
    }
    .carousel-button {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    .contact-form {
        padding: 20px;
    }
    .form-group label {
        font-size: 0.9em;
    }
    .form-group input, .form-group textarea {
        padding: 10px 12px;
        font-size: 0.9em;
    }
    .contact-info-list p {
        font-size: 1em;
    }
    footer {
        padding: 20px 15px;
    }
    .social-links {
        gap: 20px;
    }
    .social-links a {
        font-size: 1.5em;
    }
    #scrollToTopBtn {
        bottom: 20px;
        right: 20px;
        padding: 12px;
        font-size: 1em;
    }
}
