/*
 * embed.css — Rich/social embed blocks (TikTok, X, Instagram). Video iframes use .embed--oembed.
 *
 * Twitter/X widgets.js replaces the snippet with an iframe that has an inline
 * pixel height. Do not force width/height on that iframe or the card clips.
 */

.embed__html {
  position: relative;
  width: 100%;
}

/* iframe / oEmbed video blocks (YouTube, Vimeo, etc.) */
.embed--oembed .embed__html {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius, 8px);
  background: #000;
}

.embed--oembed .embed__html iframe,
.embed--oembed .embed__html video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius, 8px);
}

.article-body .embed.embed--html,
.embed.embed--html {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  background: transparent;
  overflow: visible;
  max-height: none;
}

.article-body .embed.embed--html .embed__html,
.embed--html .embed__html {
  display: block;
  width: 100%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  aspect-ratio: auto;
  overflow: visible;
  max-height: none;
  background: transparent;
  border: none;
  border-radius: 0;
}

/* Let X/TikTok/Instagram size their own iframe */
.article-body .embed.embed--html iframe,
.embed--html .embed__html iframe {
  position: static !important;
  inset: auto !important;
  display: block;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  border: none;
  aspect-ratio: auto !important;
  max-height: none;
}

/* YouTube iframes pasted as custom HTML still get 16:9 */
.embed--html .embed__html:has(iframe[src*="youtube"]),
.embed--html .embed__html:has(iframe[src*="youtu.be"]),
.embed--html .embed__html:has(iframe[src*="youtube-nocookie"]) {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: var(--radius, 8px);
}

.embed--html .embed__html:has(iframe[src*="youtube"]) iframe,
.embed--html .embed__html:has(iframe[src*="youtu.be"]) iframe,
.embed--html .embed__html:has(iframe[src*="youtube-nocookie"]) iframe {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: var(--radius, 8px);
}
