<template>
  <section class="relative overflow-hidden section-padding">
    <!-- Shadok thinker: ovoid character sitting, hand on chin, thinking bubble -->
    <svg class="shadok-thinker" viewBox="0 0 220 280" fill="none" aria-hidden="true">
      <!-- Body (seated, leaning forward) -->
      <ellipse cx="100" cy="160" rx="42" ry="50" fill="currentColor" opacity="0.85"/>
      <!-- Head (tilted) -->
      <ellipse cx="110" cy="95" rx="25" ry="24" fill="currentColor" opacity="0.8"/>
      <!-- Neck -->
      <path d="M100 118 Q105 110 108 105" stroke="currentColor" stroke-width="6" stroke-linecap="round" opacity="0.6" fill="none"/>
      <!-- Eyes (contemplative) -->
      <circle cx="103" cy="90" r="4.5" fill="currentColor" opacity="0.2"/>
      <circle cx="120" cy="90" r="4.5" fill="currentColor" opacity="0.2"/>
      <circle cx="104" cy="89" r="1.8" fill="currentColor" opacity="0.5"/>
      <circle cx="121" cy="89" r="1.8" fill="currentColor" opacity="0.5"/>
      <!-- Arm to chin -->
      <line x1="140" y1="145" x2="130" y2="108" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <!-- Hand on chin -->
      <circle cx="130" cy="105" r="5" fill="currentColor" opacity="0.45"/>
      <!-- Seated legs (crossed/bent) -->
      <path d="M75 205 Q60 230 50 240" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6" fill="none"/>
      <path d="M120 205 Q140 220 145 240" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6" fill="none"/>
      <!-- Feet -->
      <path d="M50 240 L38 243 M50 240 L45 246" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" opacity="0.5"/>
      <path d="M145 240 L133 243 M145 240 L140 246" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" opacity="0.5"/>
      <!-- Thinking bubbles -->
      <circle cx="150" cy="78" r="5" fill="currentColor" opacity="0.3"/>
      <circle cx="165" cy="62" r="8" fill="currentColor" opacity="0.25"/>
      <circle cx="185" cy="42" r="12" fill="currentColor" opacity="0.2"/>
    </svg>

    <!-- Shadok menuisier: character with plane and plank -->
    <svg class="shadok-menuisier" viewBox="0 0 240 300" fill="none" aria-hidden="true">
      <ellipse cx="120" cy="155" rx="40" ry="48" fill="currentColor" opacity="0.85"/>
      <circle cx="120" cy="92" r="25" fill="currentColor" opacity="0.8"/>
      <path d="M98 82 Q120 68 142 82" fill="currentColor" opacity="0.35"/>
      <rect x="100" y="80" width="40" height="5" rx="1" fill="currentColor" opacity="0.3"/>
      <circle cx="112" cy="90" r="4" fill="currentColor" opacity="0.2"/>
      <circle cx="130" cy="90" r="4" fill="currentColor" opacity="0.2"/>
      <circle cx="113" cy="89" r="1.8" fill="currentColor" opacity="0.5"/>
      <circle cx="131" cy="89" r="1.8" fill="currentColor" opacity="0.5"/>
      <line x1="114" y1="103" x2="126" y2="103" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" opacity="0.3"/>
      <line x1="160" y1="145" x2="195" y2="160" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <rect x="190" y="155" width="30" height="12" rx="2" fill="currentColor" opacity="0.4"/>
      <rect x="200" y="150" width="8" height="8" rx="1" fill="currentColor" opacity="0.35"/>
      <line x1="80" y1="148" x2="50" y2="168" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <line x1="105" y1="200" x2="95" y2="258" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <line x1="135" y1="200" x2="145" y2="258" stroke="currentColor" stroke-width="3.5" stroke-linecap="round" opacity="0.6"/>
      <rect x="35" y="170" width="80" height="8" rx="1" fill="currentColor" opacity="0.3"/>
      <path d="M60 168 Q55 162 62 160" stroke="currentColor" stroke-width="1" stroke-linecap="round" fill="none" opacity="0.2"/>
      <path d="M80 166 Q76 158 83 157" stroke="currentColor" stroke-width="1" stroke-linecap="round" fill="none" opacity="0.18"/>
    </svg>

    <div class="container-content">
      <div class="grid items-center gap-12 md:grid-cols-2">
        <!-- Book cover -->
        <UiScrollReveal>
          <div class="book-cover-wrapper">
            <div class="book-cover-3d">
              <img
                :src="content?.book.coverImage"
                :alt="content?.book.coverAlt"
                class="book-cover-img"
              />
            </div>
          </div>
        </UiScrollReveal>

        <!-- Description -->
        <div>
          <UiScrollReveal>
            <p class="mb-2 font-mono text-sm tracking-widest text-accent uppercase">{{ content?.bookPresentation.kicker }}</p>
            <h2 class="heading-section font-display font-bold tracking-tight text-white">
              {{ content?.bookPresentation.title }}
            </h2>
          </UiScrollReveal>

          <UiScrollReveal
            v-for="(paragraph, i) in content?.bookPresentation.description"
            :key="i"
            :delay="(i + 1) * 100"
          >
            <p class="mt-4 text-lg leading-relaxed text-white/60">
              {{ paragraph }}
            </p>
          </UiScrollReveal>

          <UiScrollReveal :delay="300">
            <div class="mt-8">
              <UiBaseButton :to="content?.bookPresentation.cta.to">
                {{ content?.bookPresentation.cta.label }}
                <div class="i-lucide-arrow-right ml-2 h-4 w-4" />
              </UiBaseButton>
            </div>
          </UiScrollReveal>
        </div>
      </div>
    </div>
  </section>
</template>

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

<style scoped>
.book-cover-wrapper {
  perspective: 800px;
  display: flex;
  justify-content: center;
}

.book-cover-3d {
  aspect-ratio: 3 / 4;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid hsl(var(--color-text) / 0.1);
  box-shadow:
    0 12px 40px hsl(var(--color-text) / 0.15),
    0 0 0 1px hsl(var(--color-text) / 0.08);
  transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1),
              box-shadow 0.5s ease;
  max-width: 360px;
}

.book-cover-3d:hover {
  transform: rotateY(-8deg) rotateX(3deg) scale(1.02);
  box-shadow:
    12px 16px 48px hsl(var(--color-text) / 0.2),
    0 0 0 1px hsl(var(--color-primary) / 0.2);
}

.book-cover-img {
  width: 200%;
  height: 100%;
  object-fit: cover;
  transform: translateX(-50%);
}

.heading-section {
  font-size: clamp(1.625rem, 4vw, 2.125rem);
}

.shadok-thinker {
  position: absolute;
  right: 2%;
  bottom: 6%;
  width: clamp(110px, 14vw, 200px);
  opacity: 0.28;
  pointer-events: none;
  color: hsl(var(--color-accent));
  animation: shadok-float-thinker 10s ease-in-out infinite;
}

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

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

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

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