<template>
  <UiContainer class="space-y-[55px] sm:space-y-[75px] md:space-y-[100px]">
    <div class="space-25-55-75">
      <div class="grid sm:grid-cols-7 md:grid-cols-4 xl:grid-cols-2">
        <h2
          class="sm:col-start-2 sm:col-end-8 md:col-end-5 xl:col-start-2 h2-bold-bounded"
        >
          {{ component.front_section_lang[0].data.section_1.title }}
        </h2>
      </div>
      <div class="space-y-[40px] sm:space-55-75">
        <div
          v-for="(item, index) in component.front_section_lang[0].data.section_1
            .text_blocks"
          :key="index"
          class="grid grid-cols-7 md:grid-cols-4 xl:grid-cols-2"
        >
          <div class="flex gap-[200px]">
            <h4 class="h4-uppercase-bold-inter">
              0{{ index + 1 }}
            </h4>
            <h4
              class="hidden xl:block h4-uppercase-bold-inter w-full whitespace-nowrap"
            >
              {{ item.block_title }}
            </h4>
          </div>
          <div
            class="col-start-2 col-end-8 md:col-end-5 space-y-[25px] sm:space-y-[45px] md:space-y-[55px]"
          >
            <h4
              class="xl:hidden h4-uppercase-bold-inter w-full whitespace-nowrap"
            >
              {{ item.block_title }}
            </h4>
            <p>{{ item.block_text }}</p>
          </div>
        </div>
      </div>
    </div>
    <div class="space-25-55-75">
      <h2 class="h2-bold-bounded">
        {{ component.front_section_lang[0].data.section_2.title }}
      </h2>
      <div
        class="grid sm:grid-cols-2 xl:grid-cols-4 gap-[30px] auto-cols-fr auto-rows-fr"
      >
        <div
          v-for="(item, index) in component.front_section_lang[0].data.section_2
            .text_blocks"
          :key="index"
          class="border border-border rounded-2xl p-8 flex flex-col justify-between gap-[55px]"
        >
          <div>
            <h4 class="h4-uppercase-bold-inter">
              0{{ index + 1 }}
            </h4>
            <h4 class="h4-uppercase-bold-inter">
              {{ item.block_title }}
            </h4>
          </div>
          <p>{{ item.block_text }}</p>
        </div>
        <div
          class="row-end-4 sm:row-end-3 col-start-1 col-end-2 xl:row-end-1 xl:col-start-3 xl:col-end-4 flex flex-col gap-[10px] md:gap-[30px]"
        >
          <div
            class="w-full h-full md:h-[211px] rounded-2xl"
            :style="{
              backgroundImage: `url('/api/public/file/${component.img[0]}_l.webp')`,
              backgroundSize: 'cover',
              backgroundPosition: 'center',
            }"
          />
          <div
            class="w-full h-full md:h-[211px] rounded-2xl"
            :style="{
              backgroundImage: `url('/api/public/file/${component.img[1]}_l.webp')`,
              backgroundSize: 'cover',
              backgroundPosition: 'center',
            }"
          />
        </div>
      </div>
    </div>
    <div class="grid space-25-55 xl:grid-cols-2">
      <h2 class="h2-bold-bounded">
        {{ component.front_section_lang[0].data.section_3.title }}
      </h2>
      <div class="flex flex-col space-25-55">
        <p
          v-for="(item, index) in component.front_section_lang[0].data.section_3
            .text_blocks"
          :key="index"
        >
          {{ item }}
        </p>
      </div>
    </div>
    <div class="grid xl:space-25-55 grid-cols-1 xl:grid-cols-2 xl:gap-[30px]">
      <div
        class="flex flex-col gap-[25px] sm:gap-[55px] md:gap-[75px] xl:justify-between"
      >
        <h2 class="h2-bold-bounded">
          {{ component.front_section_lang[0].data.section_4.title }}
        </h2>
        <p>{{ component.front_section_lang[0].data.section_4.description }}</p>
      </div>
      <div
        class="mb-[25px] mt-5 md:mb-[55px] xl:m-0 w-full h-[222px] sm:h-[371px] rounded-2xl"
        :style="{
          backgroundImage: `url('/api/public/file/${component.img[2]}_l.webp')`,
          backgroundSize: 'cover',
          backgroundPosition: 'center',
        }"
      />
      <p class="xl:col-start-2 xl:col-end-3">
        {{ component.front_section_lang[0].data.section_4.description_second }}
      </p>
    </div>
  </UiContainer>
</template>

<script setup lang="ts">
defineProps<{
  component: {
    id: number
    name: string
    img: string[]
    component_name: string
    is_no_lang: boolean
    page_name: string
    front_section_lang: {
      data: {
        section_1: {
          title: string
          text_blocks: [
            {
              block_title: string
              block_text: string
            },
          ]
        }
        section_2: {
          title: string
          text_blocks: [
            {
              block_title: string
              block_text: string
            },
          ]
        }
        section_3: {
          title: string
          text_blocks: []
        }
        section_4: {
          title: string
          description: string
          description_second: string
        }
      }
      id_front_section: number
      id_lang: number
    }[]
  }
}>()
</script>
