/* Floating contact buttons (markup and behaviour: includes/floating-menu.html).
 *
 * WhatsApp and Email side by side at the bottom centre, Email as a round
 * envelope icon. Same look as the two
 * buttons in the homepage hero (.tc-hero__btn--wa and --ghost), made smaller
 * and thinner: 2.5rem tall instead of 3.25rem. The hero's ghost button is
 * white on a dark photo, which would vanish over white sections, so Email
 * here is the same frosted glass in navy.
 * Standalone: no Tailwind classes, every class starts with "tsc-float-".
 * Sits below the navbar (z-index 50).
 */

.tsc-float-root {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100vw - 24px);
  font-family: inherit;
  line-height: 1.2;
  transform: translateX(-50%);
  opacity: 1;
  transition: opacity var(--tsc-float-dur, 250ms) ease, transform var(--tsc-float-dur, 250ms) ease;
}

.tsc-float-root *,
.tsc-float-root *::before,
.tsc-float-root *::after {
  box-sizing: border-box;
}

.tsc-float-root[hidden],
.tsc-float-root.tsc-float-suppressed {
  display: none;
}

.tsc-float-root.tsc-float-enter {
  opacity: 0;
  transform: translate(-50%, 12px);
}

/* ---- Buttons ------------------------------------------------------------ */

.tsc-float-btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0 1.1rem;
  overflow: hidden;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* The sweep of light across the glass on hover, as on the hero buttons. */
.tsc-float-btn::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 45%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}

.tsc-float-btn:hover {
  transform: translateY(-2px);
}

.tsc-float-btn:hover::after {
  left: 120%;
}

.tsc-float-icon {
  display: block;
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
}

/* .tsc-float-root in front out-ranks the site-wide .wa-cta colours. */
.tsc-float-root .tsc-float-btn-wa {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.08) 48%, rgba(255, 255, 255, 0) 52%),
    rgba(37, 211, 102, 0.9);
  color: #052e16;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 24px -10px rgba(37, 211, 102, 0.75),
    0 4px 12px -6px rgba(0, 0, 0, 0.35);
}

.tsc-float-root .tsc-float-btn-wa:hover {
  background-color: rgba(62, 224, 123, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 14px 28px -10px rgba(37, 211, 102, 0.85),
    0 6px 14px -6px rgba(0, 0, 0, 0.35);
}

.tsc-float-btn-mail {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 48%, rgba(255, 255, 255, 0) 52%),
    rgba(15, 31, 99, 0.85);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 24px -10px rgba(15, 31, 99, 0.7),
    0 4px 12px -6px rgba(0, 0, 0, 0.35);
}

.tsc-float-btn-mail:hover {
  background-color: rgba(26, 45, 128, 0.92);
}

/* Icon only: a circle as tall as the WhatsApp button. .tsc-float-root in
   front out-ranks the narrow-phone padding below. */
.tsc-float-root .tsc-float-btn-mail {
  width: 2.5rem;
  padding: 0;
}

.tsc-float-btn-mail .tsc-float-icon {
  width: 1.15rem;
  height: 1.15rem;
}

/* Short WhatsApp label on narrow phones, so both buttons fit on one line. */
.tsc-float-short {
  display: none;
}

@media (max-width: 419px) {
  .tsc-float-long {
    display: none;
  }

  .tsc-float-short {
    display: inline;
  }

  .tsc-float-btn {
    padding: 0 0.95rem;
  }
}

/* ---- Email popover (desktop only) -------------------------------------- */

.tsc-float-mail {
  position: relative;
}

.tsc-float-pop {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .tsc-float-mail:hover .tsc-float-pop,
  .tsc-float-mail:focus-within .tsc-float-pop {
    display: flex;
  }

  .tsc-float-pop {
    position: absolute;
    bottom: calc(100% + 0.6rem);
    left: 50%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 28px -12px rgba(15, 31, 99, 0.4);
    white-space: nowrap;
    transform: translateX(-50%);
  }

  /* An invisible bridge over the gap, so the pointer can travel from the
     button to Copy without the popover closing. */
  .tsc-float-pop::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.7rem;
  }
}

.tsc-float-pop-addr {
  color: #0f1f63;
  font-size: 0.9rem;
  font-weight: 600;
}

.tsc-float-copy {
  min-height: 2rem;
  margin: 0;
  padding: 0 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f1f63;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.tsc-float-copy:hover {
  border-color: #0f1f63;
  background: #f8fafc;
}

/* ---- Room at the end of the page --------------------------------------- */

/* The buttons never go away, so leave space under the footer's copyright
   line for them to sit in instead of covering it. */
body:has(.tsc-float-root) .tc-footer__bottom {
  padding-bottom: calc(0.85rem + 3.75rem + env(safe-area-inset-bottom, 0px));
}

/* ---- Focus and motion --------------------------------------------------- */

.tsc-float-root a:focus-visible,
.tsc-float-root button:focus-visible {
  outline: 2px solid #0f1f63;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .tsc-float-root,
  .tsc-float-btn,
  .tsc-float-btn::after {
    transition: none;
  }

  .tsc-float-btn:hover {
    transform: none;
  }
}

@media print {
  .tsc-float-root {
    display: none;
  }
}
