body {
    background: linear-gradient(-45deg, #1a1a2e, #16213e, #0f3460, #53354a);
    background-size: 400% 400%;
    animation: gradientBG 10s ease infinite;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.moving-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 5%, transparent 10%);
    background-size: 50px 50px;
    animation: movePattern 0s infinite alternate ease-in-out;
}
@keyframes movePattern {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    25% { transform: translate(-30px, 20px) rotate(5deg) scale(1.1); }
    50% { transform: translate(40px, -30px) rotate(-3deg) scale(0.9); }
    75% { transform: translate(-20px, 40px) rotate(2deg) scale(1.05); }
    100% { transform: translate(0, 0) rotate(0deg) scale(1); }
}
.container {
    display: grid;
    grid-template-columns: 20rem 1fr;
    grid-template-areas: "sidebar main";
    flex: 1;
}
aside {
    grid-area: sidebar;
    background-color: #2d3748;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
main {
    grid-area: main;
    padding: 2rem;
    transition: all 0.3s ease-in-out;
}
.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.button:hover {
    transform: scale(1.1);
    border-color: #ffffff;
}
.profile-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: white;
}
.sidebar-icons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}
.sidebar-icons a {
    color: white;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}
.sidebar-icons a:hover {
    color: #4a90e2;
}
/* Hide the mobile navigation bar by default */
header.mobile-nav {
    display: none;
    padding: 0.5rem 1rem; /* Reduce padding */
}
@media (max-width: 1024px) {
    aside {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        justify-content: space-around;
        padding: 1rem;
    }
    main {
        margin-left: 0;
        padding: 1rem;
    }
}
@media (max-width: 768px) {
    /* Show the mobile navigation bar */
    header.mobile-nav {
        display: block;
        background-color: #2d3748;
        padding: 0.5rem 1rem; /* Reduce padding */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    header.mobile-nav nav {
        display: flex;
        justify-content: space-around;
        gap: 0.25rem; /* Reduce gap between links */
    }

    /* Hide the sidebar */
    aside {
        display: none !important;
    }

    /* Adjust the grid layout */
    .container {
        grid-template-columns: 1fr;
    }

    main {
        margin-left: 0;
        padding: 1rem;
        margin-top: 0rem; /* Prevent overlap with the mobile nav */
        padding-top: 0rem; /* Adjust top padding for smaller screens */
    }
    .grid .w-24 {
        display: none;
    }
}

@media (max-width: 1024px) and (min-width: 768px) {
    .grid .w-24 {
        display: none;
    }
}

/* Ensure links adapt to window size and never overlap */
header.mobile-nav nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem; /* Reduce gap between links */
}

/* Add subtle border and padding for framed links */
header.mobile-nav nav a {
    display: inline-block;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
    flex: 1 1 auto; /* Allow links to adjust their width */
    max-width: 150px; /* Optional: Limit the maximum width of each link */
    padding: 0.25rem 0.5rem; /* Reduce padding inside links */
    font-size: 0.875rem; /* Slightly smaller font size */
}

header.mobile-nav nav a:hover {
    background-color: #374151; /* Slightly darker background on hover */
}

/* Research */
.article-section a {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
.project-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}
.project-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* CV */
.pdf-frame {
    width: 100%;
    min-height: 78vh;
    border: 0;
    border-radius: 1rem;
    background: #111827;
}
.pdf-shell {
    background: rgba(17, 24, 39, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* Contact */
.social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.social-link:hover {
    transform: scale(1.1);
    border-color: #ffffff;
}
