.header {
    display: flex;
    align-items: center;
    height: 70px;
    background-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);

    /* background-color: black; */
}

.logo-link {
    display: flex;
    position: relative;
    align-items: center;
    left: 10%;
    width: 10%;
}

.menu {
    display: flex;
    flex-grow: 1;
    gap: 7%;
    justify-content: center;
    font-size: 20px;
    width: 80%;

    /* color: white; */
}

.menu a {
    text-decoration: none;
    position: relative;
    /* 設定相對定位，讓 ::after 可以在此 div 內部絕對定位 */
    cursor: pointer;
    /* 讓滑鼠移到上面時顯示手形游標 */
    text-decoration: none;
    /* 移除文字預設底線 */
    padding-bottom: 4px;
    /* 為底線留出空間 */
    /* 確保文字不會因為底線而變色，保持一致 */
    transition: color 0.2s ease-out;
    color: black;
    display: block;
}

.menu div::after {
    /* 針對每個選單項目的底線效果 */
    content: '';
    /* 偽元素內容為空 */
    position: absolute;
    bottom: 0;
    /* 定位在底部 */
    left: 50%;
    /* 初始從中間開始 */
    transform: translateX(-50%);
    /* 確保真正的中心對齊 */
    width: 0;
    /* 初始寬度為 0 */
    height: 1.5px;
    /* 底線高度 */
    background-color: rgb(120, 120, 120);
    /* 底線顏色，您可以自由調整 */
    transition: width 0.2s ease-out;
    /* 過渡效果 */
}

.menu div:hover::after {
    width: 100%;
    /* 懸停時寬度展開到 100% */
}

.menu div:hover {
    color: rgb(120, 120, 120);
    /* 滑鼠懸停時文字顏色 */
}

.off-screen-menu{
    display: none;
}

.header .contact {
    width: 10%;
    display: flex;
    justify-content: center;
    position: relative;
    right: 5%;
}

.header .contact_icon img {
    transition: transform 0.2s ease-out;
}

.header .contact_icon:hover img {
    transform: translateY(-3px) scale(1.05);
    /* 向上移動 3px */
}

/* 手機 */
@media (max-width: 850px) {
    .logo-link {
        width: 100%;
        left: 7%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    .menu {
        display: none;
    }

    .hamburger-menu {
        display: block;
    }

    .header .contact {
        display: none;
    }

    /* ====================漢堡選單===================*/
    .off-screen-menu {
        background-color: white;
        position: absolute;
        top: 70px;
        width: 100vw;
        z-index: 1000;
        display: none;
        opacity: 0;
        pointer-events: none;
    }

    .off-screen-menu.active {
        display: block;
        animation: slideDown 0.3s;
        opacity: 1;
        pointer-events: auto;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }

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

    .off-screen-menu ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .off-screen-menu ul a{
        text-decoration: none;
        color: #515151;
    }

    .off-screen-menu li {
        border-bottom: 1.5px solid #e0e0e0;
        padding: 18px 0;
        text-align: center;
        font-size: 20px;
        background: transparent;
        transition: background 0.2s;
        position: relative;
        cursor: pointer;
    }

    .off-screen-menu li::after {
        content: '';
        position: absolute;
        left: 50%;
        bottom: 0;
        transform: translateX(-50%);
        width: 0;
        height: 2px;
        background: #888;
        transition: width 0.2s;
    }

    .off-screen-menu li:hover::after {
        width: 80%;
    }

    .off-screen-menu li:last-child {
        /* border-bottom: none; */
        padding: 12px 0;
    }

    .off-screen-menu li a {
        display: inline-block;
        margin: 0 8px;
        vertical-align: middle;
    }

    .off-screen-menu li img {
        width: 38px;
        height: 38px;
        border-radius: 8px;
        transition: transform 0.2s ease-out;
    }

    .off-screen-menu li a:hover img {
        transform: translateY(-3px);
    }

    nav {
        padding: 1rem;
        display: flex;
        background-color: white;
    }

    .hamburger-menu {
        height: 36px;
        width: 36px;
        margin-left: auto;
        position: relative;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hamburger-menu span {
        height: 4px;
        width: 26px;
        background-color: rgb(87, 87, 87);
        border-radius: 25px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        transition: 0.3s ease;
    }

    .hamburger-menu span:nth-child(1) {
        top: 25%;
    }

    .hamburger-menu span:nth-child(3) {
        top: 75%;
    }

    .hamburger-menu.active span:nth-child(1) {
        top: 50%;
        transform: translate(-50%, -50%) rotate(45deg);
    }

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

    .hamburger-menu.active span:nth-child(3) {
        top: 50%;
        transform: translate(-50%, -50%) rotate(-45deg);
    }

}