/* =========================================================================
   d_WEB — dPRO ai Innotech
   สีทั้งหมดถอดจากไฟล์โลโก้จริง Marketing/dPRO ai Innotech LOGO.png
   #de141b บนพื้นขาว = contrast 5.03:1 → ผ่าน WCAG AA ทั้งตัวอักษรและปุ่ม

   spacing scale ชุดนี้เป็นกริด 4px มาตรฐานไปก่อน
   ระยะ B0 จะแทนที่ด้วยค่าจริงจาก Microsoft Teams UI Kit ผ่าน Figma Dev Mode MCP
   ========================================================================= */

:root {
  --brand: #de141b;
  --brand-dark: #b30f15;
  --accent: #5eb542;
  --ink: #0f172a;
  --muted: #64748b;
  --surface: #f8fafc;
  --line: #e2e8f0;
  --white: #fff;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 8px 24px rgb(15 23 42 / .06);

  --wrap: 1100px;
  --tap: 44px;                 /* ปุ่มสูงขั้นต่ำ — ใบสั่งงาน T4 */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Sarabun, "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--white);
}

h1, h2, h3 { line-height: 1.35; margin: 0 0 var(--s3); font-weight: 700; }
h1 { font-size: clamp(1.75rem, 5vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 var(--s4); }

a { color: var(--brand-dark); text-underline-offset: 3px; }
a:hover { color: var(--brand); }

img { max-width: 100%; height: auto; }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

.lede { font-size: 1.08rem; color: var(--muted); }

.skip-link {
  position: absolute; left: -9999px;
  background: var(--brand); color: var(--white);
  padding: var(--s3) var(--s4); z-index: 100;
}
.skip-link:focus { left: var(--s4); top: var(--s4); }

/* ---------- ปุ่ม ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap);
  padding: var(--s2) var(--s5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn--primary { background: var(--brand); color: var(--white); }
.btn--primary:hover { background: var(--brand-dark); color: var(--white); }
.btn--ghost { background: var(--white); color: var(--brand-dark); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--lg { min-height: 52px; padding-inline: var(--s6); font-size: 1.05rem; }
.btn--sm { min-height: 38px; padding-inline: var(--s4); font-size: .95rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgb(255 255 255 / .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); min-height: 64px;
}
.brand { display: flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--ink); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 1.15rem; color: var(--brand); letter-spacing: -.02em; }
.brand__text small { font-size: .75rem; color: var(--muted); }

.site-nav { display: flex; align-items: center; gap: var(--s4); }
.site-nav a { text-decoration: none; font-weight: 600; color: var(--ink); }
.site-nav a:hover { color: var(--brand); }
.site-nav a:first-child { display: none; }
@media (min-width: 640px) { .site-nav a:first-child { display: inline; } }

/* ---------- hero ---------- */

.hero { padding-block: var(--s7); background: linear-gradient(180deg, #fff5f5, var(--white)); }
.hero__inner { display: grid; gap: var(--s6); align-items: center; }
@media (min-width: 860px) { .hero__inner { grid-template-columns: 1.3fr .7fr; align-items: start; } }
.hero__media { justify-self: center; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s3); }
.hero__alt { font-size: .95rem; color: var(--muted); margin: 0; }

/* ---------- section ---------- */

.section { padding-block: var(--s7); }
.section--alt { background: var(--surface); }
.section h2 { margin-bottom: var(--s5); }

/* ---------- การ์ด ---------- */

.cards { display: grid; gap: var(--s4); margin: 0; padding: 0; list-style: none; }
@media (min-width: 700px) {
  .cards--2 { grid-template-columns: repeat(2, 1fr); }
  .cards--3 { grid-template-columns: repeat(3, 1fr); }
}
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s5);
  box-shadow: var(--shadow);
}
.card h3 { color: var(--brand-dark); }
.card p:last-child { margin-bottom: 0; }

/* ---------- ตัวเลขพิสูจน์ ---------- */

.stats {
  display: grid; gap: var(--s4);
  grid-template-columns: repeat(2, 1fr);
  margin: 0; padding: 0; list-style: none;
}
@media (min-width: 800px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats li {
  text-align: center; padding: var(--s5) var(--s3);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.stats strong { display: block; font-size: 2rem; color: var(--brand); line-height: 1.2; }
.stats span { display: block; font-size: .92rem; color: var(--muted); margin-top: var(--s1); }

/* ---------- ปิดท้าย ---------- */

.cta__inner { text-align: center; max-width: 760px; margin-inline: auto; }
.cta__inner .hero__actions { justify-content: center; }

/* ---------- หน้าติดต่อ ---------- */

.contact { display: grid; gap: var(--s7); }
@media (min-width: 900px) { .contact { grid-template-columns: 1.25fr .75fr; } }

.field { margin-bottom: var(--s4); }
.field label { display: block; font-weight: 600; margin-bottom: var(--s2); }
.field input, .field textarea, .field select {
  width: 100%; min-height: var(--tap);
  padding: var(--s3) var(--s4);
  font: inherit; color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.field textarea { min-height: 120px; resize: vertical; }
.field select { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 14px) center;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
  padding-right: var(--s7); }
.field select:focus-visible { border-color: var(--brand); }
.field__hint { font-weight: 400; font-size: .85rem; color: var(--muted); }
.field input:focus-visible, .field textarea:focus-visible { border-color: var(--brand); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--brand); }

.field--check { display: flex; gap: var(--s3); align-items: flex-start; }
.field--check input { width: 22px; height: 22px; min-height: 0; margin-top: 4px; flex: none; accent-color: var(--brand); }
.field--check label { font-weight: 400; font-size: .95rem; }

/* honeypot — ต้องซ่อนจากคนแต่ยังอยู่ใน DOM ให้บอทเห็น */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.cf-turnstile { margin-bottom: var(--s4); }

.alert {
  padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  margin-top: var(--s4);
}
.alert--ok   { border-color: var(--accent); background: #f2fbef; }
.alert--err  { border-color: var(--brand);  background: #fff5f5; }
.alert--warn { border-color: #f0b429; background: #fffaf0; }

.contact__side { align-self: start; }
.contact__qr { text-align: center; }
.contact__list { list-style: none; margin: 0 0 var(--s5); padding: 0; display: grid; gap: var(--s2); }
.contact__list .btn { width: 100%; }
.contact__legal { font-size: .93rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: var(--s4); }

/* ---------- เนื้อหายาว (privacy) ---------- */

.prose { max-width: 760px; }
.prose h2 { margin-top: var(--s6); font-size: 1.25rem; }
.prose ul { margin: 0 0 var(--s4); padding-left: var(--s5); }
.prose li { margin-bottom: var(--s2); }

/* ---------- footer ---------- */

.site-footer { background: var(--ink); color: #cbd5e1; padding-block: var(--s7) var(--s5); margin-top: var(--s7); }
.site-footer a { color: var(--white); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 0 0 var(--s2); }
.site-footer__inner { display: grid; gap: var(--s5); }
@media (min-width: 760px) { .site-footer__inner { grid-template-columns: 1.4fr .8fr .8fr; } }
.site-footer__legal { color: var(--white); font-weight: 600; }
.site-footer__muted { color: #94a3b8; font-size: .92rem; }
.site-footer__base {
  border-top: 1px solid #1e293b; margin-top: var(--s5); padding-top: var(--s4);
  font-size: .88rem; color: #94a3b8;
}

/* ---------- แถบปุ่มลอย (มือถือเท่านั้น) ---------- */

.sticky-cta {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: flex; gap: var(--s2);
  padding: var(--s2) var(--s3);
  padding-bottom: calc(var(--s2) + env(safe-area-inset-bottom));
  background: rgb(255 255 255 / .96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.sticky-cta .btn { flex: 1; }
.sticky-cta .btn--primary { flex: 2; }
@media (min-width: 760px) { .sticky-cta { display: none; } }
@media (max-width: 759px) { body { padding-bottom: 76px; } }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- ตารางเปรียบเทียบ (บล็อก 6) ---------- */

/* ตารางกว้างเกินจอมือถือ ต้องเลื่อนในกล่องตัวเอง ห้ามให้ body เลื่อนแนวนอน */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: var(--s4); }

/* รายการสินค้าบนหน้า /products — ละเอียดกว่าการ์ดหน้าแรก
   เพราะคนที่มาถึงหน้านี้กำลังเทียบของ ไม่ได้แค่ผ่านตา */
.section__more { margin: 18px 0 0; font-weight: 600; }
.section__more a { color: var(--brand); }

.pitems { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
@media (min-width: 780px) { .pitems { grid-template-columns: 1fr 1fr; } }

.pitem {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 20px 22px; display: flex; flex-direction: column; gap: 10px;
}
.pitem__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pitem__head h3 { margin: 0; font-size: 1.15rem; }
.pitem__head h3 a { color: var(--ink); text-decoration: none; }
.pitem__head h3 a:hover { color: var(--brand); }
.pitem__badge {
  margin: 0; font-size: .78rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 10px;
}
.pitem__blurb { margin: 0; color: var(--muted); }

/* รายการคุณสมบัติแบบสองคอลัมน์ — หัวข้อซ้าย ค่าขวา
   ใช้ dl เพราะมันคือคู่ของคำอธิบายกับค่าจริงๆ ไม่ใช่ตารางข้อมูล */
.pitem__meta {
  margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px;
  font-size: .92rem; border-top: 1px solid var(--line); padding-top: 12px;
}
.pitem__meta dt { color: var(--muted); font-size: .86rem; }
.pitem__meta dd { margin: 0; }
.pitem__price { font-weight: 600; color: var(--brand); }
.pitem__go { margin: auto 0 0; padding-top: 4px; }

/* หัวหน้ารวม — ไม่ใช้ hero เต็มจอเพราะหน้านี้คนมาหาข้อมูล ไม่ได้มารับความประทับใจ */
.section--lead h1 { margin: .2rem 0 .6rem; }

/* การ์ดผลิตภัณฑ์บนหน้าแรก — สองบรรทัดที่ช่วยให้คนคัดตัวเองได้ก่อนคลิก */
.pcard__who { font-size: .92rem; color: var(--muted); margin: .35rem 0 .15rem; }
.pcard__who strong { color: var(--text); font-weight: 600; }
.pcard__price { font-size: .92rem; font-weight: 600; color: var(--brand); margin: 0 0 .5rem; }

/* ตารางช่วยเลือก — คอลัมน์ราคาชิดขวาและใช้ตัวเลขความกว้างเท่ากัน
   เพื่อให้เทียบราคาข้ามแถวด้วยสายตาได้ ไม่ต้องอ่านทีละตัว */
.chooser tbody th { width: 22%; }
.chooser__price { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }

.compare {
  width: 100%; min-width: 520px;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.compare th, .compare td {
  padding: var(--s3) var(--s4);
  text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.compare thead th { background: var(--surface); font-size: .95rem; }
.compare thead th small { display: block; font-weight: 400; color: var(--muted); }
.compare tbody th { width: 30%; color: var(--muted); font-weight: 600; }
.compare tbody tr:last-child th, .compare tbody tr:last-child td { border-bottom: 0; }
.compare__ours { background: #fff7f7; font-weight: 600; }
.compare thead .compare__ours { color: var(--brand); }

.note { font-size: .93rem; color: var(--muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- ลูกค้าอ้างอิง (บล็อก 7) ---------- */

.refs { display: grid; gap: var(--s5); margin-bottom: var(--s4); }
@media (min-width: 760px) { .refs { grid-template-columns: 1fr 1.6fr; } }
.refs__group h3 { color: var(--brand-dark); margin-bottom: var(--s3); }
.refs__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
@media (min-width: 560px) { .refs__list--2col { grid-template-columns: 1fr 1fr; } }
.refs__list li {
  padding: var(--s2) var(--s3);
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: .95rem;
}

.founder {
  margin-top: var(--s6); padding-top: var(--s5);
  border-top: 1px solid var(--line);
}
.founder h3 { color: var(--brand-dark); }
.founder__legal { font-size: .93rem; color: var(--muted); }

/* ---------- FAQ (บล็อก 8) ---------- */

.faq {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); margin-bottom: var(--s3);
}
.faq > summary {
  min-height: var(--tap);
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  font-weight: 600; cursor: pointer;
  list-style: none;
}
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after {
  content: "+"; margin-left: auto;
  font-size: 1.4rem; line-height: 1; color: var(--brand);
}
.faq[open] > summary::after { content: "\2212"; }
.faq > summary:hover { color: var(--brand-dark); }
.faq > p { margin: 0; padding: 0 var(--s4) var(--s4); color: var(--muted); }

/* ---------- Hero แบบสลับผลิตภัณฑ์ด้วยแท็บ ---------- */

.hero__tabs {
  display: flex; flex-wrap: wrap; gap: var(--s2);
  margin-bottom: var(--s5);
}
.hero__tabs button {
  min-height: var(--tap);
  padding: var(--s2) var(--s4);
  font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--muted); cursor: pointer;
  background: var(--white);
  border: 1px solid var(--line); border-radius: 999px;
  transition: color .15s, border-color .15s, background-color .15s;
}
.hero__tabs button:hover { color: var(--brand-dark); border-color: var(--brand); }
.hero__tabs button[aria-selected="true"] {
  background: var(--brand); border-color: var(--brand); color: var(--white);
}

.hero__panel[hidden] { display: none; }
/* กันไม่ให้ขอบ focus ของ panel ตีกรอบทั้งบล็อกตอนกดแท็บ */
.hero__panel:focus { outline: none; }

.eyebrow {
  margin: 0 0 var(--s2);
  font-size: .82rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand);
}

/* หัวข้อของแท็บที่ไม่ใช่ตัวตั้งต้นใช้ h2 เพื่อให้มี h1 เดียวทั้งหน้า
   แต่ต้องดูเท่ากับ h1 */
.hero__h {
  font-size: clamp(1.75rem, 5vw, 2.6rem);
  letter-spacing: -.01em; line-height: 1.35;
  margin: 0 0 var(--s3);
}

.hero__facts {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--s3); align-content: start;
}
.hero__facts li {
  background: var(--white); border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4);
}
.hero__facts strong { display: block; color: var(--ink); font-size: 1.05rem; }
.hero__facts span { display: block; font-size: .9rem; color: var(--muted); }

/* ---------- การ์ดผลิตภัณฑ์บนหน้าแรก ---------- */

.pcards {
  list-style: none; margin: var(--s5) 0 0; padding: 0;
  display: grid; gap: var(--s4);
}
@media (min-width: 640px) { .pcards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .pcards { grid-template-columns: repeat(4, 1fr); } }

.pcard {
  display: flex; flex-direction: column; gap: var(--s2);
  background: var(--white); border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius); padding: var(--s5);
  box-shadow: var(--shadow);
}
.pcard__badge {
  margin: 0; font-size: .75rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.pcard h3 { margin: 0; }
.pcard h3 a { color: var(--ink); text-decoration: none; }
.pcard h3 a:hover { color: var(--brand); }
.pcard__blurb { margin: 0; font-size: .95rem; color: var(--muted); flex: 1; }
.pcard__more { margin: 0; font-size: .95rem; font-weight: 600; }
/* ทั้งการ์ดกดได้ แต่ยังมีลิงก์จริงให้ screen reader และการกด Tab */
.pcard { position: relative; }
.pcard h3 a::after { content: ""; position: absolute; inset: 0; }
.pcard__more a { position: relative; }

/* ---------- เส้นทาง (breadcrumb) ---------- */

.crumb { font-size: .9rem; color: var(--muted); margin-bottom: var(--s4); }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brand); }
.crumb span[aria-hidden] { margin-inline: var(--s1); }

/* ---------- ผลิตภัณฑ์อื่น (ท้ายหน้าผลิตภัณฑ์) ---------- */

.others { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
@media (min-width: 760px) { .others { grid-template-columns: repeat(3, 1fr); } }
.others a {
  display: flex; flex-direction: column; gap: var(--s1);
  height: 100%; padding: var(--s4);
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none;
}
.others a:hover { border-color: var(--brand); }
.others strong { color: var(--ink); }
.others a:hover strong { color: var(--brand); }
.others span { font-size: .9rem; color: var(--muted); }

/* ---------- ลิสต์ผลิตภัณฑ์ใน footer ---------- */

.site-footer__products { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s2); }

/* ---------- การ์ดแพ็กเกจราคา ---------- */

.plans {
  list-style: none; margin: var(--s5) 0 var(--s4); padding: 0;
  display: grid; gap: var(--s4);
}
@media (min-width: 620px)  { .plans { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .plans { grid-template-columns: repeat(4, 1fr); } }

.plan {
  position: relative;
  display: flex; flex-direction: column; gap: var(--s3);
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s5);
}
.plan--featured {
  border-color: var(--brand); border-width: 2px;
  box-shadow: var(--shadow);
}
.plan__tag {
  position: absolute; top: calc(var(--s3) * -1); left: var(--s5);
  margin: 0; padding: 2px var(--s3);
  font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  color: var(--white); background: var(--brand); border-radius: 999px;
}
.plan h3 { margin: 0; font-size: 1.05rem; }
.plan__price { margin: 0; display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.plan__price strong {
  font-size: 1.9rem; line-height: 1.1; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.plan__price span { font-size: .88rem; color: var(--muted); }
.plan__blurb { margin: 0; font-size: .92rem; color: var(--muted); }
.plan__features { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); flex: 1; }
.plan__features li { position: relative; padding-left: var(--s5); font-size: .92rem; }
.plan__features li::before {
  content: "✓"; position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}
.plan__cta { margin: 0; }
.plan__cta .btn { width: 100%; }

.addon__head { margin-top: var(--s6); }
.addons th[scope="row"] { width: auto; color: var(--ink); font-weight: 400; }
.addon__price { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
