<template>
  <div class="relative min-h-screen">
    <!-- 1) Fixed, full-viewport background -->
    <img
      :src="MAIN.background"
      alt="background"
      class="fixed inset-0 w-full h-full object-cover dark:hidden"
    />

    <!-- 2) Main content (scrolls) -->
    <div
      class="relative z-10 w-full max-w-screen-lg mx-auto dark:max-w-full dark:mx-0"
    >
      <NuxtLayout :name="headerStore.currentLayout">
        <NuxtPage :key="$route.fullPath" />
      </NuxtLayout>
    </div>

    <!-- 3) Title image, fixed to the right -->
    <div class="pointer-events-none">
      <img
        :src="MAIN.title"
        alt="main title"
        class="fixed top-1/2 right-0 h-48 -translate-y-1/2 object-contain hidden 2xl:block"
      />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useHeaderStateStore } from '~/stores/headerStateStore';
import { MAIN } from '~/data/assets';

const contentLoaded = ref(false);
const headerStore = useHeaderStateStore(); // Initialize the header state store

//naver map api
const clientId = 'u5ju5efq99';
useHead({
  script: [
    {
      // new personal-API syntax:
      src: `https://oapi.map.naver.com/openapi/v3/maps.js?ncpKeyId=${clientId}`,
      type: 'text/javascript',
      async: true,
      defer: true,
    },
  ],
});
</script>

<style>
.page-enter-active,
.page-leave-active {
  transition: all 0.2s;
}
.page-enter-from,
.page-leave-to {
  opacity: 0;
  filter: grayscale(1rem);
}
</style>
