/*
 * site-fix.css — 靜態副本補丁樣式（WhatsApp 轉化版）
 * ---------------------------------------------------------------
 * 1. 補上由 site.js 動態產生的元件樣式（手機選單、狀態訊息、工作台降級、WhatsApp 轉化元件）
 * 2. 手機端可讀性與點擊區修正（原設計最小字級 5.1px、行內連結僅 15px 高，不利手機使用）
 * 不覆寫 index-ydi_FKnk.css 既有的版面結構與斷點規則。
 */

/* ---------------------------------------------------------------- *
 * 基礎
 * ---------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  /* 避免 iOS Safari / 部分手機瀏覽器自動放大文字（會讓版面看起來「沒適配」） */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* 圖片安全上限：任何圖片都不會超出容器，避免個別預覽器渲染成大圖 */
img { max-width: 100%; }

#consultation { scroll-margin-top: 24px; }

button.button,
button.header-cta,
button.footer-cta { cursor: pointer; }

/* 原本是 <button> 的 CTA 改成 <a> 後，維持原有點擊回饋 */
a.button:active { transform: translateY(1px); }

/* 頁頭／頁尾 CTA 加上 WhatsApp 圖示（明確告知點擊後會開啟 WhatsApp） */
.wa-btn-icon { display: flex; flex-shrink: 0; }
.wa-btn-icon svg { width: 16px; height: 16px; }
.wa-link--iconized { justify-content: center; }
.footer-cta.wa-link--iconized { justify-content: flex-start; }
@media (max-width: 600px) {
  .footer-cta.wa-link--iconized { justify-content: center; }
}

/* ---------------------------------------------------------------- *
 * 手機選單
 * ---------------------------------------------------------------- */
@media (min-width: 901px) {
  .mobile-nav { display: none !important; }
}

.mobile-nav { z-index: 30; }
.site-header.menu-open { box-shadow: 0 8px 24px #1028401a; }

.mobile-nav a.mobile-cta {
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-decoration: none;
  background: #25d366;
  color: #06281a;
  font-size: 13px;
  font-weight: 700;
  padding: 14px;
}
.mobile-nav a.mobile-cta:hover { background: #1fc35c; }
.mobile-nav a.mobile-cta svg { width: 18px; height: 18px; flex-shrink: 0; }
.mobile-nav a[aria-current="page"] { color: var(--gold); }

/* 去除重複標題：同一句話在頁首與下方段落各出現一次時，
   由 site.js 標記第二份並隱藏（避免看起來像頁面壞掉） */
.is-dup { display: none !important; }
.has-dedupe { padding-top: 2px; }

/* ---------------------------------------------------------------- *
 * WhatsApp 轉化元件
 * 桌機：右下角膠囊懸浮
 * 手機（<=600px）：底部整條固定轉化條
 * ---------------------------------------------------------------- */
.wa-cta {
  position: fixed;
  z-index: 60;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
}

.wa-cta-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: 999px;
  background: #25d366;
  color: #06281a;
  text-decoration: none;
  box-shadow: 0 12px 30px #1028402e;
  transition: background .2s, transform .2s, box-shadow .2s;
}
.wa-cta-btn:hover {
  background: #1fc35c;
  color: #06281a;
  transform: translateY(-1px);
  box-shadow: 0 16px 38px #1028403d;
}
.wa-cta-btn:active { transform: translateY(0); }

/* 呼吸光圈，吸引注意但不影響點擊 */
.wa-cta-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: wa-pulse 2.8s ease-out infinite;
}
@keyframes wa-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, .55); }
  70%  { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .wa-cta-btn::before { animation: none; }
  .wa-cta-btn { transition: none; }
}

.wa-cta-icon { display: flex; flex-shrink: 0; }
.wa-cta-icon svg { width: 26px; height: 26px; }
.wa-cta-text { display: flex; flex-direction: column; line-height: 1.25; }
.wa-cta-text strong { font-size: 13px; font-weight: 700; letter-spacing: .2px; }
.wa-cta-text em { font-size: 10px; font-style: normal; opacity: .8; margin-top: 2px; }
.wa-cta-arrow { display: flex; flex-shrink: 0; opacity: .7; }
.wa-cta-arrow svg { width: 16px; height: 16px; }

/* 進入頁尾時收起（避免遮住頁尾連結） */
.wa-cta {
  transition: transform .28s ease, opacity .28s ease;
}
.wa-cta.wa-cta--hidden {
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .wa-cta { transition: none; }
}

@media (max-width: 900px) {
  html { scroll-padding-bottom: 84px; }
}

@media (max-width: 600px) {
  .wa-cta {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    padding: 0;
  }
  .wa-cta-btn {
    border-radius: 0;
    justify-content: center;
    width: 100%;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    gap: 10px;
    box-shadow: 0 -6px 22px #10284026;
  }
  .wa-cta-btn::before { display: none; }
  .wa-cta-icon svg { width: 24px; height: 24px; }
  .wa-cta-text strong { font-size: 14px; }
  .wa-cta-text em { font-size: 10.5px; }
  .wa-cta-arrow { margin-left: auto; }

  /* 避免固定轉化條遮住頁尾內容 */
  body.has-wa-cta { padding-bottom: 74px; }
}

/* ---------------------------------------------------------------- *
 * 手機可讀性與點擊區修正（原設計有 5.1px / 8px 字級、
 * 15px 高的行內連結，在手機上難以閱讀與點按）
 * ---------------------------------------------------------------- */
@media (max-width: 600px) {
  /* 字級下限 */
  .brand small { font-size: 8px; letter-spacing: .6px; }
  .notice-bar { height: auto; min-height: 32px; padding: 7px 5%; font-size: 9.5px; line-height: 1.5; }
  .eyebrow { font-size: 9.5px; letter-spacing: 1.2px; }
  .hero-assurance { font-size: 10px; }
  .trust-band small { font-size: 9px; line-height: 1.6; }
  .trust-band strong { font-size: 11.5px; }
  .footer-bottom { font-size: 9.5px; line-height: 1.7; }
  .footer-top nav { font-size: 11px; }
  .footer-disclaimer { font-size: 9.5px !important; line-height: 1.8; }

  /* 卡片內的小字（9px → 10px） */
  .case-card small,
  .regional-card > small,
  .office-sample,
  .wa-card-head-info small,
  .wa-time,
  .service-note,
  .consultation-form > small,
  .feedback-group-head small { font-size: 10px; line-height: 1.7; }

  .fraud-case-tag,
  .case-card-top span,
  .regional-card-top strong,
  .service-detail-head small,
  .preview-card-top small,
  .team-contact-item small { font-size: 9.5px; }

  /* 點擊區下限（觸控目標） */
  .footer-top nav a { min-height: 40px; padding: 8px 0; }
  .footer-bottom-links { gap: 12px; }
  .footer-bottom-links a,
  .footer-bottom a { display: inline-flex; align-items: center; min-height: 38px; }
  .text-link { display: inline-flex; align-items: center; min-height: 40px; }
  .cta-contact { gap: 6px; }
  .cta-contact a,
  .cta-contact-addr { min-height: 34px; }
  .desktop-nav a { padding: 14px 0; }

  /* 標題與段落行距，改善手機閱讀密度 */
  .section-heading p,
  .fraud-case-summary,
  .feedback-lead { line-height: 1.9; }
}

/* 手機底部轉化條存在時，頁尾最後一列保留安全距離
   （原樣式為舊的右下角懸浮客服預留 55px，現已改由 body 內距處理） */
@media (max-width: 600px) {
  .site-footer { padding-bottom: 24px; }
  .footer-bottom { padding-bottom: 18px; }
}

/* ---------------------------------------------------------------- *
 * 語言切換器（中文 / English / Bahasa Melayu）
 * 桌機：頁首 + 頁尾；手機：頁首隱藏、收在漢堡選單內 + 頁尾
 * ---------------------------------------------------------------- */
.lang-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}
.lang-switch button {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  line-height: 1;
  padding: 9px 10px;
  min-width: 34px;
  border: 0;
  background: transparent;
  color: var(--subtle, #7c8b9a);
  cursor: pointer;
  transition: background .18s, color .18s;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button:hover { background: #f4f6f8; color: var(--navy, #102840); }
.lang-switch button.is-active {
  background: var(--gold, #c5a268);
  color: var(--navy, #102840);
  cursor: default;
}
.lang-switch--footer { border-color: #ffffff33; background: transparent; }
.lang-switch--footer button { color: #cfdae4; border-color: #ffffff22; }
.lang-switch--footer button:hover { background: #ffffff14; color: #fff; }
.lang-switch--footer button.is-active { background: var(--gold, #c5a268); color: var(--navy, #102840); }
.lang-switch--mobile {
  display: flex;
  margin-top: 12px;
  width: 100%;
}
.lang-switch--mobile button { flex: 1; padding: 12px 8px; font-size: 12px; }

@media (max-width: 900px) {
  /* 手機頁首空間有限：切換器收在漢堡選單內與頁尾 */
  .site-header .lang-switch { display: none; }
}
@media (min-width: 901px) {
  .footer-bottom-links .lang-switch { margin-left: 4px; }
}

/* ---------------------------------------------------------------- *
 * 諮詢頁：WhatsApp 面板（取代原本的諮詢表單）
 * ---------------------------------------------------------------- */
.wa-panel {
  border: 1px solid var(--line, #dfe4ea);
  background: #fff;
  padding: 26px;
  border-radius: 4px;
}
.wa-panel h3 {
  font-size: 19px;
  margin: 0 0 10px;
}
.wa-panel p {
  color: var(--subtle, #7c8b9a);
  font-size: 12px;
  line-height: 1.9;
  margin: 0 0 18px;
}
.wa-panel .button {
  width: 100%;
  justify-content: space-between;
  min-height: 50px;
}
.wa-panel-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  border-top: 1px solid var(--line, #dfe4ea);
  margin-top: 20px;
  padding-top: 16px;
  font-size: 11px;
  color: var(--subtle, #7c8b9a);
}
.wa-panel-label {
  letter-spacing: 1px;
  color: #8b6d3e;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
}
.wa-panel-links a {
  color: var(--navy, #102840);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.wa-panel-links a:hover { color: #8b6d3e; }

@media (max-width: 600px) {
  .wa-panel { padding: 20px; }
  .wa-panel h3 { font-size: 17px; }
  .wa-panel-links { gap: 6px 14px; }
  .wa-panel-links a,
  .wa-panel-links span { min-height: 30px; display: inline-flex; align-items: center; }
}

/* ---------------------------------------------------------------- *
 * 英文／馬來文標籤較長的頁首與頁尾自適應
 * （中文較短不受影響；只在 :lang(en|ms) 時壓縮）
 * ---------------------------------------------------------------- */
html[lang="en"] .site-header,
html[lang="ms"] .site-header { gap: 16px; }

html[lang="en"] .desktop-nav,
html[lang="ms"] .desktop-nav { gap: 15px; font-size: 11px; }

html[lang="en"] .header-cta,
html[lang="ms"] .header-cta {
  font-size: 11.5px;
  padding: 10px 14px;
  max-width: 186px;
  white-space: normal;
  line-height: 1.2;
  text-align: center;
}

/* 手機：頁首要同時容納品牌、CTA、漢堡按鈕，空間很緊 */
@media (max-width: 600px) {
  .site-header { gap: 9px; }
  .brand { min-width: 0; overflow: hidden; }
  .brand span { min-width: 0; overflow: hidden; }
  .brand strong {
    display: block;
    font-size: 14px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .brand small { display: none; }
  .header-cta {
    font-size: 10.5px;
    padding: 8px 10px;
    max-width: 108px;
    min-height: 38px;
    gap: 5px;
    white-space: normal;
    line-height: 1.15;
    text-align: center;
    flex-shrink: 0;
  }
  .header-cta .wa-btn-icon svg { width: 13px; height: 13px; }
  .header-cta > svg:last-child { display: none; }
  .menu-button { padding: 5px; flex-shrink: 0; }
}

/* 頁尾在英文／馬來文時允許換行，避免長句撐破版面 */
html[lang="en"] .footer-bottom,
html[lang="ms"] .footer-bottom { line-height: 1.9; }
html[lang="en"] .cta-contact,
html[lang="ms"] .cta-contact { row-gap: 10px; }
html[lang="en"] .notice-bar span,
html[lang="ms"] .notice-bar span { white-space: normal; }
@media (max-width: 600px) {
  html[lang="en"] .notice-bar,
  html[lang="ms"] .notice-bar { height: auto; min-height: 32px; padding: 7px 4%; line-height: 1.5; }
}

/* ---------------------------------------------------------------- *
 * 英文／馬來文：頁首在中等寬度改用漢堡選單，避免長標籤撐破版面
 * （中文版面完全不受影響）
 * ---------------------------------------------------------------- */
@media (max-width: 1279px) {
  .site-header .lang-switch { display: none; }
}

@media (max-width: 1100px) {
  html[lang="en"] .desktop-nav,
  html[lang="ms"] .desktop-nav { display: none; }
  html[lang="en"] .menu-button,
  html[lang="ms"] .menu-button { display: block; }
}

@media (min-width: 1101px) and (max-width: 1279px) {
  html[lang="en"] .brand,
  html[lang="ms"] .brand { max-width: 260px; min-width: 0; overflow: hidden; }
  html[lang="en"] .brand strong,
  html[lang="ms"] .brand strong {
    display: block;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  html[lang="en"] .brand small,
  html[lang="ms"] .brand small { font-size: 7px; letter-spacing: .3px; }
  html[lang="en"] .header-cta,
  html[lang="ms"] .header-cta { max-width: 156px; font-size: 10.5px; padding: 9px 11px; }
}

/* ---------------------------------------------------------------- *
 * 英文／馬來文：首屏大標題原本是 nowrap（中文每行較短沒問題），
 * 譯文較長時允許換行，避免撐破版面
 * ---------------------------------------------------------------- */
html[lang="en"] .hero h1 span,
html[lang="ms"] .hero h1 span { white-space: normal; }

html[lang="en"] .hero-coordinate,
html[lang="ms"] .hero-coordinate { white-space: normal; }

/* 頁首語言切換器在 1440 以下先收起來（頁尾仍有切換器） */
@media (max-width: 1439px) {
  .site-header .lang-switch { display: none; }
}

@media (min-width: 1101px) and (max-width: 1439px) {
  html[lang="en"] .brand,
  html[lang="ms"] .brand { max-width: 280px; min-width: 0; overflow: hidden; }
  html[lang="en"] .brand strong,
  html[lang="ms"] .brand strong {
    display: block;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  html[lang="en"] .header-cta,
  html[lang="ms"] .header-cta { max-width: 170px; font-size: 11px; padding: 10px 12px; }
}

/* ---------------------------------------------------------------- *
 * 手機頁首：品牌字樣會因語種變長，必須允許壓縮，否則整個版面會被
 * 瀏覽器放大（innerWidth > 視窗寬 = 真正的不適配）
 * ---------------------------------------------------------------- */
@media (max-width: 600px) {
  .brand { flex-shrink: 1; min-width: 0; overflow: hidden; }
  .brand span { min-width: 0; overflow: hidden; }
  .menu-button { display: block; flex-shrink: 0; }

  /* 英文／馬來文的頁首 CTA 太長：手機隱藏（底部固定條與選單內都有 WhatsApp CTA） */
  html[lang="en"] .header-cta,
  html[lang="ms"] .header-cta { display: none; }

  /* 信任帶三欄在英文／馬來文放不下副標，手機只留主標並限制兩行 */
  html[lang="en"] .trust-band small,
  html[lang="ms"] .trust-band small { display: none; }
  html[lang="en"] .trust-band strong,
  html[lang="ms"] .trust-band strong {
    font-size: 10.5px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ---------------------------------------------------------------- *
 * 手機：about 頁的裝飾方塊（right:-16px）會把版面撐寬，收回容器內
 * ---------------------------------------------------------------- */
@media (max-width: 600px) {
  .about-graphic { overflow: hidden; }
  .graphic-square { right: 10px; top: 16px; width: 34px; height: 34px; }
}

/* 英文／馬來文在 about 頁的大字標語較長，手機縮小字級避免被裁切 */
@media (max-width: 600px) {
  html[lang="en"] .about-number,
  html[lang="ms"] .about-number { font-size: 30px; line-height: 1.45; }
}
