<template>
  <div class="relative overflow-hidden section-padding">
    <!-- Shadok jardinier -->
    <svg class="shadok-jardinier" viewBox="0 0 240 300" fill="none" aria-hidden="true">
      <ellipse cx="110" cy="160" rx="40" ry="48" fill="currentColor" opacity="0.85"/>
      <circle cx="110" cy="96" r="25" fill="currentColor" opacity="0.8"/>
      <ellipse cx="110" cy="78" rx="35" ry="8" fill="currentColor" opacity="0.4"/>
      <path d="M85 78 Q110 60 135 78" fill="currentColor" opacity="0.35"/>
      <circle cx="102" cy="94" r="4" fill="currentColor" opacity="0.2"/>
      <circle cx="120" cy="94" r="4" fill="currentColor" opacity="0.2"/>
      <circle cx="103" cy="95" r="1.8" fill="currentColor" opacity="0.5"/>
      <circle cx="121" cy="95" r="1.8" fill="currentColor" opacity="0.5"/>
      <path d="M103 106 Q110 111 118 106" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" fill="none" opacity="0.3"/>
      <line x1="70" y1="150" x2="40" y2="170" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <rect x="20" y="165" width="30" height="20" rx="3" fill="currentColor" opacity="0.4"/>
      <line x1="20" y1="168" x2="10" y2="160" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" opacity="0.4"/>
      <circle cx="12" cy="165" r="1.5" fill="currentColor" opacity="0.25"/>
      <circle cx="8" cy="170" r="1.5" fill="currentColor" opacity="0.2"/>
      <circle cx="15" cy="172" r="1.5" fill="currentColor" opacity="0.2"/>
      <line x1="150" y1="150" x2="170" y2="180" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <line x1="95" y1="205" x2="85" y2="260" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <line x1="125" y1="205" x2="135" y2="260" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <line x1="180" y1="220" x2="180" y2="180" stroke="currentColor" stroke-width="2" stroke-linecap="round" opacity="0.4"/>
      <path d="M180 195 Q195 185 190 175" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none" opacity="0.35"/>
      <path d="M180 205 Q165 195 168 185" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none" opacity="0.35"/>
      <path d="M180 185 Q192 172 188 165" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none" opacity="0.3"/>
      <path d="M170 220 L175 240 L185 240 L190 220 Z" fill="currentColor" opacity="0.35"/>
    </svg>

    <!-- Shadok bâtisseur -->
    <svg class="shadok-batisseur" viewBox="0 0 260 300" fill="none" aria-hidden="true">
      <ellipse cx="130" cy="150" rx="40" ry="48" fill="currentColor" opacity="0.85"/>
      <circle cx="130" cy="86" r="25" fill="currentColor" opacity="0.8"/>
      <ellipse cx="130" cy="68" rx="28" ry="6" fill="currentColor" opacity="0.4"/>
      <rect x="108" y="60" width="44" height="10" rx="3" fill="currentColor" opacity="0.35"/>
      <circle cx="122" cy="84" r="4" fill="currentColor" opacity="0.2"/>
      <circle cx="140" cy="84" r="4" fill="currentColor" opacity="0.2"/>
      <circle cx="123" cy="83" r="1.8" fill="currentColor" opacity="0.5"/>
      <circle cx="141" cy="83" r="1.8" fill="currentColor" opacity="0.5"/>
      <path d="M123 96 Q130 101 138 96" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" fill="none" opacity="0.3"/>
      <line x1="170" y1="140" x2="210" y2="120" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <polygon points="210,115 230,110 225,120 210,122" fill="currentColor" opacity="0.45"/>
      <line x1="210" y1="118" x2="200" y2="125" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" opacity="0.4"/>
      <line x1="90" y1="145" x2="65" y2="170" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <line x1="115" y1="195" x2="105" y2="255" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <line x1="145" y1="195" x2="155" y2="255" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <rect x="40" y="200" width="50" height="16" rx="1" fill="currentColor" opacity="0.3"/>
      <rect x="45" y="183" width="40" height="16" rx="1" fill="currentColor" opacity="0.28"/>
      <rect x="50" y="166" width="30" height="16" rx="1" fill="currentColor" opacity="0.25"/>
      <line x1="65" y1="200" x2="65" y2="216" stroke="currentColor" stroke-width="1" opacity="0.15"/>
      <line x1="55" y1="183" x2="55" y2="199" stroke="currentColor" stroke-width="1" opacity="0.15"/>
    </svg>

    <div class="container-content">
      <header class="mb-12 text-center">
        <p class="mb-2 font-mono text-sm tracking-widest text-primary uppercase">{{ content?.kicker }}</p>
        <h1 class="page-title font-display font-bold tracking-tight text-white">
          {{ content?.title }}
        </h1>
        <p class="mt-4 mx-auto max-w-2xl text-white/60 leading-relaxed">
          {{ content?.description }}
        </p>
      </header>

      <div class="mx-auto max-w-3xl flex flex-col gap-6">
        <div
          v-for="pillar in content?.pillars"
          :key="pillar.id"
          class="pillar-card"
        >
          <div class="pillar-header">
            <div class="pillar-icon">
              <div :class="`i-lucide-${pillar.icon}`" class="h-5 w-5" />
            </div>
            <h2 class="font-display text-xl font-bold text-white">
              {{ pillar.label }}
            </h2>
            <span v-if="pillar.gestation" class="gestation-badge">
              <div class="i-lucide-flask-conical h-3 w-3" />
              En gestation
            </span>
          </div>

          <p class="text-white/65 leading-relaxed whitespace-pre-line mt-3">{{ pillar.text }}</p>

          <!-- Project card -->
          <div v-if="pillar.project" class="project-card mt-4">
            <div class="project-icon">
              <div class="i-lucide-rocket h-4 w-4" />
            </div>
            <div>
              <span class="font-display font-semibold text-white text-sm">{{ pillar.project.name }}</span>
              <span class="text-white/45 text-sm ml-2">{{ pillar.project.text }}</span>
            </div>
          </div>

          <div v-if="pillar.to" class="mt-4">
            <NuxtLink
              :to="pillar.to"
              class="inline-flex items-center gap-1 text-sm text-primary hover:text-primary/80 transition-colors"
            >
              En savoir plus
              <div class="i-lucide-arrow-right h-3.5 w-3.5" />
            </NuxtLink>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
definePageMeta({
  layout: 'default',
})

const { data: content } = await usePageContent('numerique')

useHead({
  title: content.value?.meta?.title ?? 'Autonomie numérique',
})
</script>

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

.pillar-card {
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--color-text) / 0.08);
  background: hsl(var(--color-surface));
  transition: border-color 0.2s;
}

.pillar-card:hover {
  border-color: hsl(var(--color-primary) / 0.2);
}

.pillar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pillar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: hsl(var(--color-primary) / 0.15);
  color: hsl(var(--color-primary));
  box-shadow: 0 0 12px hsl(var(--color-primary) / 0.12);
  flex-shrink: 0;
}

.gestation-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: hsl(var(--color-accent) / 0.12);
  color: hsl(var(--color-accent));
  font-size: 0.7rem;
  font-weight: 500;
  font-family: var(--font-mono);
}

.project-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: hsl(var(--color-bg) / 0.5);
  border: 1px solid hsl(var(--color-primary) / 0.1);
}

.project-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: hsl(var(--color-primary) / 0.1);
  color: hsl(var(--color-primary));
  flex-shrink: 0;
}

.shadok-jardinier {
  position: absolute;
  left: 2%;
  top: 5%;
  width: clamp(100px, 14vw, 200px);
  opacity: 0.28;
  pointer-events: none;
  color: hsl(var(--color-primary));
  animation: shadok-float-jardinier 10s ease-in-out infinite;
}

.shadok-batisseur {
  position: absolute;
  right: 2%;
  bottom: 5%;
  width: clamp(110px, 15vw, 210px);
  opacity: 0.3;
  pointer-events: none;
  color: hsl(var(--color-accent));
  animation: shadok-float-batisseur 11s ease-in-out infinite;
}

@keyframes shadok-float-jardinier {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes shadok-float-batisseur {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(1deg); }
}

@media (max-width: 768px) {
  .shadok-jardinier { display: none; }
  .shadok-batisseur { display: none; }
}
</style>
