/* Dynamic Link Styling with Icon Support */

.character-link,
a[data-link-type="characters"] {
  color: #4a47a3;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 4px 2px 44px;
  border-radius: 3px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.character-link:before,
a[data-link-type="characters"]:before {
  content: "";
  display: inline-block;
  width: 36px;
  height: 36px;
  background-image: url('/icons/hero-icon.svg');
  background-size: 36px 36px;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.8;
  flex-shrink: 0;
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
}

.character-link:hover,
a[data-link-type="characters"]:hover {
  color: #2e2b6b;
  background: rgba(255, 255, 255, 0.2);
  text-decoration: underline;
  transform: translateY(-1px);
}

.lore-link,
.object-link,
a[data-link-type="objects"] {
  color: #6a4c93;
  background: rgba(106, 76, 147, 0.1);
  border-bottom: 1px dotted #6a4c93;
  text-decoration: none;
  padding: 2px 4px 2px 44px;
  font-weight: bold;
  transition: all 0.3s ease;
  position: relative;
}

.lore-link:before,
.object-link:before,
a[data-link-type="objects"]:before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background-image: url('/icons/lore-icon.svg');
  background-size: 36px 36px;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.8;
}

.lore-link:hover,
.object-link:hover,
a[data-link-type="objects"]:hover {
  color: #4a3269;
  background: rgba(106, 76, 147, 0.2);
  text-decoration: none;
  border-bottom: 1px solid #6a4c93;
  transform: translateY(-1px);
}

.content-link,
.chapter-link,
.song-link,
.episode-link,
a[data-link-type="chapters"],
a[data-link-type="songs"] {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
  border-bottom: 1px dotted #e74c3c;
  text-decoration: none;
  padding: 2px 4px 2px 44px;
  font-weight: bold;
  transition: all 0.3s ease;
  position: relative;
  display: inline-block;
}

.content-link:before,
.chapter-link:before,
.song-link:before,
.episode-link:before,
a[data-link-type="chapters"]:before,
a[data-link-type="songs"]:before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background-image: url('/icons/episode-icon.svg');
  background-size: 36px 36px;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.8;
}

.content-link:hover,
.chapter-link:hover,
.song-link:hover,
.episode-link:hover,
a[data-link-type="chapters"]:hover,
a[data-link-type="songs"]:hover {
  color: #c0392b;
  background: rgba(231, 76, 60, 0.2);
  text-decoration: none;
  transform: translateY(-1px);
}

/* Enhanced line-height for content areas with dynamic links */
.episode-summary p,
.lore-description p,
.episode-lyrics em,
.chapter-summary p,
.content-description p,
.dynamic-content-area p,
.dynamic-content-area {
  line-height: 1.8 !important;
  margin-bottom: 1em;
}

/* Preserve whitespace in dynamic content areas */
.dynamic-content-area {
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Disambiguation link spacing */
.disambiguation-link {
  line-height: 1.8;
  display: inline-block;
  margin: 2px 1px;
  vertical-align: baseline;
}

/* Dynamic Link Hover Preview */
.dynamic-link-preview {
  position: fixed;
  z-index: 10000;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 320px;
  min-width: 240px;
  opacity: 0;
  transform: scale(0.95) translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none; /* Start with pointer-events disabled, enable when visible */
  cursor: pointer;
  overflow: hidden;
}

.dynamic-link-preview.visible {
  pointer-events: auto; /* Enable clicks when visible */
}

.dynamic-link-preview.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.dynamic-link-preview .preview-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #f0f0f0;
}

.dynamic-link-preview .preview-title {
  font-weight: bold;
  font-size: 1.1rem;
  padding: 12px 16px 8px;
  color: #333;
  line-height: 1.3;
}

.dynamic-link-preview .preview-description {
  padding: 0 16px 12px;
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
}

.dynamic-link-preview:hover {
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
  transform: scale(1.02) translateY(-2px);
}

/* Mobile: Hide previews on small screens */
@media (max-width: 768px) {
  .dynamic-link-preview {
    display: none !important;
  }
}

