﻿.primary_category > ul > li > ul > li > ul > li:before {
    content: none !important;
    display: none !important;
}

.header_toolbar ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* 桌機版頁首與主選單版型 (992px 以上) */
@media (min-width: 992px) {
    /* Desktop navigation uses the vendor's full-width menu container. */
    .wrap_navigation {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        z-index: 100;
        background: #fff;
    }

    .wrap_navigation::after {
        content: "";
        position: absolute;
        z-index: 1;
        right: 0;
        bottom: 0;
        left: 0;
        height: 4px;
        background: #4A7D6B;
        pointer-events: none;
    }

    .wrap_navigation:has(.primary_category > ul > li.hover, .primary_category > ul > li > a.active, .primary_category > ul > li > a:hover)::after {
        height: 1px;
    }

    .wrap_navigation > .container {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    /* Header and navigation remain separate rows in this site's markup. */
    .wrap_header,
    .wrap_header .container {
        height: 60px;
    }

    .wrap_header {
        position: relative;
        z-index: 101;
        background: #fff;
    }

    .wrap_header .primary_logo,
    .wrap_header .header_toolbar {
        pointer-events: auto;
    }

    .wrap_navigation .primary_logo {
        display: none;
    }

    .header_toolbar {
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        position: absolute;
        z-index: 4;
        top: 0;
        right: 30px;
        height: 60px;
        color: #222;
        font-family: inherit;
        font-size: 15px;
    }

    .header_toolbar .language {
        position: relative;
        margin-right: 36px;
    }

    .header_toolbar .language > .toolbar_btn,
    .header_toolbar #pcLoginArea a {
        display: inline-flex;
        align-items: center;
        height: 60px;
        padding: 0;
        border: 0;
        background: transparent;
        color: #222;
        font-family: inherit;
        font-size: 15px;
        font-weight: 700;
        line-height: 1;
        text-align: left;
        text-decoration: none;
        white-space: nowrap;
        cursor: pointer;
    }

    .header_toolbar .language > .toolbar_btn:after {
        content: "\f107";
        margin-left: 12px;
        color: #d0d0d0;
        font-family: "FontAwesome";
        font-weight: normal;
    }

    .header_toolbar .language > .toolbar_btn svg {
        flex: 0 0 20px;
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }

    .header_toolbar #pcLoginArea .toolbar_btn svg {
        flex: 0 0 20px;
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }

    .header_toolbar .language.open > .toolbar_btn:after {
        content: "\f106";
    }

    .header_toolbar .language > ul {
        display: none;
        position: absolute;
        z-index: 101;
        top: 50px;
        right: -8px;
        width: 160px;
        margin: 0;
        padding: 0;
        background: #fff;
        border: 0;
        border-radius: 4px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
        overflow: hidden;
    }

    .header_toolbar .language.open > ul,
    .header_toolbar .language:hover > ul,
    .header_toolbar .language:focus-within > ul {
        display: block;
    }

    .header_toolbar .language > ul > li {
        list-style: none;
    }

    .header_toolbar .language > ul > li > a {
        display: block;
        padding: 12px 16px;
        color: #222;
        font-size: 15px;
        line-height: 20px;
        text-align: left;
        text-decoration: none;
        transition: all .2s ease-in-out;
    }

    .header_toolbar .language > ul > li > a:hover,
    .header_toolbar .language > ul > li > a.active {
        color: #4a7d6b;
        background: #f1f1f1;
    }

    .header_toolbar .language > ul > li > a.active {
        color: #fff;
        background: #4a7d6b;
    }

    .header_toolbar #pcLoginArea {
        height: auto !important;
    }

    .header_toolbar #pcLoginArea nav > ul {
        display: flex !important;
        align-items: center;
        padding: 0 !important;
        margin: 0;
        list-style: none;
    }

    .header_toolbar #pcLoginArea nav > ul > li {
        display: flex;
        align-items: center;
        padding: 0 !important;
        border: 0 !important;
        list-style: none;
    }

    .header_toolbar #pcLoginArea nav > ul > li + li {
        margin-left: 0;
    }

    .header_toolbar #pcLoginArea nav > ul > li + li:before {
        content: "";
        display: block;
        width: 1px;
        height: 20px;
        margin: 0 16px;
        background: #d0d0d0;
    }

    .header_toolbar #pcLoginArea nav > ul > li > a:hover {
        color: #4a7d6b;
    }

    .primary_category {
        float: none;
        margin-left: 0;
        font-family: inherit;
    }

    .primary_category > ul > li.language,
    .primary_category > ul > li.desktop_only,
    .primary_category > ul > li.mobile_only {
        display: none;
    }

    /* 主選單置中排列；底線由導覽列共用線與連結狀態線呈現 */
    .primary_category > ul {
        box-sizing: border-box;
        position: static;
        width: 100%;
        max-width: 1760px;
        margin: 0 auto;
        padding: 0 30px;
        border-top: 1px solid #f1f1f1;
        border-bottom: 0;
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: stretch;
        text-align: center;
    }

    .primary_category > ul > li.has_children {
        position: static;
    }

    .primary_category > ul > li {
        display: flex;
        flex: 0 1 auto;
        min-width: 0;
        height: auto;
        min-height: 38px;
    }

    .primary_category > ul > li > a {
        width: 100%;
        height: auto;
        min-height: 38px;
        font-family: inherit;
        font-size: 15px;
        font-weight: bold;
        line-height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        padding: 18px 20px;
        border-bottom: 4px solid transparent;
        position: relative;
        color: #3d3d3d;
        text-align: center;
        white-space: nowrap;
        transition: color .2s ease-in-out, padding .2s ease-in-out, border-bottom-color .2s ease-in-out;
    }

    .primary_category > ul > li.hover > a,
    .primary_category > ul > li > a.active,
    .primary_category > ul > li > a:hover {
        padding: 16px 20px 20px;
        border-bottom-color: #4A7D6B;
        z-index: 101;
        color: #4a7d6b;
    }

    .primary_category > ul > li > a:after {
        display: none;
    }

    .primary_category > ul > li.has_children > a:after {
        color: #d0d0d0;
    }

    .primary_category > ul > li.has_children > a:after {
        display: inline-block;
        content: "\f107";
        flex: 0 0 auto;
        margin-left: 8px;
        font-family: "FontAwesome";
        font-weight: normal;
    }

    .primary_category > ul > li.has_children.hover > a:after {
        content: "\f106";
    }

    .primary_category > ul > li.has_children > ul {
        box-sizing: border-box;
        display: none;
        flex-wrap: wrap;
        justify-content: center;
        align-content: flex-start;
        align-items: flex-start;
        position: absolute;
        z-index: 100;
        top: 100%;
        left: 0;
        width: 100vw;
        max-height: calc(100vh - 120px);
        margin: 0;
        padding: 0 max(30px, calc((100vw - 1760px) / 2 + 30px));
        column-gap: 20px;
        overflow-x: hidden;
        overflow-y: auto;
        background-color: #fff;
        border-top: 1px solid #f1f1f1;
        box-shadow: 0 6px 2px -2px rgba(0, 0, 0, .1);
    }

    .primary_category > ul > li.has_children.hover > a ~ ul {
        display: flex;
        max-height: calc(100vh - 120px);
    }

    /* 欄寬、內距與字級沿用廠商 CSS，讓各欄以內容自然換行 */
    .primary_category > ul > li.has_children > ul > li {
        box-sizing: border-box;
        position: static;
        flex: 0 0 150px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 150px;
        height: auto;
        min-height: 0;
        margin: 0;
        padding: 32px 0;
        text-align: left;
        word-break: break-word;
    }

    .primary_category > ul > li.has_children > ul > li > a {
        display: block;
        min-width: 0;
        max-width: none;
        padding: 4px 4px 4px 0;
        margin-right: 8px;
        border-top: 0;
        color: #3d3d3d;
        font-family: inherit;
        font-size: 15px;
        font-weight: bold;
        line-height: 20px;
    }

    .primary_category > ul > li.has_children > ul > li > a:after {
        content: none;
        display: none;
    }

    .primary_category > ul > li.has_children > ul > li > ul {
        position: static;
        display: block;
        width: 100%;
        max-height: none !important;
        margin: 0;
        padding: 12px 0 0;
        overflow: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .primary_category > ul > li.has_children > ul > li > ul > li {
        width: auto;
        height: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        border: 0;
    }

    .primary_category > ul > li.has_children > ul > li > ul > li > a {
        display: block;
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        max-width: none;
        padding: 4px 4px 4px 0;
        margin: 0 8px 4px 0;
        color: #464646;
        font-family: inherit;
        font-size: 15px;
        font-weight: normal;
        line-height: 20px;
        text-align: left;
    }

    /* 第二層僅實際連結套用 Hover；無網址項目由 MenuBinding 輸出 javascript:; */
    .primary_category > ul > li.has_children > ul > li > a[href]:not([href=""]):not([href="javascript:;"]):hover,
    .primary_category > ul > li.has_children > ul > li > ul > li > a:hover,
    .primary_category > ul > li.has_children > ul > li > ul > li > a.active {
        color: #4a7d6b;
    }
}

/* 手機／平板版頁首與選單版型 (991px 以下) */
@media (max-width: 991px) {
    .wrap_navigation {
        z-index: 1001;
        left: 0;
        right: 0;
        top: var(--nav-top, 50px);
        bottom: 0;
        width: auto;
        height: auto;
        background: rgba(0, 0, 0, .5);
        overflow: hidden;
        visibility: hidden;
        opacity: 0;
        transition: opacity .3s ease-in-out, visibility .3s ease-in-out;
    }

    body.nav_open .wrap_navigation {
        visibility: visible;
        opacity: 1;
    }

    body.nav_open {
        overflow: hidden;
    }

    .wrap_navigation > .container {
        box-sizing: border-box;
        position: static;
        width: 100%;
        max-width: none;
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .wrap_navigation .mobile_nav_wrapper {
        display: none;
    }

    .wrap_header .mobile_nav_wrapper.turnoff .mobile_nav_button span {
        background: #464646;
    }

    .header_toolbar {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        position: absolute;
        z-index: 1003;
        top: 0;
        right: 90px;
        left: 180px;
        height: 50px;
        font-family: inherit;
        font-size: 13px;
        pointer-events: auto;
    }

    .header_toolbar #pcLoginArea {
        height: auto !important;
        max-width: 100%;
    }

    .header_toolbar #pcLoginArea nav > ul {
        display: flex !important;
        align-items: center;
        max-width: 100%;
        padding: 0 !important;
        margin: 0;
        list-style: none;
        white-space: nowrap;
    }

    .header_toolbar #pcLoginArea nav > ul > li {
        display: flex;
        align-items: center;
        padding: 0 !important;
        border: 0 !important;
        list-style: none;
    }

    .header_toolbar #pcLoginArea nav > ul > li + li {
        margin-left: 0;
    }

    .header_toolbar #pcLoginArea nav > ul > li + li:before {
        content: "";
        display: block;
        width: 1px;
        height: 20px;
        margin: 0 6px;
        background: #d0d0d0;
    }

    .header_toolbar #pcLoginArea nav > ul > li > a {
        color: #3d3d3d;
        font-size: 13px;
        font-weight: bold;
        text-decoration: none;
    }

    .header_toolbar #pcLoginArea .toolbar_btn svg {
        display: none;
    }

    .wrap_navigation > .language {
        display: block;
        position: absolute;
        box-sizing: border-box;
        z-index: 2;
        right: 0;
        bottom: 0;
        width: calc(100% - 90px);
        max-width: 360px;
        margin: 0;
        background: #fff;
        border-top: 1px solid #dde5e2;
        transform: translateX(100%);
        transition: transform .3s ease-in-out;
    }

    body.nav_open .wrap_navigation > .language {
        transform: translateX(0);
    }

    .wrap_navigation > .language > .toolbar_btn {
        display: flex;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
        height: 52px;
        padding: 0 24px;
        border: 0;
        background: #fff;
        color: #000;
        font-family: inherit;
        font-size: 14px;
        font-weight: bold;
        text-align: left;
    }

    .wrap_navigation > .language > .toolbar_btn svg {
        display: block;
        flex: 0 0 20px;
        width: 20px;
        height: 20px;
        margin: 0 8px 0 0;
    }

    .wrap_navigation > .language > .toolbar_btn .language-label {
        flex: 0 1 auto;
        white-space: nowrap;
    }

    .wrap_navigation > .language > .toolbar_btn:before {
        content: none;
        display: none;
    }

    .wrap_navigation > .language > .toolbar_btn:after {
        content: "\f107";
        margin-left: auto;
        color: #8a8a8a;
        font-family: "FontAwesome";
        font-weight: normal;
    }

    .wrap_navigation > .language.open > .toolbar_btn:after {
        content: "\f106";
    }

    /* 面板固定在底部，清單於按鈕下方展開 (面板向上長高) */
    .wrap_navigation > .language > ul {
        display: none;
        position: static;
        width: 100%;
        margin: 0;
        padding: 0;
        list-style: none;
        border: 0;
        box-shadow: none;
        background: #fff;
    }

    .wrap_navigation > .language.open > ul {
        display: block;
    }

    .wrap_navigation > .language > ul > li {
        margin: 0;
        padding: 0;
        border: 0;
    }

    .wrap_navigation > .language > ul > li > a {
        display: block;
        padding: 0 40px;
        color: #000;
        font-size: 13px;
        line-height: 37px;
        text-decoration: none;
    }

    .wrap_navigation > .language > ul > li > a:hover,
    .wrap_navigation > .language > ul > li > a.active {
        color: #fff;
        background: #3b8068;
    }

    .wrap_header {
        position: relative;
        top: auto;
        z-index: 1002;
    }

    .wrap_header::after {
        content: "";
        position: absolute;
        z-index: 1004;
        right: 0;
        bottom: 0;
        left: 0;
        height: 4px;
        background: #4A7D6B;
        pointer-events: none;
    }

    .wrap_header .primary_logo,
    .wrap_header .header_toolbar,
    .wrap_header .mobile_nav_wrapper {
        pointer-events: auto;
    }
}

@media (max-width: 991px) {
    .primary_category {
        box-sizing: border-box;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: calc(100% - 90px);
        max-width: 360px;
        padding-bottom: 52px;
        background: #fff;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(100%);
        transition: transform .3s ease-in-out;
    }

    body.nav_open .primary_category {
        transform: translateX(0);
    }
}

@media (max-width: 374px) {
    .primary_category,
    .wrap_navigation > .language {
        width: calc(100% - 50px);
    }
}

@media (min-width: 576px) and (max-width: 991px) {
    .header_toolbar {
        right: 151px;
        left: 200px;
    }
}

@media (max-width: 375px) {
    .wrap_header .primary_logo > a {
        width: 128px;
        height: 20px;
    }

    .header_toolbar {
        left: 145px;
        right: 90px;
        font-size: 11px;
    }

    .header_toolbar #pcLoginArea nav > ul > li > a {
        font-size: 11px;
    }
}

/* 第三層超過 8 個項目時，配合 JavaScript 顯示 Show more／Collapse 控制鈕 */
.primary_category .btn_more {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: #4a7d6b;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
}

.primary_category .btn_more:before {
    content: "\f107";
    font-family: "FontAwesome";
    font-size: 16px;
    margin-right: 10px;
}

.primary_category .btn_more:focus {
    outline: none;
}

.primary_category .btn_more:focus-visible {
    outline: 2px solid #4a7d6b;
    outline-offset: 2px;
}

.primary_category .btn_more .txt_less {
    display: none;
}

.primary_category .expanded > .more_toggle .btn_more:before,
.primary_category .panel_expanded > .more_toggle_panel .btn_more:before {
    content: "\f106";
}

.primary_category .expanded > .more_toggle .btn_more .txt_more,
.primary_category .panel_expanded > .more_toggle_panel .btn_more .txt_more {
    display: none;
}

.primary_category .expanded > .more_toggle .btn_more .txt_less,
.primary_category .panel_expanded > .more_toggle_panel .btn_more .txt_less {
    display: inline;
}

.primary_category ul.has_more:not(.expanded) > li:nth-child(n+9):not(.more_toggle) {
    display: none;
}

@media (min-width: 992px) {
    /* 桌機由面板底部的共用按鈕展開／收合第三層清單 */
    .primary_category > ul > li.has_children > ul.has_more_panel > li {
        padding-bottom: 16px;
    }

    .primary_category > ul > li.has_children > ul > li.more_toggle_panel {
        display: flex;
        justify-content: center;
        flex: 0 0 100%;
        width: 100%;
        box-sizing: border-box;
        padding: 8px 0 32px;
    }

    .primary_category > ul > li.has_children > ul > li.more_toggle_panel > .btn_more {
        margin: 0 auto;
    }

    .primary_category > ul > li.has_children > ul > li > ul > li.more_toggle {
        display: none;
    }
}

@media (max-width: 991px) {
    /* 手機由各第三層清單自己的按鈕控制，避免使用桌機共用按鈕 */
    .primary_category > ul > li.has_children > ul > li > ul > li.more_toggle {
        padding: 12px 24px 12px 56px;
        border-top: 1px solid #f1f1f1;
    }

    .primary_category > ul > li.has_children > ul > li.more_toggle_panel {
        display: none;
    }

    /* 手機主選單手風琴 (li.open 展開) */
    .primary_category {
        border-top: 0;
    }

    .primary_category a {
        display: block;
        padding: 12px 48px 12px 24px;
        color: #3d3d3d;
        font-family: inherit;
        font-size: 15px;
        font-weight: normal;
        line-height: 20px;
        transition: background-color .2s ease-in-out, color .2s ease-in-out;
    }

    .primary_category a:after {
        top: 50%;
        right: 24px;
        transform: translateY(-50%);
        color: #b5b5b5;
        font-size: 16px;
    }

    .primary_category a:only-child:after {
        display: none;
    }

    .primary_category > ul > li > a:hover:after {
        content: "\f107";
    }

    .primary_category > ul > li {
        border-bottom: 1px solid #dde5e2;
    }

    .primary_category > ul > li > a {
        padding: 16px 48px 16px 24px;
        font-weight: bold;
    }

    .primary_category > ul > li > ul,
    .primary_category > ul > li > ul > li > ul {
        display: none;
        max-height: none !important;
        margin: 0;
        padding: 0;
        overflow: visible;
        background-color: transparent;
        transition: none;
    }

    .primary_category > ul > li.open > ul,
    .primary_category > ul > li > ul > li.open > ul {
        display: block;
    }

    .primary_category > ul > li.open > a,
    .primary_category > ul > li > ul > li.open > a {
        color: #fff;
    }

    .primary_category > ul > li.open > a {
        background-color: #4a7d6b;
    }

    .primary_category > ul > li.open > a:after,
    .primary_category > ul > li > ul > li.open > a:after {
        content: "\f106";
        color: #fff;
    }

    .primary_category > ul > li > ul > li {
        border-top: 1px solid #dde5e2;
    }

    .primary_category > ul > li > ul > li > a {
        padding: 12px 48px 12px 36px;
        background-color: #edf2f0;
        font-weight: bold;
    }

    .primary_category > ul > li > ul > li:first-child > a {
        padding-top: 12px;
    }

    .primary_category > ul > li > ul > li > a:after {
        content: "\f107";
        display: block;
        font-family: "FontAwesome";
        font-weight: normal;
        color: #81a497;
    }

    .primary_category > ul > li > ul > li > a:only-child:after {
        display: none;
    }

    .primary_category > ul > li > ul > li.open > a {
        background-color: #81a497;
    }

    .primary_category > ul > li > ul > li > ul > li {
        border-top: 1px solid #f1f1f1;
    }

    .primary_category > ul > li > ul > li > ul > li > a {
        padding: 12px 48px 12px 56px;
        color: #464646;
        font-size: 14px;
        font-weight: normal;
    }

    .primary_category > ul > li > ul > li > ul > li > a.active {
        color: #4a7d6b;
    }
}

/* 繁體中文主選單文字加深；互動及展開狀態仍沿用既有狀態色 */
body[data-language="tw"] .primary_category > ul > li > a,
body[data-language="tw"] .primary_category > ul > li.has_children > ul > li > a,
body[data-language="tw"] .primary_category > ul > li.has_children > ul > li > ul > li > a {
    color: #222;
}

body[data-language="tw"] .primary_category > ul > li.hover > a,
body[data-language="tw"] .primary_category > ul > li.has_children > ul > li > a[href]:not([href=""]):not([href="javascript:;"]):hover,
body[data-language="tw"] .primary_category > ul > li.has_children > ul > li > ul > li > a:hover,
body[data-language="tw"] .primary_category > ul > li.has_children > ul > li > ul > li > a.active {
    color: #4a7d6b;
}

body[data-language="tw"] .primary_category > ul > li.open > a,
body[data-language="tw"] .primary_category > ul > li > ul > li.open > a {
    color: #fff;
}

/* Footer Related Websites：桌機三欄置中、手機改為單欄 */
@media (min-width: 992px) {
    .primary_sitemap .sitemap_related {
        width: 635px;
        max-width: 100%;
        margin: 0 auto;
    }

    .primary_sitemap .sitemap_related > .tit {
        width: auto;
    }

    .primary_sitemap .sitemap_related .sitemap_grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        column-gap: 25px;
    }
}

@media (max-width: 991px) {
    .primary_sitemap .sitemap_related .sitemap_grid {
        display: block;
        padding: 15px 30px 5px;
    }
}
