/* YouTube 嵌入插件 — 請與 youtube-embed-plugin.js 一併引入 */

.yt-embed-root {
  box-sizing: border-box;
}
/* 內嵌 Shorts（9:16）時避免在寬版面過高，預設置中並限制最大寬 */
.yt-embed-root--short {
  max-width: min(420px, 100%);
  margin-left: auto;
  margin-right: auto;
}
.yt-embed-root *,
.yt-embed-root *::before,
.yt-embed-root *::after {
  box-sizing: inherit;
}

/* 與 .yt-embed-frame-wrap 相同：100% 寬 + 56.25% padding-bottom 形成 16:9 外框 */
.yt-embed-placeholder {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #000;
  color: #e8e8e8;
}
.yt-embed-placeholder--cover {
  background: #000;
}
.yt-embed-placeholder__cover-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
}
.yt-embed-placeholder__scrim {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.58);
}
.yt-embed-placeholder__inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  box-sizing: border-box;
  text-align: center;
}
.yt-embed-placeholder__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.yt-embed-placeholder__yt-icon {
  display: block;
  width: 40px;
  height: 40px;
}
.yt-embed-placeholder__text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 28rem;
}
.yt-embed-placeholder__btn {
  appearance: none;
  cursor: pointer;
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #e62117;
  border: none;
  border-radius: 6px;
  transition:
    background 0.2s,
    transform 0.15s;
}
.yt-embed-placeholder__btn:hover {
  background: #c41a12;
}
.yt-embed-placeholder__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.yt-embed-frame-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #000;
}
/* YouTube Shorts / 直式 9:16（mode: short / modal-short） */
.yt-embed-placeholder--short {
  padding-bottom: 177.78%;
}
.yt-embed-frame-wrap--short {
  padding-bottom: 177.78%;
}
.yt-embed-frame-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.yt-embed-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* 供關閉鈕 position:absolute 對齊本層 */
  box-sizing: border-box;
}
.yt-embed-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}
.yt-embed-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(90vh, 100%);
  display: flex;
  flex-direction: column;
  background: #000;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  box-shadow: none;
  overflow: hidden;
}
.yt-embed-modal--short .yt-embed-modal__dialog--short {
  width: min(420px, 100%);
}
/* 關閉鈕掛在 .yt-embed-modal 上，浮於內容與遮罩之上 */
.yt-embed-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  appearance: none;
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.75rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.yt-embed-modal__close:hover {
  background: transparent;
  color: #fff;
}
.yt-embed-modal__close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}
.yt-embed-modal__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
  background: #000;
}
/* 圓角與外框由 .yt-embed-modal__dialog 負責，內層填滿不留雙重邊 */
.yt-embed-modal__body .yt-embed-frame-wrap,
.yt-embed-modal__body .yt-embed-placeholder {
  margin: 0;
  width: 100%;
  border-radius: 0;
  border: none;
}
@media (max-width: 480px) {
  .yt-embed-placeholder__inner {
    padding: 1rem;
  }
  .yt-embed-placeholder__text {
    font-size: 0.875rem;
  }
}
