/*
 * Header / 漢堡選單 共用樣式
 * 提供桌面下拉選單動效與手機子選單動畫，供 hf-components.js 注入元件使用。
 */

/* 桌面下拉選單樣式 */
.hf-header-brand {
    min-height: 2.5rem;
    color: #465B40;
}

.hf-header-brand--with-back {
    padding-right: 2.5rem;
}

.hf-header-brand-default,
.hf-header-back-home {
    transition: opacity 0.25s ease, visibility 0s linear 0.25s, transform 0.25s ease;
}

.hf-header-brand-default {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1.1);
    transform-origin: left center;
}

.hf-header-back-home {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: #788275;
    font-family: "Noto Sans TC", sans-serif;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: .12em;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);
    pointer-events: none;
    transition-delay: 0s, 0s, 0s;
}

.hf-header-back-home i,
.hf-header-back-home .hf-icon {
    color: #465B40;
    font-size: 3.2rem;
    line-height: 1;
}

.hf-header-brand--with-back:hover .hf-header-brand-default,
.hf-header-brand--with-back:focus-visible .hf-header-brand-default {
    opacity: 0;
    visibility: hidden;
    transform: translateX(8px) scale(1.1);
    transition-delay: 0s, 0.25s, 0s;
}

.hf-header-brand--with-back:hover .hf-header-back-home,
.hf-header-brand--with-back:focus-visible .hf-header-back-home {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0.08s, 0s, 0s;
}

.hf-header-nav-underline {
    right: 0;
    width: auto;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s ease;
}

.hf-header-nav-link:hover > .hf-header-nav-underline,
.hf-header-nav-link:focus-visible > .hf-header-nav-underline {
    transform: scaleX(1);
}

.hf-header-nav-link.hf-header-nav-current {
    color: #465B40;
    font-weight: 700;
}

.nav-dropdown-item {
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease-out;
    position: relative;
    padding-left: 28px;
}

.nav-item-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translate(-6px, -50%);
    opacity: 0;
    color: #C5A670;
    font-size: 12px;
    transition: all 0.2s ease;
}

.nav-item-line {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 60%;
    background: #C5A670;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-dropdown-text {
    transition: transform 0.2s ease;
}

.nav-dropdown-item:hover .nav-item-icon {
    transform: translate(0, -50%);
    opacity: 0.9;
}

.nav-dropdown-item:hover .nav-item-line {
    opacity: 0.9;
}

.nav-dropdown-item:hover .nav-dropdown-text {
    transform: translateX(2px);
}

.group:hover .nav-dropdown-item {
    opacity: 1;
    transform: translateY(0);
}

.group:hover .nav-dropdown-item:nth-child(1) { transition-delay: 0.05s; }
.group:hover .nav-dropdown-item:nth-child(2) { transition-delay: 0.1s; }
.group:hover .nav-dropdown-item:nth-child(3) { transition-delay: 0.15s; }
.group:hover .nav-dropdown-item:nth-child(4) { transition-delay: 0.2s; }
.group:hover .nav-dropdown-item:nth-child(5) { transition-delay: 0.25s; }

/*
 * 下拉選單「連往其他頁面」項目（例如「最新消息」）：
 * 與同選單中「頁內錨點」項目做視覺區隔，但沿用同一套金色／墨綠語彙，
 * 避免突兀 —— 僅以一條金色分隔線 + 文字改為主色系 + 小型外部連結圖示標示。
 */
.nav-dropdown-item--link {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid rgba(197, 166, 112, 0.32);
}

.nav-dropdown-extlink {
    font-size: 9px;
    margin-left: 4px;
    opacity: 0.7;
    vertical-align: 1px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-dropdown-item--link:hover .nav-dropdown-extlink {
    opacity: 1;
    transform: translate(1px, -1px);
}

/* 手機版子選單動畫 */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.submenu-item-fade {
    animation: fadeInUp 0.4s ease-out forwards;
    opacity: 0;
}

/*
 * 頁尾前螢幕網屏底圖（footer_screentone）
 * 桌面（md 以上）維持依比例隨寬度縮放（沿用元件 inline style：width:100% + aspect-ratio）。
 * 手機（md 以下）改為固定高度 + object-fit: cover，讓網屏點點維持一致大小，
 * 不會隨螢幕變窄而縮小到幾乎看不見。
 */
@media (max-width: 1320px) {
    .hf-footer-screentone {
        height: 480px !important;
        aspect-ratio: auto !important;
        object-fit: cover !important;
        object-position: center bottom !important;
    }
}

/* 手機版只取消品牌容器的桌面放大比例，保留原本 logo 與文字尺寸。 */
@media (max-width: 767px) {
    .hf-header-brand-default {
        transform: scale(1);
    }

    .hf-header-brand--with-back:hover .hf-header-brand-default,
    .hf-header-brand--with-back:focus-visible .hf-header-brand-default {
        transform: translateX(8px) scale(1);
    }
}

/* 手機版不切換成「回到首頁」，避免 hover／focus 顯示替代內容。 */
@media (max-width: 1023px) {
    .hf-header-brand--with-back .hf-header-back-home {
        display: none;
    }

    .hf-header-brand--with-back:hover .hf-header-brand-default,
    .hf-header-brand--with-back:focus-visible .hf-header-brand-default {
        opacity: 1;
        visibility: visible;
        transform: translateX(0) scale(1);
        transition-delay: 0s;
    }
}
