/* ============================================================
   賢滙 Sage — V24 生產級增強樣式（additive，全站最後載入）
   目標：相容性、排版穩定、對比度、響應式、功能組件
   不改動首頁 hero 背景圖與「×」元素
   ============================================================ */

/* ---------- 1. 相容性基礎（safe, additive） ---------- */
*, *::before, *::after { box-sizing: border-box; }
img, video, iframe, svg { max-width: 100%; }
img, video { height: auto; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- 2. 排版穩定：中文自然斷行，避免孤字及標點獨佔尾行 ---------- */
h1, h2, h3, h4, h5, h6,
.h1-line, .hero-title, .page-hero h1, .v8con h1 {
  text-wrap: balance;
  word-break: normal;
  line-break: strict;
  overflow-wrap: break-word;
}
p, li, blockquote, .lede, .sub, .lead, .pull {
  text-wrap: pretty;
  word-break: normal;
  line-break: strict;
  overflow-wrap: break-word;
}
.nowrap { white-space: nowrap; }   /* 用於品牌名/電話等不應斷開者 */

/* ---------- 3. 對比度：深色底/圖上文字保底（WCAG AA ≥4.5:1） ---------- */
/* 任何帶 .on-dark 的容器，文字轉白並加陰影，避免深字疊深底 */
.on-dark, .on-dark p, .on-dark li, .on-dark h1, .on-dark h2, .on-dark h3, .on-dark span {
  color: #fff !important;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
}

/* 有相片遮罩的服務 hero：標題必須保持白色，避免被頁面通用 h1 色覆蓋。 */
.v10bk .hero h1,
.v10led .hero h1,
.v10fin .hero h1,
.v10gr .hero h1 {
  color: #fff !important;
  text-shadow: 0 2px 14px rgba(0,0,0,.48);
}
/* 圖片英雄區未加 overlay 時的保底遮罩（僅作用於明確標記者） */
.needs-overlay { position: relative; }
.needs-overlay > .overlay-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,12,8,.30), rgba(20,12,8,.72));
  z-index: 0;
}
.needs-overlay > *:not(.overlay-scrim) { position: relative; z-index: 1; }

/* ---------- 4. 服務卡片 Grid：等高、響應式 ---------- */
.svc-grid, .service-grid, .card-grid, .grid-cards {
  display: grid;
  gap: clamp(16px, 2vw, 28px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  align-items: stretch;
}
.svc-grid > *, .service-grid > *, .card-grid > *, .grid-cards > * {
  display: flex; flex-direction: column; height: 100%;
}

/* ---------- 5. 分享按鈕 ---------- */
.share-bar { display: inline-flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.share-bar .share-label { font-size: 13px; color: var(--muted, #6B5D54); letter-spacing: .5px; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border, #E8E0D2);
  color: var(--wood, #7D4530); transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
  cursor: pointer;
}
.share-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(94,51,31,.14); background: var(--cream, #F4EFE5); }
.share-btn svg { width: 18px; height: 18px; }

/* ---------- 6. 聯絡表單成功訊息 ---------- */
.form-success {
  display: none;
  margin-top: 16px; padding: 16px 18px; border-radius: 12px;
  background: #EAF6EC; border: 1px solid #B7DFC0; color: #1E5B2C;
  font-size: 14.5px; line-height: 1.7;
}
.form-success.show { display: block; }
.form-success strong { color: #17431F; }

/* ---------- 7. 即時聯絡渠道卡（WhatsApp/Telegram/Line placeholder） ---------- */
.im-channels { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 4px; }
.im-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border, #E8E0D2); background: #fff; color: var(--ink, #1A1A1A);
  transition: transform .2s ease, box-shadow .2s ease;
}
.im-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.im-chip svg { width: 18px; height: 18px; }
.im-chip.wa { color: #128C4B; }
.im-chip.tg { color: #2AABEE; }
.im-chip.line { color: #06C755; }
.im-chip[aria-disabled="true"] { opacity: .55; cursor: default; }

/* ---------- 8. Google Maps 響應式框 ---------- */
.map-frame, .map-section iframe { width: 100%; min-height: 320px; border: 0; display: block; }

/* ---------- 9. 浮動 WhatsApp 按鈕：手機唔遮 CTA/表單/footer ---------- */
@media (max-width: 640px) {
  #sgWaFab, .wa-fab, .whatsapp-floater { bottom: max(16px, env(safe-area-inset-bottom)) !important; }
  /* 表單頁與 footer 尾段預留空間，避免浮鈕壓住最後一顆按鈕 */
  body { scroll-padding-bottom: 84px; }
  footer { padding-bottom: 96px; }
}

/* Cookie 提示出現時，浮動查詢掣按實際高度上移，避免遮住選項。 */
body.cookie-consent-open #sgWaFab,
body.cookie-consent-open .wa-fab,
body.cookie-consent-open .whatsapp-floater {
  bottom: calc(var(--cookie-banner-height, 128px) + 14px) !important;
}

/* ---------- 10. 可及性：鍵盤 focus 可見、skip link ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--red, #B3262E); outline-offset: 2px;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 2000;
  background: var(--red, #B3262E); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- 11. 防止水平溢出（zoom/resize 唔跳動） ---------- */
html, body { overflow-x: hidden; }
.container, .wrap, section > .inner { max-width: 1200px; margin-inline: auto; }

/* ---------- 12. Cookie 同意 Banner（隨 cookie-banner.js 注入；全站樣式保底） ---------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #FFFFFF; border-top: 1px solid #E8E0D2;
  box-shadow: 0 -8px 24px rgba(125,69,48,.10);
  padding: 18px 0; z-index: 1200;
  transform: translateY(110%); transition: transform .35s cubic-bezier(.2,.7,.25,1);
}
.cookie-banner.cookie-shown { transform: translateY(0); }
.cookie-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: space-between; }
.cookie-text { flex: 1 1 320px; font-size: 13px; color: #3A2F26; line-height: 1.65; }
.cookie-text strong { display: block; font-family: "Noto Serif HK","Noto Serif TC",serif; font-size: 15px; font-weight: 600; color: #1A1A1A; margin-bottom: 4px; }
.cookie-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn { font-family: inherit; font-size: 13px; font-weight: 500; padding: 9px 18px; border-radius: 999px; cursor: pointer; transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease; -webkit-tap-highlight-color: transparent; }
.cookie-decline { background: transparent; color: #6B5D54; border: 1px solid #E8E0D2; }
.cookie-decline:hover { color: #1A1A1A; border-color: #C9985A; }
.cookie-accept { background: #B3262E; color: #FFFFFF; border: 1px solid #B3262E; box-shadow: 0 3px 10px rgba(179,38,46,.20); }
.cookie-accept:hover { background: #8E1B23; }
@media (max-width: 640px) {
  .cookie-banner { padding: 14px 0; }
  .cookie-inner { padding: 0 16px; gap: 14px; }
  .cookie-actions { width: 100%; }
  .cookie-btn { flex: 1; padding: 10px 12px; }
  .cookie-text { font-size: 12px; line-height: 1.55; }
  .cookie-text strong { font-size: 14px; }
}

/* 全站互動元件最小觸控面積與可見 focus。 */
.nav-mobile-toggle,
.back-to-top,
.cookie-btn { min-width: 44px; min-height: 44px; }

/* 未接駁第三方付款前使用的安全查詢卡。 */
.payment-notice {
  max-width: 760px; margin: 0 auto; padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--border, #E8E0D2); border-radius: 18px;
  background: var(--off-white, #FBFAF7); text-align: center;
  box-shadow: 0 12px 32px rgba(94,51,31,.08);
}
.payment-notice h2 { margin-bottom: 12px; }
.payment-notice p { color: var(--muted, #6B5D54); margin-bottom: 22px; }
