/* =========================
   SPEC MATRIX — /products/drones (โดรนเกษตรของเรา)
   ตารางเปรียบเทียบ 4 รุ่นแบบคอนโซลควบคุม: หัวคอลัมน์มีรูปโดรน, ทุกช่องมีแท่งวัด,
   เมาส์ชี้ = ไฮไลต์ทั้งแถว+คอลัมน์ (crosshair), แตะหัวคอลัมน์ = ปักหมุดรุ่น
   สคริปต์: assets/js/pages/drones.js · สี CI เท่านั้น
   ========================= */
.mx {
  --mx-primary: var(--primary, #00A987);
  --mx-dark: var(--primary-dark, #007E66);
  --mx-soft: var(--primary-soft, #DFF7F1);
  --mx-bright: #00D7AE;
  --mx-ink: #041815;
  --mx-deep: #072720;
  --mx-rgb: 0, 169, 135;
  --mx-line: rgba(0, 215, 174, 0.16);
  --mx-ease: cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  flex-shrink: 0; /* body เป็น flex: ห้ามหด */
  overflow: hidden;
  isolation: isolate;
  padding: calc(var(--header-space, 100px) + 24px) 0 clamp(3rem, 6vw, 5rem);
  color: #fff;
  background:
    radial-gradient(1000px 500px at 50% 0%, rgba(var(--mx-rgb), 0.22), transparent 65%),
    repeating-linear-gradient(0deg, rgba(0, 215, 174, 0.05) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(0, 215, 174, 0.05) 0 1px, transparent 1px 40px),
    linear-gradient(180deg, var(--mx-deep), var(--mx-ink) 55%);
}
body:has(.mx) { padding-top: 0 !important; }
.mx-wrap { width: min(1320px, 100% - 32px); margin: 0 auto; }
.mx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── ส่วนหัว ── */
.mx-crumbs { margin-bottom: 18px; font-size: 0.82rem; color: rgba(255, 255, 255, 0.5); letter-spacing: 0.04em; }
.mx-crumbs a { color: inherit; text-decoration: none; }
.mx-crumbs a:hover { color: var(--mx-bright); }
.mx-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; margin-bottom: 26px; }
.mx-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.18em; color: var(--mx-bright); }
.mx-live { width: 8px; height: 8px; border-radius: 50%; background: var(--mx-bright); animation: mxPing 1.8s infinite; }
@keyframes mxPing { 0% { box-shadow: 0 0 0 0 rgba(0, 215, 174, 0.6); } 70%, 100% { box-shadow: 0 0 0 10px rgba(0, 215, 174, 0); } }
.mx-title h1 { margin: 10px 0 8px; font-size: clamp(2rem, 4.4vw, 3.3rem); font-weight: 800; line-height: 1.1; color: #fff; }
.mx-title p { margin: 0; max-width: 40em; color: rgba(255, 255, 255, 0.65); line-height: 1.6; }
.mx-stats { display: flex; gap: 10px; margin: 0; }
.mx-stats > div { min-width: 110px; padding: 10px 14px; border: 1px solid var(--mx-line); border-radius: 12px; background: rgba(4, 24, 21, 0.6); }
.mx-stats dt { font-size: 0.64rem; font-weight: 800; letter-spacing: 0.14em; color: rgba(255, 255, 255, 0.45); }
.mx-stats dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 800; color: var(--mx-bright); font-variant-numeric: tabular-nums; }

/* ── ตาราง ── */
.mx-scroll {
  position: relative;
  overflow-x: auto;
  border: 1px solid rgba(0, 215, 174, 0.28);
  border-radius: 22px;
  background: rgba(4, 24, 21, 0.72);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 215, 174, 0.4) transparent;
}
.mx-table { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.mx-table th, .mx-table td { padding: 0; border-bottom: 1px solid var(--mx-line); text-align: left; vertical-align: middle; }
.mx-table thead th:first-child, .mx-table tbody th[scope="row"] { width: 23%; }

/* แถวหัว: การ์ดรุ่น */
.mx-corner { padding: 20px 22px !important; vertical-align: bottom !important; }
.mx-corner span { display: block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.2em; color: var(--mx-bright); }
.mx-corner small { font-size: 0.78rem; color: rgba(255, 255, 255, 0.45); }
.mx-col { border-left: 1px solid var(--mx-line); }
.mx-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 18px 12px;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.mx-head:focus-visible { outline: 2px solid var(--mx-bright); outline-offset: -4px; }
.mx-head__pin {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.45);
  transition: all .25s;
}
/* กรอบรูปตายตัวทุกรุ่น: รูปวางแบบ absolute จึงไม่ดันกรอบให้สูงขึ้น (รูปมุมเฉียงที่ทรงเกือบจตุรัสก็อยู่ในกรอบเดียวกัน) */
.mx-head__img { position: relative; display: block; width: 88%; aspect-ratio: 16 / 9; margin-bottom: 8px; }
.mx-head__img img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; filter: drop-shadow(0 14px 14px rgba(0, 0, 0, 0.6)); transition: transform .5s var(--mx-ease); }
.mx-head:hover .mx-head__img img { transform: translateY(-6px) scale(1.04); }
.mx-head__code { font-size: 0.64rem; font-weight: 800; letter-spacing: 0.16em; color: rgba(255, 255, 255, 0.5); }
.mx-head__code em { margin-left: 4px; padding: 1px 6px; border-radius: 4px; background: var(--mx-bright); color: var(--mx-ink); font-style: normal; letter-spacing: 0.06em; }
.mx-head__name { font-size: clamp(1.6rem, 2.6vw, 2.2rem); font-weight: 800; line-height: 1.05; }
.mx-head__tag { font-size: 0.78rem; color: rgba(255, 255, 255, 0.6); }

/* หัวข้อกลุ่ม */
.mx-group th {
  padding: 14px 22px 8px !important;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, rgba(0, 169, 135, 0.18), transparent 60%);
}
.mx-group th span {
  margin-right: 10px;
  padding: 2px 8px;
  border: 1px solid rgba(0, 215, 174, 0.5);
  border-radius: 5px;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--mx-bright);
}

/* หัวแถว */
.mx-table tbody th[scope="row"] { padding: 14px 22px; font-size: 0.9rem; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.mx-table tbody th[scope="row"] small { display: block; margin-left: 30px; font-size: 0.7rem; font-weight: 500; color: rgba(255, 255, 255, 0.4); }
.mx-idx { display: inline-block; width: 30px; font-size: 0.7rem; font-weight: 800; color: rgba(0, 215, 174, 0.7); font-variant-numeric: tabular-nums; }

/* ช่องข้อมูล */
.mx-table td { padding: 12px 18px; border-left: 1px solid var(--mx-line); }
.mx-val { display: flex; align-items: baseline; gap: 5px; }
.mx-val b { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mx-val small { font-size: 0.72rem; font-weight: 700; color: rgba(255, 255, 255, 0.45); }
.mx-val em { margin-left: auto; padding: 1px 6px; border-radius: 4px; background: rgba(0, 215, 174, 0.16); color: var(--mx-bright); font-size: 0.58rem; font-weight: 800; font-style: normal; letter-spacing: 0.12em; }
.mx-meter { display: block; height: 5px; margin-top: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.mx-meter i {
  display: block;
  height: 100%;
  width: calc(var(--w, 0) * 100%);
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(0, 169, 135, 0.5), var(--mx-bright));
  box-shadow: 0 0 10px rgba(0, 215, 174, 0.5);
  transform-origin: left;
  transition: transform 1.1s var(--mx-ease);
}
.mx-table.is-armed .mx-meter i { transform: scaleX(0); }
.mx-table.is-in .mx-meter i { transform: scaleX(1); }
.mx-table td.is-max .mx-val b { color: var(--mx-bright); }
.mx-table td.is-na .mx-val { color: rgba(255, 255, 255, 0.3); font-size: 1.3rem; font-weight: 800; }
.mx-note { display: block; margin-top: 4px; font-size: 0.7rem; color: rgba(255, 255, 255, 0.35); }
.mx-chip { display: inline-flex; padding: 4px 12px; border: 1px solid rgba(0, 215, 174, 0.35); border-radius: 99px; background: rgba(0, 169, 135, 0.12); font-size: 0.82rem; font-weight: 700; color: var(--mx-soft); }

.mx-price td b { font-size: 1.4rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.mx-actions td { padding: 14px 16px 18px; border-bottom: 0; }
.mx-actions th { border-bottom: 0 !important; }
.mx-actions .mx-btn { width: 100%; }
.mx-actions .mx-btn + .mx-btn { margin-top: 6px; }

.mx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1.5px solid var(--mx-bright);
  border-radius: 10px;
  background: var(--mx-bright);
  color: var(--mx-ink);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  transition: background .25s, border-color .25s, color .25s, transform .25s var(--mx-ease);
}
.mx-btn:hover { transform: translateY(-2px); background: #fff; border-color: #fff; color: var(--mx-ink); }
.mx-btn--ghost { background: transparent; border-color: rgba(0, 215, 174, 0.45); color: #fff; }
.mx-btn--ghost:hover { background: rgba(0, 215, 174, 0.15); border-color: var(--mx-bright); color: #fff; }

/* ── crosshair: แถวที่ชี้ + คอลัมน์ที่ชี้ ── */
.mx-table td, .mx-col, .mx-table tbody th { transition: background-color .2s, opacity .3s; }
.mx-table tbody tr:not(.mx-group):hover > * { background-color: rgba(0, 215, 174, 0.06); }
.mx-table[data-hover="T25P"] [data-col="T25P"],
.mx-table[data-hover="T55"] [data-col="T55"],
.mx-table[data-hover="T70P"] [data-col="T70P"],
.mx-table[data-hover="T100"] [data-col="T100"] { background-color: rgba(0, 215, 174, 0.07); }

/* ── ปักหมุดรุ่น: คอลัมน์เด่น รุ่นอื่นจางลง ── */
.mx-table[data-pin] td:not(.is-pin), .mx-table[data-pin] .mx-col:not(.is-pin) { opacity: 0.4; }
.mx-table [data-col].is-pin { background-color: rgba(0, 169, 135, 0.14); box-shadow: inset 1px 0 0 var(--mx-bright), inset -1px 0 0 var(--mx-bright); }
.mx-col.is-pin { box-shadow: inset 1px 0 0 var(--mx-bright), inset -1px 0 0 var(--mx-bright), inset 0 3px 0 var(--mx-bright); }
.mx-col.is-pin .mx-head__pin { background: var(--mx-bright); border-color: var(--mx-bright); color: var(--mx-ink); }

.mx-hint { display: none; margin: 10px 0 0; text-align: center; font-size: 0.76rem; color: rgba(255, 255, 255, 0.45); }

/* ── ปรึกษา ── */
.mx-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: 22px;
  padding: 24px 28px;
  border: 1px solid rgba(0, 215, 174, 0.28);
  border-radius: 22px;
  background: radial-gradient(80% 140% at 0% 0%, rgba(var(--mx-rgb), 0.3), transparent 60%), rgba(4, 24, 21, 0.7);
}
.mx-help h2 { margin: 6px 0 4px; font-size: 1.3rem; font-weight: 800; color: #fff; }
.mx-help p { margin: 0; color: rgba(255, 255, 255, 0.65); font-size: 0.92rem; }
.mx-help__ctas { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 980px) {
  .mx-wrap { width: calc(100% - 24px); }
  .mx-stats { width: 100%; }
  .mx-stats > div { min-width: 0; flex: 1 1 0; padding: 8px 10px; }
  .mx-stats dd { font-size: 1.25rem; }
  .mx-table { min-width: 720px; }
  .mx-table thead th:first-child, .mx-table tbody th[scope="row"] { width: 132px; }
  /* คอลัมน์หัวแถวติดซ้ายตอนปัดตาราง */
  .mx-table thead th:first-child, .mx-table tbody th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #06201b;
    box-shadow: 1px 0 0 var(--mx-line);
  }
  .mx-table tbody th[scope="row"] { padding: 12px; font-size: 0.8rem; }
  .mx-idx { display: none; }
  .mx-table tbody th[scope="row"] small { margin-left: 0; }
  .mx-corner { padding: 14px 12px !important; }
  .mx-head { padding: 14px 8px; }
  .mx-head__tag { display: none; }
  .mx-table td { padding: 10px 12px; }
  .mx-val b { font-size: 1.2rem; }
  .mx-price td b { font-size: 1.05rem; }
  .mx-btn { min-height: 40px; padding: 0 10px; font-size: 0.8rem; }
  .mx-hint { display: block; }
  .mx-help { padding: 20px; }
  .mx-help__ctas { width: 100%; }
  .mx-help__ctas .mx-btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .mx-live { animation: none; }
  .mx-table.is-armed .mx-meter i { transform: none; }
  .mx-meter i, .mx-head__img img { transition: none; }
}

/* ── การ์ดรุ่น (แทนตารางสเปก): เหลือแค่ภาพ + ชื่อ กดไปหน้าสินค้า ── */
.mx-models {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid rgba(0, 215, 174, 0.28);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(4, 24, 21, 0.72);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.mx-model { padding: 28px 16px 26px; text-decoration: none; transition: background-color .2s; }
.mx-model + .mx-model { border-left: 1px solid var(--mx-line); }
.mx-model:hover { background-color: rgba(0, 215, 174, 0.07); }
.mx-model .mx-head__img { margin-bottom: 14px; }
.mx-model .mx-head__name { font-size: clamp(1.8rem, 3vw, 2.5rem); }
.mx-model::after {
  content: "ดูรายละเอียด →";
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mx-bright);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s, transform .2s;
}
.mx-model:hover::after, .mx-model:focus-visible::after { opacity: 1; transform: none; }

@media (max-width: 980px) {
  .mx-models { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mx-model:nth-child(3) { border-left: 0; }
  .mx-model:nth-child(n+3) { border-top: 1px solid var(--mx-line); }
  .mx-model { padding: 20px 10px; }
  .mx-model::after { opacity: 1; transform: none; }
}

/* ── กรอบตัวอักษร "FT FT FT" วิ่งวนรอบการ์ดรุ่น ──
   JS (drones.js) ห่อ .mx-models ด้วย .mx-ftframe + วาด SVG — ไม่มี JS = กรอบเส้นเดิม */
.mx-ftframe {
  position: relative;
  padding: 26px;
}
.mx-ftframe > .mx-models { border-color: rgba(0, 215, 174, 0.12); }
.mx-ftframe__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.mx-ftframe__track {
  fill: none;
  stroke: rgba(0, 215, 174, 0.1);
  stroke-width: 22;
}
.mx-ftframe__rail {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mx-ftframe__ft {
  position: absolute;
  top: 0;
  left: 0;
  offset-path: var(--ft-path);
  offset-rotate: auto;
  offset-anchor: center;
  font-family: "Gotham Latin", "Noto Sans Thai", sans-serif;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--mx-bright, #00D7AE);
  white-space: nowrap;
  will-change: offset-distance;
  animation: mx-ft-run var(--ft-dur, 60s) linear infinite;
}
.mx-ftframe__ft.is-dim { color: #0f7a66; }
@keyframes mx-ft-run {
  from { offset-distance: 0%; }
  to   { offset-distance: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .mx-ftframe__ft { animation: none; }
}

@media (max-width: 600px) {
  .mx-ftframe { padding: 20px; }
  .mx-ftframe__track { stroke-width: 18; }
  .mx-ftframe__ft { font-size: 11px; }
}
