/* =============================================
   Glossary Tooltip System
   Designed to complement HTML5UP Dimension theme
   ============================================= */

/* The underline marker on matched terms */
.glossary-term {
  position: relative;
  display: inline;
  cursor: help;

  /* Dotted underline using a gradient trick — avoids border affecting layout */
  background-image: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.45) 60%,
    transparent 0%
  );
  background-position: bottom;
  background-size: 5px 1px;
  background-repeat: repeat-x;
  padding-bottom: 1px;

  /* Subtle colour tint on the term itself */
  color: inherit;
  transition: color 0.2s ease;
}

.glossary-term:hover {
  color: #ffffff;
}

/* ── Tooltip bubble ── */
.glossary-tooltip {
  /* Hidden by default */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;

  /* Positioning */
  position: fixed;        /* fixed so it never gets clipped by overflow:hidden parents */
  z-index: 9999;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;

  /* Size */
  width: 320px;
  max-width: 90vw;

  /* Appearance — glassmorphism style matching the Dimension theme */
  background: rgba(18, 18, 28, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;

  /* Text */
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  font-weight: 400;
  letter-spacing: 0.01em;

  /* Padding */
  padding: 10px 13px 11px;
}

/* Active / visible state */
.glossary-tooltip.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: none;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0s;
}

/* Tooltip header — category badge on top, full title below */
.glossary-tooltip__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.glossary-tooltip__acronym {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

.glossary-tooltip__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.3;
}

/* Tooltip body — definition */
.glossary-tooltip__definition {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  line-height: 1.58;
}

/* Small caret arrow pointing up */
.glossary-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 16px;
  width: 10px;
  height: 6px;
  background: rgba(18, 18, 28, 0.92);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

/* Flip caret when tooltip is shown above the term */
.glossary-tooltip.is-above::before {
  top: auto;
  bottom: -6px;
  clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

/* Category badge (small pill above the title) */
.glossary-tooltip__category {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.38);
  white-space: nowrap;
}
