/* Khối CoopMax — style scoped của ProductCoop.vue, gói dưới [data-ex-section=coop]. */
/* ───── Dưới 992px: chữ rồi hàng khung vuốt ngang (bản tạm — user chưa cần responsive) ───── */
[data-ex-section="coop"] .ex-coop-stage {
  position: relative;
  overflow: hidden;
  padding: 64px 0 56px;
}
[data-ex-section="coop"] .ex-coop-brand {
  position: relative;
  z-index: 2;
  margin: 0 auto;
  max-width: 640px;
  padding: 0 16px;
  text-align: center;
}
[data-ex-section="coop"] .ex-coop-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 40px 16px 8px;
}
[data-ex-section="coop"] .ex-coop-card {
  flex: 0 0 240px;
  scroll-snap-align: start;
  container-type: inline-size;
}

/* ───── Từ 992px: sân khấu ghim, khung đặt tuyệt đối theo làn (JS tính — xem layout) ───── */
@media (min-width: 992px) {
  [data-ex-section="coop"] .ex-coop-stage {
    position: sticky;
    top: 56px; /* HEADER_PX */
    /* Mức cao tối thiểu ≤ phần màn dưới header của laptop/iPad ngang thấp (~650px − 56) — cao hơn thì đáy khối khuất suốt lúc
       ghim (rà 21/10, 620 cũ). Chỗ cho cụm chữ do layout lo (is-compact / is-tight). */
    height: max(540px, calc(100vh - 56px));
    padding: 0;
  }
  [data-ex-section="coop"] .ex-coop-stage { --bw0: 440px; }
  [data-ex-section="coop"] .ex-coop-brand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: var(--bw, var(--bw0)); /* --bw: JS đặt khi cảnh 2 cần rộng hơn (nấc 2) */
    max-width: none;
    padding: 0;
  }
  [data-ex-section="coop"] .ex-coop-cards {
    position: absolute;
    inset: 0;
    display: block;
    overflow: visible;
    padding: 0;
  }
  [data-ex-section="coop"] .ex-coop-card {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--cw, 240px);
    will-change: transform;
  }
  [data-ex-section="coop"] .ex-coop-stage:not(.is-ready) .ex-coop-card { visibility: hidden; }
}
/* 4 tính năng: lưới 2 cột, chữ canh trái trong từng ô (canh giữa cả đoạn mô tả nhiều dòng khó đọc). */
[data-ex-section="coop"] .ex-coop-feats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 32px;
  text-align: left;
}
@media (max-width: 575.98px) {
  [data-ex-section="coop"] .ex-coop-feats { grid-template-columns: minmax(0, 1fr); }
}
/* Tít cảnh 2 — nhỏ hơn tít khối một bậc rõ (đây là tít phụ, tít khối vẫn là chính). */
[data-ex-section="coop"] .ex-coop-feats-title {
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.1;
}
/* Vạch ngắn giữa tít và phần dưới (cả hai cảnh — user 20/10). */
[data-ex-section="coop"] .ex-coop-rule-mid {
  display: block;
  width: 200px;
  height: 1px;
  margin: 28px auto;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}
/* Icon tính năng: ô vuông viền trắng 52px (user 20/10). */
[data-ex-section="coop"] .ex-coop-feat-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  color: #ffffff;
}
/* Dưới 992px: tít rồi cảnh tính năng xếp nối tiếp, không đổi cảnh — logo lặp của cảnh 2 thì ẩn. */
[data-ex-section="coop"] .ex-coop-scenes > .ex-coop-scene--feats { margin-top: 40px; }
@media (max-width: 991.98px) {
  [data-ex-section="coop"] .ex-coop-scene--feats > .ex-coop-logo { display: none; }
}
/* Từ 992px: hai cảnh chồng một ô lưới (cụm chữ cao bằng cảnh cao hơn — không nhảy), chỉ cảnh `is-on` hiện. */
@media (min-width: 992px) {
  [data-ex-section="coop"] .ex-coop-scenes { display: grid; }
  [data-ex-section="coop"] .ex-coop-scenes > .ex-coop-scene {
    grid-area: 1 / 1;
    align-self: center;
    margin-top: 0;
    opacity: 0;
    visibility: hidden;
    filter: blur(10px);
    translate: 0 14px;
  }
  [data-ex-section="coop"] .ex-coop-scenes > .ex-coop-scene.is-on {
    opacity: 1;
    visibility: visible;
    filter: none;
    translate: 0 0;
  }
}
@media (min-width: 992px) and (prefers-reduced-motion: no-preference) {
  /* Ra: nhoè rồi ẩn hẳn. Vào: trễ một nhịp cho cảnh cũ kịp tan. */
  [data-ex-section="coop"] .ex-coop-scenes > .ex-coop-scene {
    transition: opacity 0.5s ease, filter 0.5s ease, translate 0.5s ease, visibility 0s linear 0.5s;
  }
  [data-ex-section="coop"] .ex-coop-scenes > .ex-coop-scene.is-on {
    transition: opacity 0.75s ease 0.25s, filter 0.75s ease 0.25s, translate 0.75s ease 0.25s, visibility 0s;
  }
}
@media (min-width: 1200px) { [data-ex-section="coop"] .ex-coop-stage { --bw0: 520px; } }
/* 580: vừa đủ dòng "trên một màn hình" ở cỡ tít 64px (~560px) — rộng hơn chỉ lấy bớt chỗ của khung hai bên. */
@media (min-width: 1600px) { [data-ex-section="coop"] .ex-coop-stage { --bw0: 580px; } }
@media (min-width: 992px) {
  /* Cảnh 1 (tít) luôn giữ bề ngang gốc kể cả khi cụm chữ rộng ra cho cảnh 2 — tít không xuống dòng khác đi. */
  [data-ex-section="coop"] .ex-coop-scenes > .ex-coop-scene:not(.ex-coop-scene--feats) { justify-self: center; width: min(100%, var(--bw0)); }
  /* Nấc gọn của cảnh 2 (layout gắn khi cụm chữ không lọt khối — laptop màn thấp). */
  [data-ex-section="coop"] .is-compact .ex-coop-scene--feats .ex-coop-feats-title { margin-top: 16px; }
  [data-ex-section="coop"] .is-compact .ex-coop-scene--feats .ex-coop-rule-mid { margin: 18px auto; }
  [data-ex-section="coop"] .is-compact .ex-coop-feats { gap: 18px 28px; }
  [data-ex-section="coop"] .is-compact .ex-coop-feats li > p { margin-top: 8px; }
  [data-ex-section="coop"] .is-compact .ex-coop-feat-icon { width: 44px; height: 44px; }
  [data-ex-section="coop"] .is-compact .ex-coop-more { margin-top: 20px; }
  [data-ex-section="coop"] .is-tight .ex-coop-scene--feats .ex-coop-rule-mid { margin: 14px auto; }
  [data-ex-section="coop"] .is-tight .ex-coop-feats { gap: 14px 24px; }
  [data-ex-section="coop"] .is-tight .ex-coop-more { margin-top: 16px; }
  [data-ex-section="coop"] .is-tight .ex-coop-rule-btn { visibility: hidden; height: 0; margin: 8px auto; }
  [data-ex-section="coop"] .is-tightest .ex-coop-scene--feats .ex-coop-logo img { height: 32px; }
  [data-ex-section="coop"] .is-tightest .ex-coop-scene--feats .ex-coop-feats-title { margin-top: 10px; }
}

/* Card minh hoạ tính năng — 4 tông xen kẽ (user 20/10): tối như nền · trắng · xanh dương · xanh lá; KHÔNG đổ bóng
   (user 20/10 "bỏ shadow"). Màu chữ phụ / vạch / dấu tích đi theo biến của từng tông nên nội dung card dùng chung class. */
[data-ex-section="coop"] .ex-coop-ui {
  --ui-bg: rgba(11, 27, 66, 0.82);
  --ui-fg: #ffffff;
  --ui-mute: rgba(255, 255, 255, 0.52);
  --ui-line: rgba(255, 255, 255, 0.1);
  --ui-label: #a8dc4f;
  --ui-ok: #a8dc4f;
  --ui-ok-ink: #061331;
  --ui-bar: #4f8fe8;
  --ui-track: rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  border: 1px solid var(--ui-line);
  background: var(--ui-bg);
  color: var(--ui-fg);
  padding: 16px;
}
[data-ex-section="coop"] .ex-coop-ui--dark {
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
[data-ex-section="coop"] .ex-coop-ui--light {
  --ui-bg: #ffffff;
  --ui-fg: #0b1a33;
  --ui-mute: #5b6b85;
  --ui-line: #e3e9f2;
  --ui-label: #1866d3;
  --ui-ok: #3f9e3c;
  --ui-ok-ink: #ffffff;
  --ui-bar: #1866d3;
  --ui-track: #e6edf7;
  border-color: transparent;
}
[data-ex-section="coop"] .ex-coop-ui--blue {
  --ui-bg: linear-gradient(150deg, #2a7be6 0%, #1458c0 100%);
  --ui-mute: rgba(255, 255, 255, 0.72);
  --ui-line: rgba(255, 255, 255, 0.2);
  --ui-label: #d4f39b;
  --ui-ok: #d4f39b;
  --ui-ok-ink: #0d3f8f;
  --ui-bar: #a8dc4f;
  --ui-track: rgba(255, 255, 255, 0.2);
  border-color: transparent;
}
/* Xanh dương TỐI đặc, chữ trắng (user 21/10; trước là xanh lá, đã thử xanh lơ → xanh ngọc rồi bỏ). Đặc màu để không lẫn
   với card kính tối trong suốt (`--dark`). */
[data-ex-section="coop"] .ex-coop-ui--navy {
  --ui-bg: linear-gradient(150deg, #1b4291 0%, #0c2459 100%);
  --ui-mute: rgba(255, 255, 255, 0.78);
  --ui-line: rgba(255, 255, 255, 0.18);
  --ui-label: #ffffff;
  --ui-ok: #ffffff;
  --ui-ok-ink: #0c2459;
  --ui-bar: #ffffff;
  --ui-track: rgba(255, 255, 255, 0.25);
  border-color: transparent;
}
[data-ex-section="coop"] .ex-coop-mute { color: var(--ui-mute); }
[data-ex-section="coop"] .ex-coop-rule { border-color: var(--ui-line); }
[data-ex-section="coop"] .ex-coop-ok { color: var(--ui-ok); }
[data-ex-section="coop"] .ex-coop-tick { background: var(--ui-ok); color: var(--ui-ok-ink); }
[data-ex-section="coop"] .ex-coop-current { border-color: var(--ui-ok); }
[data-ex-section="coop"] .ex-coop-track { background: var(--ui-track); }
[data-ex-section="coop"] .ex-coop-bar { background: var(--ui-bar); }
[data-ex-section="coop"] .ex-coop-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-label);
}
/* Số lớn co theo bề ngang khung (khung 200–300px) — cqw tính theo .ex-coop-card. */
[data-ex-section="coop"] .ex-coop-big {
  font-size: clamp(28px, 15cqw, 44px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
[data-ex-section="coop"] .ex-coop-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--ui-ok);
}
[data-ex-section="coop"] .ex-coop-rec {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #ff4d4d;
}

/* Camera AI: biển vẽ phủ biển thật trong ảnh + khung nhận diện. Cỡ chữ theo bề ngang khung ảnh (cqw của khung). */
[data-ex-section="coop"] .ex-coop-cam { container-type: inline-size; }
[data-ex-section="coop"] .ex-coop-platecover {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: #f4f4f0;
  color: #111;
  font-size: 2.3cqw;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
[data-ex-section="coop"] .ex-coop-detect {
  position: absolute;
  border: 2px solid #a8dc4f;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(2, 10, 28, 0.4), inset 0 0 18px rgba(168, 220, 79, 0.25);
}
[data-ex-section="coop"] .ex-coop-detect-tag {
  position: absolute;
  left: -2px;
  bottom: 100%;
  margin-bottom: 3px;
  white-space: nowrap;
  border-radius: 3px;
  background: #a8dc4f;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #020a1c;
}
/* Biển số Việt Nam vẽ: nền trắng, viền đen. */
[data-ex-section="coop"] .ex-coop-vnplate {
  border: 2px solid #111;
  border-radius: 4px;
  background: #f4f4f0;
  padding: 3px 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #111;
  white-space: nowrap;
}

/* ───── Quầng sáng + vệt sáng: TỰ TRÔI liên tục (user 20/10), không theo cuộn ───── */
[data-ex-section="coop"] .ex-coop-glow,
[data-ex-section="coop"] .ex-coop-beam {
  position: absolute;
  pointer-events: none;
  will-change: translate, opacity;
}
/* Video nền (đã xin phép dùng — user 21/10): đen + quầng tím / xanh ngọc. `screen` làm phần đen trong suốt, chỉ còn quầng sáng cộng lên nền xanh
   đậm; xoay màu NHẸ −20° (user 20/10: −50° "sang ecomax quá") — tím (~265°) ngả chàm (~245°), xanh ngọc ngả xanh lục. Có video thì
   tắt quầng/vệt CSS (hai lớp chồng nhau rối mắt); người tắt chuyển động thì ngược lại — bỏ video, giữ quầng CSS đứng yên. */
[data-ex-section="coop"] .ex-coop-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: screen;
  filter: hue-rotate(-20deg);
  opacity: 0.5; /* user 20/10: thử 50% */
}
@media (prefers-reduced-motion: no-preference) {
  [data-ex-section="coop"] .ex-coop-glow,
[data-ex-section="coop"] .ex-coop-beam { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  [data-ex-section="coop"] .ex-coop-video { display: none; }
}
[data-ex-section="coop"] .ex-coop-glow { border-radius: 9999px; filter: blur(40px); }
[data-ex-section="coop"] .ex-coop-glow--a {
  width: 52vw;
  height: 52vw;
  left: -18vw;
  top: -22vw;
  background: radial-gradient(circle closest-side, rgba(31, 116, 230, 0.55), transparent);
}
[data-ex-section="coop"] .ex-coop-glow--b {
  width: 44vw;
  height: 44vw;
  right: -14vw;
  bottom: -20vw;
  background: radial-gradient(circle closest-side, rgba(116, 192, 67, 0.32), transparent);
}
[data-ex-section="coop"] .ex-coop-glow--c {
  width: 34vw;
  height: 34vw;
  right: 14vw;
  top: -14vw;
  background: radial-gradient(circle closest-side, rgba(43, 182, 196, 0.3), transparent);
}
[data-ex-section="coop"] .ex-coop-beam {
  width: 80vw;
  height: 12vw;
  border-radius: 50%;
  filter: blur(36px);
}
[data-ex-section="coop"] .ex-coop-beam--a {
  left: -24vw;
  top: 58%;
  rotate: -24deg;
  background: linear-gradient(90deg, transparent, rgba(79, 143, 232, 0.4) 40%, rgba(168, 220, 79, 0.22) 70%, transparent);
}
[data-ex-section="coop"] .ex-coop-beam--b {
  right: -30vw;
  top: 14%;
  rotate: 18deg;
  background: linear-gradient(90deg, transparent, rgba(43, 182, 196, 0.3) 45%, rgba(31, 116, 230, 0.3) 70%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
  [data-ex-section="coop"] .ex-coop-glow--a { animation: ex-coop-drift-a 22s ease-in-out infinite alternate; }
  [data-ex-section="coop"] .ex-coop-glow--b { animation: ex-coop-drift-b 26s ease-in-out infinite alternate; }
  [data-ex-section="coop"] .ex-coop-glow--c { animation: ex-coop-drift-c 19s ease-in-out infinite alternate; }
  [data-ex-section="coop"] .ex-coop-beam--a { animation: ex-coop-beam-a 17s ease-in-out infinite alternate; }
  [data-ex-section="coop"] .ex-coop-beam--b { animation: ex-coop-beam-b 23s ease-in-out infinite alternate; }
  [data-ex-section="coop"] .ex-coop-dot { animation: ex-coop-blink 1.6s ease-in-out infinite; }
  [data-ex-section="coop"] .ex-coop-rec { animation: ex-coop-blink 1.2s steps(2, jump-none) infinite; }
  [data-ex-section="coop"] .ex-coop-ping { animation: ex-coop-ping 2s ease-out infinite; transform-origin: 88px 160px; }
  [data-ex-section="coop"] .ex-coop-detect { animation: ex-coop-detect 2.4s ease-in-out infinite; }
  [data-ex-section="coop"] .ex-coop-current { animation: ex-coop-blink 1.6s ease-in-out infinite; }
}
@keyframes ex-coop-drift-a {
  0% { translate: 0 0; scale: 1; }
  50% { translate: 22vw 30vh; scale: 1.15; }
  100% { translate: 8vw 62vh; scale: 0.9; }
}
@keyframes ex-coop-drift-b {
  0% { translate: 0 0; opacity: 1; }
  50% { translate: -24vw -26vh; opacity: 0.7; }
  100% { translate: -6vw -54vh; opacity: 1; }
}
@keyframes ex-coop-drift-c {
  0% { translate: 0 0; scale: 1; }
  50% { translate: -20vw 34vh; scale: 1.2; }
  100% { translate: 10vw 20vh; scale: 0.95; }
}
@keyframes ex-coop-beam-a {
  0% { translate: 0 0; opacity: 0.55; }
  50% { translate: 26vw -22vh; opacity: 1; }
  100% { translate: 50vw -8vh; opacity: 0.6; }
}
@keyframes ex-coop-beam-b {
  0% { translate: 0 0; opacity: 0.8; }
  50% { translate: -30vw 30vh; opacity: 0.45; }
  100% { translate: -12vw 52vh; opacity: 0.9; }
}
@keyframes ex-coop-blink { 50% { opacity: 0.35; } }
@keyframes ex-coop-ping {
  from { transform: scale(0.6); opacity: 1; }
  to { transform: scale(1.8); opacity: 0; }
}
@keyframes ex-coop-detect { 50% { border-color: rgba(168, 220, 79, 0.45); } }
