/* ==========================================================================
   TrueMoneyTalk — footer-triggered help popup (SHARED COMPONENT)
   --------------------------------------------------------------------------
   Loaded on all 60 pages. Edit THIS file to change the popup everywhere.

   Core Web Vitals notes:
   - position:fixed only -> the element is out of flow, so it can NEVER
     contribute to CLS (Cumulative Layout Shift).
   - Hidden state uses opacity + visibility (not display:none) so the
     transition is smooth and no reflow happens on reveal.
   - No external library, no web font, no image. ~3.4 KB raw / ~1 KB gzip.
   - Respects prefers-reduced-motion.
   ========================================================================== */

.tmt-pop {
  position: fixed;
  z-index: 80;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 16px 18px;
  border-radius: var(--r-lg, 20px);
  border: 1px solid var(--line-gold, rgba(240, 180, 41, 0.34));
  background: linear-gradient(160deg, rgba(23, 34, 58, 0.97) 0%, rgba(13, 19, 33, 0.985) 100%);
  box-shadow: 0 26px 70px -24px rgba(0, 0, 0, 0.82), 0 0 0 1px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text, #eef2f8);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;

  /* --- hidden state: invisible, non-interactive, NOT focusable --- */
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  pointer-events: none;
  transition:
    opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.34s;
}

.tmt-pop.is-on {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition:
    opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;
}

/* ---------- icon ---------- */
.tmt-pop__ico {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, #ffd166 0%, #f0b429 45%, #d18f10 100%);
  color: #201703;
  box-shadow: 0 10px 26px -12px rgba(240, 180, 41, 0.6);
}
.tmt-pop__ico svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ---------- text ---------- */
.tmt-pop__body {
  flex: 1 1 auto;
  min-width: 0;
}
.tmt-pop__title {
  margin: 0;
  font-family: Sora, Inter, system-ui, sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--text, #eef2f8);
}
.tmt-pop__sub {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2, #a9b6cb);
}

/* ---------- CTA ---------- */
.tmt-pop__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 18px;
  border-radius: var(--r-sm, 10px);
  border: 1px solid transparent;
  background: linear-gradient(135deg, #ffd166 0%, #f0b429 45%, #d18f10 100%);
  color: #201703;
  font-family: Sora, Inter, system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  box-shadow: 0 14px 34px -14px rgba(240, 180, 41, 0.55);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
.tmt-pop__cta:hover,
.tmt-pop__cta:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px -14px rgba(240, 180, 41, 0.7);
}
.tmt-pop__cta svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* ---------- close button ---------- */
.tmt-pop__x {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin: -4px -6px 0 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2, rgba(148, 163, 184, 0.22));
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-2, #a9b6cb);
  cursor: pointer;
  padding: 0;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.tmt-pop__x:hover,
.tmt-pop__x:focus-visible {
  background: rgba(148, 163, 184, 0.18);
  border-color: var(--line-2, rgba(148, 163, 184, 0.4));
  color: var(--text, #eef2f8);
}
.tmt-pop__x svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* ==========================================================================
   DESKTOP (>= 768px) — compact card, bottom-right corner
   ========================================================================== */
@media (min-width: 768px) {
  .tmt-pop {
    right: 22px;
    bottom: 22px;
    width: 352px;
    max-width: calc(100vw - 44px);
  }
}

/* ==========================================================================
   MOBILE (< 768px) — full-width bottom sheet
   ========================================================================== */
@media (max-width: 767px) {
  .tmt-pop {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 15px 16px calc(15px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -18px 50px -18px rgba(0, 0, 0, 0.85);
    /* slides up from the bottom edge */
    transform: translateY(100%);
  }
  .tmt-pop.is-on {
    transform: translateY(0);
  }
  .tmt-pop__cta {
    width: 100%;
    padding: 12px 18px;
    font-size: 14px;
  }
  .tmt-pop__title {
    font-size: 15px;
  }
}

/* ---------- accessibility: honour reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .tmt-pop,
  .tmt-pop.is-on {
    transition: opacity 0.01s linear, visibility 0s;
    transform: none;
  }
}

/* ---------- print: never show ---------- */
@media print {
  .tmt-pop {
    display: none !important;
  }
}
