<template>
  <div class="section-header">
    <div class="header-left">
      <slot name="left">
        <span class="title">{{ title }}</span>
      </slot>
    </div>
    <div class="header-right">
      <slot name="right"></slot>
    </div>
  </div>
</template>

<script setup>
import bgImg from "@/assets/RiskWarning_img/标题bg@2x.png";

defineProps({
  title: {
    type: String,
    default: "",
  },
});
</script>

<style lang="scss" scoped>
.section-header {
  height: 6.6667vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-image: url(v-bind(bgImg));
  background-size: cover;
  background-position: left;

  .header-left {
    display: flex;
    align-items: center;
    gap: 1.0667vw;
    font-size: 1.3333vw;
    .title {
      margin-left: 2.667vw;
      font-weight: bold;
      color: #fff;
      font-size: 1vw;
    }
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 1.0667vw;
  }

  @media (max-width: 768px) {
    height: 10.6667vw;

    .header-left {
      gap: 2.1333vw;

      .title {
        margin-left: 8vw;
        font-size: 1vw;
        font-weight: bold;
        color: #fff;
      }
    }

    .header-right {
      gap: 2.1333vw;
    }
  }
}

// 插槽内容自适应
::v-deep(.header-left .title),
::v-deep(.header-left > span),
::v-deep(.header-left > div) {
  font-weight: bold;
  color: #fff;

  @media (max-width: 768px) {
    font-size: 4vw;
  }
}
</style>
