/* PLAN-03：標準殼 Header 導覽深度（主頁／分類／About／聯繫）
   互動強調色：鮮藍 primary（不用 accent 紅） */
nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary {
    --sc-nav-emphasis: #2563eb;
    --sc-nav-emphasis-soft: color-mix(in srgb, #2563eb 10%, transparent);
    --sc-nav-hover-soft: color-mix(in srgb, #2563eb 8%, transparent);
}

nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link {
    position: relative;
    z-index: 0;
    gap: 0.3rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.015em;
    color: var(--site-text, #1a1a1a);
    border-radius: 0.4rem;
    transition: color 0.15s ease;
}

nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link .front-v53-header-icon {
    color: inherit;
    font-size: 0.95rem;
    opacity: 0.88;
}

nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link:hover,
nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link:focus,
nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-hover {
    color: var(--sc-nav-emphasis);
}

nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-active {
    color: var(--sc-nav-emphasis);
    font-weight: 700;
}

/* 分類長名：桌面省略 */
nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-item .sc-nav-link-text {
    white-space: nowrap;
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    line-height: 1.2;
    vertical-align: middle;
}

/* 雙側細分隔（分類群） */
nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-sep {
    display: flex;
    align-items: center;
    padding: 0 0.15rem;
    pointer-events: none;
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-sep-line {
    display: block;
    width: 1px;
    height: 0.9rem;
    background: var(--site-border-strong, rgba(11, 4, 84, 0.2));
    opacity: 0.85;
}

/* 桌面：背景區塊（::after）＋底線（::before） */
@media (min-width: 768px) {
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link {
        min-height: var(--front-v53-header-height, 53px);
        align-items: center;
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }

    /* 背景區塊：hover／active 淡底 */
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link::after {
        content: "";
        position: absolute;
        z-index: -1;
        left: 0.2rem;
        right: 0.2rem;
        top: 50%;
        height: 1.85rem;
        margin-top: -0.925rem;
        border-radius: 0.4rem;
        background: var(--sc-nav-hover-soft);
        opacity: 0;
        transform: scale(0.96);
        transition:
            opacity 0.16s ease,
            transform 0.16s ease,
            background-color 0.16s ease;
        pointer-events: none;
    }

    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link:hover::after,
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link:focus-visible::after,
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-hover::after,
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-active::after {
        opacity: 1;
        transform: scale(1);
    }

    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-active::after {
        background: var(--sc-nav-emphasis-soft);
    }

    /* 底線 */
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link::before {
        content: "";
        position: absolute;
        left: 0.65rem;
        right: 0.65rem;
        bottom: 0.22rem;
        height: 2px;
        border-radius: 1px;
        background: var(--sc-nav-emphasis);
        transform: scaleX(0);
        transform-origin: center;
        transition: transform 0.18s ease;
        pointer-events: none;
    }

    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link:hover::before,
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link:focus-visible::before,
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-hover::before,
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-active::before {
        transform: scaleX(1);
    }

    nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-sep {
        align-self: center;
        min-height: var(--front-v53-header-height, 53px);
    }
}

/* 手機 collapse：可換行，不加底線／背景區塊動畫 */
@media (max-width: 767.98px) {
    nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-item .sc-nav-link-text {
        max-width: none;
        white-space: normal;
    }

    nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-sep {
        display: none;
    }

    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-active,
    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link:hover {
        background: var(--sc-nav-hover-soft);
        border-radius: 0.4rem;
    }

    nav.front-v53-header:not(.front-v53-header-v2) .front-v53-nav-primary > .nav-item > .sc-nav-link.is-active {
        background: var(--sc-nav-emphasis-soft);
    }
}

/* PLAN-06：有子分類 — 名稱連結 + 獨立 ▾（手機只靠 ▾ 開樹） */
nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-has-children {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    position: relative;
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-has-children > .sc-nav-link {
    flex: 1 1 auto;
    min-width: 0;
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-caret {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0 0.35rem;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--site-text, #1a1a1a);
    box-shadow: none;
    border-radius: 0.4rem;
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-caret:hover,
nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-caret:focus-visible,
nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-caret.show {
    color: var(--sc-nav-emphasis);
    background: var(--sc-nav-hover-soft);
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-caret::after {
    margin-left: 0;
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-dropdown {
    --bs-dropdown-min-width: 12rem;
    max-width: min(20rem, 90vw);
    padding: 0.35rem 0;
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-dd-item {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18rem;
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-dd-item.sc-nav-depth-2 {
    padding-left: 1.75rem;
    font-weight: 400;
    opacity: 0.95;
}

nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-dd-item.is-active {
    color: var(--sc-nav-emphasis);
    font-weight: 700;
}

@media (min-width: 768px) {
    nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-has-children {
        min-height: var(--front-v53-header-height, 53px);
    }

    nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-caret {
        min-width: 1.75rem;
        min-height: var(--front-v53-header-height, 53px);
        padding-right: 0.45rem;
        border-radius: 0;
    }

    /* 桌面：滑過整塊（含 ▾／下拉）時連結也帶 is-hover 視覺由 JS／:hover 處理 */
    nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-has-children:hover > .sc-nav-link {
        color: var(--sc-nav-emphasis);
    }
}

@media (max-width: 767.98px) {
    nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-has-children {
        width: 100%;
    }

    nav.front-v53-header:not(.front-v53-header-v2) .sc-nav-dropdown {
        position: static !important;
        float: none;
        width: 100%;
        max-width: none;
        margin-top: 0.15rem;
        border: 0;
        box-shadow: none;
        background: var(--sc-nav-hover-soft);
        border-radius: 0.4rem;
    }
}
