<template>
  <div
    class="relative grid min-h-screen place-items-center overflow-hidden bg-[#f5f5f5] px-4 py-12 font-sans text-[#0c0a09] md:py-24"
  >
    <div
      class="pointer-events-none absolute left-1/2 top-10 h-[420px] w-[min(92vw,760px)] -translate-x-1/2 rounded-[48px] bg-[radial-gradient(circle_at_20%_30%,rgba(167,229,211,0.62),transparent_28%),radial-gradient(circle_at_72%_24%,rgba(244,197,168,0.56),transparent_30%),radial-gradient(circle_at_52%_78%,rgba(200,184,224,0.5),transparent_34%)] blur-2xl"
      aria-hidden="true"
    ></div>

    <main
      class="relative grid w-full max-w-[960px] gap-8 rounded-2xl border border-[#e7e5e4] bg-white p-6 shadow-[0_4px_16px_rgba(0,0,0,0.04)] md:grid-cols-[minmax(0,1fr)_auto] md:items-end md:p-8"
      aria-labelledby="landing-title"
    >
      <section>
        <p
          class="m-0 inline-flex rounded-full bg-[rgba(167,229,211,0.62)] px-3 py-1 text-xs font-semibold uppercase leading-[1.4] tracking-[0.96px] text-[#0c0a09]"
        >
          Autenticação
        </p>
        <h1
          id="landing-title"
          class="my-5 max-w-[640px] font-serif text-[40px] font-light leading-[1.05] tracking-[-1.2px] text-[#0c0a09] md:text-[64px] md:tracking-[-1.92px]"
        >
          Acesse sua conta
        </h1>
        <p
          class="m-0 max-w-[520px] text-base font-normal leading-6 tracking-[0.16px] text-[#4e4e4e]"
        >
          Entre para ver sua área autenticada ou crie uma conta nova com email e senha.
        </p>
      </section>

      <nav class="flex flex-col gap-3 sm:flex-row md:flex-col" aria-label="Acesso a conta">
        <NuxtLink
          v-if="hasToken"
          to="/home"
          class="inline-flex h-10 items-center justify-center rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] active:bg-[#0c0a09]"
        >
          Ir para home
        </NuxtLink>
        <NuxtLink
          v-else
          to="/login"
          class="inline-flex h-10 items-center justify-center rounded-full bg-[#292524] px-5 text-[15px] font-medium leading-none text-white transition hover:bg-[#0c0a09] active:bg-[#0c0a09]"
        >
          Entrar na conta
        </NuxtLink>
        <NuxtLink
          to="/criar-conta"
          class="inline-flex h-10 items-center justify-center rounded-full border border-[#d6d3d1] bg-transparent px-5 text-[15px] font-medium leading-none text-[#0c0a09] transition hover:border-[#0c0a09]"
        >
          Criar conta
        </NuxtLink>
      </nav>
    </main>
  </div>
</template>

<script setup>
const token = useCookie('token')

const hasToken = computed(() => Boolean(token.value))
</script>
