/* ===========================================================
   動画サムネイル
=========================================================== */
.video-thumb {
  position: relative;
  display: block;
  cursor: pointer;
  line-height: 0;
}

.video-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

/* サムネイル中央の再生アイコン（三角形はborderで表現） */
.video-thumb__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(112px,11.67vw);
  min-width: 40px;
  max-width: 112px;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  background: url(/ytc/corp/recruit/sales-driver/assets/img/playbtn.webp) no-repeat 0 0;
  background-size: min(112px,11.67vw);
  border-radius: 50%;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.video-thumb:hover .video-thumb__play,
.video-thumb:focus-visible .video-thumb__play {
  opacity: 0.8;
}

/* ===========================================================
   動画モーダル
=========================================================== */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vw;
  box-sizing: border-box;

  /* display:none/flexの切替えではなく opacity + visibility でフェードさせる。
     閉じる時は visibility の切替えに 0.3s の遅延を持たせ、
     フェードアウトが完了してから非表示（visibility:hidden）に切り替える。 */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.video-modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
  .video-modal {
    transition: none;
  }
}

/* 動画領域以外を覆う半透明の背景（白ベース） */
.video-modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.92);
}

/* モーダル本体（動画領域＋閉じるボタン） */
.video-modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
}

/* 閉じるボタン：モーダル右肩
   z-index を明示しないと z-index:auto 同士はDOM順で重なり順が決まるため、
   HTML上で後に出現する .video-modal__video-wrap（動画）に隠れてしまう。
   常に動画より手前に来るよう明示的に指定する。 */
.video-modal__close {
  position: absolute;
  top: -44px;
  right: 0;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #222;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
}

.video-modal__close:hover,
.video-modal__close:focus-visible {
  opacity: 0.7;
}

/* 動画をレスポンシブに保持するための16:9ラッパー（白ベース） */
.video-modal__video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #fff;
}

.video-modal__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
}

/* スマートフォン幅：閉じるボタンをモーダル内右上に収める
   ここから下は px を使わず vw で指定し、実機の画面幅に応じて
   相対的にスケールするようにしている（解像度に依存させない） */
@media screen and (max-width: 767px) {
  .video-modal {
    padding: 0;
  }

  .video-modal__dialog {
    max-width: 100%;
  }

  .video-modal__close {
    top: 2vw;
    right: 2vw;
    width: 9vw;
    height: 9vw;
    font-size: 6vw;
    background-color: rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    text-shadow: none;
  }
}

/* aspect-ratio 非対応ブラウザ向けフォールバック */
@supports not (aspect-ratio: 16 / 9) {
  .video-modal__video-wrap {
    height: 0;
    padding-top: 56.25%; /* 9 / 16 */
  }
}
