/**
 * Valhalla Pro — Link Previews: link cards in the Vikinger activity feed.
 *
 * Only theme CSS variables are used (with neutral fallbacks), so every Vikinger color preset —
 * light and dark — styles the cards automatically. Spacing follows the activity body
 * (28px side padding, 20px between blocks) and the comment text.
 */

.vhl-lp-meta {
  display: none !important;
}

.vhl-lp-card {
  display: flex;
  align-items: stretch;
  min-height: 112px;
  margin: 20px 28px 0;
  border: 1px solid var(--color-divider, #eaeaf5);
  border-radius: 12px;
  background-color: var(--color-box-background-alt, #fcfcfd);
  color: var(--color-text, #3e3f5e);
  font-family: var(--vikinger-font-family-primary, inherit);
  text-decoration: none;
  white-space: normal;
  word-break: normal;
  overflow: hidden;
  position: relative;
  transition: box-shadow .2s ease-in-out, transform .2s ease-in-out, border-color .2s ease-in-out;
}

.vhl-lp-card:hover {
  border-color: var(--color-border, #dedeea);
  box-shadow: var(--color-overbox-shadow, 3px 5px 20px 0 rgba(94, 92, 154, .12));
  transform: translate(0, -2px);
  color: var(--color-text, #3e3f5e);
}

/* Keyboard focus ring (browsers without :focus-visible keep it for every focus). */
.vhl-lp-card:focus,
.vhl-lp-card:focus-visible {
  outline: 2px solid var(--color-secondary, #615dfa);
  outline-offset: 2px;
}

.vhl-lp-card:focus:not(:focus-visible) {
  outline: none;
}

.vhl-lp-card:focus-visible {
  outline: 2px solid var(--color-secondary, #615dfa);
  outline-offset: 2px;
}

/* Image ----------------------------------------------------------------- */
.vhl-lp-card-media {
  display: block;
  flex: 0 0 144px;
  position: relative;
  background-color: var(--color-box-highlight-background, #f7f7fb);
  overflow: hidden;
}

.vhl-lp-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity .25s ease-in-out;
}

.vhl-lp-card-loaded .vhl-lp-card-image {
  opacity: 1;
}

/* Wide images (Open Graph banners): image on top, full width, 1.91:1. */
.vhl-lp-card-large {
  flex-direction: column;
}

.vhl-lp-card-large .vhl-lp-card-media {
  flex: none;
  width: 100%;
  height: 0;
  padding-top: 52.356%;
  border-bottom: 1px solid var(--color-divider, #eaeaf5);
}

/* Text ------------------------------------------------------------------ */
.vhl-lp-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 16px 20px;
}

.vhl-lp-card-large .vhl-lp-card-body {
  padding: 18px 24px 20px;
}

.vhl-lp-card-domain {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--color-text-alt, #8f91ac);
  font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.vhl-lp-card-domain-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vhl-lp-card-icon {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-inline-end: 6px;
  fill: var(--color-icon, #adafca);
}

/* Set by the script while the theme's icon sprite is not on the page. */
.vhl-lp-noicons .vhl-lp-card-icon {
  display: none;
}

.vhl-lp-card-title {
  display: -webkit-box;
  margin-top: 8px;
  color: var(--color-text, #3e3f5e);
  font-size: calc((14 / var(--vikinger-font-size-base, 16)) * 1rem);
  font-weight: 700;
  line-height: 1.4285714286em;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  transition: color .2s ease-in-out;
}

.vhl-lp-card:hover .vhl-lp-card-title {
  color: var(--color-primary-dark, #00c7d9);
}

.vhl-lp-card-text {
  display: -webkit-box;
  margin-top: 6px;
  color: var(--color-text-alt, #8f91ac);
  font-size: calc((13 / var(--vikinger-font-size-base, 16)) * 1rem);
  font-weight: 500;
  line-height: 1.5384615385em;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.vhl-lp-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Cards without an image only need the text height. */
.vhl-lp-card-noimage {
  min-height: 0;
}

/* Compact card inside comments ----------------------------------------------- */
.vhl-lp-card-small {
  min-height: 84px;
  max-width: 560px;
  margin: 12px 0 2px;
}

.vhl-lp-card-small .vhl-lp-card-media {
  flex-basis: 96px;
}

.vhl-lp-card-small .vhl-lp-card-body {
  padding: 12px 16px;
}

.vhl-lp-card-small .vhl-lp-card-title {
  margin-top: 6px;
  font-size: calc((13 / var(--vikinger-font-size-base, 16)) * 1rem);
}

.vhl-lp-card-small .vhl-lp-card-text {
  margin-top: 4px;
  font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
  -webkit-line-clamp: 1;
}

.vhl-lp-card-small.vhl-lp-card-noimage {
  min-height: 0;
}

/* Replies sit on the alternative box color: keep the card distinguishable. */
.post-comment:not(.reply-1) .vhl-lp-card-small {
  background-color: var(--color-box-background, #fff);
}

/* Comment being edited: the theme swaps the text for a form. */
.post-comment-text-editing .vhl-lp-card {
  display: none;
}

/* Small screens ------------------------------------------------------------ */
@media screen and (max-width: 680px) {
  .vhl-lp-card {
    min-height: 96px;
  }

  .vhl-lp-card-media {
    flex-basis: 104px;
  }

  .vhl-lp-card-body {
    padding: 12px 16px;
  }

  .vhl-lp-card-large .vhl-lp-card-body {
    padding: 14px 16px 16px;
  }

  .vhl-lp-card-small .vhl-lp-card-media {
    flex-basis: 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vhl-lp-card,
  .vhl-lp-card-image,
  .vhl-lp-card-title {
    transition: none;
  }

  .vhl-lp-card:hover {
    transform: none;
  }
}

/* Themes other than Vikinger (fallback body class added by the core). */
.vhl-no-vikinger .vhl-lp-card {
  margin-left: 0;
  margin-right: 0;
}
