/* ============================================================
   Media: audio / video players, NetEase embeds, image viewer chrome.
   Injected on every page via inject.head in _config.butterfly.yml.
   ============================================================ */

/* ---------- image viewer (Fancybox 6) ---------- */

/* The built-in per-slide button is disabled in
   themes/butterfly/source/js/utils.js; source/js/lightbox.js adds this one to
   the viewer container so it never moves while images slide. */
.fancybox__container .lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  transition: background .2s, transform .2s;
}

.fancybox__container .lightbox-close:hover {
  background: rgba(0, 0, 0, .78);
  transform: scale(1.06);
}

.fancybox__container .lightbox-close:active { background: rgba(0, 0, 0, .9); }

.fancybox__container .lightbox-close svg { display: block; }

/* no room is reserved for an inline close button any more */
.fancybox__container .fancybox__slide.has-close-btn { padding-top: 0; }

/* ---------- inline players ---------- */

/* Audio and video inserted by the admin (or written by hand) should fill the
   column and sit on their own line, like the justified image rows do.
   Descendant selectors, because markdown wraps a lone element in a <p>. */
#article-container audio,
#article-container video,
.home-card-body audio,
.home-card-body video,
.shuoshuo-content audio,
.shuoshuo-content video {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 14px 0;
  border-radius: 8px;
}

/* The native controls are browser chrome we cannot restyle, so deliberately no
   fixed height or background here - that clips the player in some browsers. */
.home-card-body p > audio,
.home-card-body p > video,
.shuoshuo-content p > audio,
.shuoshuo-content p > video {
  margin: 10px 0;
}

/* ---------- NetEase Cloud Music embed ({% netease %} tag) ---------- */

.netease-embed {
  margin: 16px 0;
}

.netease-embed iframe {
  display: block;
  width: 100%;
  max-width: 520px;
  border: 0;
  border-radius: 8px;
  background: var(--card-bg);
}

/* a playlist embed is tall; let it use more of the column */
.netease-embed--list iframe {
  max-width: 560px;
}

.home-card-body .netease-embed,
.shuoshuo-content .netease-embed {
  margin: 12px 0;
}
