<template>
  <NuxtLayout>
    <div class="section-padding">
      <div class="container-content max-w-3xl mx-auto">
        <!-- Back link -->
        <UiScrollReveal>
          <NuxtLink to="/" class="inline-flex items-center gap-2 text-sm text-white/50 hover:text-white/80 mb-8 transition-colors">
            <div class="i-lucide-arrow-left h-4 w-4" />
            Retour &agrave; l'accueil
          </NuxtLink>
        </UiScrollReveal>

        <!-- Header -->
        <UiScrollReveal>
          <div class="text-center mb-12">
            <span class="inline-block mb-3 rounded-full bg-amber-400/15 px-3 py-0.5 font-mono text-xs tracking-widest text-amber-400 uppercase">
              {{ content?.kicker }}
            </span>
            <h1 class="page-title font-display font-bold text-white">
              {{ content?.title }}
            </h1>
            <p class="mt-4 text-lg text-white/60 leading-relaxed max-w-xl mx-auto">
              {{ content?.description }}
            </p>
          </div>
        </UiScrollReveal>

        <!-- Explanation cards -->
        <div class="grid gap-6 md:grid-cols-2 mb-12">
          <UiScrollReveal
            v-for="(feature, i) in content?.features"
            :key="i"
            :delay="(i + 1) * 100"
          >
            <div class="gw-feature-card">
              <div :class="`i-lucide-${feature.icon}`" class="h-6 w-6 text-amber-400 mb-3" />
              <h3 class="font-display text-lg font-semibold text-white mb-2">{{ feature.title }}</h3>
              <p class="text-sm text-white/60 leading-relaxed">
                {{ feature.description }}
              </p>
            </div>
          </UiScrollReveal>
        </div>

        <!-- CTA -->
        <UiScrollReveal :delay="500">
          <div class="text-center">
            <p class="text-sm text-white/40 mb-4">
              {{ content?.cta.note }}
            </p>
            <UiBaseButton :href="url" target="_blank" @click="launch">
              <div class="i-lucide-external-link mr-2 h-5 w-5" />
              {{ content?.cta.label }}
            </UiBaseButton>
          </div>
        </UiScrollReveal>
      </div>
    </div>
  </NuxtLayout>
</template>

<script setup lang="ts">
const { data: content } = await usePageContent('gratewizard')

useHead({
  title: content.value?.meta?.title ?? 'grateWizard \u2014 Coefficients relatifs',
})

const { url, launch } = useGrateWizard()
</script>

<style scoped>
.page-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
}

.gw-feature-card {
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid hsl(20 8% 18%);
  background: hsl(20 8% 8% / 0.5);
  transition: border-color 0.3s ease, background 0.3s ease;
}

.gw-feature-card:hover {
  border-color: hsl(40 80% 50% / 0.25);
  background: hsl(20 8% 10% / 0.5);
}

code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  padding: 0.1em 0.3em;
  border-radius: 0.25em;
  background: hsl(40 80% 50% / 0.1);
}
</style>
