body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: auto;
    font-family: 'Exo 2';
    scroll-behavior: smooth;
    background-color: #dfecfc;
}


#bg-canvas{
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1; /* behind everything */
    width: 100vw;
    height: 100vh;
}

#content{
    position: relative;
    z-index: 1;
}


#title-card{
    padding-left: 2rem;
}

#navbar{
    margin-top: 1rem;
    margin-right: 1rem;
    display: flex;
    align-items: center;
}

#navbar a {
    margin-left: 1rem;
    margin-right: 1rem;
    margin-bottom: .5rem;
    margin-top: .5rem;
    color: darkblue;
}

#top-bar{
    display: flex;
    justify-content: space-between;
}

#name{
    font-size: 3rem;
}

#aboutme, #gallery, #projects {
    padding: 1rem;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#profile-pic{
    max-width: min(460px, 100%);
    border-radius: .5rem;
}

.section-title{
    margin-top: 12px;
    margin-bottom: 12px;
    font-size: xx-large;
}

.aboutme-p {
    margin-top: 6px;
    margin-bottom: 6px;
    max-width: min(700px, 100%);

}


.work-item {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
    margin-top: 1rem;
    transition: transform 0.2s ease;
    padding-bottom: .2rem;
    margin-left: auto;
    margin-right: auto;
    max-width: min(460px, 100%);
    margin-bottom: 2rem;

}

.work-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.work-thumb {
    height: auto;
    border-radius: 0.5rem;
    max-width: min(460px, 100%);

}

.work-button {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: #2c3e50;
    color: white;
    font-size: larger;
    text-decoration: none;
    border-radius: 0.4rem;
    transition: background-color 0.2s ease;
}

.work-button:hover {
    background-color: #1a2533;
}

#slideshow-container {
    width: 100%;
    max-width: 800px;
    margin: auto;
    position: relative;
    aspect-ratio: 4 / 3;
    min-height: 350px;
    /* Remove background and flex centering */
    background: none;
    display: block;
}

#slideshow {
    position: static; /* Remove absolute positioning */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    gap: 2rem; 
    overflow: hidden;
}

#slideshow img {
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    width: auto;
    object-fit: contain;
    transition: transform 0.5s ease;
    display: block;
    border-radius: .5rem;
    margin: auto
}

.nav-button {
    background: rgba(0, 0, 0, 0.5);
    color: gainsboro;
    border: none;
    font-size: 3rem;
    cursor: pointer;
    z-index: 1;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.nav-button:hover {
    background: rgba(0, 0, 0, 0.7);
}

#prev, #next {
    /* No need for left/right positioning */
    min-width: 3.5rem;
    min-height: 3.5rem;
    margin-left: 2rem;
    margin-right: 2rem;
}

#button-container {
    display:flex;
    flex-direction: row;
    margin-bottom: -20px;
}

@media (max-width: 768px) {
    #slideshow {
        flex-direction: column;
        min-height: 570px;
    }


    #navbar {
        display: flex;
        flex-direction: column;
        margin-top: 2.5rem;
    }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-bg {
    position: absolute;
    width: 100vw;
    height: 100vh;
    left: 0;
    top: 0;
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    margin: auto;
    z-index: 1001;
    border-radius: .3rem;
    box-shadow: 0 0 24px 4px rgba(0,0,0,0.5);
    display: block;
    background: white;
    object-fit: contain;
}

.work-item-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.work-item-link:hover .work-item {
    box-shadow: 0 0 8px #aaa;
    cursor: pointer;
}