/* Reset default browser styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global modal state constraint */
body.modal-open {
    overflow: hidden !important;
}

/* Live Color-Shifting Gradient Background */
body {
    background: linear-gradient(135deg, #005FDB, #A946FC);
    background-size: 400% 400%;
    animation: gradientBG 18s ease infinite;
    /* Fix the background so it doesn't move when scrolling */
    background-attachment: fixed;
    min-height: 100vh;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* Smooth background shift animation */
@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Toolbar / Navigation Bar */
.toolbar {
    background-color: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Logo System - Prevents Animation Clipping */
.logo {
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: visible;
}

    .logo:hover {
        transform: scale(1.08);
    }

    .logo img {
        display: block;
        object-fit: contain;
    }

#logo-text {
    font-family: 'Bangers', cursive;
    font-size: 28px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
}

/* Clean Desktop Link Elements (No Weird Box Shapes) */
.nav-links {
    display: flex;
    list-style: none;
    gap: 25px;
}

    .nav-links button {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        font-family: 'Bangers', cursive;
        color: #ffffff;
        font-size: 22px;
        letter-spacing: 1.5px;
        cursor: pointer;
        padding: 5px 10px;
        transition: color 0.2s ease, transform 0.2s ease;
    }

        .nav-links button:hover {
            color: #ffeaa7;
            transform: translateY(-2px);
        }

/* View Management (Hides sections not currently active) */
.view {
    display: none;
    flex: 1;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    animation: fadeIn 0.4s ease-out;
}

    .view.active {
        display: flex;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Home Content */
.home-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 20px;
}

/* WebP Animation Container */
.home-video-wrapper {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.home-video {
    width: 100%;
    height: auto;
    max-height: 380px;
    display: block;
    outline: none;
}

/* Style for fallback animated Hello World text */
.home-fallback-h1 {
    font-family: 'Bangers', cursive;
    font-size: 5.5rem;
    letter-spacing: 4px;
    margin-bottom: 20px;
    text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.25);
    line-height: 1;
    animation: bounceIn 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    70% {
        transform: scale(0.9);
        opacity: 0.9;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.home-content p {
    font-size: 1.4rem;
    opacity: 0.95;
    line-height: 1.7;
    background: rgba(0, 0, 0, 0.2);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Glassmorphism Containers for the Blurred effect */
.glass-panel {
    width: 100%;
    max-width: 1000px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 40px;
}

.blur-light {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.blur-heavy {
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.glass-panel h2 {
    font-family: 'Bangers', cursive;
    font-size: 3.8rem;
    letter-spacing: 2px;
    margin-bottom: 5px;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.3);
}

.subtitle-text {
    margin-bottom: 30px;
    font-size: 1.1rem;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.15);
    padding-bottom: 15px;
    opacity: 0.85;
}

/* Grid Layout Group Type Beat */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    width: 100%;
}

/* Project Cards */
.card {
    background: rgba(0, 0, 0, 0.3);
    padding: 0;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

    .card:hover {
        background: rgba(0, 0, 0, 0.5);
        transform: translateY(-8px);
        border-color: rgba(255, 255, 255, 0.35);
        box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
    }

/* Thumbnail Container */
.card-thumbnail {
    width: 100%;
    height: 160px;
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

    .card-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

.card:hover .card-thumbnail img {
    transform: scale(1.08);
}

/* Embedded Dynamic SVG Styling for missing images */
.card-thumbnail svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Card Text Padding */
.card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card h3 {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    color: #ffeaa7;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

.card p {
    font-size: 1rem;
    line-height: 1.5;
    opacity: 0.9;
}

/* Back Button */
.back-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    margin-bottom: 25px;
    transition: all 0.2s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
}

    .back-btn:hover {
        background: rgba(255, 255, 255, 0.3);
        border-color: rgba(255, 255, 255, 0.6);
        transform: translateX(-3px);
    }

/* Modal Overlay Styling */
.overlay-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease-out;
}

    .overlay-modal.active {
        opacity: 1;
        pointer-events: auto;
    }

.overlay-panel {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 24px;
    padding: 35px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    position: relative;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(30px);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto;
}

.overlay-modal.active .overlay-panel {
    transform: scale(1) translateY(0);
}

.overlay-close-btn {
    position: absolute;
    top: 25px;
    right: 25px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

    .overlay-close-btn:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: rotate(90deg);
    }

.overlay-header {
    margin-right: 50px;
    margin-bottom: 25px;
}

    .overlay-header h2 {
        font-family: 'Bangers', cursive;
        font-size: 3.2rem;
        color: #ffffff;
        letter-spacing: 2px;
        line-height: 1;
        text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.3);
    }

.overlay-subtitle {
    font-size: 1.2rem;
    color: #ffeaa7;
    opacity: 0.95;
    margin-top: 5px;
    font-weight: 500;
}

.overlay-body {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ffffff;
}

#overlay-desc {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 30px;
    opacity: 0.95;
}

.overlay-subprojects-section h3 {
    font-family: 'Bangers', cursive;
    font-size: 2.2rem;
    letter-spacing: 1px;
    margin-bottom: 15px;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.overlay-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 650px) {
    .overlay-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.overlay-sub-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 18px;
    transition: transform 0.2s, background-color 0.2s;
}

    .overlay-sub-card:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: translateY(-3px);
    }

    .overlay-sub-card h4 {
        font-size: 1.15rem;
        color: #ffeaa7;
        margin-bottom: 8px;
        font-weight: 600;
    }

    .overlay-sub-card p {
        font-size: 0.95rem;
        opacity: 0.9;
        line-height: 1.4;
    }

/* About Section Profile Layout */
.about-container {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: flex-start;
    margin-top: 25px;
    margin-bottom: 40px;
    width: 100%;
}

.profile-img-wrapper {
    flex: 0 0 180px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#svg-profile-fallback {
    width: 100%;
    height: 100%;
}

.about-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lead-bio {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #ffeaa7;
}

.about-text p {
    font-size: 1.05rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* Contacts & Social Grid */
.contact-section {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 30px;
    width: 100%;
}

    .contact-section h3 {
        font-family: 'Bangers', cursive;
        font-size: 2.6rem;
        letter-spacing: 1.5px;
        margin-bottom: 5px;
    }

.contact-subtitle {
    font-size: 1rem;
    opacity: 0.75;
    margin-bottom: 25px;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    width: 100%;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 16px;
    text-decoration: none;
    color: #ffffff;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

    .contact-card:hover {
        transform: translateY(-4px);
        background: rgba(0, 0, 0, 0.45);
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    }

.contact-icon-wrapper {
    color: #ffeaa7;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-info h4 {
    font-size: 1.15rem;
    color: #ffffff;
    margin-bottom: 4px;
    font-weight: 600;
}

.contact-info p {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
}

/* ====================================
   MOBILE RESPONSIVENESS & SLIDING ICON
   ==================================== */

.hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    background: none !important;
    border: none !important;
    z-index: 101;
    padding: 5px;
    position: fixed;
    top: 36px;
    right: 20px;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

    .hamburger span {
        width: 32px;
        height: 3px;
        background-color: #ffffff;
        border-radius: 3px;
        transition: all 0.3s ease;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

    /* Moves the fixed hamburger with the sliding menu panel */
    .hamburger.toggle {
        right: 270px;
    }

        .hamburger.toggle span:nth-child(1) {
            transform: translateY(9px) rotate(45deg);
        }

        .hamburger.toggle span:nth-child(2) {
            opacity: 0;
        }

        .hamburger.toggle span:nth-child(3) {
            transform: translateY(-9px) rotate(-45deg);
        }

@media (max-width: 768px) {
    .toolbar {
        padding: 15px 20px;
    }

    .hamburger {
        display: flex;
    }

    /* Side Navigation Drawer */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 250px;
        background-color: rgba(15, 15, 15, 0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 20px;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
        z-index: 100;
        padding: 40px;
    }

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

        .nav-links button {
            width: 100%;
            text-align: center;
            padding: 12px;
            font-size: 1.3rem;
        }

    .about-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .grid-layout {
        grid-template-columns: 1fr;
    }
}

/* ====================================
   MOBILE RESPONSIVENESS & REPAIRS
   ==================================== */

/* Global protection against random horizontal scrolling sizing leaks */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Adjust the main views to have less aggressive paddings on small screens */
@media (max-width: 768px) {
    .toolbar {
        padding: 10px 20px; /* Bring bar margins inward */
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    /* Wrap the menu buttons elegantly if screen space disappears */
    .nav-links {
        gap: 12px;
    }

        .nav-links button {
            font-size: 18px; /* Slightly scale down font to prevent dropping to 2 lines */
        }

    .view {
        padding: 20px 15px; /* Stop padding from forcing text to overflow screen edges */
    }

    /* Shrink the giant homepage fallback text so it doesn't break boundaries */
    .home-fallback-h1 {
        font-size: 3.2rem;
    }

    .home-content p {
        font-size: 1.1rem;
        padding: 15px;
    }

    .glass-panel {
        padding: 20px; /* Reduce massive desktop inner padding container margins */
        border-radius: 16px;
    }

        .glass-panel h2 {
            font-size: 2.5rem; /* Stop massive titles from splitting awkwardly */
        }

    /* Adjust About section layout for mobile stacked layout */
    .about-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .about-text {
        text-align: center;
    }

    /* Adjust Contact links layout for mobile */
    .contact-grid {
        grid-template-columns: 1fr !important; /* Stack them up straight */
        gap: 15px;
    }
}

/* Specific Overlay Panel System Repair Suite */
@media (max-width: 600px) {
    .overlay-panel {
        padding: 20px; /* Free up space inside the modal view window */
        width: 100%;
        max-height: 85vh; /* Keep it bounded inside viewable territory */
        border-radius: 16px;
    }

    .overlay-close-btn {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .overlay-header {
        margin-right: 40px; /* Ensure title text doesn't flow underneath the X button */
        margin-bottom: 15px;
    }

        .overlay-header h2 {
            font-size: 2.2rem; /* Reduce enormous headers */
            word-wrap: break-word;
        }

    .overlay-subtitle {
        font-size: 1rem;
    }

    .overlay-body {
        font-size: 0.95rem;
    }

    #overlay-desc {
        padding: 12px;
        margin-bottom: 20px;
    }

    .overlay-subprojects-section h3 {
        font-size: 1.6rem;
    }

    .overlay-grid {
        grid-template-columns: 1fr !important; /* Forces modules into 1 clean vertical column layout */
        gap: 10px;
    }

    .overlay-sub-card {
        padding: 12px;
    }
}