/* Base wrapper styling */
a[hovertitle], 
div[hovertitle],
span[hovertitle] {
  position: relative;
  display: inline-block;
  color: #74bcee;
}

/* Tooltip Body */
a[hovertitle]:hover::after, 
div[hovertitle]:hover::after,
span[hovertitle]:hover::after {
  content: attr(hovertitle);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  
  /* Required Fixes for Multi-line */
  display: block;          /* Ensures proper line box calculation */
  white-space: pre-line;   /* Preserves breaks and allows natural text wrapping */
  width: max-content;      /* Prevents the box from collapsing to zero width */
  line-height: 1.4;        /* Provides vertical clearance between lines */
  
  /* Typography & Layout */
  padding: 6px 12px;
  color: #74bcee;
  font-size: 12px;
  text-align: center;
  z-index: 101;
  
  /* Roll20 Gradient & Border Style */
  background-image: linear-gradient(to bottom, #444444, #000000, #000000, #222222);
  border: 1px solid #000000;
  border-radius: 6px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* Top Arrow Pointer (#222222 with Black Border) */
a[hovertitle]:hover::before, 
div[hovertitle]:hover::before,
span[hovertitle]:hover::before {
  content: "";
  position: absolute;
  top: calc(100% + 3px); /* Tucks the lower half of the diamond behind the main tooltip */
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  
  /* Diamond Shape Dimensions */
  width: 10px;
  height: 10px;
  
  /* Fill & Border Styling */
  background-color: #333333;
  border-top: 1px solid #000000;
  border-left: 1px solid #000000;
  
  z-index: 101; /* Sits above the body border for a smooth join */
  pointer-events: none;
}

/* Container positioning */
.hover-image-container {
  position: relative;
  display: inline-block;
}

/* Tooltip container (Hidden by default) */
.hover-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px;
  z-index: 100;
  
  /* Roll20 Styling */
  background-image: linear-gradient(to bottom, #444444, #000000, #000000, #222222);
  border: 1px solid #000000;
  border-radius: 6px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* Tooltip Image Sizing */
.hover-tooltip img {
  max-width: 300px; /* Adjust as needed */
  height: auto;
  display: block;
  border-radius: 4px;
}

/* Display on hover */
.hover-image-container:hover .hover-tooltip {
  display: block;
}

/* Top Arrow Pointer */
.hover-image-container:hover::before {
  content: "";
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background-color: #333333;
  border-top: 1px solid #000000;
  border-left: 1px solid #000000;
  z-index: 100;
  pointer-events: none;
}