/* 語言切換器（作法比照 aiscreen 的地球圖示下拉）。
   掛在 header 右上角、與左側 MENU 對稱；由 tools/seo/apply_lang_switcher.py 以 ?v= 版本號引用。
   ⚠ 改了本檔請同步 bump 該腳本的 ASSET_VER 並重跑：/front/* 有 30 天快取，不換 ?v= 回訪者拿不到新檔。 */

.header .navi-container { position: relative; }

.lang { position: absolute; right: 0; top: 50%; transform: translateY(-50%); z-index: 3; }

.lang-btn {
  display: flex; align-items: center; gap: 7px;
  margin: 0; padding: 8px 12px;
  border: 0; border-radius: 999px; background: transparent;
  color: #fff; font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: .04em; line-height: 1;
  white-space: nowrap; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: background .3s;
}
.lang-btn:hover, .lang-btn:focus-visible { background: rgba(255,255,255,.12); outline: none; }
.lang-btn:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.lang-btn .globe { width: 16px; height: 16px; flex: 0 0 auto; opacity: .9; }
.lang-btn .chev { font-size: 9px; transition: transform .3s ease; }
.lang.is-open .lang-btn .chev { transform: rotate(180deg); }

.lang-menu {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 178px;
  padding: 8px; border-radius: 14px;
  background: rgba(14,16,22,.94); border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .3s, transform .3s ease, visibility .3s;
  text-align: left;
}
.lang.is-open .lang-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-menu a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; border-radius: 10px;
  font-size: 14px; line-height: 1.4; color: #E0E0E0; text-decoration: none;
  transition: background .25s;
}
.lang-menu a:hover, .lang-menu a:focus-visible { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; outline: none; }
/* 目前語言：比照 Google 的做法用高亮＋圓點標示，而不是變淡到看不見 */
.lang-menu a.is-current { pointer-events: none; font-weight: 700; background: rgba(255,255,255,.13); color: #fff; }
.lang-menu a.is-current::after { content: ""; width: 6px; height: 6px; margin-left: 12px; border-radius: 50%; background: #fff; flex: 0 0 auto; }

/* 白底 header（產品／案例／據點等頁）改深色文字、淺色選單 */
.header.white .lang-btn { color: #000; }
.header.white .lang-btn:hover, .header.white .lang-btn:focus-visible { background: rgba(0,0,0,.08); }
.header.white .lang-btn:focus-visible { box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.header.white .lang-menu { background: rgba(255,255,255,.97); border-color: rgba(0,0,0,.08); box-shadow: 0 16px 48px rgba(0,0,0,.18); }
.header.white .lang-menu a { color: #333; }
.header.white .lang-menu a:hover, .header.white .lang-menu a:focus-visible { background: rgba(0,0,0,.06); color: #000; }
.header.white .lang-menu a.is-current { background: rgba(0,0,0,.08); color: #000; }
.header.white .lang-menu a.is-current::after { background: #000; }

/* 手機：logo 居中、左邊是 MENU，右邊只留地球＋箭頭（完整語言名在全螢幕選單裡） */
@media (max-width: 767px) {
  .lang-btn { padding: 8px 10px; }
  .lang-btn .lang-name { display: none; }
  .lang-menu { min-width: 160px; }
}

/* 全螢幕選單（MENU）最底下的語言列（不加標題，讓它在 900px 高的桌機視窗內就看得到） */
.navi-fixed-list .list li.menu-langs { margin-top: 1.5rem; }
.navi-fixed-list .list li.menu-langs a {
  display: inline-block; margin: 0 .3rem .5rem; padding: .3rem .7rem;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  font-size: .8125rem; letter-spacing: .08em; color: #E0E0E0; text-decoration: none;
}
.navi-fixed-list .list li.menu-langs a:hover { border-color: #fff; color: #fff; }
.navi-fixed-list .list li.menu-langs a.is-current { background: #fff; color: #000; border-color: #fff; pointer-events: none; }
@media (min-width: 992px) {
  .navi-fixed-list .menu-list .list li.menu-langs { text-align: right; }
  .navi-fixed-list .menu-list .list li.menu-langs a { margin: 0 0 .375rem .4rem; }
}

/* 語言建議小卡（lang.js 產生）：浮出請訪客自己點，刻意不自動轉址——
   Google 不建議依推測的地理位置轉址，且爬蟲多半自美國 IP 來，
   自動導向會讓中文版（x-default）在索引裡被英文版取代。 */
.lang-hint {
  position: fixed; z-index: 8000; left: 16px; bottom: 24px;
  max-width: min(380px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px;
  padding: 13px 13px 13px 18px; border-radius: 14px;
  background: rgba(12,14,19,.88); border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 16px 48px rgba(0,0,0,.42);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  opacity: 0; transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease;
}
.lang-hint.is-on { opacity: 1; transform: none; }
.lang-hint p { flex: 1 1 auto; margin: 0; font-size: 14px; line-height: 1.5; color: #E0E0E0; }
.lang-hint .lh-go {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 16px; border-radius: 999px;
  background: #fff; color: #000; font-size: 13px; font-weight: 600; letter-spacing: .03em;
  white-space: nowrap; text-decoration: none;
}
.lang-hint .lh-go:hover { background: #e6e6e6; color: #000; text-decoration: none; }
.lang-hint .lh-x {
  flex: 0 0 auto; width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 50%;
  color: #9a9a9a; font-size: 20px; line-height: 1; cursor: pointer;
  transition: color .3s, background .3s;
}
.lang-hint .lh-x:hover { color: #fff; background: rgba(255,255,255,.08); }
@media (prefers-reduced-motion: reduce) {
  .lang-hint, .lang-menu, .lang-btn .chev { transition: none; }
}

/* 日／韓文頁的字型。all.css 以「*, body, html … !important」鎖定中文堆疊（Noto Sans TC → 微軟正黑），
   拿它排日文假名與韓文會逐字退回系統預設字型、字重不一。
   這裡用更高特異度的 html[lang] * 同樣加 !important，改成該語言的正規堆疊（英／越文用原堆疊即可）。 */
html[lang="ja"], html[lang="ja"] body, html[lang="ja"] * {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo,
               "Noto Sans TC", "Microsoft Jhenghei", Arial, sans-serif !important;
}
html[lang="ko"], html[lang="ko"] body, html[lang="ko"] * {
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic",
               "Noto Sans TC", "Microsoft Jhenghei", Arial, sans-serif !important;
}
