/* Variables for easier theme switching */
:root {
    --bg-color: #0d1117;
    --container-bg: #161b22;
    --text-color: #c9d1d9;
    --heading-color: #58a6ff;
    --border-color: #21262d;
    --link-color: #58a6ff;
    --blockquote-bg: #1a1f26;
    --sticky-bg: #161b22;
    --dark-mode-toggle-bg: #30363d;
    --dark-mode-toggle-icon: #c9d1d9;
    --active-nav-link: #e6edf3;
    --hover-bg: #30363d;
    --card-bg: #21262d;
    --card-border: #30363d;
}

/* Light Mode specific variables */
body.light-mode {
    --bg-color: #f0f2f5;
    --container-bg: #ffffff;
    --text-color: #333333;
    --heading-color: #007bff;
    --border-color: #cccccc;
    --link-color: #007bff;
    --blockquote-bg: #e9ecef;
    --sticky-bg: #ffffff;
    --dark-mode-toggle-bg: #e0e0e0;
    --dark-mode-toggle-icon: #333333;
    --active-nav-link: #000000;
    --hover-bg: #f8f9fa;
    --card-bg: #f8f9fa;
    --card-border: #e0e0e0;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: background-color 0.3s, box-shadow 0.3s;
}

/* Header Section Styling */
.main-header-section {
    background-color: var(--container-bg);
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    border-radius: 0 0 8px 8px; /* Rounded bottom corners */
}
.header-top-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}
.profile-title {
    display: flex;
    align-items: center;
}
.welcome-icon {
    vertical-align: middle;
    margin-right: 15px;
    height: 150px; /* Adjust size */
}
.main-header-section h1 {
    font-size: 2.5em;
    color: var(--heading-color);
    border-bottom: none;
    padding-bottom: 0;
    margin: 0;
    display: inline; /* To keep it next to icon */
}
.header-gif {
    height: 80px; /* Adjust size */
    object-fit: cover; /* Ensure image covers area */
}

/* Typewriter Effect */
.typewriter-text {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.3em;
    color: var(--text-color);
    white-space: nowrap; /* Ensures the text stays on one line */
    overflow: hidden; /* Ensures the text is hidden until typed */
    border-right: 3px solid var(--heading-color); /* The typewriter cursor */
    animation: typing 4s steps(40, end), blink-caret .75s step-end infinite;
    max-width: 100%; /* Ensure it fits on smaller screens */
    margin-bottom: 1.5em;
}

/* The typing animation */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

/* The typewriter cursor effect */
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--heading-color); }
}


/* Sticky Navigation Bar */
#main-nav {
    background-color: var(--sticky-bg);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s;
}
.nav-content {
    display: flex;
    justify-content: center; /* Center the links */
    align-items: center;
    padding: 10px 20px;
    flex-wrap: wrap; /* Allow wrapping for mobile */
}
.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}
.nav-links li {
    margin: 0 15px;
}
.nav-links a {
    color: var(--text-color);
    padding: 8px 12px;
    display: block;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
    font-weight: 600;
}
.nav-links a:hover,
.nav-links a.active {
    background-color: var(--hover-bg);
    color: var(--active-nav-link);
    text-decoration: none;
}

/* Hamburger Menu for Mobile */
.hamburger {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.8em;
    cursor: pointer;
    margin-right: 15px;
}
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }
    .nav-links {
        display: none; /* Hide nav links by default on mobile */
        flex-direction: column;
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }
    .nav-links.active {
        display: flex; /* Show when active */
    }
    .nav-links li {
        margin: 5px 0;
    }
    .nav-content {
        justify-content: space-between; /* Hamburger on left, possibly logo on right */
    }
    /* Adjust main header content for smaller screens */
    .header-top-content {
        flex-direction: column;
        text-align: center;
    }
    .profile-title {
        flex-direction: column;
        margin-bottom: 10px;
    }
    .welcome-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }
    .header-gif {
        order: -1; /* Move GIF to top on mobile */
        margin-bottom: 15px;
    }
    .typewriter-text {
        font-size: 1em; /* Smaller text on mobile */
    }
}


/* General Section Styling */
.profile-section {
    padding: 40px 0; /* More vertical padding for sections */
}
.section-heading {
    color: var(--heading-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5em;
    margin-bottom: 1em;
    font-size: 2em;
    display: flex; /* For icon alignment */
    align-items: center;
}
.section-heading i {
    margin-right: 10px;
    color: var(--link-color); /* Icon color */
}
/* Ensure sticky headers are functional */
h2.section-heading, h3.section-heading {
    position: sticky;
    top: 60px; /* Adjust based on nav height + a little buffer */
    background-color: var(--container-bg);
    z-index: 999;
    padding-top: 15px;
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
}


/* About Me Grid */
.about-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 15px;
}
@media (min-width: 600px) {
    .about-grid {
        grid-template-columns: repeat(2, 1fr); /* Two columns on larger screens */
    }
}

/* Technologies Grid */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.tech-category {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease-in-out;
}
.tech-category:hover {
    transform: translateY(-5px);
}
.tech-category h3 {
    color: var(--link-color);
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
.tech-category ul {
    padding-left: 0; /* Remove default list padding */
}
.tech-category ul li {
    padding: 5px 0;
    display: flex;
    align-items: center;
}
.tech-category ul li:before {
    content: "\2022"; /* Unicode bullet for list */
    color: var(--heading-color);
    margin-right: 8px;
    font-size: 1.2em;
}

/* What I Do Grid */
.what-i-do-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}
.activity-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease-in-out;
}
.activity-card:hover {
    transform: translateY(-5px);
}
.activity-card i {
    font-size: 3em;
    color: var(--heading-color);
    margin-bottom: 10px;
}
.activity-card h4 {
    color: var(--link-color);
    margin-top: 0;
    font-size: 1.2em;
}
.activity-card p {
    font-size: 0.9em;
}

/* GitHub Stats */
.github-stats-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}
.github-stats-container .image-container {
    flex: 1 1 auto; /* Allow flexible sizing */
    min-width: 300px; /* Minimum width before wrapping */
    margin: 0; /* Override default margin */
}
.github-stats-container img {
    width: 100%; /* Make images fill their container */
    max-width: 450px; /* Max size for each image */
    height: auto;
}

/* Connect With Me Grid */
.contact-links-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 20px;
}
@media (min-width: 600px) {
    .contact-links-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Two columns on larger screens */
    }
}
.contact-item {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease-in-out;
}
.contact-item:hover {
    transform: translateY(-5px);
}
.contact-item .contact-link {
    font-weight: 600;
    color: var(--link-color);
    font-size: 1.1em;
    margin-bottom: 10px;
}
.contact-item .contact-link img {
    vertical-align: middle;
    margin-right: 10px;
}
.contact-item .contact-link span {
    vertical-align: middle;
}
.contact-item p.contact-slogan {
    font-size: 0.9em;
    margin-top: 10px;
    color: var(--text-color);
}

/* Email Copy Button */
.copy-button {
    background-color: var(--link-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    margin-top: 10px;
    transition: background-color 0.2s;
}
.copy-button:hover {
    background-color: #0056b3; /* Darker blue on hover */
}
.copy-message {
    display: none;
    margin-top: 10px;
    color: green;
    font-size: 0.9em;
}

/* Scroll to Top Button */
#scrollToTopBtn {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    font-size: 18px;
    border: none;
    outline: none;
    background-color: var(--heading-color);
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s;
}
#scrollToTopBtn:hover {
    background-color: #0056b3;
}

/* Dark/Light Mode Toggle */
.mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001; /* Above everything else */
    background-color: var(--dark-mode-toggle-bg);
    color: var(--dark-mode-toggle-icon);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s, color 0.3s;
    font-size: 1.2em;
}
.mode-toggle .fa-sun,
.mode-toggle .fa-moon {
    display: none; /* Hide both by default, show one with JS */
}
body.light-mode .mode-toggle .fa-sun {
    display: block;
}
body:not(.light-mode) .mode-toggle .fa-moon {
    display: block;
}

/* General Link and HR Styles */
hr {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 2em 0;
}
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    text-decoration: underline;
    color: var(--active-nav-link);
}
blockquote {
    background-color: var(--blockquote-bg);
    border-left: 5px solid var(--heading-color);
    margin: 20px 0;
    padding: 15px 20px;
    border-radius: 5px;
    font-style: italic;
    font-size: 0.95em;
}