/* =========================================
   1. CSS Variables & Theme Setup - Modernized
========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    /* Modern Palette - Light */
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-light: #818cf8;
    /* Indigo 400 */
    --primary-dark: #3730a3;
    /* Indigo 800 */
    --secondary-color: #ec4899;
    /* Pink 500 */
    --accent-color: #06b6d4;
    /* Cyan 500 */

    --text-color: #1e293b;
    /* Slate 900 */
    --text-light: #64748b;
    /* Slate 500 */

    --bg-color: #f8fafc;
    /* Slate 50 */
    --bg-gradient: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);

    --card-bg: rgba(255, 255, 255, 0.7);
    --nav-bg: rgba(255, 255, 255, 0.6);

    --glass-border: 1px solid rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);

    --gradient-text: linear-gradient(to right, #4f46e5, #ec4899);

    --border-radius: 16px;
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
    /* Modern Palette - Dark */
    --primary-color: #818cf8;
    /* Indigo 400 */
    --primary-light: #a5b4fc;
    /* Indigo 300 */
    --primary-dark: #4f46e5;
    /* Indigo 600 */
    --secondary-color: #f472b6;
    /* Pink 400 */
    --accent-color: #22d3ee;
    /* Cyan 400 */

    --text-color: #f8fafc;
    /* Slate 50 */
    --text-light: #cbd5e1;
    /* Slate 300 */

    --bg-color: #0f172a;
    /* Slate 900 */
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1e24 100%);

    --card-bg: rgba(30, 41, 59, 0.6);
    --nav-bg: rgba(15, 23, 42, 0.6);

    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    --gradient-text: linear-gradient(to right, #818cf8, #f472b6);
}

/* =========================================
   2. Reset & Base Styles - Enhanced
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.7;
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-color);
    line-height: 1.2;
}

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

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
    border-radius: var(--border-radius);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* =========================================
   3. Utility Classes - Modernized
========================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 100px 0;
    position: relative;
    z-index: 1;
}

.section-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 70px;
    position: relative;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 6px;
    background: var(--gradient-text);
    border-radius: 4px;
}

.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 10px 20px -10px var(--primary-color);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 30px -10px var(--primary-color);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 10px 20px -10px var(--primary-color);
    transform: translateY(-3px);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* Glassmorphism Card Utility */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--border-radius);
    padding: 30px;
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px 0 rgba(31, 38, 135, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* =========================================
   4. Navbar - Glass Effect
========================================= */
.navbar {
    position: sticky;
    top: 0;
    width: 100%;
    background-color: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    border-bottom: var(--glass-border);
    height: 80px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: var(--font-heading);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-link {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
    position: relative;
    padding: 5px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: 0;
    left: 0;
    background: var(--gradient-text);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    z-index: 1002;
}

.bar {
    width: 30px;
    height: 3px;
    background: var(--gradient-text);
    transition: var(--transition);
    border-radius: 3px;
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Theme Toggle */
#theme-toggle {
    background: var(--card-bg);
    border: var(--glass-border);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glass-shadow);
}

#theme-toggle:hover {
    color: var(--primary-color);
    transform: rotate(15deg) scale(1.1);
    background: white;
}

/* =========================================
   5. Home Section (Hero) - Animated
========================================= */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 80px;
    margin-top: -80px;
    position: relative;
    overflow: hidden;
}

/* Blob Backgrounds */
.hero::before,
.hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
    animation: float 10s infinite alternate;
}

.hero::before {
    width: 500px;
    height: 500px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
}

.hero::after {
    width: 400px;
    height: 400px;
    background: var(--secondary-color);
    bottom: 50px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

.hero-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    padding: 50px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-title {
    font-size: 4.5rem;
    margin-bottom: 20px;
    font-weight: 800;
    letter-spacing: -2px;
}

.highlight {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-tagline {
    font-size: 1.8rem;
    color: var(--text-light);
    margin-bottom: 40px;
    min-height: 1.6em;
    font-weight: 500;
}

.cursor {
    display: inline-block;
    width: 3px;
    background-color: var(--secondary-color);
    animation: blink 1s infinite;
    margin-left: 5px;
}

.social-icons {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 30px;
    z-index: 10;
}

.social-icons a {
    font-size: 2rem;
    color: var(--text-color);
    background: var(--card-bg);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: var(--glass-border);
    backdrop-filter: blur(5px);
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.social-icons a:hover {
    color: white;
    background: var(--primary-color);
    transform: translateY(-10px) rotate(360deg);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
}

/* =========================================
   6. About Section - Glass Cards
========================================= */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 60px;
    align-items: center;
}

.about-image {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.about-image img {
    border-radius: 30px;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    position: relative;
    z-index: 2;
}

.about-image::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: -20px;
    bottom: -20px;
    background: var(--gradient-text);
    border-radius: 30px;
    z-index: 1;
    opacity: 0.5;
}

.about-image:hover img {
    transform: scale(1.03) translate(-10px, -10px);
}

.about-text {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: var(--border-radius);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1.15rem;
    color: var(--text-color);
}

/* =========================================
   7. Skills Section - Floating Effect
========================================= */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
}

.skill-category {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: var(--glass-border);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
    text-align: center;
    transition: var(--transition);
}

.skill-category:hover {
    transform: translateY(-15px);
    border-color: var(--primary-light);
}

.skill-category h3 {
    margin-bottom: 25px;
    color: var(--primary-color);
    font-size: 1.4rem;
}

.skill-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    position: relative;
}

.skill-item i {
    font-size: 3rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: var(--transition);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.skill-item span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 1;
    transition: var(--transition);
    transform: translateY(0);
    margin-top: 5px;
}

.skill-item:hover {
    transform: scale(1.1);
}

/* =========================================
   8. Projects Section - Modern Cards
========================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
}

.project-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
}

.project-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    border-color: var(--secondary-color);
}

.project-img {
    height: 250px;
    overflow: hidden;
    position: relative;
}

.project-img::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    opacity: 0;
    transition: var(--transition);
}

.project-card:hover .project-img::after {
    opacity: 1;
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

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

.project-info {
    padding: 30px;
}

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

[data-theme="dark"] .project-info h3 {
    color: var(--primary-light);
}

.project-info p {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 20px;
}

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

.tech-stack span {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

[data-theme="dark"] .tech-stack span {
    background: rgba(129, 140, 248, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(129, 140, 248, 0.2);
}

.project-links {
    display: flex;
    gap: 20px;
}

/* =========================================
   9. Experience Section - Modern Timeline
========================================= */
.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: var(--gradient-text);
    /* Gradient line */
    opacity: 0.3;
    border-radius: 2px;
}

.timeline-item {
    margin-bottom: 60px;
    position: relative;
    width: 50%;
    padding: 0 70px;
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}

.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
}

.timeline-dot {
    position: absolute;
    top: 5px;
    width: 24px;
    height: 24px;
    background: var(--bg-color);
    border-radius: 50%;
    border: 4px solid var(--secondary-color);
    z-index: 2;
    transition: var(--transition);
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.2);
}

.timeline-item:nth-child(odd) .timeline-dot {
    right: -12px;
}

.timeline-item:nth-child(even) .timeline-dot {
    left: -12px;
}

.timeline-item:hover .timeline-dot {
    background: var(--secondary-color);
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--secondary-color);
}

/* Ensure content inside the card is always left-aligned for readability */
.timeline-content {
    text-align: left;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    padding: 35px;
    border-radius: var(--border-radius);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
}

.timeline-item:hover .timeline-content {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.timeline-content ul {
    list-style-type: disc;
    padding-left: 20px;
    /* Add padding for bullets */
    margin-top: 10px;
}

.timeline-content ul li {
    position: relative;
    margin-bottom: 12px;
    font-size: 1.05rem;
    line-height: 1.6;
    padding-left: 5px;
    /* Spacing between bullet and text */
}

/* Reset specific padding overrides that messed up alignment */
.timeline-item:nth-child(odd) .timeline-content ul li,
.timeline-item:nth-child(even) .timeline-content ul li {
    padding-left: 5px;
    padding-right: 0;
}

.timeline-date {
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: left;
    /* Ensure date is also left aligned in card */
}

.timeline-content h3 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--primary-dark);
}

[data-theme="dark"] .timeline-content h3 {
    color: var(--primary-light);
}

.timeline-content h4 {
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

/* =========================================
   10. Contact Section - Centered Glass
========================================= */
.contact-content {
    display: flex;
    justify-content: center;
    width: 100%;
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    /* Increased min-width to ensure long emails fit */
    gap: 30px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    padding: 60px;
    border-radius: var(--border-radius);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    width: 100%;
    max-width: 1100px;
    align-items: center;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 1.2rem;
    width: 100%;
    padding: 20px;
    border-radius: 15px;
    transition: var(--transition);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    justify-content: flex-start;
    /* Default alignment */
    /* Remove overflow: hidden to allow text wrapping */
    word-break: break-all;
    /* Ensures very long emails break if needed */
}

@media (max-width: 768px) {
    .contact-info {
        padding: 30px 20px;
        /* Reduced padding on mobile */
        grid-template-columns: 1fr;
        /* Force single column */
    }

    .contact-item {
        justify-content: center;
        /* Center on mobile */
        flex-direction: column;
        text-align: center;
        gap: 10px;
        font-size: 1rem;
        padding: 15px;
    }
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.contact-item i {
    color: white;
    font-size: 1.5rem;
    background: var(--gradient-text);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.contact-item a {
    transition: var(--transition);
    position: relative;
}

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

.contact-item:hover a::after {
    width: 100%;
}

/* =========================================
   11. Footer
========================================= */
.footer {
    padding: 40px 0;
    text-align: center;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    color: var(--text-light);
    margin-top: 80px;
    border-top: var(--glass-border);
    font-weight: 500;
}

/* =========================================
   12. Animations - Entrance
========================================= */
.fade-in {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* =========================================
   13. Responsive Media Queries
========================================= */
@media (max-width: 1024px) {
    .menu-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(30px);
        flex-direction: column;
        justify-content: center;
        transition: right 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
        padding: 50px;
        z-index: 1001;
    }

    [data-theme="dark"] .nav-menu {
        background: rgba(15, 23, 42, 0.95);
    }

    .nav-menu.active {
        right: 0;
    }

    .hero-title {
        font-size: 3.5rem;
    }

    .section-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.8rem;
    }

    .hero-tagline {
        font-size: 1.2rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .about-image {
        margin-bottom: 30px;
    }

    .project-links {
        flex-direction: column;
    }

    .project-links .btn {
        width: 100%;
        text-align: center;
    }

    .timeline::before {
        left: 30px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 0;
        text-align: left !important;
    }

    .timeline-item:nth-child(even) {
        left: 0;
    }

    .timeline-item:nth-child(odd) .timeline-dot,
    .timeline-item:nth-child(even) .timeline-dot {
        left: 18px;
        right: auto;
    }

    .contact-item {
        font-size: 1rem;
        flex-direction: column;
        text-align: center;
    }
}