/**
 * YouTube Embed Component
 *
 * Privacy-friendly embed with click-to-load
 */

.embed--youtube {
  position: relative;
  margin: 2rem 0;
  padding: 0;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}

/* 16:9 Aspect Ratio Container */
.embed--youtube::before {
  content: '';
  display: block;
  padding-bottom: 56.25%; /* 16:9 ratio */
}

/* Poster Button */
.embed__poster {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.embed__poster:hover {
  opacity: 0.9;
}

.embed__poster:focus {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* Poster Image */
.embed__poster img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Play Button Icon */
.embed__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: rgba(255, 0, 0, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.embed__poster:hover .embed__play {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgb(255, 0, 0);
}

/* Play Triangle */
.embed__play::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px; /* Optical centering */
}

/* Iframe (after click) */
.embed--youtube iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .embed--youtube {
    margin: 1.5rem 0;
  }

  .embed__play {
    width: 60px;
    height: 60px;
  }

  .embed__play::after {
    border-width: 10px 0 10px 16px;
    margin-left: 3px;
  }
}

