/* Joico: consent-gated YouTube embed (OneTrust category C0007).
 * Visual target: the sexyhair.com blocked-video overlay. The thumbnail stays visible under
 * a light scrim. The message and the green "Cookie settings" link sit on one dark plate.
 * Selectors are doubled (.joico-yt .x) so theme / WPBakery rules for p and button don't leak in.
 */

.joico-yt {
  /* REPLACE if the brand team wants different colours */
  --joico-yt-scrim: rgba(0, 0, 0, 0.38);   /* darkening over the thumbnail */
  --joico-yt-plate: rgba(0, 0, 0, 0.82);   /* backing behind the message + link */
  --joico-yt-text: #fff;
  --joico-yt-link: #4ade80;                /* green "Cookie settings" link, as on sexyhair.com */
  --joico-yt-play: #ff0000;                /* play-button colour */

  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
}

/* Poster + play button (one control covering the whole embed) */
.joico-yt .joico-yt__play {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  line-height: 0;
  cursor: pointer;
}

.joico-yt .joico-yt__play[hidden] {
  display: none;
}

.joico-yt .joico-yt__poster {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.joico-yt .joico-yt__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 48px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.joico-yt .joico-yt__icon-bg {
  fill: var(--joico-yt-play);
}

.joico-yt .joico-yt__play:hover .joico-yt__icon,
.joico-yt .joico-yt__play:focus-visible .joico-yt__icon {
  transform: translate(-50%, -50%) scale(1.08);
}

/* While gated, the play icon is hidden, as on sexyhair.com */
.joico-yt.is-gated .joico-yt__icon {
  display: none;
}

/* The player that replaces the poster after consent + click */
.joico-yt .joico-yt__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Overlay: passive scrim. Clicks pass through to the poster button underneath, which
 * opens the Preference Center. Only the "Cookie settings" button takes clicks itself. */
.joico-yt .joico-yt__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 1rem 1.25rem;
  background: var(--joico-yt-scrim);
  color: var(--joico-yt-text);
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
  pointer-events: none;
}

.joico-yt .joico-yt__msg {
  max-width: 42ch;
  margin: 0;
  padding: 0.35rem 0.6rem 0.2rem;
  background: var(--joico-yt-plate);
  color: var(--joico-yt-text);
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.joico-yt .joico-yt__cta {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0.2rem 0.6rem 0.35rem;
  border: 0;
  border-radius: 0;
  background: var(--joico-yt-plate);
  box-shadow: none;
  color: var(--joico-yt-link);
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
}

.joico-yt .joico-yt__cta:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.joico-yt .joico-yt__cta:focus-visible {
  outline: 2px solid var(--joico-yt-link);
  outline-offset: 2px;
}

/* The overlay sits on top of the poster button, so draw the button's focus ring on the overlay */
.joico-yt .joico-yt__play:focus-visible ~ .joico-yt__overlay {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

@media (prefers-reduced-motion: reduce) {
  .joico-yt .joico-yt__icon {
    transition: none;
  }
}

/* Higher contrast on request: a solid fill instead of the see-through scrim */
@media (prefers-contrast: more) {
  .joico-yt .joico-yt__overlay {
    background: #111;
  }

  .joico-yt .joico-yt__msg,
  .joico-yt .joico-yt__cta {
    background: none;
  }
}
