/* ==========================================================================
   M26-R2 · FUYAO bespoke global CTA  (owner: m26r2-cta)
   --------------------------------------------------------------------------
   Content source of truth: demos/a/_partials/global-cta.html (injected
   site-wide by m26-chrome). This file is presentation only — no copy lives
   here; the controller (global-cta-widget.js) only hydrates behaviour.

   Collapsed : 52x52 deep-forest-green round chat bubble, bottom-inline-end
               (bottom-left under HTML dir=rtl / AR). NEVER auto-opens — on
               desktop OR mobile. There is no timer in the controller at all
               (M26-R2 P0-6a); the buyer taps the bubble.
   Expanded  : warm-ivory concierge card — eyebrow, two-line serif
               headline, packaging intro, 3 linear-SVG channel rows, quote
               text link and a 1-business-day reassurance note. NO form.
               The bottom note must be fully readable at 390px: no tight
               max-height / overflow:hidden, only a viewport-aware scroll
               fallback for very short screens.
   AR mirror : logical properties throughout (inset-inline-end,
               padding-inline-end, margin-inline-end); flex rows follow the
               document writing direction so icon/main/arrow flip themselves.
   z-index   : widget 3600 < mega backdrop 3500? — no: mega PANEL is 3900 and
               header 4000 (tokens in home-v3/r1-megamenu-opaque.css), and the
               body-level mega backdrop is 3500. The widget sits at 3600 so it
               paints above the page but strictly BELOW the mega panel; while
               a menu is open the controller also force-collapses the card and
               marks the widget data-cta-menu="open", which drops it under the
               backdrop so the two layers can never interleave.
   i18n      : every visible string is a data-i18n node; no English copy in CSS.
   ========================================================================== */

/* Retire the earlier heavy components (M8 four-stack dock, M9 capsule/orb).
   Keep them display:none rather than deleting DOM generated by other files. */
.fy-cta-dock, .fy-cta-dock__orb, .h8-dock[data-h8] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Pre-JS guard: if legacy markup is briefly painted before the controller
   hydrates it, hide its pill label / status dot so no text spills out. */
.fy-cta-fab__label, .fy-cta-widget .fy-cta-dot { display: none !important; }

.fy-cta-widget {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  inset-inline-end: 22px;
  z-index: 3600;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* M26-R2 P0-6b/P0-6d · LAYER INTERLOCK.
   While ANY mega-menu / drawer / language panel is open the controller marks
   the widget data-cta-menu="open". Drop the whole widget below every overlay
   layer of the site pyramid (mobile drawer 2999, mega backdrop 3500, mega
   panel 3900, header 4000, lang 4100) so the 52px bubble can never paint on
   top of an open menu — the review's "CTA 与大菜单叠压" is a stacking bug as
   much as a state bug, and the collapsed bubble alone is enough to cause it.
   The controller also force-collapses the card, so this rule only ever has to
   move a 52px circle out of the menu's way. */
.fy-cta-widget[data-cta-menu="open"] {
  z-index: 2900 !important;
  pointer-events: none !important;
}

/* ---- Collapsed: 52px forest-green circle -------------------------------- */
.fy-cta-fab {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #1B4D3E;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(20, 35, 27, .28);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.fy-cta-fab:hover {
  transform: translateY(-2px);
  background: #143B2F;
  box-shadow: 0 14px 32px rgba(20, 35, 27, .34);
}
.fy-cta-fab:focus-visible { outline: 2px solid #C8A464; outline-offset: 3px; }
.fy-cta-fab svg { display: block; width: 22px; height: 22px; }

/* ---- Expanded: 304px warm-ivory concierge card -------------------------- */
.fy-cta-dialog {
  position: relative;
  box-sizing: border-box;
  width: min(340px, calc(100vw - 32px));
  /* M26-04: the old min(78vh,470px) cap forced the "Direct factory team"
     note into a scroll area and it was read as clipped at 390px. Give the
     card the full space above the bubble; scroll ONLY on very short screens
     (landscape / 568px), and never clip with overflow:hidden. */
  max-height: calc(100vh - 160px);
  max-height: calc(100dvh - 160px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: #F6F3EC;
  color: #1F241F;
  border: 1px solid rgba(27, 77, 62, .16);
  border-radius: 18px;
  padding: 20px 18px 16px;
  box-shadow: 0 24px 56px rgba(20, 24, 21, .22);
  animation: fyCtaPop .24s cubic-bezier(.22, 1, .36, 1);
  text-align: start;
}
.fy-cta-dialog[hidden] { display: none !important; }
@keyframes fyCtaPop {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* STRICTLY CENTERED × — inline-flex + geometric SVG. */
.fy-cta-dialog__close {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  /* 44x44 touch target, 30px visual circle drawn by ::before so the card
     keeps its delicate × while the tap area meets the ≥44px hard rule. */
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #1F241F;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease;
}
.fy-cta-dialog__close::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: rgba(31, 36, 31, .08);
  transition: background-color .15s ease;
}
.fy-cta-dialog__close:hover::before { background: rgba(31, 36, 31, .16); }
.fy-cta-dialog__close:focus-visible { outline: 2px solid #C8A464; outline-offset: 0; }
.fy-cta-dialog__close svg { display: block; position: relative; z-index: 1; }

/* ---- Editorial header ---------------------------------------------------- */
.fy-cta-dialog__eyebrow {
  margin: 0 0 9px;
  margin-inline-end: 32px;
  font-family: var(--font-mono, ui-monospace, 'SFMono-Regular', Menlo, monospace);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .16em;
  line-height: 1.4;
  text-transform: uppercase;
  color: #6B7A70;
}
/* Serif headline — two independent lines so every language keeps the break,
   and padding-inline-end reserves space so it never runs under the ×. */
.fy-cta-dialog__title {
  margin: 0 0 10px;
  padding-inline-end: 30px;
  font-family: Georgia, 'Times New Roman', 'Noto Serif TC', serif;
  font-size: 23px;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -.01em;
  color: #1B2A22;
}
.fy-cta-dialog__title span { display: block; }

.fy-cta-dialog__desc {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.55;
  color: #55605A;
}

/* ---- Three direct channels ---------------------------------------------- */
.fy-cta-channels { display: flex; flex-direction: column; gap: 8px; }
/* M26-04: one flex row per channel. The arrow is pinned to the inline-end
   with margin-left:auto + flex-shrink:0 so the Email row can no longer
   float its arrow in the middle. (>=44px tall = mobile touch target.) */
.fy-cta-ch {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  box-sizing: border-box;
  border: 1px solid rgba(27, 77, 62, .16);
  border-radius: 12px;
  background: rgba(255, 255, 255, .62);
  color: #1B2A22;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.fy-cta-ch:hover { background: #FFFFFF; border-color: rgba(27, 77, 62, .34); }
/* Signature soft-sage tint marks the recommended WhatsApp channel. */
.fy-cta-ch--wa { background: #E3ECE6; border-color: rgba(27, 77, 62, .24); }
.fy-cta-ch--wa:hover { background: #D8E7DE; }

/* Linear SVG icons: geometric 28px tile, colour inherited from SVG
   currentColor so the RTL mirror needs no second set of assets. */
.fy-cta-ch__icon {
  display: inline-flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .66);
  border: 1px solid rgba(27, 77, 62, .14);
}
.fy-cta-ch--wa .fy-cta-ch__icon { color: #1B4D3E; }
.fy-cta-ch--mail .fy-cta-ch__icon { color: #233B2F; }
.fy-cta-ch--studio .fy-cta-ch__icon { color: #6B4E24; }
.fy-cta-ch__icon svg { display: block; }

.fy-cta-ch__main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
.fy-cta-ch__main strong { font-size: 13px; font-weight: 600; line-height: 1.2; }
.fy-cta-ch__main span {
  font-size: 11px;
  line-height: 1.3;
  color: #55605A;
  overflow-wrap: anywhere;
}
/* Physical margin-left is the main-end side in BOTH LTR and RTL flex rows:
   it absorbs the free space and pins ↗ to the right (left in AR) edge. */
.fy-cta-ch__arrow {
  margin-left: auto !important;
  flex: 0 0 auto !important;
  font-size: 15px;
  line-height: 1;
  color: #1B4D3E;
}

/* ---- Bottom text link + reassurance note -------------------------------- */
.fy-cta-dialog__link {
  display: flex;
  align-items: center;
  /* M26-R2 P0-6c: the ↗ is a separate span, so the markup has no literal
     whitespace before it — the gap MUST be drawn by the flex container or
     the arrow reads as "quote↗". */
  gap: 6px;
  min-height: 44px;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1B4D3E;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* Accept both the current markup (.fy-cta-dialog__link-arrow) and any page
   baked with the older bare <span aria-hidden> arrow. */
.fy-cta-dialog__link-arrow,
.fy-cta-dialog__link > span[aria-hidden="true"] {
  flex: 0 0 auto;
  margin-inline-start: 2px;
}
.fy-cta-dialog__link:hover { color: #143B2F; }

.fy-cta-dialog__note {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(27, 77, 62, .14);
  font-size: 10.5px;
  line-height: 1.4;
  letter-spacing: .01em;
  color: #6B7A70;
}

/* ---- Positioning / a11y refinements ------------------------------------- */
/* Below 1024px the widget stays a 52px bubble until tapped; the card is
   width-constrained to the viewport and never auto-opens (see the JS). */
@media (max-width: 1023px) {
  .fy-cta-widget { inset-inline-end: 16px; }
  .fy-cta-dialog {
    width: min(340px, calc(100vw - 32px));
    max-height: calc(100dvh - 160px);
    padding: 20px 18px 16px;
  }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .fy-cta-dialog { max-height: calc(100dvh - 110px); }
}
/* On small screens the persistent .h8-bottom bar occupies the bottom edge;
   lift the bubble above it so the two never overlap. */
@media (max-width: 767px) {
  .fy-cta-widget { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
/* Short screens (landscape / 568px): compact the card instead of clipping
   the note — every channel row stays ≥44px tall. */
@media (max-height: 640px) {
  .fy-cta-dialog { padding: 16px 16px 14px; }
  .fy-cta-dialog__eyebrow { margin-bottom: 6px; }
  .fy-cta-dialog__title { font-size: 20px; margin-bottom: 6px; }
  .fy-cta-dialog__desc { margin-bottom: 9px; line-height: 1.4; }
  .fy-cta-channels { gap: 6px; }
  .fy-cta-ch { padding: 7px 10px; min-height: 44px; }
  .fy-cta-dialog__note { margin-top: 5px; padding-top: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .fy-cta-fab, .fy-cta-dialog, .fy-cta-dialog__close, .fy-cta-dialog__close::before,
  .fy-cta-ch { transition: none; animation: none; }
}
