<template>
  <div class="page pg-bg pg1" parallax>
    <div class="bg">
      <div>
        <!-- <InkEffect class="ink-bg" src="/images/pg1/bg1.png" :active="true" /> -->
        <img src="/images/pg1/bg1.png" alt="">
      </div>
    </div>
    <div class="conent">
      <div class="header">        
        <Logo class="logo" />
      </div>
      <div class="body" parallax-offset='-100'>
        <Part1 class="part1" :animate="active == 1" @click="onClick(1)" />
        <Part2 class="part2" :animate="active == 2" @click="onClick(2)" />
        <Part3 class="part3" :animate="active == 3" @click="onClick(3)" />
      </div>
    </div>
    <div class="footer abs animate__animated animate__fadeInUp">
      <img src="/images/pg1/bg2.png" alt="" parallax-offset='-200'>
    </div>

    <DownArrow />
    <Md1 v-if="mdActive == 1" @cancel="onCancel(1)" />
    <Md2 v-if="mdActive == 2" @cancel="onCancel(2)" />
    <Md3 v-if="mdActive == 3" @cancel="onCancel(3)" />
  </div>
</template>

<script setup>
  import { onMounted, ref } from 'vue';
  import { useRouter } from 'vue-router';
  import InkEffect from '@/components/InkEffect.vue';
  import DownArrow from '@/components/DownArrow.vue';
  import Logo from './Logo.vue';
  import Part1 from './P1.vue';
  import Part2 from './P2.vue';
  import Part3 from './P3.vue';
  import Md1 from './Md1.vue';
  import Md2 from './Md2.vue';
  import Md3 from './Md3.vue';

  const router = useRouter();
  const active = ref(1);
  const mdActive = ref(0);

  const onClick = (inx) => {
    mdActive.value = inx;
  }

  const onCancel = (inx) => {
    mdActive.value = 0;
    const next = inx + 1 > 3 ? 1 : inx + 1;
    active.value = next;
  }

</script>

<style lang="less" scoped>
  .bg {
    position: absolute;
    z-index: 0;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    & > div {
      position: relative;
    }

    .ink-bg {
      width: 100%;
    }
  }

  .conent {
    position: relative;
    height: 100%;
    box-sizing: border-box;
    padding: 30px;
    z-index: 10;

    .header {
      display: flex;
      justify-content: space-between;

      & > div {
        flex: none;
      }
    }

    .body {
      margin-top: 10vh;
    }

    .part2 {
      margin-top: 48px;
    }
    .part3 {
      margin-top: 40px;
    }
  }

  .footer {
    bottom: 0;
    left: 0;
    width: 100vw;
    z-index: 10;
  }

</style>