:root {
  --color-shortcode-douban-card-background: #f5f5f5;
  --color-shortcode-douban-card-tag-foreground: #999999;
  --color-shortcode-douban-card-green: #42be57;

  --image-shortcode-douban-card-stars-1x: url("/images/_shortcodes/douban-card/douban-stars.png");
  --image-shortcode-douban-card-stars-2x: url("/images/_shortcodes/douban-card/douban-stars@2x.png");
}

/* Theme wiring — see admonition.css for the full contract rationale.
 * Earlier `.dark { … }` selector was dead code. */
@media (prefers-color-scheme: dark) {
  :root {
    --color-shortcode-douban-card-background: #383838;
  }
}

:root[data-theme="dark"] {
  --color-shortcode-douban-card-background: #383838;
}

:root[data-theme="light"] {
  --color-shortcode-douban-card-background: #f5f5f5;
}

.shortcode-douban-card {
  max-height: 12.6em;
  margin: 1em auto;
  position: relative;
  display: flex;
  justify-content: space-between;
  background: var(--color-shortcode-douban-card-background);
  border-radius: 0.25rem;
}

.shortcode-douban-card a {
  text-decoration: none;
  border: none;
}

.shortcode-douban-card--middle {
  width: auto;
  padding: 1em;
}

.shortcode-douban-card--title {
  font-size: 18px;
  font-weight: bold;
  max-height: 1.8em;
  overflow: hidden;
}

.shortcode-douban-card--tags {
  font-size: 14px;
  max-height: 1.8em;
  line-height: 1.8em;
  color: var(--color-shortcode-douban-card-tag-foreground);
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.shortcode-douban-card--summary {
  font-size: 14px;
  line-height: 1.6em;
  max-height: 6.4em;
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.shortcode-douban-card--right {
  min-width: 160px;
  max-width: 160px;
}

.shortcode-douban-card--right img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  border-top-right-radius: 0.2rem;
  border-bottom-right-radius: 0.2rem;
}

.shortcode-douban-card--stars-rating {
  display: flex;
  font-size: 0.9em;
  height: 1.6em;
  line-height: 1.2em;
  overflow: hidden;
  margin: 0.2em 0;
}

.shortcode-douban-card--logo-dou {
  color: #fff;
  text-align: center;
  background-color: var(--color-shortcode-douban-card-green);
  border: 1.5px solid var(--color-shortcode-douban-card-green);
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  padding: 2px 3px;
}

.shortcode-douban-card--logo-rating {
  color: var(--color-shortcode-douban-card-green);
  width: 66px;
  border-top: 1.5px solid var(--color-shortcode-douban-card-green);
  border-right: 1.5px solid var(--color-shortcode-douban-card-green);
  border-bottom: 1.5px solid var(--color-shortcode-douban-card-green);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  padding: 2px 3px;
}

.shortcode-douban-card--stars {
  display: inline-block;
  width: 75px;
  height: 15px !important;
  background-image: var(--image-shortcode-douban-card-stars-1x);
  background: -webkit-image-set(
    var(--image-shortcode-douban-card-stars-1x) 1x,
    var(--image-shortcode-douban-card-stars-2x) 2x
    ) no-repeat;
  background-position: center center;
  overflow: hidden;
  margin-left: 0.6em;
  margin-top: 0.2em;
  text-align: center;
}

.shortcode-douban-card--stars-10 {
  background-position: 0px 0px;
}

.shortcode-douban-card--stars-9 {
  background-position: 0px -15px;
}

.shortcode-douban-card--stars-8 {
  background-position: 0px -30px;
}

.shortcode-douban-card--stars-7 {
  background-position: 0px -45px;
}

.shortcode-douban-card--stars-6 {
  background-position: 0px -60px;
}

.shortcode-douban-card--stars-5 {
  background-position: 0px -75px;
}

.shortcode-douban-card--stars-4 {
  background-position: 0px -90px;
}

.shortcode-douban-card--stars-3 {
  background-position: 0px -105px;
}

.shortcode-douban-card--stars-2 {
  background-position: 0px -120px;
}

.shortcode-douban-card--stars-1 {
  background-position: 0px -135px;
}

.shortcode-douban-card--stars-0 {
  background-position: 0px -150px;
}

.shortcode-douban-card--rating {
  font-weight: bold;
  margin-left: 0.6em;
  padding-top: 3px;
}
