/*
 * Khối "Tại sao chọn chúng tôi" (why_us, ADR-0084) — hình vẽ bằng code (SVG + CSS), không ảnh.
 * Màu / chữ / bo góc lấy từ biến của giao diện (--accent, --on-accent, --ink, --muted, --surface, --line, --display…) với giá trị dự phòng,
 * nên hợp với mọi giao diện sáng / tối. "Mỗi lý do một màu" = xoay sắc độ (OKLCH) quanh màu chủ đạo, giữ độ sáng → chữ trên nút số vẫn đọc rõ.
 * Khung ≥ 840 px: logo trái + cung tròn + thẻ theo vòng cung (toạ độ % từ WhyUsBlock::geometry, chữ co giãn theo cqw).
 * Khung hẹp: logo trên, danh sách dọc có trục nối. "Giảm chuyển động" → đứng yên.
 */
.blk.blk-why {
  --why-accent: var(--accent, #1F4FD8);
  --why-on-accent: var(--on-accent, #FFFFFF);
  --why-ink: var(--ink, #1B1B1F);
  --why-muted: var(--muted, #5B616E);
  --why-surface: var(--surface, #F3F4F6);
  --why-bg: var(--bg, #FFFFFF);
  --why-line: var(--line, #E2E4E9);
  --why-display: var(--display, inherit);
  --why-weight: var(--display-weight, 700);
  --why-ease: var(--ease, cubic-bezier(.16, 1, .3, 1));
  --c: var(--why-accent);
}
.blk.blk-why .blk-why__inner { container: whyus / inline-size; }

/* ---------- Tiêu đề ---------- */
.blk.blk-why .blk-why__head { max-width: 760px; margin: 0 auto clamp(20px, 4vw, 40px); text-align: center; }
.blk.blk-why .blk-why__eyebrow {
  margin: 0 0 10px; color: var(--why-accent); font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.blk.blk-why .blk-why__title { margin: 0; }
.blk.blk-why .blk-why__lead { margin: 14px 0 0; color: var(--why-muted); }

/* ---------- Màu từng lý do ---------- */
@supports (color: oklch(from red l c h)) {
  .blk.blk-why--nhieu-mau :is(.blk-why__item, .blk-why__wire, .blk-why__node, .blk-why__pulse) {
    --c: oklch(from var(--why-accent) l max(c, .11) calc(h + var(--k) * (300 / var(--why-n))));
  }
}

/* ---------- Khung hẹp (mặc định): logo trên, danh sách dọc ---------- */
.blk.blk-why .blk-why__stage { position: relative; }
.blk.blk-why .blk-why__svg { display: none; }
.blk.blk-why .blk-why__logo { position: relative; width: 132px; aspect-ratio: 1; margin: 0 auto 26px; }
.blk.blk-why .blk-why__halo {
  position: absolute; inset: -18%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--why-accent) 30%, transparent), transparent);
  animation: why-breathe 4.8s ease-in-out infinite;
}
.blk.blk-why .blk-why__ring {
  position: absolute; inset: -5px; border-radius: 50%; padding: 3px; pointer-events: none;
  background: conic-gradient(from 0deg, var(--why-accent), color-mix(in oklab, var(--why-accent) 10%, transparent) 40%, transparent 60%, var(--why-accent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: why-spin 7s linear infinite;
}
.blk.blk-why .blk-why__core {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 0 0 6px color-mix(in oklab, var(--why-accent) 16%, transparent), 0 24px 50px -24px color-mix(in oklab, var(--why-accent) 70%, #000);
}
.blk.blk-why .blk-why__core img {
  width: 76%; height: 76%; max-width: none; margin: 0; object-fit: contain; border-radius: 0; box-shadow: none; aspect-ratio: auto;
}
.blk.blk-why .blk-why__mark { color: var(--why-accent); font-family: var(--why-display); font-weight: 800; font-size: 28px; letter-spacing: .04em; }

.blk.blk-why .blk-why__list {
  position: relative; display: grid; gap: 14px; max-width: 560px; margin: 0 auto; padding: 0; list-style: none; counter-reset: none;
}
.blk.blk-why .blk-why__list::before {
  content: ''; position: absolute; left: 25px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--why-accent), transparent); opacity: .5;
}
.blk.blk-why .blk-why__item {
  position: relative; display: flex; align-items: center; gap: 14px; margin: 0; padding: 0;
}
.blk.blk-why .blk-why__item::before { content: none; }
.blk.blk-why .blk-why__num {
  position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 52px; aspect-ratio: 1; border-radius: 50%;
  background: var(--c); color: var(--why-on-accent); font-family: var(--why-display); font-weight: 800; font-size: 17px; line-height: 1;
  box-shadow: 0 0 0 5px color-mix(in oklab, var(--c) 18%, transparent), 0 10px 24px -10px var(--c);
}
.blk.blk-why .blk-why__body {
  flex: 1; display: grid; gap: 3px; min-width: 0; padding: 13px 18px; border-radius: 999px;
  background: color-mix(in oklab, var(--c) 11%, var(--why-surface));
  border: 1px solid color-mix(in oklab, var(--c) 38%, transparent);
  transition: transform .45s var(--why-ease), box-shadow .45s var(--why-ease), border-color .45s var(--why-ease);
}
.blk.blk-why .blk-why__name {
  color: var(--why-ink); font-family: var(--why-display); font-weight: var(--why-weight); font-size: 17px; line-height: 1.25; letter-spacing: .01em;
}
.blk.blk-why .blk-why__text { color: var(--why-muted); font-size: 14px; line-height: 1.45; }
.blk.blk-why .blk-why__item:hover .blk-why__body {
  transform: translateX(6px); border-color: color-mix(in oklab, var(--c) 70%, transparent);
  box-shadow: 0 16px 36px -18px color-mix(in oklab, var(--c) 80%, transparent);
}

/* ---------- Khung rộng: logo + cung tròn + thẻ theo vòng cung ---------- */
@container whyus (min-width: 840px) {
  .blk.blk-why .blk-why__stage { aspect-ratio: var(--why-ratio); }
  .blk.blk-why .blk-why__svg { display: block; position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .blk.blk-why .blk-why__logo {
    position: absolute; left: var(--x); top: var(--y); width: var(--d); margin: 0; transform: translate(-50%, -50%);
  }
  .blk.blk-why .blk-why__ring { inset: -1.2cqw; padding: .5cqw; }
  .blk.blk-why .blk-why__core { box-shadow: 0 0 0 1.2cqw color-mix(in oklab, var(--why-accent) 14%, transparent), 0 3cqw 6cqw -3cqw color-mix(in oklab, var(--why-accent) 70%, #000); }
  .blk.blk-why .blk-why__mark { font-size: 4.4cqw; }
  .blk.blk-why .blk-why__list { position: absolute; inset: 0; display: block; max-width: none; margin: 0; }
  .blk.blk-why .blk-why__list::before { content: none; }
  .blk.blk-why .blk-why__item {
    position: absolute; left: var(--x); top: var(--y); width: 38%; min-height: var(--ch); gap: 0; transform: translateY(-50%);
  }
  .blk.blk-why .blk-why__num {
    position: absolute; left: 0; top: 50%; width: 6.4cqw; min-width: 44px; font-size: clamp(14px, 1.9cqw, 22px);
    transform: translate(-35%, -50%); box-shadow: 0 0 0 .7cqw color-mix(in oklab, var(--c) 20%, transparent), 0 1.2cqw 2.6cqw -1cqw var(--c);
  }
  .blk.blk-why .blk-why__body {
    align-self: stretch; align-content: center; padding: .9cqw 2.2cqw .9cqw max(4.6cqw, 38px);
  }
  .blk.blk-why .blk-why__name { font-size: clamp(15px, 1.95cqw, 23px); }
  .blk.blk-why .blk-why__text {
    font-size: clamp(12.5px, 1.3cqw, 15px); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  }
  .blk.blk-why--dense .blk-why__text { -webkit-line-clamp: 1; }
}

/* ---------- SVG: vệt quỹ đạo, cung, đốm sáng, dây nối, nút ---------- */
.blk.blk-why .blk-why__track { fill: none; stroke: var(--why-line); stroke-width: 1.5; stroke-dasharray: 2 10; stroke-linecap: round; }
.blk.blk-why .blk-why__stop { stop-color: var(--why-accent); }
.blk.blk-why .blk-why__stop--fade { stop-opacity: .12; }
.blk.blk-why .blk-why__arc { fill: none; stroke-width: 3; stroke-linecap: round; }
.blk.blk-why .blk-why__comet { fill: var(--why-accent); filter: drop-shadow(0 0 6px var(--why-accent)); }
.blk.blk-why .blk-why__wire {
  fill: none; stroke: var(--c); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 0 9; opacity: .75;
  animation: why-flow 1.4s linear infinite; transition: opacity .3s, stroke-width .3s;
}
.blk.blk-why .blk-why__node { fill: var(--why-bg); stroke: var(--c); stroke-width: 3.5; }
.blk.blk-why .blk-why__pulse {
  fill: var(--c); opacity: 0; transform-box: fill-box; transform-origin: center;
  animation: why-ping 2.8s var(--why-ease) infinite; animation-delay: calc(var(--k) * .35s);
}
/* Rê chuột vào thẻ → dây nối của thẻ đó sáng lên */
.blk-why__stage:has(.blk-why__item:nth-child(1):hover) .blk-why__wire:nth-child(1),
.blk-why__stage:has(.blk-why__item:nth-child(2):hover) .blk-why__wire:nth-child(2),
.blk-why__stage:has(.blk-why__item:nth-child(3):hover) .blk-why__wire:nth-child(3),
.blk-why__stage:has(.blk-why__item:nth-child(4):hover) .blk-why__wire:nth-child(4),
.blk-why__stage:has(.blk-why__item:nth-child(5):hover) .blk-why__wire:nth-child(5),
.blk-why__stage:has(.blk-why__item:nth-child(6):hover) .blk-why__wire:nth-child(6),
.blk-why__stage:has(.blk-why__item:nth-child(7):hover) .blk-why__wire:nth-child(7) { opacity: 1; stroke-width: 3.6; animation-duration: .7s; }

@keyframes why-spin { to { transform: rotate(1turn); } }
@keyframes why-breathe { 0%, 100% { transform: scale(.92); opacity: .65; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes why-flow { to { stroke-dashoffset: -18; } }
@keyframes why-ping { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(3.4); opacity: 0; } }
@keyframes why-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes why-in { from { opacity: 0; translate: -28px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes why-pop { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }

/* Hiện dần khi cuộn tới (trình duyệt hỗ trợ dòng thời gian cuộn; nơi khác hiện sẵn) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .blk.blk-why .blk-why__arc { stroke-dasharray: 1; animation: why-draw linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
    .blk.blk-why .blk-why__item { animation: why-in linear both; animation-timeline: view(); animation-range: entry 0% entry 90%; }
    .blk.blk-why .blk-why__logo { animation: why-pop linear both; animation-timeline: view(); animation-range: entry 0% entry 90%; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .blk.blk-why :is(.blk-why__halo, .blk-why__ring, .blk-why__wire, .blk-why__pulse) { animation: none; }
  .blk.blk-why .blk-why__comet { display: none; }
  .blk.blk-why .blk-why__body { transition: none; }
}
