/* ======================== */
/* --- Global Variables --- */
/* ======================== */
:root {
    /* DARK MODE (Default) */
    --bg-color: #0d1117; /* Primary background color */
    --text-color: #c9d1d9; /* General text color */
    --heading-color: #ffffff; /* Headings and prominent text */
    --accent-gradient: linear-gradient(45deg, #2DD4BF, #34d399, #a78bfa); /* Gradient for accents */
    --accent-color-start: #2DD4BF; /* Starting color of accent gradient, used for solid accents */
    --secondary-color: #8b949e; /* Secondary text color, for less prominent text */
    --card-bg-color: rgba(22, 27, 34, 0.6); /* Background for cards, with transparency */
    --card-border-color: rgba(48, 54, 61, 0.8); /* Border for cards */
    --nav-bg-color: rgba(13, 17, 23, 0.7); /* Navbar background, with transparency */
    --font-heading: 'Figtree', sans-serif; /* Font for headings */
    --font-body: 'Inter', sans-serif; /* Font for body text */
    --spotlight-color: rgba(45, 212, 191, 0.15); /* Color for cursor spotlight */
}

/* Light Mode Variables */
body.light-mode {
    --bg-color: #f9fafb;
    --text-color: #374151;
    --heading-color: #111827;
    --accent-gradient: linear-gradient(45deg, #0d9488, #10b981, #8b5cf6);
    --accent-color-start: #0d9488;
    --secondary-color: #6b7280;
    --card-bg-color: rgba(255, 255, 255, 0.6);
    --card-border-color: #e5e7eb;
    --nav-bg-color: rgba(255, 255, 255, 0.7);
    --spotlight-color: rgba(13, 148, 136, 0.1);
}

/* ================== */
/* --- Preloader --- */
/* ================== */
#preloader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color); z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease;
}
.loader {
    width: 50px; height: 50px;
    border: 5px solid var(--card-border-color);
    border-top: 5px solid var(--accent-color-start);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================== */
/* --- Base Setup --- */
/* ================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    transition: background-color 0.4s ease;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* ========================= */
/* --- Cursor Spotlight --- */
/* ========================= */
#cursor-spotlight {
    position: fixed; top: 0; left: 0;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--spotlight-color) 0%, rgba(255, 255, 255, 0) 60%);
    pointer-events: none; /* Allows clicks to pass through */
    transform: translate(-50%, -50%); /* Centers the spotlight on the cursor */
    z-index: 9999;
    transition: background 0.3s ease; /* Smooth transition for theme change */
}

/* ========================== */
/* --- Aurora Background --- */
/* ========================== */
.aurora-background {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; /* Behind all content */
    overflow: hidden;
}
.aurora-dot {
    position: absolute; border-radius: 50%;
    filter: blur(120px); opacity: 0.3;
}
/* Individual dot styling and animation */
.aurora-dot:nth-child(1) { width: 500px; height: 500px; background-color: #2DD4BF; top: -20%; left: -15%; animation: aurora-move 20s infinite alternate; }
.aurora-dot:nth-child(2) { width: 600px; height: 600px; background-color: #a78bfa; top: 30%; right: -25%; animation: aurora-move 25s infinite alternate-reverse; }
.aurora-dot:nth-child(3) { width: 400px; height: 400px; background-color: #34d399; bottom: -25%; left: 20%; animation: aurora-move 22s infinite alternate; }
@keyframes aurora-move {
    from { transform: translate(0, 0) rotate(0deg) scale(1); }
    to { transform: translate(150px, 80px) rotate(120deg) scale(1.2); }
}

/* ========================= */
/* --- Navigation Bar --- */
/* ========================= */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 5%;
    background-color: var(--nav-bg-color);
    backdrop-filter: blur(10px); /* Frosted glass effect */
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    border-bottom: 1px solid var(--card-border-color);
}
.nav-logo {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-heading); font-size: 1.5rem; font-weight: 800;
    color: var(--accent-color-start); text-decoration: none;
}
.nav-profile-pic {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid var(--accent-color-start);
}
.nav-menu {
    display: flex; list-style: none; margin: 0; padding: 0; gap: 1rem;
}
.nav-link {
    display: flex; align-items: center; gap: 8px; /* Icon and text alignment */
    color: var(--secondary-color); text-decoration: none; font-weight: 500;
    transition: color 0.3s ease; position: relative; padding: 5px;
}
.nav-link svg {
    width: 20px; height: 20px; /* Size for navigation icons */
}
.nav-link:hover, .nav-link.active {
    color: var(--accent-color-start);
}
.nav-right {
    display: flex; align-items: center; gap: 1rem;
}
.theme-toggle-button {
    background: none; border: none; cursor: pointer; padding: 5px;
    color: var(--secondary-color); transition: color 0.3s ease;
}
.theme-toggle-button:hover {
    color: var(--accent-color-start);
}
/* Theme toggle icon visibility */
.moon-icon { display: none; }
.sun-icon { display: block; }
body.light-mode .moon-icon { display: block; }
body.light-mode .sun-icon { display: none; }

/* =================== */
/* --- Hero Section --- */
/* =================== */
.hero {
    position: relative; min-height: 100vh;
    display: flex; align-items: center; justify-content: center; text-align: center;
    overflow: hidden; /* Important for starfield */
    padding-top: 60px; /* Account for fixed navbar */
}
#starfield {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
}
.hero-content {
    position: relative; z-index: 1;
}
.hero-profile-pic {
    width: 120px; height: 120px; border-radius: 50%;
    border: 4px solid var(--accent-color-start);
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.4); /* Glow effect */
}
.hero-name {
    font-size: clamp(2.5rem, 10vw, 5rem); font-weight: 800;
    color: var(--heading-color); margin: 0;
}
.hero-title {
    font-size: 1.5rem; margin: 0.5rem 0;
}
#typed-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text; /* For gradient text */
    -webkit-text-fill-color: transparent; /* For gradient text */
    font-weight: 500;
}
.hero-tagline {
    font-size: 1.1rem; color: var(--secondary-color);
    margin-top: 1rem; margin-bottom: 2rem;
    max-width: 500px; margin-left: auto; margin-right: auto;
}

/* =============================== */
/* --- General Content Sections --- */
/* =============================== */
main {
    max-width: 1000px; margin: 0 auto; padding: 0 5%;
    position: relative; z-index: 2; /* Ensure content is above aurora */
}
section {
    padding: 100px 0; /* Vertical spacing between sections */
}
.section-title {
    font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 800; text-align: center;
    margin-bottom: 50px; color: var(--heading-color);
}
.section-title.left-align { /* For titles that are left-aligned */
    text-align: left; margin-bottom: 20px;
}

/* ======================================= */
/* --- Bento Grid (About & Skills Section) --- */
/* ======================================= */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns by default */
    gap: 20px;
}
.bento-item {
    background: var(--card-bg-color);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border-color);
    border-radius: 12px;
    padding: 30px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.bento-item:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color-start);
}
.bento-item.span-2 { grid-column: span 2; } /* Item spans 2 columns */
.bento-item.span-3 { grid-column: span 3; } /* Item spans 3 columns */
.bento-intro .bento-title {
    font-size: 2.2rem; margin-top: 0;
    color: var(--heading-color);
}
.bento-intro p {
    line-height: 1.6; margin-bottom: 20px;
}
.bento-intro .small-btn {
    padding: 8px 16px; font-size: 0.9rem;
}
.bento-subtitle {
    font-size: 1.1rem; color: var(--heading-color);
    margin: 0 0 15px 0;
}
.bento-item ul {
    list-style: none; padding: 0; margin: 0;
}
.bento-item li {
    margin-bottom: 10px; color: var(--secondary-color);
    display: flex; align-items: center; gap: 10px; /* For icon alignment */
}
.proficiency-icon {
    width: 20px; height: 20px; /* Size for proficiency icons */
    stroke: var(--accent-color-start);
    flex-shrink: 0;
}

/* Tech Stack Icons in About */
.bento-tech-stack .tech-stack-icons {
    display: flex; flex-wrap: wrap; gap: 15px;
    align-items: center;
    justify-content: center; /* Center icons in the grid item */
}
.bento-tech-stack .tech-stack-icons img {
    height: 32px; /* Uniform height for all tech icons */
    width: auto;
    object-fit: contain; /* Ensure images scale correctly */
}
body.light-mode .bento-tech-stack .tech-stack-icons img[src*="snowflake"] {
    filter: invert(1); /* Invert snowflake logo for visibility in light mode */
}
/* Call to Action Card */
.bento-cta {
    grid-column: span 1; /* Always one column for CTA */
    display: flex; justify-content: space-between; align-items: center;
    text-decoration: none; color: var(--text-color);
}
.bento-cta span {
    font-size: 2rem; transition: transform 0.3s ease;
}
.bento-cta:hover span {
    transform: translateX(5px);
}

/* ============================= */
/* --- Experience Timeline --- */
/* ============================= */
.timeline {
    position: relative; max-width: 750px; margin: 0 auto; padding: 40px 0;
}
.timeline::after { /* Vertical line */
    content: ''; position: absolute; width: 3px; background: var(--card-border-color);
    top: 0; bottom: 0; left: 50%; margin-left: -1.5px;
}
.timeline-item {
    padding: 10px 40px; position: relative; width: 50%;
}
.timeline-item:nth-child(odd) { left: 0; } /* Left side items */
.timeline-item:nth-child(even) { left: 50%; } /* Right side items */
.timeline-item::after { /* Circular markers */
    content: ''; position: absolute; width: 18px; height: 18px; right: -9px;
    background-color: var(--bg-color); border: 3px solid var(--accent-color-start);
    top: 30px; border-radius: 50%; z-index: 1; transition: transform 0.3s ease;
}
.timeline-item:nth-child(even)::after { left: -9px; } /* Adjust marker for right side */
.timeline-item:hover::after { transform: scale(1.2); } /* Interactive marker */
.timeline-content {
    padding: 25px 30px; background: var(--card-bg-color); backdrop-filter: blur(10px);
    position: relative; border-radius: 8px; border: 1px solid var(--card-border-color);
}
.timeline-content h3 { margin-top: 0; color: var(--heading-color); }
.timeline-company { font-weight: 500; color: var(--accent-color-start); margin-bottom: 0.25rem; }
.timeline-date { font-size: 0.9rem; color: var(--secondary-color); margin-top: 0; }
.timeline-content ul { padding-left: 20px; color: var(--secondary-color); margin: 15px 0 0 0; }
.timeline-content ul li { margin-bottom: 5px; } /* Adjust list item spacing */


/* ============================= */
/* --- Certifications Section --- */
/* ============================= */
.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid for cert cards */
    gap: 30px;
}
.cert-card {
    background-color: transparent; /* Allows inner content to show through */
    height: 280px; /* Fixed height for consistent card size */
    perspective: 1000px; /* For 3D flip effect */
}
.cert-card-inner {
    position: relative;
    width: 100%; height: 100%;
    text-align: center;
    transition: transform 0.6s; /* Smooth flip animation */
    transform-style: preserve-3d; /* Keep children in 3D space */
}
.cert-card:hover .cert-card-inner {
    transform: rotateY(180deg);
}
.cert-card-front, .cert-card-back {
    position: absolute;
    width: 100%; height: 100%;
    -webkit-backface-visibility: hidden; /* Hide back of element during flip */
    backface-visibility: hidden;
    background: var(--card-bg-color);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border-color);
    border-radius: 12px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.cert-card-back {
    transform: rotateY(180deg); /* Start rotated for back face */
    align-items: flex-start; /* Align text to left */
    text-align: left;
}
.cert-card-front img {
    width: 120px; height: 120px; /* Certification badge size */
    object-fit: contain;
    margin-bottom: 15px;
}
.cert-card-front h3 {
    color: var(--heading-color); font-size: 1.15rem; margin-top: 0;
}
.cert-card-back h4 {
    color: var(--accent-color-start); margin-top: 0; margin-bottom: 15px;
    font-size: 1.1rem;
}
.cert-card-back ul {
    list-style: none; padding: 0; margin: 0;
}
.cert-card-back li {
    margin-bottom: 8px; font-size: 0.9rem; color: var(--secondary-color);
    display: flex; align-items: center; gap: 8px;
}
.cert-card-back li svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent-color-start);
    flex-shrink: 0;
}

/* ===================== */
/* --- Projects Cards --- */
/* ===================== */
.projects-grid {
    position: relative;
}
.project-card {
    background: var(--card-bg-color); backdrop-filter: blur(12px);
    border: 1px solid var(--card-border-color); border-radius: 12px;
    padding: 30px; 
    display: flex; flex-direction: column; /* Ensure content stacks vertically */
    /* Transition for Isotope filtering */
    transition: transform 0.6s ease, opacity 0.6s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.project-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--accent-color-start);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.project-card h3 { color: var(--heading-color); margin: 0 0 10px 0; }
.project-card p {
    color: var(--secondary-color); margin: 0 0 20px 0; line-height: 1.5;
    flex-grow: 1; /* Allows paragraphs to take up available space */
}
.project-tags {
    margin-top: auto; /* Pushes tags to the bottom of the card */
    display: flex; flex-wrap: wrap; gap: 8px; /* Spacing for tags */
}
.project-tags span {
    background: var(--accent-gradient); color: white;
    padding: 4px 12px; border-radius: 12px;
    font-size: 0.75rem; font-weight: 500;
    display: inline-block;
}

/* ====================== */
/* --- Project Filters --- */
/* ====================== */
.project-filters {
    text-align: center; margin-bottom: 40px;
}
.filter-btn {
    background: none; border: 1px solid var(--card-border-color);
    color: var(--secondary-color); padding: 10px 20px;
    border-radius: 20px; cursor: pointer; margin: 0 5px;
    transition: all 0.3s ease;
}
.filter-btn:hover {
    color: var(--heading-color); border-color: var(--accent-color-start);
}
.filter-btn.active {
    background: var(--accent-gradient); color: #fff; border-color: transparent;
}

/* ==================== */
/* --- Blog Section --- */
/* ==================== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
.blog-card {
    background: var(--card-bg-color); backdrop-filter: blur(12px);
    border: 1px solid var(--card-border-color); border-radius: 12px;
    text-decoration: none;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.blog-card:hover {
    transform: translateY(-5px); 
    border-color: var(--accent-color-start);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.blog-content { padding: 30px; }
.blog-date { font-size: 0.8rem; color: var(--secondary-color); margin-bottom: 10px; }
.blog-content h3 { color: var(--heading-color); margin: 0 0 10px 0; font-size: 1.2rem; }
.blog-excerpt { color: var(--secondary-color); margin: 0 0 20px 0; font-size: 0.9rem; }
.blog-content span { color: var(--accent-color-start); font-weight: 500; }

/* ===================== */
/* --- Contact Section --- */
/* ===================== */
#contact {
    text-align: center;
}
#contact p {
    max-width: 600px; margin: 0 auto 30px auto;
}
.contact-info {
    margin-bottom: 30px;
}
.contact-info p {
    margin: 5px 0; font-size: 1.1rem;
}

/* ======================== */
/* --- Hamburger Menu --- */
/* ======================== */
.hamburger {
    display: none; /* Hidden by default on desktop */
    cursor: pointer;
}
.hamburger span {
    display: block; width: 25px; height: 3px; margin: 5px 0;
    background-color: var(--text-color); transition: all 0.3s ease-in-out;
}

/* ================ */
/* --- Footer --- */
/* ================ */
footer {
    text-align: center; padding: 40px 20px;
    color: var(--secondary-color); font-size: 0.9rem;
}
.social-links { margin-bottom: 1rem; }
.social-links a {
    margin: 0 15px; color: var(--secondary-color);
    transition: color 0.3s ease;
}
.social-links a:hover {
    color: var(--accent-color-start);
}
.social-links svg {
    width: 24px; height: 24px; fill: currentColor;
}

/* =========================== */
/* --- Buttons & Back to Top --- */
/* =========================== */
.btn {
    position: relative; overflow: hidden; z-index: 1;
    padding: 12px 24px; border-radius: 8px; text-decoration: none;
    font-weight: 500; transition: all 0.3s ease; margin: 5px;
    display: inline-block; cursor: pointer;
}
.btn-primary {
    background: var(--accent-gradient); background-size: 200% auto;
    color: white; border: none;
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.4); /* Initial glow */
}
.btn-primary:hover {
    background-position: right center; /* Animates gradient on hover */
    box-shadow: 0 0 25px rgba(45, 212, 191, 0.6); /* Stronger glow */
    transform: translateY(-3px);
}
.btn-secondary {
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color); background: transparent;
}
.btn-secondary:hover {
    border-color: var(--accent-color-start);
    color: var(--accent-color-start);
    transform: translateY(-3px);
}
#back-to-top {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--accent-gradient); color: white;
    width: 40px; height: 40px; border-radius: 50%;
    text-align: center; line-height: 40px; font-size: 20px;
    text-decoration: none; z-index: 100;
    opacity: 0; visibility: hidden; /* Hidden by default */
    transition: all 0.3s;
    transform: translateY(20px); /* Starts slightly off screen */
    border: none;
}
#back-to-top.visible {
    opacity: 1; visibility: visible; transform: translateY(0); /* Fades in and slides up */
}

/* ========================= */
/* --- Responsive Design --- */
/* ========================= */
@media (max-width: 900px) {
    .bento-grid {
        grid-template-columns: 1fr; /* Single column for Bento Grid on smaller screens */
    }
    .bento-item.span-2, .bento-item.span-3, .bento-cta {
        grid-column: span 1; /* Ensure all items take full width */
    }
}

@media (max-width: 768px) {
    /* Mobile Navigation */
    .nav-menu {
        position: fixed; top: 65px; right: -100%; /* Off-screen by default */
        width: 100%; height: calc(100vh - 65px); /* Full height minus navbar */
        background-color: var(--bg-color); /* Matches page background */
        flex-direction: column; align-items: center;
        justify-content: center;
        gap: 2rem;
        transition: right 0.3s ease-in-out;
    }
    .nav-menu.active {
        right: 0; /* Slides in from right */
    }
    .hamburger {
        display: block; /* Show hamburger icon */
    }
    /* Hamburger animation when active */
    .hamburger.active span:nth-child(2) { opacity: 0; }
    .hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .section-title.left-align { text-align: center; }
    .bento-intro .bento-title { text-align: center; } /* Center bento title on mobile */
    .bento-intro p { text-align: center; }
    .bento-profile-pic { float: none; margin: 0 auto 20px auto; display: block; } /* Center image on mobile */

    /* Mobile Timeline adjustments */
    .timeline::after { left: 30px; } /* Move vertical line to left */
    .timeline-item { width: 100%; padding-left: 70px; padding-right: 20px; } /* Full width, adjusted padding */
    .timeline-item:nth-child(even) { left: 0; } /* All items align left */
    .timeline-item::after { left: 21px; } /* Adjust marker position */

    .nav-link span { display: none; } /* Hide text in mobile nav to just show icons */
    .nav-link { padding: 15px; } /* Larger clickable area for icons */
}