/* --- CSS Variables for Theming --- */
:root {
    /* Dark Mode (Default) */
    --primary-color: #00bfa5;
    --primary-hover: #00a794;
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --surface-color-2: #2a2a2a;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --heading-color: #ffffff;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --font-family: 'Poppins', sans-serif;
}

html.light-mode {
    /* Light Mode */
    --primary-color: #00897b;
    --primary-hover: #00695c;
    --bg-color: #f5f5f5;
    --surface-color: #ffffff;
    --surface-color-2: #f0f0f0;
    --text-color: #333333;
    --text-muted: #666666;
    --heading-color: #111111;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
}


/* --- Global Styles --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-padding {
    padding: 100px 0;
}

.section-title {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 60px;
    color: var(--primary-color);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* --- Header & Navigation --- */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

header.scrolled {
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px var(--shadow-color);
}

html.light-mode header.scrolled {
    background: rgba(255, 255, 255, 0.8);
}


header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 75px;
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--heading-color);
    text-decoration: none;
    transition: color 0.3s;
}

nav ul {
    list-style: none;
    display: flex;
}

nav ul li {
    margin-left: 35px;
}

nav ul li a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

nav ul li a:hover::after {
    width: 100%;
}

nav ul li a:hover {
    color: var(--primary-color);
}

/* --- Hero Section --- */
#hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    background: linear-gradient(-45deg, #121212, #1a237e, #004d40, #121212);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: #fff;
}

html.light-mode #hero {
    background: linear-gradient(-45deg, #e0f2f1, #e3f2fd, #f1f8e9, #e0f2f1);
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    color: var(--heading-color);
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.hero-content h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 10px;
}

.hero-content .subtitle {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 300;
    margin-bottom: 25px;
}

html.light-mode .hero-content .subtitle {
    color: var(--text-muted);
}

.dynamic-text {
    font-weight: 600;
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
    animation: blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: var(--primary-color);
    }
}

.hero-content .description {
    max-width: 600px;
    margin: 0 auto 35px;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 14px 32px;
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 191, 165, 0.2);
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 191, 165, 0.4);
}

html.light-mode .btn {
    color: #fff;
}

.btn-outline {
    display: inline-block;
    padding: 12px 28px;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-3px);
}

.btn-outline i,
.btn i {
    margin-right: 8px;
}

/* --- About Section --- */
.about-content {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 60px;
    align-items: center;
}

.skills h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--heading-color);
    border-left: 4px solid var(--primary-color);
    padding-left: 15px;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.skill-item {
    background: var(--surface-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.3s, background 0.3s;
    border: 1px solid var(--border-color);
}

.skill-item:hover {
    transform: translateY(-5px);
    background: var(--primary-color);
    color: #fff;
}

.skill-item i {
    color: var(--primary-color);
    font-size: 1.5rem;
    transition: color 0.3s;
}

.skill-item:hover i {
    color: #fff;
}

/* --- Projects Section --- */
#projects {
    background-color: var(--surface-color-2);
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 50px;
}

.project-card {
    background: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    box-shadow: 0 4px 25px var(--shadow-color);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-color);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px var(--shadow-color);
}

/* Alternate project card layout */
.project-card:nth-child(even) {
    grid-template-columns: 1fr 1fr;
}

.project-card:nth-child(even) .project-image-wrapper {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.project-card:nth-child(even) .project-info {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}


.project-image-wrapper {
    overflow: hidden;
    height: 100%;
}

.project-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

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

.project-info {
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.project-info h3 {
    font-size: 1.6rem;
    margin-bottom: 15px;
    color: var(--heading-color);
}

.project-info p {
    color: var(--text-muted);
    margin-bottom: 25px;
    flex-grow: 1;
}

.project-tech {
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.project-tech span {
    background: var(--bg-color);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.project-links a {
    margin-right: 10px;
}


/* --- Contact Section --- */
#contact {
    text-align: center;
}

.contact-text {
    max-width: 550px;
    margin: 0 auto 40px;
    font-size: 1.2rem;
}

.contact-links a {
    margin: 10px;
}

/* --- Footer --- */
footer {
    background-color: var(--surface-color);
    text-align: center;
    padding: 25px 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* --- Theme Toggle Button --- */
#theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--surface-color-2);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

#theme-toggle:hover {
    transform: scale(1.1);
    background: var(--primary-color);
    color: #fff;
}

#theme-toggle .fa-sun {
    display: none;
}

#theme-toggle .fa-moon {
    display: block;
}

html.light-mode #theme-toggle .fa-sun {
    display: block;
}

html.light-mode #theme-toggle .fa-moon {
    display: none;
}


/* --- Scroll Animations --- */
.section-title,
.about-content,
.project-card,
.contact-text,
.contact-links {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .project-card,
    .project-card:nth-child(even) {
        grid-template-columns: 1fr;
    }

    .project-card:nth-child(even) .project-image-wrapper {
        grid-column: auto;
        grid-row: auto;
    }

    .project-card:nth-child(even) .project-info {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 768px) {
    .section-padding {
        padding: 80px 0;
    }

    nav ul {
        display: none;
        /* Simplification for small screens */
    }

    .project-info {
        padding: 30px;
    }
}