/* ============================================================
   About: Reliable Supply / 中国地图（about.html Section 3）
   Figma 蓝色区块（1920x1080，var(--color-primary)）
   地图容器 1281x950 位于 (31,43)，右侧文案 1210 起
   ============================================================ */

.ab-supply {
  position: relative;
  width: 100%;
  aspect-ratio: 1920 / 1080;
  background: var(--color-primary);
  overflow: hidden;
}

/* --- 地图容器（Figma x=31, y=43, 1281x950） --- */
.ab-supply__map {
  position: absolute;
  left: 1.61%;
  top: 3.98%;
  width: min(66.72vw, 1281px);       /* 1281/1920 */
  aspect-ratio: 1281 / 950;
}

.ab-supply__map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- 地图标题（Figma x=117/1281, y=787/950） --- */
.ab-map__title {
  position: absolute;
  left: 9.13%;
  top: 82.84%;
  margin: 0;
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: min(1.667vw, 2rem);     /* 32/1920 */
  color: var(--color-primary);
  white-space: nowrap;
}

/* --- 厂址浮标（整体渲染为单张图片，等比缩放零错位，严格按设计稿） --- */
.ab-map__tag {
  position: absolute;
  width: 15.61%;                     /* 200/1281 */
}

.ab-map__tag-img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- 图例（Figma x=117/1281, y=865/950，行顶距 44px，行高 24px → gap 20px）
       cqw 需解析"最近的祖先容器"：legend 本身不能设 container-type，
       因此嵌套一层 .ab-map__legend-cq 作为查询容器，所有 cqw 在其子孙上 --- */
.ab-map__legend {
  position: absolute;
  left: 9.13%;
  top: 91.05%;
  width: 27.71%;                     /* 355/1281 */
}

.ab-map__legend-cq {
  width: 100%;
  container-type: inline-size;       /* 查询容器（cqw 基准 = 图例宽度） */
}

.ab-map__legend-list {
  display: flex;
  flex-direction: column;
  gap: 5.63cqw;                      /* 20/355 → 行顶距 44px */
}

.ab-map__legend-row {
  display: flex;
  align-items: center;
  gap: 4.23cqw;                      /* 15/355 */
}

.ab-map__legend-sq {
  width: 9.86cqw;                    /* 35/355 */
  aspect-ratio: 35 / 20;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.ab-map__legend-sq--plant { background: var(--color-map-plant); }
.ab-map__legend-sq--rd    { background: var(--color-map-rd); }    /* #A7CD50 */
.ab-map__legend-sq--dist  { background: var(--color-map-dist); }

.ab-map__legend-text {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 6.76cqw;                /* 24/355 */
  line-height: 1;
  color: var(--color-white);
  white-space: nowrap;
}

/* ============================================================
   地图入场动效（用户需求）：
   进入视口时（.ab-supply__map.in-view，由 main.js IntersectionObserver 触发）——
   中国地图先淡入，随后 10 个厂址标签按延迟逐次浮现；
   不同标签从不同方向/距离滑入（上部标签自上落下、中部近距上滑、
   南部远距上滑、东部自右滑入），幅度差形成视差层次
   ============================================================ */

@keyframes ab-map-tag-far {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ab-map-tag-near {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ab-map-tag-down {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ab-map-tag-side {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes ab-map-tag-side-l {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 标签在动画开始前隐藏（backwards 填充在 delay 期间保持 from 态） */
.ab-supply__map .ab-map__tag {
  opacity: 0;
}

.ab-supply__map.in-view .ab-supply__map-bg {
  animation: fade-in var(--duration-base) var(--ease-decelerate) both;   /* 地图先淡入 */
}

.ab-supply__map.in-view .ab-map__tag {
  animation-duration: var(--duration-slow);
  animation-timing-function: var(--ease-decelerate);
  animation-fill-mode: both;
}

/* 错落延迟 350ms 起，每标签递增 130ms（地图淡入完成后再出现）；
   方向按标签地理位置分配：北部落下 / 南部升起 / 西部左入 / 东部右入 */
.ab-supply__map.in-view .ab-map__tag:nth-of-type(1)  { animation-name: ab-map-tag-far;    animation-delay: 350ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(2)  { animation-name: ab-map-tag-far;    animation-delay: 480ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(3)  { animation-name: ab-map-tag-side;   animation-delay: 610ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(4)  { animation-name: ab-map-tag-near;   animation-delay: 740ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(5)  { animation-name: ab-map-tag-side-l; animation-delay: 870ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(6)  { animation-name: ab-map-tag-down;   animation-delay: 1000ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(7)  { animation-name: ab-map-tag-side-l; animation-delay: 1130ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(8)  { animation-name: ab-map-tag-side;   animation-delay: 1260ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(9)  { animation-name: ab-map-tag-down;   animation-delay: 1390ms; }
.ab-supply__map.in-view .ab-map__tag:nth-of-type(10) { animation-name: ab-map-tag-down;   animation-delay: 1520ms; }

/* --- 右侧文案（Figma title y=411, desc y=519, 宽 638） --- */
.ab-supply__copy {
  position: absolute;
  left: 63.02%;                      /* 1210/1920 */
  top: 38.06%;                       /* 411/1080 */
  width: 33.23%;                     /* 638/1920 */
  display: flex;
  flex-direction: column;
  gap: 60px;                         /* desc 519 - title 459 = 60 */
}

.ab-supply__title {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.9583vw, 4.75rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--color-white);
  margin: 0;
  white-space: nowrap;
}

.ab-supply__desc {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: clamp(0.875rem, 1.6667vw, 2rem);
  line-height: 1.5;
  letter-spacing: -0.02em;
  color: var(--color-white);
  margin: 0;
}

/* ==================== 响应式（1200 以下移动端布局） ==================== */
@media (max-width: 1200px) {
  .ab-supply {
    aspect-ratio: auto;
    padding: 80px 0;
  }

  .ab-supply__map {
    position: static;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 64px;
  }

  .ab-supply__copy {
    position: static;
    width: 100%;
    max-width: var(--container-content);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    text-align: center;
    align-items: center;
    gap: 22px;
  }

  .ab-supply__title {
    font-size: clamp(1.5rem, 0.65vw + 1.35rem, 2.5rem);
    line-height: 1.18;
    letter-spacing: -0.02em;
    white-space: normal;
  }

  .ab-supply__desc {
    font-size: clamp(1rem, 1.6667vw, 2.125rem);
    line-height: 1.5;
  }

  .ab-map__title {
    font-size: clamp(1rem, 0.32vw + 0.92rem, 1.5rem);
  }
}

@media (max-width: 768px) {
  .ab-supply {
    padding: 56px 0;
  }

  .ab-supply__title {
    font-size: clamp(1.5rem, 0.81vw + 1.31rem, 2.75rem);
    line-height: 1.18;
  }

  .ab-supply__map {
    margin-bottom: 48px;
  }

  .ab-supply__desc {
    font-size: clamp(1rem, 1.6667vw, 2.125rem);
    line-height: 1.5;
  }

  .ab-map__title {
    font-size: clamp(1rem, 0.16vw + 0.96rem, 1.25rem);
  }
}

@media (max-width: 576px) {
  .ab-supply__title {
    font-size: clamp(1.625rem, 8vw, 2.25rem);
    line-height: 1.18;
  }
}

/* ==================== 无障碍降级 ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
