<template>
  <div class="relative w-full lg:h-[80vh] md:h-80 h-52 z-0">
    <div
      class="absolute w-full lg:h-full rounded-[30px] md:h-full h-52 bg-white/90 bg-cover"
      :style="{ backgroundImage: 'url(/images/cover-video.png)' }"
      style="opacity: 1"
    ></div>

    <div class="absolute inset-0 bg-black opacity-70 rounded-[30px]"></div>

    <div
      @mouseenter="enter"
      @mouseleave="leave"
      class="absolute w-full lg:h-full md:h-full h-52 z-10 flex flex-col text-center justify-center"
    >
      <div class="inline">
        <div
          @click="isVideoShow = true"
          class="play-button inline hover:scale-150 transition duration-500 cursor-pointer"
        >
          <div class="play-icon">
            <svg
              width="60"
              height="60"
              viewBox="0 0 24 24"
              fill="none"
              xmlns="http://www.w3.org/2000/svg"
            >
              <circle cx="12" cy="12" r="12" fill="white" />
              <polygon points="10,8 16,12 10,16" fill="red" />
            </svg>
          </div>
        </div>
        <div class="text-2xl font-bold py-5 text-white">
          What’s Inside ARIRANG
        </div>
      </div>
    </div>
  </div>

  <div
    @click="isVideoShow = false"
    v-if="isVideoShow"
    class="fixed w-full h-full top-0 left-0 bg-black/90 flex flex-col align-center justify-center px-30"
  >
    <a
      @mouseleave="leave"
      class="text-end ml-auto w-5 mr-5 text-white text-2xl hover:text-secondary mb-5"
    >
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="#fff">
        <path
          d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
        />
      </svg>
    </a>

    <div></div>
    <div class="flex w-full z-0 px-10 justify-center">
      <iframe
        class="w-full md:h-[380px] h-[180px] lg:w-[70%] lg:h-[550px] z-0"
        src="https://www.youtube.com/embed/qkFj1sHO-eM?si=LFhvPwbWNMKUGIGI"
        title="YouTube video player"
        frameborder="0"
        allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
        allowfullscreen
      ></iframe>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";

defineProps(["video", "image", "cover"]);
const isHover = ref(false);
const isVideoShow = ref(false);

function enter() {
  isHover.value = true;
}

function leave() {
  isHover.value = false;
}
</script>

<style scoped>
.my-clip {
  clip-path: circle(250px at center);
  inset: 0;
  background-size: cover;
  opacity: 1;
  z-index: 10;
  transition: 800ms ease-in-out;
}

.my-clip-hover {
  clip-path: circle(380px at center);
  transition: 800ms ease-in-out;
}

@media (max-width: 393px) {
  .my-clip {
    clip-path: circle(174px at center);
    inset: 0;
    background-size: cover;
    opacity: 1;
    z-index: 10;
    transition: 800ms ease-in-out;
  }
}
.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px; /* Set desired size */
  height: 60px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.play-button:hover {
  transform: scale(1.1);
}

.play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
