/* FLAT Law Firm — WeChat floating button, popup dialog, in-page card
   and footer strip. Namespaced .flat-wechat-* only.
   Desktop: bottom-right floating button. Mobile/tablet (≤1024px): the
   button hides and WeChat lives in the bottom contact bar instead. */

.flat-wechat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: #07c160;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
  line-height: 0;
}
.flat-wechat-fab:hover, .flat-wechat-fab:focus-visible {
  background: #06ad56;
  outline: 2px solid #fff;
  outline-offset: 2px;
}
/* The official mark is a vector path, so it never stretches: fixed box. */
.flat-wechat-fab svg {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}
/* Desktop, 01/11/2026 (supersedes the 01/11 morning right-side stack):
   the single desktop floating set is now the LEFT contact bar
   (assets/contact-bar.css + inc/contact-bar.php). Two consequences,
   both scoped to >1024px only:
   1) The right-side WeChat FAB is hidden here — otherwise the desktop
      would show two floating contact systems. Its markup stays for
      <=1024px (where it is hidden anyway) and the popup itself is
      untouched; the left bar's WeChat item opens the same popup.
   2) Flatsome's own #top-link back-to-top is REUSED (no second button)
      and stays ON THE RIGHT (Vincent 01/11/2026: the scroll-up button
      belongs on the right, not in the left column): right 22px, bottom
      24px, fixed 54px circle mirroring the left column's buttons, white
      background, burgundy border and arrow, per the left-bar design.
      The right side is otherwise empty on desktop (the FAB is hidden),
      so nothing overlaps it. Flatsome's opacity/transform show-hide
      animation and smooth scroll are untouched, so at the top of a
      page the button stays hidden (as before) and appears on scroll.
   At <=1024px none of this applies: the left bar is hidden, the FAB
   stays hidden, and flat-foundation.css lifts back-to-top above the
   mobile contact bar; at <=849px Flatsome hides back-to-top itself. */
@media (min-width: 1025px) {
  .flat-wechat-fab { display: none; }
  body.flat-legal-site #top-link.back-to-top {
    right: 22px;
    bottom: 24px;
    width: 54px;
    min-width: 54px;
    height: 54px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid var(--flat-burgundy, #940c27);
    color: var(--flat-burgundy, #940c27);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
    z-index: 998;
  }
  body.flat-legal-site #top-link.back-to-top i { color: inherit; }
  body.flat-legal-site #top-link.back-to-top:focus-visible {
    outline: 2px solid var(--flat-burgundy, #940c27);
    outline-offset: 3px;
  }
}
@media (min-width: 1025px) and (max-height: 430px) {
  body.flat-legal-site #top-link.back-to-top { bottom: 16px; }
}
/* Official-mark badge shared by the in-page card and the popup dialog:
   green disc, white mark, centred — the law-firm-minimal treatment. */
.flat-wechat-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #07c160;
  color: #fff;
  text-decoration: none;
}
.flat-wechat-mark svg {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}
a.flat-wechat-mark:hover, a.flat-wechat-mark:focus-visible {
  background: #06ad56;
  outline: 2px solid #07c160;
  outline-offset: 2px;
}
.flat-wechat-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
/* No-JS fallback: the open buttons are anchors to #flat-wechat-dialog,
   so :target opens the popup even if every script is delayed or blocked.
   When JS runs, wechat.js adds .flat-js to <html> and the dialog opens
   only via .is-open. This matters because history.replaceState() in
   close() strips the hash but does NOT unmatch :target in the browser,
   so a :target-opened dialog could never be closed by × / Esc / backdrop
   (bug 19/11/2026). Scoping :target to no-JS keeps the fallback and
   makes close() work in every state. */
html:not(.flat-js) .flat-wechat-overlay:target,
.flat-wechat-overlay.is-open { display: flex; }
.flat-wechat-dialog {
  position: relative;
  background: #fff;
  color: #222;
  border-radius: 16px;
  max-width: 360px;
  width: 100%;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.flat-wechat-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #666;
  cursor: pointer;
}
.flat-wechat-brand {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 4px;
}
.flat-wechat-title { font-size: 18px; margin: 0 0 12px; }
.flat-wechat-qr {
  width: 200px;
  height: auto;
  max-width: 100%;
  border-radius: 12px;
  background: #fff;
}
.flat-wechat-scan { margin: 12px 0 8px; font-size: 14px; }
.flat-wechat-idrow { margin: 8px 0; font-size: 14px; }
.flat-wechat-id {
  background: #f2f2f2;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 14px;
  word-break: break-all;
}
.flat-wechat-copy {
  margin-left: 6px;
  border: 0;
  border-radius: 8px;
  background: #1a3a5c;
  color: #fff;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}
.flat-wechat-copy:hover, .flat-wechat-copy:focus-visible {
  background: #0f2a44;
  outline: 2px solid #1a3a5c;
  outline-offset: 2px;
}
.flat-wechat-copyfb { display: block; min-height: 18px; font-size: 13px; color: #07c160; }
.flat-wechat-savelink { font-size: 14px; }
.flat-wechat-savelink:hover { text-decoration: underline; }
.flat-wechat-help { font-size: 13px; color: #555; margin: 10px 0 0; }

/* In-page card (contact pages + /wechat pages). */
.flat-wechat-card {
  max-width: 520px;
  margin: 32px auto;
  border: 1px solid #e2e2e2;
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  background: #fff;
}
.flat-wechat-card .flat-wechat-qr { width: 220px; }

@media (max-width: 1024px) {
  /* WeChat lives in the bottom bar at these widths — hide the floating
     button so it never overlaps the bar (the bar shows up to 1024px). */
  .flat-wechat-fab { display: none; }
}
@media (max-width: 768px) {
  .flat-wechat-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .flat-wechat-dialog {
    max-width: none;
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
}
