/*
 * Koenig card styles.
 *
 * Casper declares `card_assets: true` in its package.json, which told *Ghost* to inject
 * its own card stylesheet at render time. Casper itself only ships colour and spacing
 * rules for these cards, not their layout — so without Ghost, bookmark cards collapsed
 * to inline text. This supplies the missing layout for the card types this blog uses:
 * bookmark (80), image (33) and embed (5).
 *
 * Sizes are in rem against Casper's `html { font-size: 62.5% }`, so 1.5rem = 15px.
 */

/* --- bookmark ------------------------------------------------------------- */

.kg-bookmark-card,
.kg-bookmark-publisher {
  position: relative;
  width: 100%;
}

.kg-card.kg-bookmark-card + .kg-card.kg-bookmark-card {
  margin-top: 1.6rem;
}

.kg-bookmark-container,
.kg-bookmark-card a.kg-bookmark-container {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(124, 139, 154, 0.25);
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none !important;
  color: currentColor;
  transition: border-color 0.2s ease;
}

.kg-bookmark-card a.kg-bookmark-container:hover {
  border-color: rgba(124, 139, 154, 0.5);
}

@media (min-width: 640px) {
  .kg-bookmark-container,
  .kg-bookmark-card a.kg-bookmark-container {
    flex-direction: row;
    min-height: 148px;
  }
}

.kg-bookmark-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  order: 1;
  flex-basis: 100%;
  padding: 20px;
  overflow: hidden;
}

.kg-bookmark-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3em;
}

.kg-bookmark-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-y: hidden;
  margin-top: 4px;
  max-height: 44px;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.5em;
  opacity: 0.7;
}

.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
  width: 100%;
  font-size: 1.4rem;
  font-weight: 500;
}

.kg-bookmark-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 3px;
  object-fit: contain;
}

.kg-bookmark-author,
.kg-bookmark-publisher {
  overflow: hidden;
  max-width: 240px;
  line-height: 1.5em;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.7;
}

/* Separator only when both a source and a publisher are present. */
.kg-bookmark-author + .kg-bookmark-publisher::before {
  content: "•";
  margin: 0 6px;
  opacity: 0.6;
}

.kg-bookmark-thumbnail {
  position: relative;
  order: 2;
  min-width: 33%;
  max-height: 200px;
}

@media (min-width: 640px) {
  .kg-bookmark-thumbnail {
    max-height: none;
  }
}

.kg-bookmark-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 200px;
  object-fit: cover;
}

@media (min-width: 640px) {
  .kg-bookmark-thumbnail img {
    position: absolute;
    inset: 0;
    max-height: none;
    border-radius: 0 5px 5px 0;
  }
}

/* --- image ---------------------------------------------------------------- */

.kg-image-card img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

/* --- embed ---------------------------------------------------------------- */

.kg-embed-card iframe {
  max-width: 100%;
}

/*
 * Ghost wraps some pasted embeds in these markers. They carry no styling of their own
 * and would otherwise render as stray empty blocks.
 */
.kg-card-begin,
.kg-card-end {
  display: none;
}
