/* モーダル全体のコンテナ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* モーダルが開いた時 */
.modal.is-open {
  display: flex;
}

/* 開いた時、背景の黒マスクをフェードイン */
.modal.is-open .modal-overlay {
  animation: fadeIn 0.3s ease forwards;
}

/* 開いた時、動画ウィンドウを浮き上がらせる */
.modal.is-open .modal-content {
  animation: modalUp 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* ==========================================
   【追加】閉じる時（フェードアウト）のスタイル
   ========================================== */
/* 閉じている最中、背景の黒マスクをフェードアウト */
.modal.is-closing .modal-overlay {
  animation: fadeOut 0.3s ease forwards;
}

/* 閉じている最中、動画ウィンドウを少し下に下げながら消す */
.modal.is-closing .modal-content {
  animation: modalDown 0.3s ease forwards;
}
/* ========================================== */

/* 背景の黒いマスク */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  opacity: 0;
}

/* コンテンツエリア */
.modal-content {
  position: relative;
  width: 90%;
  max-width: 800px;
  background: #000;
  z-index: 1001;
  opacity: 0;
}

/* 閉じるボタン */
.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
}

/* 16:9のレスポンシブ保持用のラッパー */
.iframe-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
}

.iframe-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* アニメーションの動きの定義 */
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* 【追加】背景フェードアウト */
@keyframes fadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes modalUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 【追加】動画ウィンドウが消える動き */
@keyframes modalDown {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(20px);
  }
}
