/* =========================================================
   Firmament Tag Heatmap — Canvas Interactive Edition (v3.3.0)
   🌌 Refined Tooltip Anchor • Inline Count • Paragraph Layout
   ========================================================= */

/* --- Base Frame --- */
.firmament-tag-heatmap {
  position: relative;
  width: 100%;
  height: 80vh;
  min-height: 70vh !important;
  max-height: 100dvh;
  overflow: hidden;
  background: transparent;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

/* --- WordPress wrapper fix --- */
.entry-content .firmament-tag-heatmap {
  position: relative !important;
  overflow: hidden !important;
  width: 100% !important;
  height: auto !important;
  min-height: 70vh !important;
  box-sizing: border-box !important;
}

/* --- Physics boundary / Canvas host --- */
#firmament-bubbles {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block !important;
  overflow: hidden !important;
  background: transparent;
  contain: layout paint size !important;
  isolation: isolate;
  z-index: 2;
  box-sizing: border-box;
  clip-path: none !important;
  mask-image: none !important;
  -webkit-mask-image: none !important;
  transform: none !important;
  touch-action: none;
  user-select: none;
}

/* --- Canvas element --- */
#firmament-bubbles canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  user-select: none;
  z-index: 2;
  position: relative;
  touch-action: none;
  transition: filter 0.25s ease, transform 0.25s ease;
}

/* --- Background gradient overlay --- */
.firmament-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(60, 90, 150, .25), transparent 70%),
    radial-gradient(circle at 80% 20%, rgba(150, 80, 200, .2), transparent 70%);
  z-index: 1;
  pointer-events: none;
}

/* =========================================================
   ✨ Tooltip — Closer Bubble Anchor • Inline Count • Paragraph Layout
   ========================================================= */
.fthm-tooltip {
  position: fixed !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(10, 20, 50, 0.88);
  color: #e8f0ff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  pointer-events: none;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(8px) saturate(130%) brightness(1.15);
  box-shadow: 0 0 18px rgba(120, 180, 255, 0.45);
  transform: translate3d(0, 0, 0);
  user-select: none;
  border: 1px solid rgba(200, 220, 255, 0.15);
  text-align: left;
  line-height: 1.45;
  max-width: 420px; /* 🩵 paragraph readability */
  min-width: 200px;
  word-wrap: break-word;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Smooth fade-in */
.fthm-tooltip.show {
  opacity: 1;
  transform: translateY(-2px);
}

/* --- Tooltip Title + Inline Count --- */
.fthm-tooltip-name {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  letter-spacing: 0.25px;
  margin-bottom: 3px;
  display: block;
}

/* --- Description paragraph --- */
.fthm-tooltip-desc {
  font-size: 13px;
  color: #c8dcff;
  opacity: 0.95;
  line-height: 1.5;
  margin-bottom: 2px;
  text-align: justify;
  animation: fadeInDesc 0.3s ease forwards;
}

/* --- Animated fade-in for paragraph --- */
@keyframes fadeInDesc {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Tooltip hover state --- */
.fthm-tooltip[data-active="true"] {
  opacity: 1;
  transform: scale(1.02);
}

/* --- Legacy HTML fallback --- */
.fthm-bubble {
  display: none !important;
}

/* =========================================================
   📱 Mobile adjustments
   ========================================================= */
@media (max-width: 768px) {
  .firmament-tag-heatmap {
    height: calc(100dvh - 60px) !important;
    min-height: 60vh !important;
  }

  #firmament-bubbles {
    min-height: calc(100dvh - 60px) !important;
  }

  .fthm-tooltip {
    font-size: 12px;
    padding: 8px 12px;
    backdrop-filter: blur(4px) brightness(1.1);
    max-width: 320px;
  }

  .fthm-tooltip-desc {
    font-size: 12px;
  }
}
