/* ═══════════════════════════════════════════════════════════
   Master FAB v1 — consolidates My Trip, Talk Story, and Rate
   into a single bottom-right launcher with a fan-out menu.
   Feature modules expose direct APIs; this file owns only the
   current consolidated launcher and its menu.
   Scoped to .hg-mfab-*.
   ═══════════════════════════════════════════════════════════ */

/* Hide the hero action-bar share row (page-meta-share-v1.js). The
   Share pill under the master FAB replaces it. Rule is defensive:
   the footer no longer loads the injector, but a cached build
   could still have the DOM in place for a brief window. */
.pm-share { display: none !important; }

/* ── Master FAB container ───────────────────────────────────── */
/* bottom: 130px sits just above the Raptive sticky footer ad on
   both desktop and mobile. Dropped from 160 → 130 so the FAB reads
   as "near the bottom of the screen" rather than floating mid-viewport.
   Keep this in sync with the stack convention. */
.hg-mfab {
  position: fixed;
  bottom: 130px;
  right: 16px;
  z-index: 9993;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none; /* children opt back in */
  transition: bottom 0.3s ease;
}
.hg-mfab,
.hg-mfab * {
  box-sizing: border-box;
}

/* ── Primary launcher button ────────────────────────────────── */
.hg-mfab-main {
  pointer-events: auto;
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(135deg, #F27A24 0%, #d8630e 100%);
  box-shadow: 0 6px 20px rgba(0,0,0,0.28);
  cursor: pointer;
  padding: 0;
  color: #fff;
  font-family: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  animation: hg-mfab-breathe 3s ease-in-out infinite;
}
.hg-mfab-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.34);
}
.hg-mfab-main:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.hg-mfab-main.is-open {
  animation: none;
  background: linear-gradient(135deg, #2f3640 0%, #1e252e 100%);
  transform: rotate(90deg);
}

.hg-mfab-icon,
.hg-mfab-close {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease, transform 0.25s ease;
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hg-mfab-close {
  opacity: 0;
  font-style: normal;
  font-size: 28px;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0.4);
}
.hg-mfab-main.is-open .hg-mfab-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scale(0.4);
}
.hg-mfab-main.is-open .hg-mfab-close {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0) scale(1);
}

/* Count badge (My Trip items) */
.hg-mfab-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hg-mfab-count:empty {
  display: none;
}
.hg-mfab-main.is-open .hg-mfab-count {
  opacity: 0;
  pointer-events: none;
}

@keyframes hg-mfab-breathe {
  0%, 100% { box-shadow: 0 6px 20px rgba(0,0,0,0.28), 0 0 0 0 rgba(242,122,36,0.45); }
  70%      { box-shadow: 0 6px 20px rgba(0,0,0,0.28), 0 0 0 14px rgba(242,122,36,0); }
}

/* ── Fan-out menu ───────────────────────────────────────────── */
.hg-mfab-menu {
  /*
    Pills all render at the widest pill's natural width:
      width: max-content   → menu sizes to the widest child's intrinsic width
      align-items: stretch → every child cross-axis fills that width
    Parent .hg-mfab (align-items: flex-end) keeps the menu right-aligned
    against the viewport edge, same as before.
  */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: max-content;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  margin-bottom: 2px;
  /* Cap the fan-out to the space above the launcher so the top pill
     can't clip off the top of the screen. The launcher is pinned at
     bottom:110-135px to clear the Raptive sticky footer ad, so it
     can't drop lower — without this cap a 6-pill menu overshoots the
     top edge on short mobile viewports and the top item is unreachable.
     Scrolls only when the menu can't fully fit; on tall screens the
     cap exceeds the content height and nothing scrolls. dvh tracks the
     real viewport as iOS Safari's URL bar shows/hides; the vh line is
     the fallback for engines without dvh. Reserve = bottom offset (130)
     + launcher (58) + gap (10) + a 16px top breathing margin. */
  max-height: calc(100vh - 214px);
  max-height: calc(100dvh - 214px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.hg-mfab.is-open .hg-mfab-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.hg-mfab-child {
  /* Disabled when menu is closed so the invisible stacked pills
     don't intercept taps on page content (e.g. a video pause icon
     positioned near the bottom-right on mobile). Re-enabled in the
     .hg-mfab.is-open state below. Mirrors the share popover pattern. */
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  min-height: 44px;
  justify-content: flex-start;
  /* No white border or drop shadow: the colored fills provide sufficient
     separation, while shadows are clipped into rectangular slabs by the
     short-viewport scroll container. */
  border: none;
  border-radius: 999px;
  color: #fff;
  background: #555;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: none;
  white-space: nowrap;
  line-height: 1;
  opacity: 0;
  transform: translateY(8px);
  transition: transform 0.15s ease, opacity 0.18s ease;
}
.hg-mfab.is-open .hg-mfab-child {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
/* Stagger the fan-out so children cascade in top-down order. */
.hg-mfab.is-open .hg-mfab-child:nth-child(1) { transition-delay: 0.02s; }
.hg-mfab.is-open .hg-mfab-child:nth-child(2) { transition-delay: 0.06s; }
.hg-mfab.is-open .hg-mfab-child:nth-child(3) { transition-delay: 0.10s; }

.hg-mfab-child:hover {
  transform: translateY(-1px);
  box-shadow: none;
  color: #fff;
}
.hg-mfab-child:focus-visible {
  /* Dual ring: visible on white pages AND dark/photo backgrounds
     (the old all-white outline vanished on white pages) */
  outline: 3px solid #F27A24;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff, 0 6px 18px rgba(0, 0, 0, 0.3);
}

.hg-mfab-child-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 15px;
}
.hg-mfab-child-icon svg {
  width: 14px;
  height: 14px;
  fill: #fff;
}

.hg-mfab-child-badge {
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: 4px;
}
.hg-mfab-child-badge:empty {
  display: none;
}

/* Per-child brand colors */
.hg-mfab-child-talk {
  background: linear-gradient(135deg, #1D9771 0%, #156d52 100%);
}
.hg-mfab-child-concierge {
  background: linear-gradient(135deg, #c3232f 0%, #9a1c26 100%);
}
.hg-mfab-child-email {
  background: linear-gradient(135deg, #00acc1 0%, #00838f 100%);
}
.hg-mfab-child-trip {
  background: linear-gradient(135deg, #1a6fbe 0%, #155da0 100%);
}
.hg-mfab-child-share {
  background: linear-gradient(135deg, #8e44ad 0%, #6c3483 100%);
}
.hg-mfab-child-share.is-active {
  background: linear-gradient(135deg, #6c3483 0%, #4a235a 100%);
}
.hg-mfab-child-rate {
  background: linear-gradient(135deg, #f5c842 0%, #e8b730 100%);
  color: #2d2a1a;
}
.hg-mfab-child-rate .hg-mfab-child-icon {
  background: rgba(0,0,0,0.15);
  color: #2d2a1a;
}

/* ── Share popover ──────────────────────────────────────────── */
/* Row of share icons that floats just above the master FAB's
   orange launcher when the Share pill is tapped.
   IMPORTANT: we explicitly anchor to the main button's height
   (58px desktop / 54px mobile) + 16px gap, NOT `bottom: 100%`.
   The parent `.hg-mfab` is a flex column whose `.hg-mfab-menu`
   child always reserves flex height even when visually hidden
   (opacity 0), so `bottom: 100%` would position the popover at
   the TOP of the reserved menu stack, several hundred pixels
   above the visible launcher — on mobile that lands the popover
   smack on top of the site header. The fixed-pixel anchor keeps
   it glued to the launcher regardless of menu state. */
.hg-mfab-share-popover {
  position: absolute;
  right: 0;
  bottom: 74px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(0,0,0,0.26), 0 2px 6px rgba(0,0,0,0.12);
  border: 2px solid #f0f2f5;
  opacity: 0;
  transform: translateY(6px) scale(0.94);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}
.hg-mfab-share-popover.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}
.hg-mfab-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: #fff;
  text-decoration: none;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  padding: 0;
}
.hg-mfab-share-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
  color: #fff;
}
.hg-mfab-share-btn .fa { font-size: 15px; color: #fff; line-height: 1; }
.hg-mfab-share-fb     { background: #1877f2; }
.hg-mfab-share-pin    { background: #e60023; }
.hg-mfab-share-x      { background: #111111; }
.hg-mfab-share-email  { background: #5a6773; }
.hg-mfab-share-copy   { background: #1D9771; }
.hg-mfab-share-copy.is-copied { background: #0f5c44; }
.hg-mfab-share-native { background: #F27A24; }

/* Desktop pages with an active right rail reserve its content area for
   newsletter, sponsor, and related modules. The shared sidebar itself does
   not become a two-column grid until 1180px; below that it is hidden, so the
   launcher must keep the normal viewport-edge position. */
@media (min-width: 1180px) {
  body:has(.has-sidebar-grid) .hg-mfab,
  body:has(.video-cover-container > aside.aside) .hg-mfab {
    right: calc(max(16px, 50vw - 645px) + 250px);
  }
}

/* ── Mobile adjustments ─────────────────────────────────────── */
@media (max-width: 600px) {
  /* When the compact utility bar exposes its Shaka quick-actions menu,
     suppress the duplicate floating launcher so it cannot cover article
     copy, tabs, or primary calls to action. Pages without that replacement
     keep the positioned launcher below. */
  body.hg-mfab-has-utility-bar .hg-mfab {
    display: none !important;
  }
  .hg-mfab {
    bottom: 110px;
    right: 12px;
  }
  .hg-mfab-main {
    width: 54px;
    height: 54px;
  }
  .hg-mfab-child {
    font-size: 13px;
    padding: 9px 14px 9px 12px;
    min-height: 42px;
  }
  /* Re-derive the fan-out cap for mobile's smaller launcher offset.
     Reserve = bottom offset (110) + launcher (54) + gap (10) + 16px. */
  .hg-mfab-menu {
    max-height: calc(100vh - 190px);
    max-height: calc(100dvh - 190px);
  }
  /* Mobile main button is 54px; keep a 16px gap above it. */
  .hg-mfab-share-popover { bottom: 70px; }
}

/* ── Print: hide everything ─────────────────────────────────── */
@media print {
  .hg-mfab { display: none !important; }
}
