/* ── ผิวสาธารณะที่เป็น "เอกสาร" ────────────────────────────────────────────
   ใช้โดย /privacy · /terms · /request-access — หน้าที่คนอ่านก่อนตัดสินใจ
   ล็อกอิน จึงต้องโหลดได้โดยไม่มี session และต้องไม่ลาก CSS/JS ของแอปเข้ามา

   ทำไมไม่ใช้ชุดเดียวกับ landing.html ทั้งดุ้น: หัวหน้าของหน้าแรกมีพฤติกรรม
   ผูกกับคัฟเวอร์ (โปร่งตอนอยู่บนภาพเปิด · ทึบเมื่อเลื่อนพ้น) ซึ่งหน้าเอกสาร
   ไม่มีคัฟเวอร์เลย มันจึงเป็นคนละคอมโพเนนต์จริง ๆ ไม่ใช่การก๊อป
   ส่วนที่ *เหมือนกันจริง* คือโทเคน ซึ่งมาจาก tokens.css แหล่งเดียวอยู่แล้ว

   กฎเดียวกับ landing.html: ห้าม literal สี · เส้น 1px เป็น box-shadow inset ·
   ห้าม backdrop-filter คู่พื้นโปร่ง · ห้าม -webkit-font-smoothing
   (ที่มา: docs/brand/RASTER-AND-DPI.md) */

:root {
  --ease: cubic-bezier(.22, 1, .36, 1);
  --doc-col: var(--read-max);   /* = --content-max ของแอป (720) ระยะอ่านเดียวกับหน้าแชท */
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--stage); background-attachment: fixed;
  color: var(--text); font-family: var(--font-ui);
  font-size: var(--fs-xl); line-height: 28px;
}
a { color: var(--accent-ink); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm);
}

/* ── หัวหน้า — นิ่ง ไม่ sticky ไม่โปร่ง ── */
.pub-top { box-shadow: inset 0 -1px 0 var(--line); background: var(--canvas); }
.pub-top-in {
  max-width: var(--page-max); margin: 0 auto; padding: var(--sp-3) var(--sp-6);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
}
/* lockup แบรนด์อยู่ที่ /css/site.css — ใช้ร่วมกับหน้าแรกด้วย */

/* ปุ่ม — ไทยล้วน จึงไม่ถ่างตัวอักษรและไม่แปลงตัวพิมพ์ (uppercase ไม่ทำอะไรกับ
   อักษรไทย ส่วน letter-spacing ทำลายรูปคำที่มีสระบน-ล่างเกาะอยู่) */
.pub-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--h-pill); padding: 0 var(--sp-5); border: none; border-radius: var(--r-full);
  background: transparent; color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2);
  text-decoration: none; font-size: var(--fs-base); line-height: 24px;
  cursor: pointer; white-space: nowrap;
  transition: box-shadow .25s var(--ease), background .25s var(--ease);
}
.pub-btn:hover { box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-tint); }
.pub-btn-primary {
  height: var(--h-field); padding: 0 var(--sp-8); font-size: var(--fs-lg); line-height: 28px;
  font-weight: var(--fw-medium);
  background: var(--accent); color: var(--on-accent); box-shadow: none;
}
.pub-btn-primary:hover { background: var(--accent-hover); box-shadow: none; }

/* ── ตัวเอกสาร ── */
.doc { max-width: var(--doc-col); margin: 0 auto; padding: var(--sp-12) var(--sp-6) var(--sp-12); }
/* ตารางกว้างกว่าจอมือถือเสมอ — ต้องเลื่อนในกล่องของตัวเอง ไม่ใช่ดันทั้งหน้า
   ให้เลื่อนแนวนอน ซึ่งเป็นอาการที่คนมองว่าหน้าพัง */
.doc-scroll { overflow-x: auto; margin: 0 0 var(--sp-6); }
.doc-scroll .doc-table { margin: 0; min-width: 560px; }
.doc-kicker { margin: 0 0 var(--sp-2); font-size: var(--fs-base); line-height: 24px; color: var(--accent-ink); }
.doc h1 {
  margin: 0 0 var(--sp-3); font-size: clamp(30px, 4.4vw, 42px); line-height: 48px;
  font-weight: var(--fw-semibold); letter-spacing: -.03em;
}
.doc-meta { margin: 0 0 var(--sp-8); color: var(--muted); font-size: var(--fs-base); line-height: 24px; }

/* ป้าย "ยังไม่ผ่านการตรวจ" — ต้องเห็นก่อนอ่านเนื้อ ไม่ใช่ซ่อนท้ายหน้า
   เอกสารแบบนี้ถ้าไม่ติดป้าย คนจะอ่านว่ามันมีผลผูกพันแล้ว */
.doc-draft {
  margin: 0 0 var(--sp-8); padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-lg); background: var(--warn-glow);
  box-shadow: inset 0 0 0 1px var(--warn);
  font-size: var(--fs-md); line-height: 24px;
}
.doc-draft b { color: var(--text); }

.doc h2 {
  margin: var(--sp-10) 0 var(--sp-3); font-size: var(--fs-3xl); line-height: 32px;
  font-weight: var(--fw-semibold); letter-spacing: -.02em;
}
.doc h3 {
  margin: var(--sp-6) 0 var(--sp-2); font-size: var(--fs-xl); line-height: 24px;
  font-weight: var(--fw-semibold);
}
/* เนื้อความอ่านเป็นย่อหน้า → --font-body ตัวเดียวกับที่ใช้ในฟองแชท
   (หัวข้อกับป้ายยังเป็น --font-ui ตามที่ tokens.css แบ่งหน้าที่ไว้) */
.doc p, .doc li, .doc-draft, .doc-note, .doc-table td,
.field input, .field textarea, .field-hint {
  font-family: var(--font-body);
}
.doc p { margin: 0 0 var(--sp-4); color: var(--text); }
.doc p strong, .doc li strong { color: var(--text); font-weight: var(--fw-semibold); }
.doc ul { margin: 0 0 var(--sp-4); padding-left: var(--sp-5); color: var(--text); }
.doc li { margin-bottom: var(--sp-2); }

/* ตาราง "เก็บอะไรบ้าง" — เส้นเป็น box-shadow ไม่ใช่ border ทั้งหมด */
.doc-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 0 var(--sp-6); }
.doc-table th:first-child, .doc-table td:first-child { width: 26%; }
.doc-table th, .doc-table td {
  text-align: left; padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-md); line-height: 28px; vertical-align: top;
  box-shadow: inset 0 -1px 0 var(--line);
}
.doc-table th { color: var(--text); font-weight: var(--fw-semibold); }
.doc-table td { color: var(--text); }
.doc-table tr:first-child th { box-shadow: inset 0 -1px 0 var(--line-2); }

.doc-note {
  margin: var(--sp-8) 0 0; padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-lg); background: var(--accent-tint);
  font-size: var(--fs-md); line-height: 24px;
}

/* ── ฟอร์มขอสิทธิ์ทดลอง ── */
.form-card {
  background: var(--surface); border-radius: var(--r-xl); padding: var(--sp-6);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}
.field { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-6); }
.field:last-of-type { margin-bottom: 0; }
.field label { font-size: var(--fs-base); line-height: 24px; color: var(--text); }
/* `font-family: inherit` ไม่ใช่ `font: inherit` — shorthand ลบ line-height ทิ้ง */
.field input, .field textarea {
  width: 100%; border: none; border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: var(--sp-3) var(--sp-4);
  font-family: inherit; font-size: var(--fs-xl); line-height: 24px;
  transition: box-shadow var(--dur-fast) var(--ease-ui);
}
.field input { height: var(--h-field); }
.field textarea { min-height: 104px; resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: none; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-tint);
}
.field-hint { color: var(--muted); font-size: var(--fs-base); line-height: 24px; }
/* ⚠️ ต้องนำหน้าด้วย .doc — `.doc p` มี specificity (0,1,1) ซึ่งชนะคลาสเดี่ยว (0,1,0)
   เสมอไม่ว่าจะเขียนทีหลังแค่ไหน · ระยะใต้ปุ่มถูก `.doc p { margin: 0 0 16px }`
   ทับอยู่ตลอด แก้ค่าสามรอบจึงไม่ขยับเลย — กับดักของ selector ที่ผสมแท็กกับคลาส */
.doc .form-head { margin-top: 0; }
.doc .form-lede { margin: 0 0 var(--sp-5); }
/* หมายเหตุใต้ปุ่ม — ต้องหายใจ ไม่ใช่แปะติดขอบล่างปุ่ม
   16 แน่นเกินไปเมื่อปุ่มสูง 48 และตัวหนังสือมีสองบรรทัด · 24 ให้กลุ่มอ่านเป็น
   "ปุ่ม แล้วค่อยคำอธิบาย" ไม่ใช่ก้อนเดียวที่ชนกัน
   จำกัดความกว้างด้วยเพื่อไม่ให้บรรทัดยาวจนห่อในตำแหน่งแปลก ๆ */
.doc .form-alt { margin: var(--sp-5) auto 0; text-align: center; max-width: 42ch; }

/* ท้ายหน้าอยู่ที่ /css/site-foot.css — ใช้ร่วมกับหน้าแรกด้วย */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* เอกสารแบบนี้คนพิมพ์ออกมาอ่านและเก็บไว้จริง — ตัดส่วนที่ไม่ใช่เนื้อหาออก
   และคลี่ตารางให้ไม่ต้องเลื่อน */
@media print {
  .pub-top { display: none; }
  body { background: none; font-size: 12pt; line-height: 1.6; }
  .doc { max-width: none; padding: 0; }
  .doc-scroll { overflow: visible; }
  .doc-scroll .doc-table { min-width: 0; }
  .doc h2 { break-after: avoid; }
  .doc-table tr { break-inside: avoid; }
}

/* ── ข้อความบอกความผิดพลาดในฟอร์ม ──────────────────────────────────────────
   สีเตือนของระบบ ไม่ใช่แดงที่คิดขึ้นเอง · ขึ้นใต้ช่องที่ผิดเสมอ ไม่ใช่รวมไว้บนสุด
   คนจะได้ไม่ต้องไล่หาว่าอันไหนผิด */
.field-err { margin: 0; color: var(--warn); font-size: var(--fs-base); line-height: 24px; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  box-shadow: inset 0 0 0 1px var(--warn);
}
.form-submit { width: 100%; margin-top: var(--sp-6); }

/* ลำดับขั้นในหน้าเอกสาร — เลขวงกลมสีแบรนด์ อ่านเป็นลำดับจริง ไม่ใช่จุดนำ */
.steps-doc { list-style: none; margin: 0 0 var(--sp-4); padding: 0; counter-reset: sd; }
.steps-doc li {
  position: relative; padding-left: var(--sp-10); margin-bottom: var(--sp-5);
  color: var(--text);
}
.steps-doc li::before {
  counter-increment: sd; content: counter(sd);
  position: absolute; left: 0; top: 2px;
  width: 28px; height: 28px; border-radius: var(--r-full);
  background: var(--accent-soft); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--fs-base); line-height: 1;
}
.steps-doc strong { display: block; color: var(--text); font-weight: var(--fw-semibold); }
