<template>
  <UiContainer class="space-y-[55px] md:space-y-[75px] xl:space-y-[100px]">
    <div class="space-y-10 sm:space-y-[55px] md:space-y-14">
      <h1 class="h1 text-center">
        <span
          v-for="(item, index) in component.front_section_lang[0].data.title"
          :key="index"
          :class="[
            item.highlight
              ? 'text-accent-green-light dark:text-accent-green-dark'
              : '',
            'inline',
          ]"
        >
          {{ item.text }}
          <span
            v-if="
              index !== component.front_section_lang[0].data.title.length - 1
            "
          />
        </span>
      </h1>
      <div
        class="h-[180px] sm:h-[330px] md:h-[500px] rounded-2xl"
        :style="{
          backgroundImage: `url('/api/public/file/${component.img[0]}_l.webp')`,
          backgroundSize: 'cover',
          backgroundPosition: 'center',
        }"
      />
      <div class="md:w-full xl:w-[70%] space-y-14">
        <p>{{ component.front_section_lang[0].data.main_description }}</p>
        <h4 class="h4-uppercase-bold-inter">
          {{ component.front_section_lang[0].data.secondary_description }}
        </h4>
      </div>
    </div>
    <div class="grid space-25-75 xl:space-0 grid-cols-1 xl:grid-cols-2">
      <h2 class="h2-bold-bounded">
        {{ component.front_section_lang[0].data.section_1_title }}
      </h2>
      <p v-html="component.front_section_lang[0].data.section_1_description" />
    </div>
    <div class="grid space-25-75 xl:space-0 grid-cols-1 xl:grid-cols-2">
      <h2 class="h2-bold-bounded">
        <span
          v-for="(item, index) in component.front_section_lang[0].data
            .section_2_title"
          :key="index"
          :class="[
            item.highlight
              ? 'text-accent-green-light dark:text-accent-green-dark'
              : '',
            'inline',
          ]"
        >
          {{ item.text }}
          <span
            v-if="
              index !== component.front_section_lang[0].data.title.length - 1
            "
          />
        </span>
      </h2>
      <p v-html="component.front_section_lang[0].data.section_2_description" />
    </div>
    <div class="space-25-75">
      <h2 class="h2-bold-bounded">
        {{ component.front_section_lang[0].data.section_3_title }}
      </h2>
      <div
        class="grid grid-cols-1 space-25-55 md:space-0 xl:gap-2 md:grid-cols-2"
      >
        <div class="space-y-[25px] sm:space-y-[45px]">
          <p>
            {{ component.front_section_lang[0].data.section_3_description }}
          </p>
          <div class="">
            <p
              v-for="(item, index) in component.front_section_lang[0].data
                .section_3_items"
              :key="index"
            >
              {{ index + 1 }}.
              {{ item }}
            </p>
          </div>
        </div>
        <div
          class="h-[315px] xl:h-full rounded-2xl"
          :style="{
            backgroundImage: `url('/api/public/file/${component.img[1]}_l.webp')`,
            backgroundSize: 'cover',
            backgroundPosition: 'center',
          }"
        />
      </div>
    </div>
    <div class="grid grid-cols-1 xl:grid-cols-2">
      <div class="col-start-2 col-end-3 space-25-75 xl:space-0">
        <h2 class="h2-bold-bounded">
          {{ component.front_section_lang[0].data.section_4_title }}
        </h2>
        <p
          v-html="component.front_section_lang[0].data.section_4_description"
        />
      </div>
    </div>
  </UiContainer>
</template>

<script lang="ts" setup>
defineProps<{
  component: {
    id: number
    name: string
    img: string[]
    component_name: string
    is_no_lang: boolean
    page_name: string
    front_section_lang: {
      data: {
        title: {
          text: string
          highlight: boolean
        }[]
        main_description: string
        secondary_description: string
        section_1_title: string
        section_1_description: string
        section_2_title: {
          text: string
          highlight: boolean
        }[]
        section_2_description: string
        section_3_title: string
        section_3_description: string
        section_3_items: string[]
        section_4_title: string
        section_4_description: string
      }
      id_front_section: number
      id_lang: number
    }[]
  }
}>()
</script>
