/* ==========================================================================
   AgriPluse — Landing page
   --------------------------------------------------------------------------
   ทิศทางเดียวที่เลือกแล้วทำให้สุด: "หน้าปัดเครื่องมือวัดภาคสนาม"
   เส้นบาง ตาราง มุมคม ตัวเลขโมโนสเปซ และแถบสี NDVI เป็นสัญลักษณ์ประจำหน้า
   จงใจไม่ใช้ การ์ดมุมมนขนาดเท่ากันเรียงเป็นตาราง / ไอคอน emoji / เงาฟุ้ง ๆ
   เพราะสามอย่างนั้นคือหน้าตามาตรฐานของเว็บที่ AI ปั๊มออกมา

   ตัวอักษร: IBM Plex Sans Thai (หัวข้อ) + Sarabun (เนื้อความ ตามแอป)
             + IBM Plex Mono (ตัวเลข/ป้ายกำกับข้อมูล)
   สี:       เขียว #34a853 ของแบรนด์เป็นสีหลัก + น้ำตาลดิน #985214 เป็นสีรอง
             + แถบ NDVI 5 ขั้นใช้เป็นองค์ประกอบโครงสร้าง
   ========================================================================== */

:root {
  /* --- แบรนด์ (ตรงกับ frontend/src/styles/theme.css) --- */
  --primary-color: #34a853;
  --primary-dark: #1e7e3e;
  --primary-deep: #10502c;
  /* เขียวแบรนด์ #34a853 บนพื้นสว่างได้คอนทราสต์ 2.7 ไม่ผ่าน WCAG AA
     จึงแยกโทเคนสำหรับตัวอักษร/ไอคอน ส่วนพื้นที่ระบายสี (กราฟ แถบ จุด) ยังใช้สีแบรนด์เดิม */
  --primary-ink: #1b7037;
  --accent: #985214;
  --info-color: #4285f4;
  --warning-color: #fbbc05;
  --danger-color: #ea4335;

  /* --- แถบมาตราส่วน NDVI ใช้เป็นลายเซ็นของหน้า --- */
  --ndvi-1: #a52a2a;
  --ndvi-2: #e9a33b;
  --ndvi-3: #f2df5e;
  --ndvi-4: #66bd63;
  --ndvi-5: #006837;

  --attention-bg-color: rgba(234, 67, 53, 0.08);
  --attention-glow-color: rgba(234, 67, 53, 0.32);

  /* --- ตัวอักษร --- */
  --font-display: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
  --font-body: 'Sarabun', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Sarabun', ui-monospace, monospace;

  /* --- พื้นผิว: กระดาษอุ่นเล็กน้อย ไม่ใช่เทาฟ้าแบบ dashboard ทั่วไป --- */
  --background-color: #f2f3ee;
  --surface: #ffffff;
  --surface-alt: #e9ebe3;
  --surface-sunk: #f6f7f2;
  --header-bg: rgba(246, 247, 242, 0.86);

  --ink: #16211b;
  --text-color: #3b433d;
  --text-muted: #5e675f;
  --rule: #dcdfd5;
  --rule-strong: #b8bfb0;

  /* --- มุมคมเป็นหลัก มนเฉพาะปุ่มกับ pill --- */
  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 8px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16, 32, 22, 0.05);
  --shadow-2: 0 1px 2px rgba(16, 32, 22, 0.05), 0 14px 30px -18px rgba(16, 32, 22, 0.35);
  --grid-line: rgba(22, 33, 27, 0.07);
  --glow: rgba(52, 168, 83, 0.14);
  --hl-band: rgba(52, 168, 83, 0.24);

  --transition-speed: 0.25s;
  --max-width: 1160px;
}

[data-theme='dark'] {
  --primary-deep: #0c3a20;
  /* บนพื้นมืด เขียวแบรนด์ผ่าน AA อยู่แล้ว (6.2) จึงใช้สีเดียวกันได้ */
  --primary-ink: #34a853;
  --accent: #d78a3c;

  --background-color: #0e110f;
  --surface: #161a17;
  --surface-alt: #0a0c0a;
  --surface-sunk: #1c211d;
  --header-bg: rgba(14, 17, 15, 0.84);

  --ink: #eef1ec;
  --text-color: #c6cec8;
  --text-muted: #8b948d;
  --rule: #2b312d;
  --rule-strong: #414a44;

  --attention-bg-color: rgba(234, 67, 53, 0.14);
  --attention-glow-color: rgba(234, 67, 53, 0.42);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 30px -18px rgba(0, 0, 0, 0.9);
  --grid-line: rgba(255, 255, 255, 0.055);
  --glow: rgba(52, 168, 83, 0.18);
  --hl-band: rgba(52, 168, 83, 0.3);
}

/* --------------------------------------------------------------- base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px; /* กันหัวข้อมุดใต้ header ที่ปักหมุด */
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.78;
  color: var(--text-color);
  background: var(--background-color);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* เกรนบาง ๆ ทับทั้งหน้า — พื้นสีเรียบเปล่า ๆ คือหนึ่งในสัญญาณของเว็บ AI */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme='dark'] body::after {
  opacity: 0.055;
  mix-blend-mode: screen;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink);
}

p {
  margin: 0;
}

/* ตัวเลขและป้ายข้อมูล — ใช้โมโนสเปซให้อ่านแบบหน้าปัดเครื่องมือ */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* ป้ายกำกับเล็ก ๆ เหนือบล็อกข้อมูล */
.tick {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.6;
  color: var(--text-muted);
}

.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
}

.wrap-narrow {
  max-width: 820px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--primary-color);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* --------------------------------------------------------------- icons --- */
/* เก็บ <symbol> ไว้ต้นหน้า: ซ่อนด้วยขนาด 0 ไม่ใช่ display:none เพราะ
   บางเบราว์เซอร์จะทำให้ <use> ที่อ้างถึงหายไปด้วย */
.icon-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------- buttons --- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--transition-speed), color var(--transition-speed),
    border-color var(--transition-speed), transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.button-primary {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 1px 0 rgba(16, 32, 22, 0.12);
}

.button-primary:hover {
  background: var(--primary-deep);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -10px rgba(16, 32, 22, 0.7);
}

.button-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}

.button-ghost:hover {
  border-color: var(--primary-ink);
  color: var(--primary-ink);
  background: rgba(52, 168, 83, 0.07);
}

.button:active {
  transform: translateY(0);
}

/* ลูกศรขยับตอนชี้ — micro-interaction จุดเดียวที่ตั้งใจให้มี */
.button .ico {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.button:hover .ico {
  transform: translateX(3px);
}

.button-lg {
  padding: 14px 26px;
  font-size: 1rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--text-color);
  cursor: pointer;
  transition: border-color var(--transition-speed), color var(--transition-speed);
}

.icon-button:hover {
  border-color: var(--primary-ink);
  color: var(--primary-ink);
}

/* ปุ่มสลับธีม — โชว์ไอคอนเดียวตามธีมปัจจุบัน */
.icon-moon {
  display: none;
}
[data-theme='dark'] .icon-sun {
  display: none;
}
[data-theme='dark'] .icon-moon {
  display: block;
}

/* -------------------------------------------------------------- header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-speed);
}

.site-header.scrolled {
  border-bottom-color: var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 74px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline: auto;
}

.site-nav a {
  position: relative;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition-speed);
}

/* ขีดสั้น ๆ ใต้ลิงก์แทนพื้นหลังเป็นก้อน — เข้ากับภาษาของเส้นทั้งหน้า */
.site-nav a::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 1px;
  background: var(--primary-color);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-speed);
}

.site-nav a:hover {
  color: var(--ink);
}
.site-nav a:hover::after {
  transform: scaleX(1);
}
.site-nav .nav-cta::after {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: none;
}

/* ปุ่มทดลองใช้ในเมนู — โผล่เฉพาะจอเล็กที่ปุ่มบนหัวเว็บถูกซ่อน */
.nav-cta {
  display: none;
}

/* ---------------------------------------------------------------- hero --- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(44px, 7vw, 88px) 0 clamp(52px, 8vw, 92px);
}

/* ลายกริดแปลงเกษตรมองจากด้านบน — พื้นหลังประจำตัวของหน้านี้ */
.field-grid {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 140%;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 68px 68px;
  transform: perspective(900px) rotateX(52deg);
  transform-origin: top center;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.35) 45%, transparent 78%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.35) 45%, transparent 78%);
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  top: -240px;
  right: -160px;
  width: 720px;
  height: 720px;
  background: radial-gradient(circle, var(--glow) 0%, transparent 68%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: clamp(32px, 5vw, 60px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* จุดกระเพื่อม — ยืม heroPulse ของแอปมาใช้ต่อ */
.pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color);
  flex-shrink: 0;
}

.hero-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--primary-color);
  animation: heroPulse 2.4s ease-out infinite;
}

@keyframes heroPulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

/* เน้นด้วยแถบไฮไลต์ที่อยู่ "ข้างหลัง" ตัวอักษร ไม่ใช่เส้นใต้
   ภาษาไทยมีสระล่างและหางอักษร (ญ ฏ ฐ) เส้นใต้บาง ๆ จะไปพาดทับเสมอ */
.hl {
  position: relative;
  white-space: nowrap;
  background: linear-gradient(
    to bottom,
    transparent 14%,
    var(--hl-band) 14%,
    var(--hl-band) 93%,
    transparent 93%
  );
  padding-inline: 6px;
}

.lede {
  font-size: clamp(1.02rem, 1.5vw, 1.12rem);
  color: var(--text-color);
  max-width: 34em;
  margin-bottom: 30px;
}

.lede strong {
  color: var(--ink);
  font-weight: 700;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 26px;
}

/* --- แถบความน่าเชื่อถือเหนือ fold --- */
.trust-row {
  list-style: none;
  margin: 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
}

.trust-row li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.trust-row .ico {
  width: 17px;
  height: 17px;
  color: var(--primary-ink);
}

/* --- แผงตัวอย่างหน้าจอ --- */
.hero-panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  /* เอียงนิดเดียวให้องค์ประกอบไม่สมมาตรจนแข็ง */
  transform: rotate(-0.8deg);
  transition: transform 0.45s ease;
}

.hero-panel:hover {
  transform: rotate(0deg) translateY(-4px);
}

/* เส้นสแกนกวาดผ่านแผง — ภาพจำหลักของหน้านี้ (ดาวเทียมกวาดผ่านแปลง) */
.scan {
  position: absolute;
  inset: 0 auto 0 -42%;
  width: 42%;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(52, 168, 83, 0.05) 42%,
    rgba(52, 168, 83, 0.12) 50%,
    rgba(52, 168, 83, 0.05) 58%,
    transparent
  );
  animation: scanSweep 8s cubic-bezier(0.5, 0, 0.5, 1) 1.4s infinite;
}

[data-theme='dark'] .scan {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(102, 189, 99, 0.04) 42%,
    rgba(102, 189, 99, 0.1) 50%,
    rgba(102, 189, 99, 0.04) 58%,
    transparent
  );
}

@keyframes scanSweep {
  0% {
    transform: translateX(0);
  }
  55%,
  100% {
    transform: translateX(340%);
  }
}

.panel-chrome {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-sunk);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
}

.panel-stamp {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.panel-body {
  padding: 18px 18px 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 20px;
  border: 1px solid var(--rule);
}

.mini-stat {
  min-width: 0; /* กัน grid ดันคอลัมน์เพี้ยน — บั๊กเดิมที่เคยเจอในแอป */
  padding: 11px 12px;
  border-left: 1px solid var(--rule);
}

.mini-stat:first-child {
  border-left: 0;
}

.mini-stat.attention {
  background: var(--attention-bg-color);
  box-shadow: inset 0 -2px 0 var(--attention-glow-color);
}

.mini-label {
  display: block;
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.mini-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.mini-value.mono {
  font-family: var(--font-mono);
}

.mini-value small {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
}

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.tick-fore {
  color: var(--accent);
}

.spark {
  width: 100%;
  height: 96px;
  display: block;
}

.spark-grid {
  stroke: var(--rule);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.spark-line {
  stroke: var(--primary-color);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 380;
  stroke-dashoffset: 380;
  animation: drawLine 1.5s cubic-bezier(0.22, 1, 0.36, 1) 0.4s forwards;
}

/* ส่วนพยากรณ์วาดเป็นเส้นประ — บอกตรง ๆ ว่าอันนี้ยังไม่เกิดขึ้นจริง */
.spark-fore {
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 4 4;
  opacity: 0;
  animation: fadeIn 0.7s ease 1.7s forwards;
}

.spark-now {
  stroke: var(--rule-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.spark-area {
  opacity: 0;
  animation: fadeIn 0.8s ease 1.4s forwards;
}

.spark-head {
  fill: var(--primary-color);
  opacity: 0;
  animation: fadeIn 0.6s ease 1.6s forwards;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.legend-scale {
  display: flex;
  flex: 1;
  max-width: 150px;
}

.legend-scale i {
  display: block;
  flex: 1;
  height: 7px;
}

.legend-range {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ------------------------------------------------------------- readout --- */
/* แถบตัวเลขระบบ — เป็นแถวที่ขีดเส้นแบ่ง ไม่ใช่การ์ดสี่ใบเรียงกัน */
.readout {
  border-block: 1px solid var(--rule-strong);
  background: var(--surface);
}

.readout-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.readout-item {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 26px 22px 26px 24px;
  border-left: 1px solid var(--rule);
}

.readout-item:first-child {
  border-left: 0;
  padding-left: 0;
}

.readout-item b {
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--primary-ink);
}

.readout-item span {
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ------------------------------------------------------------ sections --- */
.section {
  padding-block: clamp(56px, 8vw, 100px);
}

.section-alt {
  background: var(--surface-alt);
}

/* หัวเรื่องทุกบล็อกเปิดด้วยเส้นบาง + แถบ NDVI สั้น ๆ ที่มุมซ้าย */
.section-head {
  position: relative;
  border-top: 1px solid var(--rule-strong);
  padding-top: 24px;
  margin-bottom: 46px;
}

.section-head::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 0;
  width: 72px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--ndvi-1) 0 20%,
    var(--ndvi-2) 20% 40%,
    var(--ndvi-3) 40% 60%,
    var(--ndvi-4) 60% 80%,
    var(--ndvi-5) 80% 100%
  );
}

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.section-eyebrow .mono {
  color: var(--accent);
}

.section-title {
  font-size: clamp(1.6rem, 3.2vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  max-width: 18em;
  margin-bottom: 14px;
}

.section-lede {
  font-size: 1.02rem;
  color: var(--text-muted);
  max-width: 44em;
}

/* ---------------------------------------------------------------- steps --- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.step {
  min-width: 0;
  position: relative;
  padding: 26px 26px 8px 22px;
  border-top: 1px solid var(--rule-strong);
  border-left: 1px solid var(--rule);
  transition: background var(--transition-speed);
}

.step:first-child {
  border-left: 0;
}

/* ขีดบอกตำแหน่งบนเส้นบน เหมือนสเกลบนไม้บรรทัด */
.step::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 22px;
  width: 22px;
  height: 3px;
  background: var(--rule-strong);
  transition: background var(--transition-speed), width var(--transition-speed);
}

.step:first-child::before {
  left: 0;
}

.step:hover::before {
  background: var(--primary-color);
  width: 46px;
}

.step-no {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
}

.step h3 {
  font-size: 1.06rem;
  margin-bottom: 8px;
}

.step p {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- bento --- */
/* ตั้งใจให้ช่องไม่เท่ากัน — ตารางการ์ดขนาดเดียวกันหมดคือลายเซ็นของเว็บ AI */
.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.tile {
  min-width: 0;
  position: relative;
  overflow: hidden;
  grid-column: span 2;
  padding: 24px 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  transition: border-color var(--transition-speed), transform var(--transition-speed),
    box-shadow var(--transition-speed);
}

.tile:hover {
  border-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}

/* มุมบนขวามีขีดกำกับเหมือนกรอบเล็งของภาพถ่ายทางอากาศ */
.tile::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-top: 1px solid var(--rule-strong);
  border-right: 1px solid var(--rule-strong);
  transition: border-color var(--transition-speed);
}

.tile:hover::after {
  border-color: var(--primary-color);
}

.tile-ico {
  width: 30px;
  height: 30px;
  margin-bottom: 18px;
  fill: none;
  stroke: var(--primary-ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.tile p {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.tile-meta {
  margin-top: 14px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ช่องกว้าง: ไอคอนอยู่ซ้าย เนื้อหาอยู่ขวา และมีแถบ NDVI พาดขอบล่าง */
.tile-wide {
  grid-column: span 4;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  padding: 30px 28px 34px;
}

.tile-wide .tile-ico {
  width: 38px;
  height: 38px;
  margin-bottom: 0;
}

.tile-ramp {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  height: 4px;
}

.tile-ramp i {
  display: block;
  flex: 1;
}

/* ช่องพยากรณ์ใช้สีดินเป็นสัญญาณว่า "นี่คือสิ่งที่ยังไม่เกิด" ให้ตรงกับเส้นประในกราฟ */
.tile-accent .tile-ico {
  stroke: var(--accent);
}

.tile-accent:hover {
  border-color: var(--accent);
}

.tile-accent::after {
  border-color: var(--accent);
  opacity: 0.55;
}

/* แถบเต็มความกว้างปิดท้าย */
.tile-bar {
  grid-column: span 6;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
  padding: 26px 28px;
  background: var(--surface-sunk);
}

.tile-bar .tile-ico {
  margin-bottom: 0;
  margin-top: 2px;
}

.tile-bar p {
  max-width: 62em;
}

/* ------------------------------------------------------------------ who --- */
.who-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.check-list li {
  position: relative;
  padding: 14px 0 14px 30px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.98rem;
}

.check-list li:first-child {
  border-top: 1px solid var(--rule);
}

.check-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 1.42em;
  width: 9px;
  height: 5px;
  border-left: 1.6px solid var(--primary-ink);
  border-bottom: 1.6px solid var(--primary-ink);
  transform: rotate(-45deg);
}

/* --- แผงขอบเขต: แทนคำรีวิวลอย ๆ ที่ไม่มีเจ้าของจริง --- */
.scope-card {
  position: relative;
  padding: 26px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-1);
  margin-top: 38px; /* เหลื่อมลงจากคอลัมน์ซ้าย ไม่ให้เรียงตรงกันเป๊ะ */
}

.scope-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color) 0 55%, var(--accent) 55% 100%);
}

.scope-card h3 {
  font-size: 1.12rem;
  margin: 6px 0 20px;
}

.scope-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.scope-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  font-size: 0.92rem;
  line-height: 1.65;
}

.scope-list .ico {
  margin-top: 0.34em;
  width: 16px;
  height: 16px;
}

.scope-list::before {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.scope-can::before {
  content: 'ทำได้';
}

.scope-can .ico {
  color: var(--primary-ink);
}

.scope-cannot {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.scope-cannot::before {
  content: 'ยังทำไม่ได้';
}

.scope-cannot .ico {
  color: var(--accent);
}

.scope-cannot li {
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ faq --- */
/* รายการเดียวคั่นด้วยเส้น ไม่ใช่การ์ดมุมมนซ้อนกันเจ็ดใบ */
.faq {
  border-top: 1px solid var(--rule-strong);
}

.faq details {
  border-bottom: 1px solid var(--rule);
}

.faq summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  padding: 20px 48px 20px 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  transition: color var(--transition-speed);
}

.faq summary:hover {
  color: var(--primary-ink);
}

.faq summary::-webkit-details-marker {
  display: none;
}

/* เครื่องหมายบวก/ลบวาดด้วยเส้นสองเส้น */
.faq summary::before,
.faq summary::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  width: 13px;
  height: 1.5px;
  background: var(--text-muted);
  transition: transform var(--transition-speed), background var(--transition-speed);
}

.faq summary::after {
  transform: rotate(90deg);
}

.faq details[open] summary::before,
.faq details[open] summary::after {
  background: var(--primary-color);
}

.faq details[open] summary::after {
  transform: rotate(0deg);
}

.faq details p {
  padding: 0 48px 22px 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ------------------------------------------------------------- cta band --- */
.cta-band {
  position: relative;
  overflow: hidden;
  padding-block: clamp(56px, 8vw, 88px);
  background: var(--primary-deep);
  color: #fff;
  text-align: center;
}

/* แถบ NDVI ปิดหัวบล็อก — ตัวเดียวกับที่ใช้เปิดทุกหัวเรื่อง */
.cta-band::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--ndvi-1) 0 20%,
    var(--ndvi-2) 20% 40%,
    var(--ndvi-3) 40% 60%,
    var(--ndvi-4) 60% 80%,
    var(--ndvi-5) 80% 100%
  );
  z-index: 2;
}

.cta-band .field-grid {
  --grid-line: rgba(255, 255, 255, 0.12);
  opacity: 0.9;
}

.cta-inner {
  position: relative;
}

.cta-band h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  color: #fff;
  margin-bottom: 12px;
}

.cta-band p {
  font-size: 1.02rem;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 28px;
}

.cta-band .button-primary {
  background: #fff;
  color: var(--primary-deep);
}

.cta-band .button-primary:hover {
  background: #eef3ec;
  color: var(--primary-deep);
}

.cta-note {
  margin-top: 20px;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.72);
}

/* -------------------------------------------------------------- footer --- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--rule);
  padding-block: 40px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-nav a:hover {
  color: var(--primary-ink);
}

.footer-note {
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.85;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}

/* ------------------------------------------------------------- reveal --- */
/* เผยเนื้อหาแบบไล่ทีละชิ้นครั้งเดียวตอนเลื่อนถึง
   ค่า --d ตั้งใน HTML สำหรับ hero ส่วนที่เหลือ JS ไล่ตั้งให้ */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0ms),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0ms);
  will-change: opacity, transform;
}

.js .reveal.shown {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------- responsive --- */
@media (max-width: 1000px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
  .hero-panel {
    transform: none;
    max-width: 560px;
  }
  .who-grid {
    grid-template-columns: 1fr;
  }
  .scope-card {
    margin-top: 0;
  }
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .step:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }
  .step:nth-child(odd)::before {
    left: 0;
  }
  .readout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .readout-item:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }
  .readout-item:nth-child(n + 3) {
    border-top: 1px solid var(--rule);
  }
  /* bento เหลือ 2 คอลัมน์ */
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tile {
    grid-column: span 1;
  }
  .tile-wide,
  .tile-bar {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 82px;
  }
  .header-inner {
    height: 66px;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .header-cta {
    display: none;
  }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 18px;
    margin: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow-2);
    /* ปิดไว้ด้วย visibility เพื่อให้ยังเฟดได้ (display:none animate ไม่ได้) */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--transition-speed), transform var(--transition-speed),
      visibility var(--transition-speed);
  }
  .site-nav.open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .site-nav a {
    padding: 13px 4px;
    border-bottom: 1px solid var(--rule);
  }
  .site-nav a::after {
    display: none;
  }
  .site-nav .nav-cta {
    display: inline-flex;
    margin-top: 14px;
    color: #fff;
    padding: 13px 18px;
    border-bottom: 0;
  }
  .site-nav .nav-cta:hover {
    color: #fff;
  }
  .steps {
    grid-template-columns: 1fr;
  }
  .step {
    border-left: 0;
    padding-left: 0;
  }
  .step::before {
    left: 0;
  }
  .readout-grid {
    grid-template-columns: 1fr;
  }
  .readout-item {
    border-left: 0;
    padding: 20px 0;
  }
  .readout-item:nth-child(n + 2) {
    border-top: 1px solid var(--rule);
  }
  .bento {
    grid-template-columns: 1fr;
  }
  .tile,
  .tile-wide,
  .tile-bar {
    grid-column: span 1;
  }
  .tile-wide,
  .tile-bar {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .stat-row {
    grid-template-columns: 1fr;
  }
  .mini-stat {
    border-left: 0;
    border-top: 1px solid var(--rule);
  }
  .mini-stat:first-child {
    border-top: 0;
  }
  .trust-row {
    gap: 8px 18px;
  }
}

@media (max-width: 520px) {
  /* บนจอแคบ ปุ่มสองปุ่มกว้างไม่เท่ากันจะดูเหมือนวางพลาด ให้เต็มความกว้างทั้งคู่ */
  .hero-cta .button {
    width: 100%;
  }
}

/* เคารพการตั้งค่าลดการเคลื่อนไหวของผู้ใช้ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
  }
  .scan {
    display: none;
  }
  .spark-line {
    stroke-dashoffset: 0;
  }
  .spark-area,
  .spark-fore,
  .spark-head {
    opacity: 1;
  }
}
