* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: coolvetica, sans-serif;
}
body {
    background-color: white;
    display: flex;
    overflow: hidden;
    height: 100vh;
    flex-direction: column;
    align-items: center;
    gap: 3vh;
}

/* Language Button */
#language-btn {
    align-self: flex-end;
    padding: 1vh 1.4vw;
    background-color: #66726E;
    color: white;
    border: none;
    font-size: calc(1rem + 0.65vw);
    cursor: pointer;
    width: 3em;
    box-sizing: border-box;
    font-family: neuehaasxthin;
}

.main {
    display: flex;
    gap: 10vw;
    align-items: flex-end;
}

/* Logo */
.logo {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.logo img {
    display: block;
    width: 20vw;
    height: auto;
    transition: opacity 0.3s ease-in-out;
}

/* Default image visible */
.logo img:first-child {
    opacity: 1;
}

/* Hover image hidden by default */
.logo .hover-img {
    position: absolute;
    width: 20vw; /* Ensure this matches the width of the logo */
    height: auto;
    opacity: 0;
}

/* On hover, fade in the hover image and fade out the default image */
.logo:hover .hover-img {
    opacity: 1;
}

.logo:hover img:first-child {
    opacity: 1;
}

/* Navigation */
.nav-container {
    display: flex;
    gap: 8vw;
    align-items: center;
    flex-direction: row;
    transition: gap 0.5s ease-in-out; 
}

.nav-button {
    position: relative;
    background: none;
    border: none;
    padding: 0;
    text-align: center;
    display: inline-block;
    max-height: 20vh;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out, max-height 0.5s ease-in-out, margin 0.5s ease-in-out;
}
.nav-button.hidden {
    opacity: 0;
    max-height: 0; /* Collapse height smoothly */
    pointer-events: none; /* Prevent interaction when hidden */
    transition: opacity 0.5s ease-in-out, max-height 0.5s ease-in-out, margin 0.5s ease-in-out;
}
.nav-button img {
    width: 7.5vw;
    height: auto;
    display: block;
    margin: 0 auto;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

/* Default image visible by default */
.nav-button img:first-child {
    opacity: 1;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

/* Hover image hidden by default */
.hover-img {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 7.5vw;
    height: auto;
    opacity: 0;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}


.nav-button:hover .hover-img,
.nav-button.active .hover-img {
    opacity: 1; /* Hover image fades in */
}
.nav-button:hover img:first-child,
.nav-button.active img:first-child {
    opacity: 0; /* Original image fades out */
}
.nav-button img:hover {
    cursor: pointer;
}

.nav-button p {
    font-size: 1.6vw;
}


.gallery {
    width: 70vw;
    display: flex;
    overflow-x: scroll;
    height: 62vh;
    overflow-y: hidden;
}

.gallery div {
    width: 100%;
    display: grid;
    grid-template-columns: auto auto auto auto auto;
    padding: 1vw;
    flex: none;
}

.gallery div img {
    width: 100%;
}

.gallery img {
    transition: transform 0.3s ease-in-out;
    transform: scale(1);
}

.gallery img:hover {
    transition: transform 0.3s ease-in-out;
    transform: scale(1.1);
}

.gallery::-webkit-scrollbar {
    display: none;
}

.gallery-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0vw auto;
    height: 62vh;
}
  
.gallery p {
    font-family: neuehaaslight;
    font-size: 1.51vw;
    margin-top: 3vw;
    color: #66726E;
}

#backBtn, #nextBtn {
    width: 4vw;
    cursor: pointer;
    margin: 1vw 1vw 9vh 1vw;
    background: none;
    border: none;
}


/* Gradient Bar */
.gradient-bar {
    width: 100%;
    background: linear-gradient(to right, #DD0D7E 5%, #865873 32%, #66726E 63%, #841D7C 95%);
    position: absolute;
    bottom: 0;
    padding: 1vh 0;
    color: white;
    overflow: hidden;
}

#running-text {
    display: flex;
    animation: marquee var(--animation-duration) linear infinite;
    font-size: 1.8em;
    gap: 7vw; /* Ensure this matches the gap you're using */
}

#running-text .text {
    flex-shrink: 0;
    white-space: nowrap;
    font-family: NEUEHAASTHIN, sans-serif;
}

.coolvetica {
    font-family: CoolVetica;
}
#meist-content { 
    display: flex; 
    margin-right: 10.3vw; 
    align-self: end; 
    overflow: auto;
    scrollbar-width: none;
    margin-bottom: 7vh;
    -ms-overflow-style: none;
}
#meist-content p { 
    font-size: calc(1rem + 0.65vw); 
    width: 42vw;
    margin-bottom: 4vw;
    height: 50vh;
    font-family: neuehaaslight;
}
#meist-content::-webkit-scrollbar {
    display: none;
}

/*HETKEL UUENDAMISEL section (no projects to show)*/
#projektid-content {
    flex-wrap: wrap;
}
#projektid-content img {
    max-width: 100%;
    height: auto;
    padding: 0 10vw;
}
#projektid-content p {
    font-size: calc(1rem + 0.65vw);
    margin: 0 10vw;
    word-wrap: break-word;
    font-family: neuehaaslight;
}
/**/
#kontakt-content {
    font-size: 2em;
    color: black;
    text-align: left;
    width: 50vw;
    flex-flow: wrap;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    align-self: flex-start;
    margin-left: 16vw;
    max-width: 100%;
}
#kontakt-content a {
    color: black;
    text-decoration: none;
}
#kontakt-content a:hover {
    color: #DD0D7E;
}
#kontakt-content p:hover {
    color: #DD0D7E;
    cursor: pointer;
}

@font-face {
    font-family: 'Coolvetica';
    src: url('fonts/COOLVETICA.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'CoolveticaCond';
    src: url('fonts/COOLVETICACONDENSED.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'NeueHaasThin';
    src: url('fonts/NEUEHAASTHIN.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: NeueHaasXXThin;
    src: url('fonts/NeueHaasDisplayXXThin.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: NeueHaasXThin;
    src: url('fonts/NeueHaasDisplayXThin.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: NeueHaasLight;
    src: url('fonts/NeueHaasDisplayLight.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: NeueHaasRoman;
    src: url('fonts/NeueHaasDisplayRoman.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@keyframes marquee {
    from {
        transform: translateX(3.5%);
    }
    to {
        transform: translateX(calc(-1 * var(--text-width)));
    }
}

@media screen and (max-width: 768px) {
    body {
        gap: 5vw;
        overflow: auto;
        height: 110vh;
    }
    .main {
        flex-direction: column;
        align-items: center;
        gap: 20vw;
    }
    .nav-container {
        flex-direction: column; /* Switch to column layout when screen width is less than 768px */
        gap: 5vh; /* Adjust the gap for stacked items */
        align-items: center;
    }
    .nav-button {
        position: relative;
        background: none;
        border: none;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .nav-button p {
        font-size: 1.6em;
        margin-top: 0;
    }    
    .nav-button img {
        top: 0;
        width: 25vw; /* Adjust image size for smaller screens */
    }

    .nav-button .hover-img {
        width: 25vw; /* Ensure hover image also adjusts size */
    }
    .logo img {
        width: 70vw;
    }
    .logo .hover-img {
        width: 70vw;
    }
    .gradient-bar {
        display: none !important;
    }
    #language-btn {
        font-size: 1.5em;
        width: 3.5em;
        padding: 1.3vh 0vw;
    }
    #meist-content {
        align-self: center;
        margin-right: 0;
        margin-top: 5vh;
        margin-bottom: 0;
        overflow: visible;
    }
    #meist-content p {
        font-size: calc(1rem + 1.55vw);
        width: 88vw;
        height: 100%;
        margin-bottom: 5vh;
    }
    /*HETKEL UUENDAMISEL section (no projects to show)*/
    #projektid-content img {
        display: none;
    }
    #projektid-content p {
        margin: 10vh 10vw 0;
    }
    #kontakt-content {
        gap: 10vh;
        font-size: 1.5em;
        color: black;
        text-align: center;
        display: flex;
        flex-direction: column;
        margin: 8.5vh 0 2vh;
        align-self: center;
        flex-flow: column-reverse;
    }
}