/**
 * Sticky mini YouTube player (single articles).
 * Guidelines: keep CLS low with placeholder; no external libs.
 */

.ta-yt-sticky {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10040;
  width: min(360px, calc(100vw - 24px));
  max-width: 42vw;
  border-radius: 12px;
  overflow: hidden;
  background: #0b0e11;
  box-shadow: 0 12px 40px rgba(11, 14, 17, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ta-yt-sticky.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ta-yt-sticky[hidden] {
  display: none !important;
}

.ta-yt-sticky__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.ta-yt-sticky__iframe,
.ta-yt-sticky__frame iframe {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border: 0 !important;
  display: block !important;
}

.ta-yt-sticky__close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(11, 14, 17, 0.78);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ta-yt-sticky__close:hover,
.ta-yt-sticky__close:focus-visible {
  background: rgba(11, 14, 17, 0.95);
  outline: 2px solid #d6ff3e;
  outline-offset: 2px;
}

.ta-yt-sticky-placeholder {
  display: block;
  width: 100%;
  background: transparent;
}

@media (max-width: 720px) {
  .ta-yt-sticky {
    width: min(280px, calc(100vw - 20px));
    max-width: none;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    border-radius: 10px;
  }

  .ta-yt-sticky__close {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ta-yt-sticky {
    transition: none;
  }
}

/* Dark mode: same chrome, slightly stronger edge */
[data-theme="dark"] .ta-yt-sticky,
.ta-dark .ta-yt-sticky {
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
