/**
 * Content links — normal link text with a favicon after the label (inline).
 * Must stay `display: inline` (not flex) so long labels wrap without
 * shoving the favicon to the far-right edge of the line on mobile.
 */

.post-content a.finsery-content-link,
.generic-modern-template-content a.finsery-content-link,
.prose a.finsery-content-link,
.post-content a.finsery-external-link,
.generic-modern-template-content a.finsery-external-link,
.prose a.finsery-external-link {
  display: inline !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  color: #3c83f6 !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit;
  text-decoration: underline !important;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
  text-decoration-skip-ink: auto;
  vertical-align: baseline;
  white-space: normal;
  overflow: visible !important;
  text-overflow: clip !important;
  box-shadow: none !important;
  outline: none !important;
  transition: color 0.2s ease;
  /* Keep underline/background paint tight to each wrapped fragment */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Generic Modern: underline only on hover */
.generic-modern-template-content a.finsery-content-link,
.generic-modern-template-content .prose a.finsery-content-link,
.generic-modern-template-content a.finsery-external-link,
.generic-modern-template-content .prose a.finsery-external-link {
  text-decoration: none !important;
}

.generic-modern-template-content a.finsery-content-link:hover,
.generic-modern-template-content .prose a.finsery-content-link:hover,
.generic-modern-template-content a.finsery-external-link:hover,
.generic-modern-template-content .prose a.finsery-external-link:hover {
  text-decoration: underline !important;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
}

.post-content a.finsery-content-link:hover,
.generic-modern-template-content a.finsery-content-link:hover,
.prose a.finsery-content-link:hover,
.post-content a.finsery-external-link:hover,
.generic-modern-template-content a.finsery-external-link:hover,
.prose a.finsery-external-link:hover {
  color: #1d4ed8 !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Atomic wrap unit: short links move wholly; long links keep last word + logo together */
.post-content a.finsery-content-link .finsery-content-link__unit,
.generic-modern-template-content a.finsery-content-link .finsery-content-link__unit,
.prose a.finsery-content-link .finsery-content-link__unit,
.post-content a.finsery-content-link .finsery-content-link__tail,
.generic-modern-template-content a.finsery-content-link .finsery-content-link__tail,
.prose a.finsery-content-link .finsery-content-link__tail {
  /* Inline (not inline-block) so the anchor's hover underline still paints */
  display: inline !important;
  white-space: nowrap !important;
  /* Space before the following word outside the link */
  margin: 0 0.2em 0 0 !important;
  padding: 0 !important;
}

/* Kill Tailwind Typography (.prose) img margins that push the logo onto its own line */
.post-content a.finsery-content-link .finsery-content-link__icon,
.generic-modern-template-content a.finsery-content-link .finsery-content-link__icon,
.prose a.finsery-content-link .finsery-content-link__icon,
.prose a.finsery-content-link img.finsery-content-link__icon,
.post-content a.finsery-external-link .finsery-external-link__icon,
.generic-modern-template-content a.finsery-external-link .finsery-external-link__icon,
.prose a.finsery-external-link .finsery-external-link__icon,
.prose a.finsery-external-link img.finsery-external-link__icon {
  display: inline-block !important;
  width: 1em !important;
  height: 1em !important;
  max-width: 1em !important;
  max-height: 1em !important;
  min-width: 1em !important;
  min-height: 1em !important;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: -0.12em !important;
  border: 0 !important;
  border-radius: 2px !important;
  background: transparent !important;
  object-fit: contain !important;
  object-position: center !important;
  image-rendering: auto;
  float: none !important;
  position: static !important;
}

.post-content a.finsery-content-link .finsery-content-link__label,
.generic-modern-template-content a.finsery-content-link .finsery-content-link__label,
.prose a.finsery-content-link .finsery-content-link__label,
.post-content a.finsery-external-link .finsery-external-link__label,
.generic-modern-template-content a.finsery-external-link .finsery-external-link__label,
.prose a.finsery-external-link .finsery-external-link__label {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  text-overflow: clip !important;
  max-width: none !important;
  white-space: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}

/* Recommended Reads: branded fallback when a post has no featured image (matches Latest articles) */
.finsery-rec-image-fallback.finsery-image-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 10rem;
  background: #e8f0ff;
  transition: transform 0.3s ease;
}

.group:hover .finsery-rec-image-fallback.finsery-image-fallback {
  transform: scale(1.03);
}

.finsery-rec-image-fallback .finsery-image-fallback__mark {
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: rgba(69, 87, 161, 0.35);
  user-select: none;
}

/* Internal link hover preview — thumbnail + title */
.finsery-internal-link-wrap {
  position: relative;
  display: inline;
}

.finsery-internal-link-preview {
  display: none !important;
  position: relative;
  box-sizing: border-box;
  width: 220px;
  max-width: calc(100vw - 24px);
  padding: 0;
  overflow: visible;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  color: #0f172a;
  text-decoration: none;
  pointer-events: none;
  z-index: 99999;
}

.finsery-internal-link-preview.is-open,
.finsery-internal-link-preview.is-open[hidden] {
  display: block !important;
}

.finsery-internal-link-preview__media {
  position: relative;
  display: block;
  overflow: visible;
  border-radius: 0.75rem 0.75rem 0 0;
  background: #f1f5f9;
}

.finsery-internal-link-preview__thumb {
  display: block !important;
  width: 100% !important;
  height: 124px !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0.75rem 0.75rem 0 0 !important;
  object-fit: cover !important;
  background: #f1f5f9;
}

.finsery-internal-link-preview__title {
  display: block;
  padding: 0.625rem 0.75rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  color: #0f172a;
}

/* Caret from the image edge, pointing outward toward the link */
.finsery-internal-link-preview__caret {
  position: absolute;
  left: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  margin-left: -8px;
  background: transparent;
  border-style: solid;
  box-sizing: border-box;
  transform: none;
  box-shadow: none;
}

/* Panel below link: arrow on top of image, pointing up (outward to the link) */
.finsery-internal-link-preview.is-below .finsery-internal-link-preview__caret {
  top: -8px;
  bottom: auto;
  border-width: 0 8px 8px 8px;
  border-color: transparent transparent #fff transparent;
  filter: drop-shadow(0 -1px 0 #e2e8f0);
}

/* Panel above link: hide image caret; use card-bottom tip instead */
.finsery-internal-link-preview:not(.is-below) .finsery-internal-link-preview__caret {
  display: none;
}

.finsery-internal-link-preview:not(.is-below)::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  z-index: 3;
  width: 0;
  height: 0;
  margin-left: -8px;
  border-style: solid;
  border-width: 8px 8px 0 8px;
  border-color: #fff transparent transparent transparent;
  filter: drop-shadow(0 1px 0 #e2e8f0);
}
