/* ============================================================
   หน้าบริการ: รับร่างสัญญาและตรวจสัญญา  (/services-contract-drafting)
   โหลดต่อจาก svc-notice.css — ส่วนที่ใช้ร่วม (hero, ปัญหา, บันได, เครื่องมือ, ขั้นตอน, ค่าบริการ, ทนาย, FAQ, ฟอร์ม) ใช้คลาส dn-* เดิม
   ไฟล์นี้มีเฉพาะส่วนใหม่ของหน้านี้ · prefix "ct-" = contract · ทุกค่าดึงจาก tokens เดิม
   ============================================================ */

.ct-types [hidden], .dn-tool [hidden] { display: none !important; }

/* Hero — รูปสัญญาบนโต๊ะ: เอากระดาษกับปากกา (ขวาของภาพ) ไว้ในกรอบที่ไล่สีจางที่สุด · ไม่มีป้ายเล็กเหนือ H1 */
.ct-hero .dn-hero-bg img { object-position: 64% 62%; }
.ct-hero h1 { margin-top: 0; }

/* ============================================================
   S3 · สัญญา 8 ประเภท — แฟ้มเอกสารบนโต๊ะกรมท่า: แถบชื่อแฟ้มด้านซ้าย แผ่นสัญญาด้านขวา
   ไม่มี JS = ทุกแผ่นเรียงลงมา และรายการด้านบนเป็นลิงก์กระโดด (ยังอ่านได้ครบ)
   ============================================================ */
.ct-types-sec { position: relative; isolation: isolate; overflow: hidden; background: var(--grad-ink); color: var(--on-navy); }
.ct-types-sec::before { content: ""; position: absolute; z-index: -1; right: -14%; top: -24%; width: 58%; aspect-ratio: 1; background: radial-gradient(closest-side, rgba(184,144,47,.13), transparent); }
.ct-types-sec .dn-sec-head h2 { color: var(--white); }
.ct-types-sec .dn-sec-head p { color: var(--on-navy-muted); }

.ct-types { display: grid; grid-template-columns: minmax(230px, 290px) minmax(0, 1fr); align-items: start; }
.ct-index { display: grid; gap: 4px; padding-top: 10px; position: sticky; top: calc(var(--header-h) + 18px); }
.ct-tab {
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 10px 22px 10px 16px; border-radius: var(--r-md) 0 0 var(--r-md);
  color: var(--on-navy); font-weight: 500; line-height: 1.4;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.ct-tab svg { flex: none; width: 30px; height: 30px; color: var(--gold-soft); transition: color .25s var(--ease); }
.ct-tab:hover { background: rgba(255,255,255,.055); color: var(--white); }
.ct-tab:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -2px; }
/* แถบที่เปิดอยู่ = สันแฟ้มต่อเนื้อเดียวกับแผ่นกระดาษ */
.ct-tab[aria-selected="true"] { z-index: 2; background: var(--ivory-warm); color: var(--navy); font-weight: 600; margin-right: -1px; }
.ct-tab[aria-selected="true"] svg { color: var(--gold-text); }

.ct-panels { position: relative; min-width: 0; }
.ct-panel {
  position: relative; padding: clamp(26px, 3.2vw, 46px);
  background: var(--ivory-warm); color: var(--ink);
  border-radius: var(--r-lg); box-shadow: var(--sh-xl);
}
.ct-panel + .ct-panel { margin-top: 18px; }
.ct-types.is-tabs .ct-panel + .ct-panel { margin-top: 0; }
.ct-panel.is-fresh { animation: ctIn .55s var(--ease-out-expo); }
@keyframes ctIn { from { opacity: .4; transform: translateX(10px); } to { opacity: 1; transform: none; } }

.ct-panel-head { display: flex; gap: 18px; align-items: flex-start; padding-bottom: 22px; border-bottom: 1px solid var(--line-strong); }
.ct-panel-ic { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--navy); color: var(--gold-bright); }
.ct-panel-ic svg { width: 30px; height: 30px; }
.ct-panel-head h3 { font-size: var(--fs-h3); line-height: 1.3; text-wrap: balance; }
.ct-who { margin-top: 8px; color: var(--slate); line-height: 1.7; max-width: 62ch; text-wrap: pretty; }
.ct-who b { color: var(--gold-text); font-weight: 600; margin-right: 4px; }

.ct-cols { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: clamp(22px, 3vw, 44px); margin-top: 24px; }
.ct-col h4 { font-size: 1.02rem; color: var(--navy); padding-bottom: 10px; border-bottom: 1.5px solid var(--navy); }
.ct-col .dn-check li { font-size: var(--fs-sm); }

/* จุดที่มักพลาด — กากบาทสีอิฐ แยกจากเครื่องหมายถูกของฝั่งซ้าย */
.ct-pit li { position: relative; padding: 11px 0 11px 28px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: var(--fs-sm); line-height: 1.6; }
.ct-pit li:last-child { border-bottom: 0; }
.ct-pit li::before, .ct-pit li::after { content: ""; position: absolute; left: 3px; top: calc(11px + .8em); width: 14px; height: 2px; border-radius: 2px; background: #A4462F; transform: rotate(45deg); }
.ct-pit li::after { transform: rotate(-45deg); }
.ct-law { margin-top: 14px; }
.ct-law .dn-law { white-space: normal; display: inline-block; line-height: 1.55; padding-block: 4px; }

.ct-panel-foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 28px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-strong); }
.ct-reads { display: grid; gap: 6px; min-width: 0; flex: 1 1 320px; }
.ct-reads-k { font-size: var(--fs-xs); font-weight: 700; color: var(--slate); }
.ct-reads a { color: var(--navy); font-size: var(--fs-sm); line-height: 1.55; text-decoration: underline; text-decoration-color: var(--line-gold); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: color .2s, text-decoration-color .2s; }
.ct-reads a:hover { color: var(--gold-text); text-decoration-color: var(--gold); }
.ct-panel-act { display: flex; flex-wrap: wrap; gap: 10px; }

/* ============================================================
   S4 · ตัวอย่างโครงสัญญา (ใช้กระดาษ .dn-paper เดิม)
   ============================================================ */
.ct-c-title { text-align: center; color: var(--navy); font-weight: 700; font-size: 1.12rem; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 2px solid var(--navy); }
.ct-contract .dn-l-sign { font-size: .9rem; }

/* ============================================================
   S6 · เครื่องมือเช็กลิสต์ — ส่วนที่ต่างจากเครื่องมือหน้าโนติส
   ============================================================ */
.ct-opts--stack { grid-template-columns: 1fr; }
em.ct-nb { font-style: normal; }
.ct-r-k { margin-top: 20px; font-size: var(--fs-xs); font-weight: 700; color: var(--gold-soft); }
.ct-r-k + .dn-r-why { margin-top: 10px; }
.ct-r-docs li::before { background: var(--on-navy-muted); }
.ct-r-more { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--gold-bright); font-weight: 600; font-size: var(--fs-sm); border-bottom: 1.5px solid rgba(231,203,128,.5); padding-bottom: 2px; }
.ct-r-more svg { width: 15px; height: 15px; }
.ct-r-more:hover { color: var(--white); }

/* ============================================================
   หน้าย่อย 8 ประเภท (inc/contract-type-page.php)
   ============================================================ */
.ct-law-wrap { white-space: normal; line-height: 1.55; padding-block: 3px; }

/* S3 · แผ่นสัญญาบนโต๊ะกรมท่า — หัวข้อซ้าย (ติดตามตอนเลื่อน) แผ่นกระดาษขวา เลขข้อเป็นเลขไทยแบบสัญญาจริง */
.ct-clauses { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.ct-clauses-head { position: sticky; top: calc(var(--header-h) + 28px); }
.ct-clauses-head .ct-panel-ic { margin-bottom: 22px; background: rgba(255,255,255,.06); border: 1px solid rgba(217,197,139,.3); }
.ct-clauses-head h2 { color: var(--white); font-size: var(--fs-h2); text-wrap: balance; }
.ct-clauses-head h2::after { content: ""; display: block; width: 56px; height: 3px; border-radius: 3px; background: var(--gold); margin-top: 18px; }
.ct-clauses-head p { margin-top: 16px; color: var(--on-navy-muted); font-size: var(--fs-lead); line-height: 1.75; text-wrap: pretty; }
.ct-clauses-head .btn { margin-top: 28px; }
.ct-sheet {
  position: relative; padding: clamp(28px, 4vw, 56px) clamp(24px, 4vw, 56px) clamp(22px, 3vw, 40px);
  background: var(--ivory-warm); color: var(--ink); border-radius: 4px; box-shadow: var(--sh-xl);
}
.ct-sheet::before { content: ""; position: absolute; inset: 10px; border: 1px solid var(--line-gold); border-radius: 2px; pointer-events: none; }
.ct-sheet-title { text-align: center; font-family: var(--serif-th); font-weight: 700; font-size: 1.2rem; color: var(--navy); padding-bottom: 14px; border-bottom: 2px solid var(--navy); text-wrap: balance; }
.ct-sheet-list { list-style: none; padding: 0; margin-top: 8px; counter-reset: cl; }
.ct-sheet-list li { counter-increment: cl; display: grid; grid-template-columns: 4.2em minmax(0, 1fr); column-gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.ct-sheet-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.ct-sheet-list li::before { content: "ข้อ " counter(cl, thai); grid-row: span 2; font-family: var(--serif-th); font-weight: 700; color: var(--gold-text); line-height: 1.45; }
.ct-sheet-list h3 { font-size: 1.08rem; color: var(--navy); line-height: 1.45; }
.ct-sheet-list p { margin-top: 4px; color: var(--slate); font-size: var(--fs-sm); line-height: 1.75; text-wrap: pretty; }

/* S4 · เอกสารที่ควรเตรียม */
.ct-pit-grid { align-items: start; }
.ct-docs { padding: clamp(24px, 3vw, 34px); border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--ivory); }
.ct-docs h3 { font-size: 1.2rem; padding-bottom: 12px; border-bottom: 1.5px solid var(--navy); }
.ct-docs .dn-check { margin-top: 4px; }
.ct-docs > p { margin-top: 14px; color: var(--slate); font-size: var(--fs-sm); line-height: 1.65; }
.ct-docs .btn { margin-top: 18px; width: 100%; white-space: normal; text-align: center; }
.ct-docs-more { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; color: var(--navy); font-weight: 600; font-size: var(--fs-sm); border-bottom: 1.5px solid var(--gold); padding-bottom: 2px; }
.ct-docs-more svg { width: 15px; height: 15px; transition: transform .3s var(--ease); }
.ct-docs-more:hover svg { transform: translateX(3px); }

/* ท้ายหน้า · สัญญาประเภทอื่น */
.ct-siblings { margin-top: clamp(40px, 5vw, 64px); padding-top: clamp(28px, 3vw, 40px); border-top: 1px solid var(--line); }
.ct-siblings:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.ct-siblings h2 { font-size: var(--fs-h3); margin-bottom: 18px; }
.ct-siblings ul { display: flex; flex-wrap: wrap; gap: 10px; }
.ct-siblings a { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 18px 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--white); color: var(--navy); font-weight: 500; line-height: 1.35; transition: border-color .2s, background-color .2s; }
.ct-siblings a svg { flex: none; width: 24px; height: 24px; color: var(--gold-text); }
.ct-siblings a:hover { border-color: var(--gold); background: var(--ivory-warm); }
.ct-siblings a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ct-siblings .ct-sib-all { background: var(--navy); border-color: var(--navy); color: var(--white); }
.ct-siblings .ct-sib-all svg { color: var(--gold-bright); }
.ct-siblings .ct-sib-all:hover { background: var(--navy-700); }
.ct-next { margin-top: clamp(28px, 3vw, 40px); }

/* ============================================================
   Responsive — จัดใหม่ ไม่ใช่แค่ย่อ
   ============================================================ */
@media (max-width: 920px) {
  /* แถบแฟ้ม → ปุ่มเม็ดยา 2 คอลัมน์เหนือแผ่นกระดาษ */
  .ct-types { grid-template-columns: 1fr; gap: 16px; }
  .ct-index { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 0; }
  .ct-tab { min-height: 52px; padding: 9px 12px; gap: 10px; border-radius: var(--r-md); border: 1px solid rgba(217,197,139,.22); font-size: var(--fs-sm); }
  .ct-tab svg { width: 24px; height: 24px; }
  .ct-tab[aria-selected="true"] { margin-right: 0; border-color: var(--ivory-warm); }
  .ct-cols { grid-template-columns: 1fr; }
  .ct-clauses { grid-template-columns: 1fr; }
  .ct-clauses-head { position: static; }
}
@media (max-width: 640px) {
  .ct-panel-head { flex-direction: column; gap: 14px; }
  .ct-panel-ic { width: 44px; height: 44px; }
  .ct-panel-ic svg { width: 24px; height: 24px; }
  .ct-panel-act, .ct-panel-act .btn { width: 100%; }
  .ct-panel-act .btn { white-space: normal; text-align: center; }
}
@media (max-width: 420px) {
  .ct-tab { padding: 8px 10px; gap: 8px; font-size: var(--fs-xs); line-height: 1.35; }
  .ct-tab svg { width: 20px; height: 20px; }
}
@media (max-width: 359px) {
  .ct-tab svg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ct-panel.is-fresh { animation: none !important; }
  .ct-tab, .ct-tab svg { transition: none; }
}
