.yt-facade {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
  container-type: inline-size;
}

/* Inside a wrapper which already sets the size (youtube module figure). */
.yt-facade--cover {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
}

.yt-facade__thumb,
.yt-facade__iframe,
.yt-facade__play,
.yt-facade__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.yt-facade__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-facade__iframe {
  border: 0;
}

/* The thumbnail given by the theme sets the size of the placeholder. */
.yt-facade--custom-thumb {
  height: auto;
  aspect-ratio: auto;
  background: transparent;
}

.yt-facade--custom-thumb .yt-facade__thumb {
  position: relative;
}

.yt-facade__overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  box-sizing: border-box;
  padding: 1.5em;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.7);
}

.yt-facade__msg {
  max-width: 34em;
  margin: 0;
  font-size: 0.9em;
  color: #fff;
}

.yt-facade__btn {
  padding: 0.75em 1.5em;
  border: 0;
  border-radius: 4px;
  background: #cb3232;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.yt-facade__manage {
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 0.85em;
  text-decoration: underline;
  cursor: pointer;
}

.yt-facade__btn:focus-visible,
.yt-facade__manage:focus-visible,
.yt-facade__play:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.yt-facade__play {
  display: none;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.yt-facade:not(.yt-facade--custom-thumb) .yt-facade__play::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 48px;
  border-radius: 12px;
  background: #cb3232 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 68 48'%3E%3Cpath d='M45 24 27 14v20' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: translate(-50%, -50%);
}

/* Anti-flash: nothing is displayed until the Didomi status is known. */
.yt-facade--blocked .yt-facade__overlay {
  display: flex;
}

/* The consent message may be taller than the 16:9 frame: the placeholder grows with it. */
.yt-facade--blocked:not(.yt-facade--custom-thumb) {
  height: auto;
  overflow: visible;
}

.yt-facade--cover.yt-facade--blocked {
  position: relative;
  inset: auto;
  aspect-ratio: 16 / 9;
}

.youtube-container--responsive:has(> .yt-facade--blocked) {
  height: auto;
  padding-bottom: 0;
}

.yt-facade--consented .yt-facade__play {
  display: block;
}

.yt-facade--active .yt-facade__thumb {
  visibility: hidden;
}

@container (max-width: 480px) {
  .yt-facade__overlay {
    gap: 0.5em;
    padding: 0.75em;
  }

  .yt-facade--blocked:not(.yt-facade--custom-thumb) .yt-facade__overlay {
    position: relative;
    height: auto;
  }

  .yt-facade__msg {
    font-size: 0.75em;
  }

  .yt-facade__btn {
    padding: 0.5em 1em;
    font-size: 0.85em;
  }
}
