<template>
  <div class="relative overflow-hidden section-padding">
    <!-- Shadok jardinier: character with watering can and plant -->
    <svg class="shadok-jardinier" viewBox="0 0 240 300" fill="none" aria-hidden="true">
      <!-- Body -->
      <ellipse cx="110" cy="160" rx="40" ry="48" fill="currentColor" opacity="0.85"/>
      <!-- Head -->
      <circle cx="110" cy="96" r="25" fill="currentColor" opacity="0.8"/>
      <!-- Straw hat -->
      <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"/>
      <!-- Eyes (focused, looking down at plant) -->
      <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"/>
      <!-- Smile -->
      <path d="M103 106 Q110 111 118 106" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" fill="none" opacity="0.3"/>
      <!-- Arm holding watering can -->
      <line x1="70" y1="150" x2="40" y2="170" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <!-- Watering can -->
      <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"/>
      <!-- Water drops -->
      <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"/>
      <!-- Other arm -->
      <line x1="150" y1="150" x2="170" y2="180" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <!-- Legs -->
      <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"/>
      <!-- Plant -->
      <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"/>
      <!-- Pot -->
      <path d="M170 220 L175 240 L185 240 L190 220 Z" fill="currentColor" opacity="0.35"/>
    </svg>

    <!-- Shadok bâtisseur: character with trowel building a wall -->
    <svg class="shadok-batisseur" viewBox="0 0 260 300" fill="none" aria-hidden="true">
      <!-- Body -->
      <ellipse cx="130" cy="150" rx="40" ry="48" fill="currentColor" opacity="0.85"/>
      <!-- Head -->
      <circle cx="130" cy="86" r="25" fill="currentColor" opacity="0.8"/>
      <!-- Hard hat -->
      <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"/>
      <!-- Eyes (determined) -->
      <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"/>
      <!-- Grin -->
      <path d="M123 96 Q130 101 138 96" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" fill="none" opacity="0.3"/>
      <!-- Arm with trowel -->
      <line x1="170" y1="140" x2="210" y2="120" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <!-- Trowel -->
      <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"/>
      <!-- Other arm -->
      <line x1="90" y1="145" x2="65" y2="170" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <!-- Legs -->
      <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"/>
      <!-- Wall (bricks) -->
      <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"/>
      <!-- Brick lines -->
      <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">
          {{ content?.description }}
        </p>
      </header>

      <div class="mx-auto max-w-3xl flex flex-col gap-6">
        <div
          v-for="(extract, i) in content?.extracts"
          :key="i"
          class="card-surface"
        >
          <p class="mb-2 font-mono text-xs tracking-widest text-accent uppercase">
            {{ extract.chapter }}
          </p>
          <blockquote class="border-l-2 border-primary/30 pl-4 text-white/70 italic leading-relaxed whitespace-pre-line">
            {{ extract.text }}
          </blockquote>
          <div class="mt-4">
            <NuxtLink
              :to="`/modele-eco/${extract.chapterSlug}`"
              class="inline-flex items-center gap-1 text-sm text-primary hover:text-primary/80 transition-colors"
            >
              Lire le chapitre
              <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);
}

.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>
