@charset "UTF-8";
/* ============================================================
   header 內頁版覆蓋樣式
   - 需接在 nstyle_header.css 之後載入才會生效
   - 目的：內頁不要固定浮動，讓 header 成為置頂於正常文件流的滿版整條，
     內容自然接在其下方（首頁仍維持 nstyle_header.css 的 fixed 卡片）。
   ============================================================ */
.nheader {
  /* 由 fixed 改為 relative：置頂但佔正常版面，不再蓋住下方內容 */
  position: relative;
  /* z-index 保留，使下拉選單仍能疊在後續內容之上 */
  z-index: 7;
  /* 滿版整條，但上方保留一點留白 */
  padding: 24px 0 0;
}

/* 去掉「漂浮圓角卡片」外觀，改成整條滿版的 header bar */
.nheader__inner {
  max-width: none;      /* 不再置中限寬，整條拉滿 */
  margin: 0;
  border: none;         /* 去白色外框 */
  border-radius: 0;     /* 去圓角 */
  box-shadow: none;     /* 去陰影 */
  background: #fff;     /* 單純白底，不再是漂浮漸層卡片 */
}

/* 內頁 header 是滿版白色 bar（非首頁的漂浮圓角卡片）。
   子選單預設 margin-top:0，會讓上緣 19px（含 14px 圓角）疊進白色 bar 裡，
   白底疊白底 → 上方兩個圓角被蓋掉，看起來變直角。
   解法：桌機時把子選單整個往下移到 bar 下方，露出上方圓角；
   再用透明 ::before 補回 nav 與子選單之間的空隙，維持滑鼠移入時 hover 不中斷。 */
@media (min-width: 1200px) {
  .nheader .nav-item.dropdown > .dropdown-menu {
    margin-top: 19px; /* 剛好等於重疊量，子選單緊貼白色 bar 下緣、上方圓角完整露出 */
    /* 舊版 bootstrap.css（BS3）有一條 .navbar-nav > li > .dropdown-menu
       把上緣兩個圓角設為 0（權重 0,2,1 > .nheader .dropdown-menu 的 0,2,0），
       這裡用權重更高的選擇器把 14px 圓角補回來。 */
    border-radius: 14px;
  }
  .nheader .nav-item.dropdown > .dropdown-menu::before {
    content: "";
    position: absolute;
    top: -19px;
    left: 0;
    right: 0;
    height: 19px;
  }
}

/* 內頁 BS3 的 .navbar-nav 規則（float / 負 margin）會污染新版 BS5 header 的 flex 排版，
   造成選單/按鈕位置歪掉。這裡在 .nheader 範圍還原成 BS5 行為（不分寬度）。 */
.nheader .navbar-nav {
  float: none;
  margin: 0;
}
.nheader .navbar-nav > li {
  float: none;
}

@media (max-width: 1199.98px) {
  .nheader {
    padding: 16px 0 0;
  }
  /* 收合狀態：logo 靠左、漢堡靠右，展開的選單整條落到下一列 */
  .nheader__inner .container-fluid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  /* Bootstrap 3 的 clearfix ::before/::after 在 flex 下會變成空白 flex item，
     佔走兩端位置，把 logo／漢堡擠到中間 → 移除它們 */
  .nheader__inner .container-fluid::before,
  .nheader__inner .container-fluid::after {
    display: none;
  }
  /* 展開後的選單整條落到下一列 */
  .nheader__inner .navbar-collapse {
    flex-basis: 100%;
  }

  /* ----------------------------------------------------------
     修正漢堡選單：內頁同時載入 bootstrap.css(BS3) 與 Bootstrap5。
     兩者 collapse 機制不同（BS3 展開靠 .in、BS5 靠 .show），BS3 規則會蓋掉 BS5：
       1) .collapse{display:none;visibility:hidden} → 點漢堡加了 .show 仍被隱藏（選單消失）。
       2) @media(min-width:768px) .navbar-collapse.collapse{display:block!important} → 平板寬度選單被強制常開。
     以下在 .nheader 範圍、<1200 時把 BS5 的收合行為補回。
     （≥1200 由 BS5 .navbar-expand-xl 的 display:flex!important 處理，不在此範圍。首頁未載 BS3 故不受影響。）
     ---------------------------------------------------------- */
  .nheader .navbar-collapse.collapse:not(.show) {
    display: none !important;          /* 收合狀態：確實隱藏（壓過 BS3 的 display:block!important） */
    visibility: hidden;
  }
  .nheader .navbar-collapse.collapse.show,
  .nheader .navbar-collapse.collapsing {
    display: block !important;         /* 展開狀態：顯示（壓過 BS3 的 display:none;visibility:hidden） */
    visibility: visible !important;
    height: auto !important;
    /* 浮在內容上方，不把下方內容往下推：以 .nheader__inner（position:relative）為定位基準 */
    position: absolute;
    top: calc(100% + 8px);            /* 白色 bar 下方留一點間距 */
    left: 12px;                       /* 左右留白，不貼螢幕邊 */
    right: 12px;
    z-index: 20;                       /* 蓋在頁面內容之上 */
    margin-top: 0;                     /* 取消原本 in-flow 的 margin-top:8px */
    background: #fff;                  /* 需實心背景，內容才不會透出來 */
    border: 1px solid #d3deff;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(23, 38, 89, 0.15);
    padding: 8px 16px 16px;
    max-height: calc(100vh - 120px);  /* 選單過長時可內部捲動 */
    overflow-y: auto;
  }

  /* 手機／平板：子選單（dropdown）改為靜態、滿版區塊。
     BS3 的 .dropdown-menu{position:absolute;float;min-width} 會讓子選單縮成
     內容寬度的浮框並靠邊；這裡在 .nheader 範圍還原成 BS5 導覽列的收合行為。 */
  .nheader .navbar-nav .dropdown-menu {
    position: static !important;   /* 回到文件流，不絕對定位 */
    transform: none !important;    /* 清掉 Popper 可能加的位移 */
    inset: auto !important;        /* 清掉 top/left/right 定位 */
    float: none;
    width: 100%;                   /* 滿版 */
    min-width: 0;                  /* 移除 BS3 的 min-width:160px */
    margin: 4px 0 8px;
    border-radius: 14px;           /* 補回圓角：壓過 BS3 .navbar-nav>li>.dropdown-menu 把上緣圓角設 0 */
  }
