/* Opacity Header */
.opacity-header{
    position: fixed;
    z-index: 5;
    width: 100%;
    transition: transform .3s;
}

.opacity-header-top{
    display: flex;
    justify-content: space-between;
    max-width: 1440px;
    margin: 0 auto;
    .logo{
        padding: 16px 0 16px max(calc((min(100vw, 1440px) - 1200px) / 2), 24px);
        display: flex;
        align-items: center;
        img{
            height: 48px;
        }
    }
}

.opacity-header-bottom{
    margin-top: 12px;
    box-shadow: inset 0px -1px var(--color-gray-5);
    .header-link-item{
        >.main-link{
            color: white;
        }
    }
}

@media screen and (width < 1024px) {
    .opacity-header-top .logo{
        padding: 12px 0 12px max(calc((min(100vw, 1440px) - 1200px) / 2), 24px);
        img{
            height: 30px;
        }
    }
    .opacity-header-bottom{
        display: none;
    }
}
@media screen and (width < 768px) {
    .opacity-header-top .logo img{
        height: 24px;
    }
}





/* White Header */
.white-header{
    position: fixed;
    z-index: 5;
    width: 100%;
    background-color: white;
    box-shadow: inset 0px -1px var(--color-gray-5);
    transform: translateY(-100%);
    transition: transform .3s;
    >div{
        max-width: 1440px;
        margin: 0 auto;
        display: flex;
        gap: 32px;
        justify-content: space-between;
        >.logo{
            display: flex;
            align-items: center;
            padding: 20px 40px 20px max(calc((min(100vw, 1440px) - 1200px) / 2), 24px);
            img{
                height: 40px;
            }
        }
    }
}

@media screen and (width < 1440px) {
    .white-header{
        >div > .logo{
            padding: 12px 0px 12px max(calc((min(100vw, 1440px) - 1200px) / 2), 24px);
        }
    }
}
@media screen and (width < 1280px) {
    .white-header > div{
        gap: 16px;
        > .logo img{
            height: 30px;
        }
    }
}
@media screen and (width < 768px) {
    .white-header > div> .logo img{
        height: 24px;
    }
}




/* Mobile Header */
.mobile-header-dropdown{
    position: fixed;
    z-index: 4;
    inset: var(--nav-height) 0 0 0;
    display: none;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s;
    &.active{
        transform: translateX(0%);
    }
}
.header-mobile-links-container{
    flex-grow: 1;
    background-color: var(--color-gray-2);
    padding: 24px;
    overflow: auto;
    >div{
        padding: 16px 0;
        border-bottom: 1px solid var(--color-gray-5);
        >.main-link{
            color: white;
            width: fit-content;
        }
        >.sub-link{
            color: white;
            opacity: 0.5;
            width: fit-content;
            margin-top: 8px;
            margin-left: 8px;
        }
        &:first-child{
            border-top: 1px solid var(--color-gray-5);
        }
    }
}
.header-mobile-contact{
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: var(--color-primary-1);
    padding: 24px;
}
@media screen and (width < 1024px) {
    .mobile-header-dropdown{
        display: flex;
    }
}



/* Header Component */
.header-right-container{
    display: flex;
    gap: 12px;
    align-items: center;
}
@media screen and (width < 1024px) {
    .header-right-container{
        gap: 24px;
    }
}
.header-language-container{
    position: relative;
    display: flex;
    justify-content: center;
    .dropdown{
        width: max-content;
        position: absolute;
        bottom: 0;
        z-index: 2;
        background-color: white;
        transform: translateY(100%);
        box-shadow: 0 4px 10px 0px rgba(0, 0, 0, 0.2);
        >a{
            padding: 12px 40px;
            text-align: center;
            transition: background-color .3s, color, .3s;
            &:hover{
                background-color: var(--color-primary-1);
                color: white;
            }
            &.zh{
                font-family: "Noto Sans TC", sans-serif;
                letter-spacing: 1px;
            }
            &.en{
                font-family: "Barlow", sans-serif;
                letter-spacing: 0px;
            }
        }

        &.hidden{
            display: none;
        }
    }
}
@media screen and (width < 768px) {
    .header-language-container .dropdown >a{
        padding: 8px 24px;
    }
}
.header-contact-container{
    position: relative;
    z-index: 1;
    padding: 24px 24px 24px 96px;
    display: flex;
    gap: 12px;
    align-items: center;
    >.bg{
        position: absolute;
        z-index: -1;
        inset: 0 -100vw 0 0;
        background-color: var(--color-primary-1);
        clip-path: polygon(
            80px 0, 
            100% 0,
            100% 100%,
            0 100%
        );
    }
    >h5{
        font-family: "Noto Sans TC", sans-serif !important;
        letter-spacing: 2px !important;
    }
}
@media screen and (width < 1024px) {
    .header-contact-container{
        display: none;
    }
}
.header-burger{
    display: none;
    path{
        transition: transform .3s;
        &.cancel{
            transform: translateX(100%);
        }
    }

    &.active{
        path.cancel{
            transform: translateX(0);
        }
        path.burger{
            transform: translateX(-100%);
        }
    }
}
@media screen and (width < 1024px) {
    .header-burger{
        display: block;
    }
}
.header-links-container{
    display: flex;
    justify-content: space-between;
    gap: 24px;
}
@media screen and (width < 1280px) {
    .header-links-container{
        gap: 0px;
    }
}
@media screen and (width < 1024px) {
    .header-links-container{
        display: none;
    }
}

.header-link-item{
    position: relative;
    display: flex;
    justify-content: center;
    >.main-link{
        padding: 12px;
        transition: box-shadow .3s;
        display: flex;
        align-items: center;
        &.active{
            box-shadow: inset 0px -3px var(--color-primary-1);
        }
    }
    >.sub-link-dropdown{
        position: absolute;
        bottom: 0;
        width: max-content;
        min-width: 100%;
        transform: translateY(100%);
        display: grid;
        grid-template-rows: 0fr;
        box-shadow: 0px 4px 10px rgba(0,0,0,0.2);
        transition: grid-template-rows .5s;
        >div{
            overflow: hidden;
        }
    }
    .sub-link{
        padding: 12px 24px;
        background-color: white;
        border-bottom: 1px solid var(--color-gray-4);
        text-align: center;
        transition: background-color .3s, color .3s;
        &:hover{
            background-color: var(--color-primary-1);
            color: white;
        }
    }

    &:hover{
        >.main-link{
            box-shadow: inset 0px -3px var(--color-primary-1);
        }
        >.sub-link-dropdown{
            grid-template-rows: 1fr;
        }
    }
}

@media screen and (width < 1440px) {
    .header-link-item > .main-link{
        padding: 12px 4px;
    }
}


/* Change Between Opacity Header And White Header */
#masthead.active{
    >.opacity-header{
        transform: translateY(-100%);
    }
    >.white-header{
        transform: translateY(0);
    }
}