/* Bilibili click-to-play facade.
   Each embed ships as the video's own Bilibili cover image plus a play badge;
   the Bilibili player iframe is only created when a visitor clicks (see
   js/bilibili-facade.js), and it starts the video from 0s. */

.bili-facade {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background-color: #000;
  cursor: pointer;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}

.bili-facade img {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.bili-facade-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66px;
  height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  background-color: rgba(0, 0, 0, .55);
  transition: background-color .2s ease-in-out;
  pointer-events: none;
}

.bili-facade-play:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border: 9px solid transparent;
  border-left: 15px solid #fff;
  border-right: 0;
}

.bili-facade:hover .bili-facade-play,
.bili-facade:focus-visible .bili-facade-play {
  background-color: #fb7299;
}

.bili-facade:focus-visible {
  outline: 2px solid #fb7299;
  outline-offset: 2px;
}

/* While the player boots, the cover stays on top of it and the badge turns
   into a spinner; js/bilibili-facade.js removes it once the player has
   loaded. Clicks pass straight through to the player underneath. */
.bili-facade.is-loading {
  z-index: 1;
  cursor: default;
  pointer-events: none;
}

.bili-facade.is-loading .bili-facade-play:after {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: bili-facade-spin .8s linear infinite;
}

@keyframes bili-facade-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .bili-facade.is-loading .bili-facade-play:after {
    animation: none;
  }
}
