/* Global Variables & Base Styles */
:root {
    --font-primary: 'Roboto', sans-serif;
    --font-secondary: 'Montserrat', sans-serif;

    /* Light Theme */
    --bg-color-light: #f4f7f6;
    --text-color-light: #2c3e50; /* Darker text for better contrast */
    --primary-color-light: #3498db; /* Brighter blue */
    --secondary-color-light: #95a5a6;
    --card-bg-light: #ffffff;
    --nav-bg-light: rgba(255, 255, 255, 0.9);
    --progress-bar-bg-light: #ecf0f1;
    --button-hover-bg-light: #2980b9;
    --shadow-color-light: rgba(0, 0, 0, 0.1);

    /* Dark Theme */
    --bg-color-dark: #1c1c1e; /* Slightly lighter dark */
    --text-color-dark: #e1e1e6;
    --primary-color-dark: #58a6ff; /* GitHub's blue */
    --secondary-color-dark: #8b949e;
    --card-bg-dark: #2a2a2e;
    --nav-bg-dark: rgba(30, 30, 30, 0.9);
    --progress-bar-bg-dark: #3a3a3c;
    --button-hover-bg-dark: #4a93e6;
    --shadow-color-dark: rgba(0, 0, 0, 0.3);

    /* Default to dark theme variables */
    --bg-color: var(--bg-color-dark);
    --text-color: var(--text-color-dark);
    --primary-color: var(--primary-color-dark);
    --secondary-color: var(--secondary-color-dark);
    --card-bg: var(--card-bg-dark);
    --nav-bg: var(--nav-bg-dark);
    --progress-bar-bg: var(--progress-bar-bg-dark);
    --button-hover-bg: var(--button-hover-bg-dark);
    --shadow-color: var(--shadow-color-dark);

    --border-radius: 10px; /* Slightly larger radius */
    --box-shadow: 0 6px 20px var(--shadow-color);
    --transition-speed: 0.3s ease;
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

body {
    font-family: var(--font-primary);
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

body.light-theme {
    --bg-color: var(--bg-color-light);
    --text-color: var(--text-color-light);
    --primary-color: var(--primary-color-light);
    --secondary-color: var(--secondary-color-light);
    --card-bg: var(--card-bg-light);
    --nav-bg: var(--nav-bg-light);
    --progress-bar-bg: var(--progress-bar-bg-light);
    --button-hover-bg: var(--button-hover-bg-light);
    --shadow-color: var(--shadow-color-light);
}

/* Theme Toggle Button */
#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1002; /* Above modals */
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: background-color var(--transition-speed), color var(--transition-speed), transform 0.2s ease;
}
#theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background-color: var(--primary-color);
    color: var(--card-bg);
}

/* Video Background */
#bg-video {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    z-index: -2;
    object-fit: cover;
}
.video-overlay {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    z-index: -1;
    background-color: rgba(0, 0, 0, 0.65);
}
body.light-theme .video-overlay {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Navigation Bar */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    padding: 1rem 0;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 3px 12px var(--shadow-color);
}
nav ul { list-style: none; padding: 0; margin: 0; }
nav ul li { display: inline; margin: 0 18px; }
nav ul li a {
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-secondary);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 8px 0;
    position: relative;
    transition: color var(--transition-speed);
}
nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    transition: width 0.3s var(--transition-bounce);
}
nav ul li a:hover::after,
nav ul li a.active::after {
    width: 100%;
}
nav ul li a:hover,
nav ul li a.active {
    color: var(--primary-color);
}

/* Hero Section */
.heading { /* This is the #home section now */
    min-height: 100vh; /* Full viewport height */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    padding: 0 20px;
    position: relative; /* For GSAP animations relative to this */
}
.hero-content {
    /* GSAP will handle initial position */
}
#animated-heading-line1, #animated-heading-line2 {
    font-family: var(--font-secondary);
    font-size: clamp(2.5rem, 6vw, 4.5rem); /* Responsive font size */
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
    line-height: 1.2;
    /* GSAP will handle opacity and transform */
}
#animated-heading-line2 {
    color: var(--primary-color-dark); /* Can adjust for light theme via JS if needed */
}
body.light-theme #animated-heading-line2 {
    color: var(--primary-color-light);
}

#typing-text-container {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 400;
    margin-top: 1.5rem;
    color: #f0f0f0;
    /* GSAP will handle opacity and transform */
}
#typing-target::after {
    content: '|';
    animation: blink 0.7s infinite;
    color: var(--primary-color-dark);
}
body.light-theme #typing-target::after {
    color: var(--primary-color-light);
}
@keyframes blink { 50% { opacity: 0; } }

/* Header Section (Profile) */
.profile-header {
    text-align: center;
    padding: 60px 20px 40px;
    background-color: var(--card-bg);
    margin: -80px auto 40px auto; /* Negative margin to overlap hero slightly */
    max-width: 900px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative; /* Ensure it's above video overlay */
    z-index: 10;
}
.profile-img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 6px solid var(--primary-color);
    object-fit: cover;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 25px var(--shadow-color);
    transition: transform 0.4s var(--transition-bounce);
}
.profile-img:hover {
    transform: scale(1.05);
}
.profile-name { /* Changed from h1 to h2 */
    font-family: var(--font-secondary);
    margin: 0.5rem 0;
    font-size: 2.2rem;
    color: var(--primary-color);
}
.profile-title {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}
.social-links a {
    color: var(--secondary-color);
    font-size: 1.9rem;
    margin: 0 15px;
    transition: color var(--transition-speed), transform var(--transition-speed);
}
.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px) scale(1.1);
}

/* General Container & Sections */
.container {
    max-width: 1100px; /* Wider container */
    margin: 0 auto;
    padding: 20px;
}
section:not(.heading) { /* Exclude hero from this styling */
    padding: 70px 30px;
    margin-bottom: 40px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    /* GSAP will handle scroll animations */
}
.section-title {
    font-family: var(--font-secondary);
    text-align: center;
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 50px;
    position: relative;
}
.section-title::after {
    content: '';
    display: block;
    width: 70px;
    height: 4px;
    background-color: var(--primary-color);
    margin: 10px auto 0;
    border-radius: 2px;
}

/* About Section */
#about p {
    text-align: center;
    font-size: 1.15rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Skills Section */
.skills-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 35px;
}
.skill {
    background-color: var(--bg-color);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: transform 0.3s var(--transition-bounce), box-shadow var(--transition-speed);
    border: 1px solid transparent; /* For hover effect */
}
.skill:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px var(--shadow-color);
    border-color: var(--primary-color);
}
.skill-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    font-size: 1.3rem;
    font-weight: 500;
}
.skill-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-right: 12px;
}
.progress-bar-container {
    background-color: var(--progress-bar-bg);
    border-radius: var(--border-radius);
    height: 14px;
    margin-bottom: 10px;
    overflow: hidden;
}
.progress-bar {
    background-color: var(--primary-color);
    height: 100%;
    width: 0; /* GSAP animates this */
    border-radius: var(--border-radius);
}
.progress-percent {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--secondary-color);
}

/* Projects Section */
.projects-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}
.project-card {
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    display: flex;
    flex-direction: column;
    cursor: pointer; /* Indicates clickable for modal */
    padding: 20px;
}
.project-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 12px 30px var(--shadow-color);
}
.project-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: calc(var(--border-radius) - 10px); /* Inner radius */
    margin-bottom: 15px;
}
.project-card h3 {
    font-family: var(--font-secondary);
    color: var(--primary-color);
    margin: 0 0 10px;
    font-size: 1.5rem;
}
.project-short-desc {
    font-size: 0.95rem;
    margin-bottom: 15px;
    flex-grow: 1;
    color: var(--secondary-color);
}
.project-tags {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.project-tags span {
    background-color: var(--primary-color);
    color: var(--bg-color);
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 500;
}
.project-details-btn {
    background-color: var(--primary-color);
    color: var(--bg-color);
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition-speed);
    align-self: flex-start; /* Align button to the start if card uses flex */
}
.project-details-btn:hover {
    background-color: var(--button-hover-bg);
}


/* CV Download Section */
.cv-section p { text-align: center; margin-bottom: 30px; font-size: 1.05rem; }
.cv-buttons { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.cv-button {
    color: #fff !important; /* Ensure white text on colored buttons */
    padding: 14px 28px;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: background-color var(--transition-speed), transform var(--transition-speed);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.cv-button:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
    border-bottom: none;
}
.cv-button.pdf { background-color: #e74c3c; } /* Red */
.cv-button.doc { background-color: #3498db; } /* Blue */
.cv-button.html { background-color: #2ecc71; } /* Green */
.cv-button.pdf:hover { background-color: #c0392b; }
.cv-button.doc:hover { background-color: #2980b9; }
.cv-button.html:hover { background-color: #27ae60; }

/* Contact Section */
.contact-container { display: flex; flex-wrap: wrap; gap: 40px; }
.contact-info, .contact-form { flex: 1; min-width: 300px; }
.contact-info p { margin-bottom: 20px; }
.contact-info ul { list-style: none; padding: 0; }
.contact-info ul li { margin-bottom: 18px; display: flex; align-items: center; }
.contact-info ul li i {
    color: var(--primary-color);
    margin-right: 15px;
    font-size: 1.3rem;
    width: 25px; text-align: center;
}
.contact-info ul li a { color: var(--text-color); text-decoration: none; }
.contact-info ul li a:hover { color: var(--primary-color); text-decoration: underline; }

.contact-form input, .contact-form textarea {
    width: calc(100% - 26px);
    padding: 14px;
    margin-bottom: 18px;
    border: 1px solid var(--secondary-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-primary);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
.contact-form input:focus, .contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-color);
}
.send-button {
  background-color: #4da6ff; /* Light blue */
  color: #fff;
  padding: 14px 30px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s, transform 0.3s;
}

.send-button:hover {
  background-color: #1e90ff; /* Darker blue */
  transform: translateY(-2px);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    background-color: var(--card-bg);
    margin-top: 50px;
    font-size: 0.9rem;
    border-top: 1px solid var(--progress-bar-bg);
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: var(--primary-color);
    color: var(--bg-color);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: var(--box-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
    transition: opacity var(--transition-speed), visibility var(--transition-speed), transform var(--transition-speed);
}
#back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
#back-to-top:hover { background-color: var(--button-hover-bg); transform: scale(1.1); }

/* Project Modals Styling */
.modal {
    position: fixed;
    z-index: 1001; /* Above nav, below theme toggle */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7); /* Darker overlay */
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.modal.active {
    display: flex; /* Use flex for centering */
    opacity: 1;
}
.modal-content {
    background-color: var(--card-bg);
    margin: auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 700px;
    box-shadow: 0 10px 30px var(--shadow-color-dark); /* Stronger shadow for modal */
    position: relative;
    transform: scale(0.9);
    transition: transform 0.4s var(--transition-bounce);
}
.modal.active .modal-content {
    transform: scale(1);
}
.modal-close-btn {
    color: var(--secondary-color);
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color var(--transition-speed);
}
.modal-close-btn:hover, .modal-close-btn:focus {
    color: var(--primary-color);
    text-decoration: none;
}
.modal-img {
    width: 100%;
    max-height: 350px;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}
.modal-content h2 {
    font-family: var(--font-secondary);
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 2rem;
}
.modal-tags {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.modal-tags span {
    background-color: var(--primary-color);
    color: var(--bg-color);
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.9rem;
}
.modal-content p {
    font-size: 1.05rem;
    margin-bottom: 20px;
    line-height: 1.8;
}
.modal-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}
.modal-link {
    background-color: var(--primary-color);
    color: var(--bg-color) !important;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color var(--transition-speed), transform var(--transition-speed);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.modal-link:hover {
    background-color: var(--button-hover-bg);
    transform: translateY(-2px);
    border-bottom: none;
}
.modal-link.github {
    background-color: var(--secondary-color);
}
.modal-link.github:hover {
    background-color: var(--text-color);
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    nav ul li { margin: 0 10px; }
    nav ul li a { font-size: 0.95rem; }
    .section-title { font-size: 1.9rem; }
    .cv-buttons { flex-direction: column; align-items: center; }
    .cv-button { width: 70%; justify-content: center; }
    .contact-container { flex-direction: column; }
    .profile-header { margin-top: -60px; }
    .modal-content { width: 95%; padding: 20px; }
    .modal-content h2 { font-size: 1.6rem; }
}

@media (max-width: 480px) {
    #theme-toggle, #back-to-top { width: 40px; height: 40px; font-size: 1rem; }
    .profile-name { font-size: 1.8rem; }
    .profile-title { font-size: 1rem; }
    .skill-header { flex-direction: column; gap: 5px; }
    .skill-icon { margin-right: 0; }
    .modal-links { flex-direction: column; }
}