/* =========================================================================
   興泰鐵工廠 共用頁首 xt-head(四版首頁共用)
   對標:大光製作所 taiko-ss.co.jp 的浮動半透明選單條(.floating__navi)
   Eric 2026-12-04:「HEADER 統一用這個 但是把右邊的漢堡MENU拔掉
                    中間的半透明BAR的文字選單改成18px」
   規則:所有樣式都掛在 .xt-head 底下,不寫全域 reset。
   網站可在 :root 設這三個變數覆蓋預設:
     --xt-x    左右版邊(跟網站共用,沒設就用下面的 clamp)
     --xt-red  品牌紅(只用在滑過/選中的小圓點)
     --xt-font 字型(Noto Sans TC,Google Fonts 要載 400;500;600)
   ========================================================================= */

.xt-head {
  --_x: var(--xt-x, clamp(20px, 2.5vw, 64px));
  --_red: var(--xt-red, #D61518);
  --_font: var(--xt-font, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif);
  --_top: 24px;            /* 長條離畫面頂(原站 30;我們長條比較高,收到 24) */
  --_h: 56px;              /* 長條高 = logo 高(原站 10px 字長條約 38px,字放大到 18 後同比例) */
  --_ease: cubic-bezier(.2, .7, .2, 1);

  /* 深底(預設):壓在影片、暗色照片上 */
  --_bar-bg: rgba(171, 179, 179, .7);        /* 原站 #abb3b3 50%;壓暗影片時字對比只剩 3 左右,加到 70% */
  --_bar-ink: rgba(0, 4, 6, .85);            /* 原站 rgba(0,4,6,.7) */
  --_scrim: rgba(0, 4, 6, .4);               /* 捲離頂端後,頁首後面墊的一層漸層(見 .xt-head__row::before) */
  --_bar-ink-strong: #000406;
  --_mark: #fff;                             /* logo 旁字標 */
  --_tool-ink: rgba(255, 255, 255, .92);
  --_tool-line: rgba(255, 255, 255, .32);
  --_tool-line-hover: rgba(255, 255, 255, .7);
  --_tool-bg: rgba(255, 255, 255, .08);

  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  font-family: var(--_font);
  -webkit-font-smoothing: antialiased;
  pointer-events: none;     /* 只有裡面的東西能點,頁首空白處不擋網頁 */
}
/* 頁首內的小 reset:用 :where() 讓權重 = 0,下面各元件自己的顏色才蓋得過 */
.xt-head :where(*, *::before, *::after) { box-sizing: border-box; }
.xt-head :where(ul) { list-style: none; margin: 0; padding: 0; }
.xt-head :where(a) { text-decoration: none; color: inherit; }
.xt-head :where(button) { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* 淺底:壓在白、淺灰段落上 */
.xt-head--on-light {
  --_bar-bg: rgba(171, 179, 179, .3);
  --_bar-ink: rgba(0, 4, 6, .78);
  --_mark: #000406;
  --_tool-ink: rgba(0, 4, 6, .8);
  --_tool-line: rgba(0, 4, 6, .16);
  --_tool-line-hover: rgba(0, 4, 6, .5);
  --_tool-bg: rgba(255, 255, 255, .5);
  --_scrim: rgba(255, 255, 255, .92);
}

/* ---------- 頁首那一排(往下捲整排藏、往上捲出現) ---------- */
.xt-head__row {
  position: relative;
  height: calc(var(--_top) + var(--_h));
  padding: var(--_top) var(--_x) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform .5s var(--_ease);
}
.xt-head__row > * { pointer-events: auto; }
/* 捲離頂端後墊一層由上往下淡掉的漸層:logo 旁字標壓在網頁內文上不會糊在一起(原站靠 mix-blend 反白,我們 logo 要保留紅色) */
.xt-head__row::before {
  content: "";
  position: absolute;
  inset: 0 0 -56px 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--_scrim) 0%, var(--_scrim) 65%, transparent 100%);
  opacity: 0;
  transition: opacity .4s ease, background .3s ease;
}
.xt-head:not(.xt-head--top):not(.xt-head--open) .xt-head__row::before { opacity: 1; }
.xt-head--hidden .xt-head__row { transform: translateY(calc(-100% - 8px)); }

/* ---------- 左:logo + 字標 ---------- */
.xt-head__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--_h);
}
.xt-head__logo {
  display: block;
  height: var(--_h);
  width: auto;
}
.xt-head__mark {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--_mark);
  transition: color .3s ease;
  white-space: nowrap;
}
.xt-head__mark-zh {
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: .12em;
  margin-right: -.12em;   /* 扣掉最後一字後面的字距,外框 = 字墨寬,下排才對得齊 */
}
/* 12-04 Eric:下排改「SINCE 1963」,寬度跟上排中文一樣(每個字一格,左右撐開) */
.xt-head__mark-en {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  line-height: 1;
  font-weight: 500;
}
.xt-head__mark-en i { font-style: normal; }
.xt-head__mark-en .xt-head__sp { width: .3em; }

/* ---------- 中:半透明圓角長條(畫面正中間) ---------- */
.xt-head__bar {
  position: absolute;
  top: var(--_top);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  width: max-content;               /* 絕對定位 left:50% 會被擠成半個畫面寬,詢價鈕會掉出長條 */
  height: var(--_h);
  padding: 0 8px 0 32px;            /* 右邊 8 = 長條圓角 12 − 詢價鈕圓角 4,同心 */
  border-radius: 12px;
  background: var(--_bar-bg);
  -webkit-backdrop-filter: blur(24px);
          backdrop-filter: blur(24px);
  transition: background-color .3s ease;
}
.xt-head__list {
  display: flex;
  flex: none;
  align-items: stretch;
  gap: 36px;
  height: 100%;
  padding-bottom: 2px;   /* Noto Sans TC 中文字墨在行框裡偏下 1px 多,量過後往上提,字墨中線 = 長條中線 */
}
.xt-head__item { position: relative; display: flex; }
.xt-head__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--_bar-ink);
  white-space: nowrap;
  transition: color .3s ease;
}
.xt-head__num {
  font-size: 14px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.xt-head__label {
  position: relative;
  font-size: 18px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .06em;
}
.xt-head__caret {
  width: 10px;
  height: 10px;
  margin-left: -2px;
  opacity: .6;
  transition: transform .3s var(--_ease);
}
/* 滑過 / 目前頁:紅色小圓點(原站同位置是 3px 黑點) */
.xt-head__label::after,
.xt-head__drop-text::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--_red);
  opacity: 0;
  scale: 0;
  transition: opacity .3s ease, scale .3s var(--_ease);
}
@media (hover: hover) {
  .xt-head__link:hover { color: var(--_bar-ink-strong); }
  .xt-head__link:hover .xt-head__label::after { opacity: 1; scale: 1; }
}
.xt-head__link:focus-visible { color: var(--_bar-ink-strong); outline: none; }
.xt-head__link:focus-visible .xt-head__label::after,
.xt-head__link[aria-current="page"] .xt-head__label::after { opacity: 1; scale: 1; }
.xt-head__item--has-sub:hover .xt-head__caret,
.xt-head__item--has-sub.is-open .xt-head__caret { transform: rotate(180deg); }

/* 下拉小卡:大項正下方置中、白底、細灰框、圓角 12、無陰影 */
.xt-head__drop {
  position: absolute;
  top: 100%;
  left: 50%;
  padding-top: 8px;                /* 長條和小卡之間的橋,滑鼠移過去不會斷 */
  transform: translate(-50%, -4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, transform .3s var(--_ease), visibility 0s linear .3s;
}
.xt-head__item--has-sub:hover .xt-head__drop,
.xt-head__item--has-sub:focus-within .xt-head__drop,
.xt-head__item--has-sub.is-open .xt-head__drop {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
.xt-head__drop-list {
  min-width: 100%;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 4, 6, .12);
}
.xt-head__drop-link {
  display: block;
  padding: 12px 20px;
  text-align: center;
  white-space: nowrap;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: .04em;
  color: rgba(0, 4, 6, .78);
  transition: color .3s ease;
}
.xt-head__drop-text { position: relative; }
@media (hover: hover) {
  .xt-head__drop-link:hover { color: #000406; }
  .xt-head__drop-link:hover .xt-head__drop-text::after { opacity: 1; scale: 1; }
}
.xt-head__drop-link:focus-visible { color: #000406; outline: none; }
.xt-head__drop-link:focus-visible .xt-head__drop-text::after { opacity: 1; scale: 1; }


/* ---------- 長條右段:語系 + 詢價單(12-04 Eric「HEADER拉長 把按鈕也包進去 數字拿掉」) ---------- */
.xt-head__bar-tools {
  display: flex;
  align-items: center;
  height: 100%;
  margin-left: 36px;               /* = 選單項目間距 */
}
.xt-head__bar-sep {
  width: 1px;
  height: 20px;
  margin-right: 28px;
  background: currentColor;
  color: var(--_bar-ink);
  opacity: .25;
}
/* 語系在長條裡改成跟選單同色的字(不再是外框膠囊) */
.xt-head__bar .xt-head__lang {
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  -webkit-backdrop-filter: none;
          backdrop-filter: none;
  color: var(--_bar-ink);
  font-size: 16px;
  padding-bottom: 2px;             /* 同選單字墨上提 */
}
/* 詢價單 = 主動作:品牌紅實心,圓角 4(= 長條圓角 12 − 內距 8,同心) */
.xt-head__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: calc(var(--_h) - 16px);
  margin-left: 28px;
  padding: 0 20px;
  border-radius: 4px;
  background: var(--_red);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: .06em;
  white-space: nowrap;
  transition: background-color .3s ease;
}
.xt-head__cta svg { width: 16px; height: 16px; flex: none; }
.xt-head__cta span { padding-bottom: 1px; }
@media (hover: hover) { .xt-head__cta:hover { background: color-mix(in srgb, var(--_red) 82%, #000); } }
.xt-head__cta:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- 右:詢價單、語系(手機選單裡用;電腦版收進長條) ---------- */
.xt-head__tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.xt-head__tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;                  /* = 半徑,字不伸進兩端半圓 */
  border-radius: 999px;
  border: 1px solid var(--_tool-line);
  background: var(--_tool-bg);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  color: var(--_tool-ink);
  font-size: 14px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .06em;
  white-space: nowrap;
  transition: border-color .3s ease, color .3s ease, background-color .3s ease;
}
.xt-head__tool svg { width: 16px; height: 16px; flex: none; }
@media (hover: hover) {
  a.xt-head__tool:hover { border-color: var(--_tool-line-hover); }
}
.xt-head__lang { gap: 10px; }
.xt-head__lang a { opacity: .5; transition: opacity .3s ease; }
.xt-head__lang a[aria-current="true"] { opacity: 1; }
@media (hover: hover) { .xt-head__lang a:hover { opacity: 1; } }
.xt-head__lang-sep { opacity: .35; }

/* 手機選單鈕(細線兩條);電腦版藏 */
.xt-head__menu-btn {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  margin-right: -8px;              /* 線的右端對齊版邊,點擊範圍維持 44 */
  color: var(--_mark);
}
.xt-head__menu-btn span {
  position: absolute;
  right: 8px;
  width: 28px;
  height: 1.5px;
  background: currentColor;
  transition: transform .4s var(--_ease), top .4s var(--_ease);
}
.xt-head__menu-btn span:nth-child(1) { top: 17px; }
.xt-head__menu-btn span:nth-child(2) { top: 25px; }
.xt-head--open .xt-head__menu-btn span:nth-child(1) { top: 21px; transform: rotate(20deg); }
.xt-head--open .xt-head__menu-btn span:nth-child(2) { top: 21px; transform: rotate(-20deg); }

/* ---------- 手機全螢幕選單 ---------- */
.xt-head__panel {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: none;
  padding: calc(var(--_top) + var(--_h) + 40px) var(--_x) 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(0, 4, 6, .92);
  -webkit-backdrop-filter: blur(32px);
          backdrop-filter: blur(32px);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  pointer-events: auto;
  transition: opacity .35s ease, visibility 0s linear .35s;
}
.xt-head--open .xt-head__panel {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
.xt-head__p-item { border-bottom: 1px solid rgba(255, 255, 255, .14); }
.xt-head__p-row { display: flex; align-items: center; justify-content: space-between; }
.xt-head__p-link {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 64px;
}
.xt-head__p-label { font-size: 22px; line-height: 1.3; font-weight: 500; letter-spacing: .06em; }
.xt-head__p-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  margin-right: -12px;
  flex: none;
}
.xt-head__p-toggle::before,
.xt-head__p-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 1.5px;
  margin: -.75px 0 0 -8px;
  background: currentColor;
  transition: transform .35s var(--_ease);
}
.xt-head__p-toggle::after { transform: rotate(90deg); }
.xt-head__p-item.is-open .xt-head__p-toggle::after { transform: rotate(0deg); }
.xt-head__p-sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .4s var(--_ease);
}
.xt-head__p-item.is-open .xt-head__p-sub { grid-template-rows: 1fr; }
.xt-head__p-sub > ul { overflow: hidden; }
.xt-head__p-sub li:last-child { padding-bottom: 16px; }
.xt-head__p-sub a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-left: 16px;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .72);
}
.xt-head__p-tools { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.xt-head__p-tools .xt-head__tool {
  height: 44px;
  padding: 0 22px;
  font-size: 16px;
  color: rgba(255, 255, 255, .92);
  border-color: rgba(255, 255, 255, .32);
  background: rgba(255, 255, 255, .06);
}

/* 選單打開時,頁首那排一律用深底配色(底下是深色選單) */
.xt-head--open {
  --_mark: #fff;
}

/* ---------- 斷點:長條放不下 → 收起,改手機選單 ----------
   18px 四項長條寬 641px;左邊 logo+字標 198、右邊控制鈕 237,
   1280 時長條兩側各還空 50px 以上;再窄右邊會貼到長條(1200 只剩 12px),所以 1279 以下就收。 */
@media (max-width: 1279px) {
  .xt-head__bar,
  .xt-head__tools > .xt-head__tool { display: none; }
  .xt-head__menu-btn { display: block; }
  .xt-head__panel { display: block; }
}
/* 1280–1439:長條收一點,跟左邊字標至少空 40 */
@media (min-width: 1280px) and (max-width: 1439px) {
  .xt-head__list { gap: 28px; }
  .xt-head__bar-tools { margin-left: 28px; }
  .xt-head__bar-sep { margin-right: 20px; }
  .xt-head__cta { margin-left: 20px; }
}
@media (max-width: 767px) {
  .xt-head { --_top: 16px; --_h: 44px; }
  .xt-head__brand { gap: 10px; }
  .xt-head__mark { gap: 5px; }
  .xt-head__mark-zh { font-size: 17px; }
  .xt-head__mark-en { font-size: 10px; }
}

/* ---------- 進場(對照原站:logo 從下往上露出、長條由小放大淡入) ---------- */
@keyframes xt-head-brand-in {
  from { clip-path: inset(100% 0 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes xt-head-bar-in {
  from { opacity: 0; scale: .8; }
  to   { opacity: 1; scale: 1; }
}
@keyframes xt-head-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.xt-head__brand { animation: xt-head-brand-in .7s cubic-bezier(.9, 0, .1, 1) .1s both; }
.xt-head__bar   { animation: xt-head-bar-in .5s var(--_ease) .35s both; }
.xt-head__tools { animation: xt-head-fade-in .5s ease .6s both; }
.xt-head--no-intro .xt-head__brand,
.xt-head--no-intro .xt-head__bar,
.xt-head--no-intro .xt-head__tools { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .xt-head :where(*, *::before, *::after) { animation: none !important; transition-duration: .01s !important; }
}
