:root {
  --bg: #ffffff; --bg-alt: #f5f5f7; --ink: #1d1d1f; --ink-2: #6e6e73; --ink-3: #86868b; --line: #d2d2d7;
  --blue: #0071e3; --blue-hover: #0077ed; --link: #0066cc; --card: #ffffff;
  --crim: #bf4800; --civil: #0a6cbc; --ok: #248a3d; --err: #d70015;
  --nav: rgba(255,255,255,.72);
  --g1: #0071e3; --g2: #8e5af7; --g3: #e0428b;
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) { --bg: #000; --bg-alt: #111113; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #86868b; --line: #3a3a3c; --card: #1c1c1e; --link: #2997ff; --nav: rgba(22,22,23,.72); --crim: #ff9f0a; --civil: #64d2ff; --ok: #30d158; --err: #ff453a; }
}
:root[data-theme=dark] { --bg: #000; --bg-alt: #111113; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #86868b; --line: #3a3a3c; --card: #1c1c1e; --link: #2997ff; --nav: rgba(22,22,23,.72); --crim: #ff9f0a; --civil: #64d2ff; --ok: #30d158; --err: #ff453a; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body:has(dialog[open]) { overflow: hidden; }
a { color: var(--link); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 70%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 18px; border-radius: 99px; font-size: 14px; transition: top .2s var(--ease); }
.skip:focus { top: 8px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 50; background: var(--nav); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.nav-in { max-width: 1024px; margin: 0 auto; height: 48px; display: flex; align-items: center; gap: 28px; padding: 0 22px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.nav-links { display: flex; gap: 28px; margin-left: auto; }
.nav-links a { position: relative; color: var(--ink); opacity: .8; font-size: 13px; transition: opacity .2s; }
.nav-links a:hover { opacity: 1; }
.nav-links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -5px; height: 2px; border-radius: 2px; background: var(--ink); transform: scaleX(0); transition: transform .3s var(--ease); }
.nav-links a[aria-current=true] { opacity: 1; }
.nav-links a[aria-current=true]::after { transform: scaleX(1); }
.nav-cta { font-size: 12.5px; background: var(--blue); color: #fff; padding: 3px 13px; border-radius: 99px; line-height: 1.7; transition: background .2s; }
.nav-cta:hover { background: var(--blue-hover); }
.nav-burger { display: none; background: none; border: 0; width: 36px; height: 36px; position: relative; cursor: pointer; margin-left: 0; }
.nav-burger span { position: absolute; left: 9px; right: 9px; height: 1.5px; background: var(--ink); transition: .25s; }
.nav-burger span:first-child { top: 14px; } .nav-burger span:last-child { top: 21px; }
.nav-burger[aria-expanded=true] span:first-child { top: 17px; transform: rotate(45deg); }
.nav-burger[aria-expanded=true] span:last-child { top: 17px; transform: rotate(-45deg); }

/* type */
.eyebrow { font-size: 17px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; letter-spacing: -.005em; }
/* ภาษาไทยมีสระ/วรรณยุกต์สูงต่ำ — ระยะบรรทัดของหัวข้อใหญ่ต้องไม่ต่ำกว่า ~1.32 ไม่งั้นบรรทัดบนกับล่างทับกัน */
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.32; text-wrap: balance; }
h1 { font-size: clamp(40px, 7.4vw, 84px); font-weight: 700; line-height: 1.34; }
h2 { font-size: clamp(32px, 5.2vw, 56px); font-weight: 700; }
.lead { font-size: clamp(18px, 2.2vw, 24px); line-height: 1.55; color: var(--ink-2); font-weight: 400; max-width: 34em; margin: 18px auto 0; text-wrap: pretty; }
.grad { background: linear-gradient(92deg, var(--g1) 0%, var(--g2) 55%, var(--g3) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .08em; }
.fine { font-size: 13px; color: var(--ink-3); line-height: 1.6; }

/* buttons */
.actions { display: flex; gap: 22px; justify-content: center; align-items: center; margin-top: 30px; flex-wrap: wrap; }
.btn-pill { display: inline-flex; align-items: center; justify-content: center; border: 0; cursor: pointer; padding: 11px 24px; border-radius: 99px; font-size: 17px; font-weight: 500; transition: background .2s, transform .15s; }
.btn-pill.sm { padding: 5px 16px; font-size: 14px; }
.btn-pill.primary { background: var(--blue); color: #fff; } .btn-pill.primary:hover { background: var(--blue-hover); }
.btn-pill.ghost { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); } .btn-pill.ghost:hover { background: color-mix(in srgb, var(--ink) 14%, transparent); }
.btn-pill.light { background: #fff; color: #1d1d1f; } .btn-pill.light:hover { background: #e8e8ed; }
.btn-pill:active { transform: scale(.97); }
.btn-pill:focus-visible { outline-offset: 3px; border-radius: 99px; }
.link-arrow { font-size: 19px; } .link-arrow::after { content: ' ›'; }
.link-arrow:hover { text-decoration: underline; }

/* sections */
.hero { text-align: center; padding: clamp(24px, 5vw, 56px) 22px 60px; max-width: 1024px; margin: 0 auto; }
.sec { padding: clamp(64px, 11vw, 120px) 0; }
.sec.alt { background: var(--bg-alt); }
.sec.dark { background: #000; color: #f5f5f7; --ink: #f5f5f7; --ink-2: #a1a1a6; }
.wrap { max-width: 1024px; margin: 0 auto; padding: 0 22px; }
.wrap.narrow { max-width: 780px; }
.sec-head { text-align: center; margin-bottom: 44px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 64px; }
.stat { padding: 8px; } .stat b { display: block; font-size: clamp(30px, 5vw, 52px); font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: 15px; }

/* scales of justice */
.scales-wrap { width: clamp(176px, 26vw, 256px); margin: 0 auto clamp(16px, 3vw, 30px); color: var(--ink); will-change: transform, opacity;
  transform: translate3d(0, calc(var(--p, 0) * 30px), 0); opacity: calc(1 - var(--p, 0) * .4); }
.scales { --amp: 6deg; display: block; width: 100%; height: auto; overflow: visible; color: var(--ink); }
.scales-wrap .scales { --amp: var(--amp-live, 6deg); }
.scales .d { stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; stroke-dashoffset: 1; }
.scales .bowl { fill-opacity: 0; }
.scales .beam { transform-origin: 200px 70px; }
.scales .pan, .scales .dish { transform-origin: 60px 70px; }
.scales .pan.r, .scales .dish.r { transform-origin: 340px 70px; }
.scales.play .d { animation: s-draw var(--dur, .65s) cubic-bezier(.4,0,.2,1) calc(var(--d, 0s) * .28) forwards; }
.scales.play .bowl { animation: s-draw var(--dur, .65s) cubic-bezier(.4,0,.2,1) calc(var(--d, 0s) * .28) forwards, s-fill .5s ease-out calc(var(--d, 0s) * .28 + var(--dur, .65s) * .7) forwards; }
.scales.play .beam { animation: s-tilt 7.5s ease-in-out 2.4s infinite both; }
.scales.play .pan { animation: s-untilt 7.5s ease-in-out 2.4s infinite both; }
.scales.play .dish { animation: s-dish 7.5s ease-in-out 2.7s infinite both; }
.scales.mini { --amp: 4deg; --dur: .5s; }
@keyframes s-draw { to { stroke-dashoffset: 0; } }
@keyframes s-fill { to { fill-opacity: .92; } }
@keyframes s-tilt { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(var(--amp)); } 75% { transform: rotate(calc(var(--amp) * -1)); } }
@keyframes s-untilt { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(calc(var(--amp) * -1)); } 75% { transform: rotate(var(--amp)); } }
@keyframes s-dish { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(calc(var(--amp) * -.22)); } 75% { transform: rotate(calc(var(--amp) * .22)); } }
.mini-scales { width: 78px; margin: 0 auto 16px; color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  /* ผู้ใช้ที่ลดการเคลื่อนไหว: ยังเห็นเส้นค่อย ๆ วาดเข้า แต่ไม่มีการโยก/เลื่อนตาม scroll */
  .scales.play .beam, .scales.play .pan, .scales.play .dish { animation: none; }
  .scales-wrap { transform: none; opacity: 1; }
}

/* library */
.search { position: relative; max-width: 560px; margin: 0 auto 18px; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; border: 0; background: var(--card); border-radius: 14px; padding: 15px 18px 15px 46px; font-size: 17px; box-shadow: 0 0 0 1px var(--line) inset; transition: box-shadow .2s; }
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 55%, transparent); }
.chips { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; }
.kindseg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.kindseg button { border: 0; background: transparent; padding: 6px 20px; border-radius: 9px; cursor: pointer; font-size: 15px; font-weight: 500; color: var(--ink-2); transition: background .2s, color .2s, box-shadow .2s; }
.kindseg button:hover { color: var(--ink); }
.kindseg button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.kindseg button:focus-visible { outline-offset: 1px; }
.lawrow { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.chip { border: 0; background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; padding: 6px 15px; border-radius: 99px; cursor: pointer; font-size: 14.5px; transition: .15s; }
.chip:hover { box-shadow: 0 0 0 1px var(--ink-3) inset; }
.chip:focus-visible { outline-offset: 3px; border-radius: 99px; }
.chip[aria-pressed=true] { background: var(--ink); color: var(--bg); box-shadow: none; }
.chip small { opacity: .55; margin-left: 5px; font-size: 12.5px; }
.pillsel { position: relative; display: inline-block; }
.pillsel select { appearance: none; -webkit-appearance: none; border: 0; cursor: pointer; font-size: 14.5px; max-width: min(300px, 78vw); padding: 6px 34px 6px 15px; border-radius: 99px; color: var(--ink); background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%2386868b' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m1 1 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 14px center; box-shadow: 0 0 0 1px var(--line) inset; text-overflow: ellipsis; }
.pillsel select:hover { box-shadow: 0 0 0 1px var(--ink-3) inset; }
.pillsel.on select { background-color: var(--ink); color: var(--bg); box-shadow: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.count { text-align: center; font-size: 13.5px; color: var(--ink-3); margin: 0 0 16px; min-height: 1.6em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 0; border-radius: 22px; padding: 22px 24px 20px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: transform .25s var(--ease), box-shadow .25s; box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 70%, transparent); }
.card:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 14px 34px rgba(0,0,0,.09); }
.card:active { transform: scale(.985); }
.card:focus-visible { outline-offset: 3px; border-radius: 22px; }
.card .law { font-size: 13px; color: var(--ink-3); font-weight: 500; display: flex; gap: 8px; align-items: center; }
.card .sec-no { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; }
.card .sec-no small { font-size: 15px; font-weight: 500; color: var(--ink-3); margin-right: 4px; letter-spacing: 0; }
.card h3 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.card p { margin: 0; font-size: 14.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card.skel { min-height: 168px; pointer-events: none; box-shadow: none; background: linear-gradient(100deg, var(--card) 30%, color-mix(in srgb, var(--ink) 6%, var(--card)) 50%, var(--card) 70%) 0 0 / 220% 100%; animation: shimmer 1.5s linear infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }
.tag { font-size: 12px; padding: 1px 9px; border-radius: 99px; font-weight: 600; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.tag.crim { color: var(--crim); background: color-mix(in srgb, var(--crim) 12%, transparent); }
.tag.civil { color: var(--civil); background: color-mix(in srgb, var(--civil) 12%, transparent); }
.tag.warn { color: var(--crim); background: color-mix(in srgb, var(--crim) 12%, transparent); }
.more { text-align: center; margin-top: 28px; }
.empty { grid-column: 1/-1; text-align: center; color: var(--ink-2); padding: 44px 0; display: grid; gap: 14px; justify-items: center; }
.empty p { margin: 0; }

/* jurisdiction */
.finder { background: var(--bg-alt); border-radius: 28px; padding: 28px; display: grid; gap: 18px; }
.finder-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 10px; padding: 3px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 6px 22px; border-radius: 8px; font-size: 15px; cursor: pointer; font-weight: 500; transition: .2s; }
.seg input:checked + span { background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue) 70%, transparent); }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sel { display: grid; gap: 6px; align-content: start; min-width: 0; }
.sel > span { font-size: 14px; font-weight: 600; line-height: 1.4; } .sel small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.sel select { width: 100%; appearance: none; -webkit-appearance: none; border: 0; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2386868b' stroke-width='2'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 16px center; border-radius: 12px; padding: 13px 40px 13px 16px; font-size: 16px; box-shadow: 0 0 0 1px var(--line) inset; cursor: pointer; text-overflow: ellipsis; transition: box-shadow .2s, opacity .25s; }
.sel select:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--ink-3) inset; }
.sel select:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 55%, transparent); }
.sel select:disabled { opacity: .45; cursor: not-allowed; }
.sel select option { color: #1d1d1f; background: #fff; }
.court-out { display: grid; }
.jhint { text-align: center; color: var(--ink-3); margin: 0; padding: 14px 0 6px; font-size: 15px; }
.jcard { background: var(--card); border-radius: 22px; padding: 22px 24px 24px; animation: rise .55s var(--ease) both; }
.jhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 18px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.jhead .k { font-size: 12.5px; color: var(--ink-3); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.addr { margin: 2px 0 0; font-size: clamp(19px, 3vw, 24px); font-weight: 650; letter-spacing: -.01em; line-height: 1.4; }
.addr .muted { color: var(--ink-3); font-weight: 500; }
.zip { align-self: center; background: color-mix(in srgb, var(--ink) 7%, transparent); border-radius: 99px; padding: 4px 14px; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.zip b { color: var(--ink); font-weight: 650; letter-spacing: .02em; }
.jsec { margin-top: 22px; animation: rise .55s var(--ease) both; animation-delay: calc(min(var(--i, 0), 10) * 45ms); }
.jsec h4 { margin: 0 0 10px; font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; letter-spacing: -.005em; }
.jsec.minor h4 { font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.court-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.court { background: var(--bg-alt); border-radius: 14px; padding: 11px 14px 12px; font-size: 15px; line-height: 1.45; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; animation: rise .5s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 35ms + 80ms); }
.court .cn { font-weight: 550; }
.court small { display: block; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.court.hl { background: color-mix(in srgb, var(--blue) 8%, var(--card)); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--blue) 50%, transparent) inset; }
.badge { display: inline-block; font-size: 11.5px; line-height: 1.6; padding: 0 9px; border-radius: 99px; font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink-2); }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.badge.pending { color: var(--crim); background: color-mix(in srgb, var(--crim) 13%, transparent); }
.badge.match { color: var(--link); background: color-mix(in srgb, var(--blue) 13%, transparent); }
.jwarn { margin-top: 14px; display: flex; gap: 10px; align-items: flex-start; background: color-mix(in srgb, var(--crim) 9%, transparent); border-radius: 14px; padding: 11px 14px; font-size: 14px; line-height: 1.55; color: var(--ink); }
.jwarn::before { content: '!'; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--crim); color: var(--card); display: grid; place-items: center; font-weight: 700; font-size: 13px; margin-top: 2px; }
.jnote { margin: 18px 0 0; }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 26px 0 14px; }
.rule { background: var(--bg-alt); border-radius: 22px; padding: 22px; }
.rule h3 { font-size: 17px; margin-bottom: 8px; font-weight: 600; } .rule p { margin: 0; color: var(--ink-2); font-size: 15px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* process */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; gap: 14px; max-width: 760px; margin: 0 auto; }
.steps li { counter-increment: s; background: var(--card); border-radius: 22px; padding: 22px 26px 22px 80px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 24px; top: 20px; width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.steps h3 { font-size: 19px; font-weight: 600; margin-bottom: 4px; } .steps p { margin: 0; color: var(--ink-2); font-size: 15.5px; } .steps .ref { font-size: 13px; color: var(--ink-3); margin-top: 6px; }

/* feature tiles */
.feat { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tile { background: #161617; border-radius: 28px; padding: 30px 28px 34px; min-height: 240px; display: flex; flex-direction: column; justify-content: flex-end; }
.tile h3 { font-size: 27px; font-weight: 700; margin-bottom: 10px; } .tile p { margin: 0; color: #a1a1a6; font-size: 15.5px; }
.actions.center { margin-top: 44px; }

/* footer */
.foot { background: var(--bg-alt); padding: 36px 0 48px; font-size: 13px; color: var(--ink-3); }
.foot p { margin: 0 0 10px; max-width: 70ch; } .foot strong { color: var(--ink-2); }
.foot.sf { padding: clamp(40px, 6vw, 64px) 0 28px; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.sf-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.15fr 1.3fr; gap: 36px 40px; padding-bottom: 36px; }
.sf-logo { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 19px; font-weight: 500; letter-spacing: -.01em; }
.sf-logo b { font-weight: 700; background: linear-gradient(92deg, #0071e3, #8e5af7 60%, #e0428b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sf-mark { height: 28px; width: auto; display: block; }
.foot .sf-name { margin: 14px 0 6px; color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.5; }
.foot .sf-desc { margin: 0 0 18px; font-size: 13.5px; line-height: 1.7; max-width: 38ch; }
.sf-cta { text-decoration: none; }
.sf-h { margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .01em; color: var(--ink); line-height: 1.4; }
.sf-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.sf-col a { color: var(--ink-2); font-size: 14px; line-height: 1.5; transition: color .15s; }
.sf-col a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.sf-addr { font-style: normal; display: grid; gap: 3px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.sf-addr b { color: var(--ink); font-weight: 600; font-size: 14px; }
.sf-contacts { margin-top: 14px !important; }
.sf-contacts li { font-size: 14px; color: var(--ink-2); }
.sf-contacts li > a > span, .sf-contacts li > span { color: var(--ink-3); margin-right: 4px; }
.sf-bottom { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); padding-top: 20px; display: grid; grid-template-columns: 1fr auto; gap: 8px 28px; align-items: start; }
.foot .sf-copy { grid-column: 1; margin: 0; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.foot .sf-legal { grid-column: 1; margin: 0; max-width: 78ch; font-size: 12.5px; line-height: 1.7; }
.foot .sf-links { grid-column: 2; grid-row: 1 / span 2; margin: 0; display: flex; gap: 18px; font-size: 13px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sf-links a { color: var(--ink-2); } .sf-links a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.sf-links .sf-admin { color: var(--ink-3); font-size: 12px; }
@media (max-width: 900px) { .sf-grid { grid-template-columns: 1fr 1fr; } .sf-brand { grid-column: 1 / -1; } }
@media (max-width: 560px) {
  .sf-grid { grid-template-columns: 1fr; gap: 28px; }
  .sf-bottom { grid-template-columns: 1fr; }
  .foot .sf-links { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 6px; }
}

/* sheet */
dialog { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog[open] { display: grid; place-items: end center; }
@media (min-width: 700px) { dialog[open] { place-items: center; } }
dialog article { position: relative; background: var(--card); width: min(680px, 100%); max-height: 90vh; max-height: 90dvh; overflow: auto; overscroll-behavior: contain; border-radius: 28px 28px 0 0; padding: 34px 32px 36px; animation: up .35s var(--ease); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
@media (min-width: 700px) { dialog article { border-radius: 28px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.x { position: absolute; right: 16px; top: 16px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--ink) 10%, transparent); cursor: pointer; transition: background .2s; }
.x:hover { background: color-mix(in srgb, var(--ink) 18%, transparent); }
.detail h3 { font-size: 30px; font-weight: 700; margin: 8px 0 16px; padding-right: 30px; }
.detail dl { display: grid; grid-template-columns: 8em 1fr; gap: 12px 18px; margin: 0; font-size: 16px; }
.detail dt { color: var(--ink-3); font-size: 14px; padding-top: 2px; } .detail dd { margin: 0; }
.detail .box { background: var(--bg-alt); border-radius: 14px; padding: 12px 16px; margin-top: 16px; font-size: 15px; }
.detail .cta { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 640px) { .detail dl { grid-template-columns: 1fr; gap: 2px; } .detail dt { margin-top: 10px; } }

/* reveal */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; }
  dialog article, .jcard, .jsec, .court { animation: none; }
  .card.skel { animation: none; }
  .card, .card:hover { transition: none; transform: none; }
}

@media (max-width: 760px) {
  .nav-links { position: fixed; inset: 48px 0 auto 0; background: var(--bg); flex-direction: column; gap: 0; padding: 8px 22px 18px; margin: 0; border-bottom: 1px solid var(--line); transform: translateY(-8px); opacity: 0; pointer-events: none; transition: .25s; }
  .nav-links a { font-size: 17px; padding: 12px 0; border-bottom: 1px solid var(--line); opacity: 1; }
  .nav-links a::after { display: none; }
  .nav-links a[aria-current=true] { color: var(--ink); font-weight: 600; }
  .nav-links.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-burger { display: block; } .nav-cta { margin-left: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 48px; }
  .steps li { padding-left: 74px; }
  .finder { padding: 20px; border-radius: 24px; }
  .fields { grid-template-columns: 1fr; }
  .jcard { padding: 18px 18px 20px; }
  .court-list { grid-template-columns: 1fr; }
  .sec-head { margin-bottom: 32px; }
  dialog article { padding: 30px 22px 32px; }
}

[hidden] { display: none !important; }

.logo-mark { height: var(--logo-h, 22px); width: auto; display: block; }
/* โลโก้เป็น SVG ที่ใช้สี currentColor จึงสลับโหมดมืดเองได้ ไม่ต้อง invert */

.nav-in { height: auto; min-height: 48px; padding-top: 4px; padding-bottom: 4px; }

.logo-text { font-weight: 500; letter-spacing: -.01em; display: flex; flex-direction: column; line-height: 1.15; }
.logo-text .lt-th { font-size: 14px; font-weight: 600; white-space: nowrap; }
.logo-text .lt-en { font-size: 10.5px; font-weight: 400; letter-spacing: .03em; color: var(--ink-2); white-space: nowrap; }
.logo-text b { font-weight: 700; background: linear-gradient(92deg, #0071e3, #8e5af7 60%, #e0428b); -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: 1px; }
.logo { gap: 9px; }

.firm { font-style: normal; display: grid; gap: 2px; margin: 14px 0 12px; font-size: 13.5px; color: var(--ink-2); }
.firm b { color: var(--ink); font-weight: 600; font-size: 14px; }

/* ---------- โหลดข้อมูลแบบนุ่ม ๆ (ไม่ให้โผล่พรึบ) ---------- */
@keyframes sf-pop { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.cards .card.pop { animation: sf-pop .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 38ms); }
.cards .card.skel { animation: sf-pulse 1.4s ease-in-out infinite; }
@keyframes sf-pulse { 50% { opacity: .55; } }
#results[aria-busy=false], #steps, .rules, .court-out { animation: sf-fade .4s ease both; }
@keyframes sf-fade { from { opacity: 0; } to { opacity: 1; } }
#steps li { animation: sf-pop .5s var(--ease) both; }
#steps li:nth-child(2) { animation-delay: .06s; } #steps li:nth-child(3) { animation-delay: .12s; } #steps li:nth-child(4) { animation-delay: .18s; }
#steps li:nth-child(5) { animation-delay: .24s; } #steps li:nth-child(n+6) { animation-delay: .3s; }
select, input { transition: box-shadow .2s, background-color .2s; }
.court-out > * { animation: sf-pop .45s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .cards .card.pop, .cards .card.skel, #results[aria-busy=false], #steps, #steps li, .rules, .court-out, .court-out > * { animation: none; } }

/* โลโก้/ชื่อสำนักงาน: ขาว-ดำตามโหมด คนละบรรทัด (ไทย / อังกฤษ) */
.logo-text .lt-th, .sf-logo .lt-th { color: var(--ink); }
.logo-text .lt-en, .sf-logo .lt-en { color: var(--ink-2); }
.sf-logo { color: var(--ink); }
.sf-copy { display: flex; gap: 10px; align-items: flex-start; margin: 0; }
.sf-copy-name { display: flex; flex-direction: column; line-height: 1.35; }
.sf-copy-name > span:last-child { color: var(--ink-3); }

/* ==========================================================================
   มือถือ (portrait) — เว็บสาธารณะ: ออกแบบจากจอโทรศัพท์แนวตั้งก่อน
   (ต่อท้ายไฟล์ · ไม่แตะหน้าจอ ≥ 1024px)  กฎ: ปุ่ม/ลิงก์กดได้ ≥ 44px · ช่องกรอก 16px · ขอบข้าง 18px
   ========================================================================== */
a, button, select, input, textarea, label, summary { touch-action: manipulation; }
.nav-cta { white-space: nowrap; }
@media (hover: none) {
  .card:hover { transform: none; box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 70%, transparent); }
  .btn-pill:hover, .chip:hover, .nav-links a:hover { transform: none; }
}

@media (max-width: 760px) {
  :root { --gut: 18px; }
  html { scroll-padding-top: 72px; }
  body { overflow-wrap: break-word; }

  /* --- แถบเมนู: โลโก้ + ปุ่มเข้าสู่ระบบ + แฮมเบอร์เกอร์ในบรรทัดเดียว --- */
  .nav { padding-top: env(safe-area-inset-top, 0px); }
  .nav-in { min-height: 56px; gap: 6px; padding: 4px max(var(--gut), env(safe-area-inset-right)) 4px max(var(--gut), env(safe-area-inset-left)); }
  .logo { min-width: 0; min-height: 44px; gap: 8px; flex: 0 1 auto; }
  .logo-mark { --logo-h: 24px; flex: none; }
  .logo-text .lt-th { font-size: 14px; }
  .logo-text .lt-en { font-size: 11px; }
  .nav-cta { position: relative; margin-left: auto; flex: none; font-size: 13px; padding: 5px 14px; line-height: 1.5; }
  .nav-cta::before { content: ''; position: absolute; inset: -8px -3px; } /* ขยายพื้นที่กดเป็น 44px โดยไม่เปลี่ยนหน้าตา */
  .nav-burger { width: 44px; height: 44px; margin-right: -10px; flex: none; }
  .nav-burger span { left: 12px; right: 12px; height: 2px; border-radius: 2px; }
  .nav-burger span:first-child { top: 16px; } .nav-burger span:last-child { top: 25px; }
  .nav-burger[aria-expanded=true] span:first-child, .nav-burger[aria-expanded=true] span:last-child { top: 21px; }
  .nav-links { position: absolute; inset: 100% 0 auto 0; max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain;
    padding: 4px max(var(--gut), env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom, 0px)) max(var(--gut), env(safe-area-inset-left));
    box-shadow: 0 22px 36px -12px rgba(0, 0, 0, .22); visibility: hidden; transition: transform .25s var(--ease), opacity .25s, visibility 0s .25s; }
  .nav-links.open { visibility: visible; transition-delay: 0s; }
  .nav-links a { display: flex; align-items: center; min-height: 52px; padding: 6px 0; }
  .nav-links a:last-child { border-bottom: 0; }

  /* --- ตัวอักษร / ระยะห่าง --- */
  h1 { font-size: clamp(34px, 9.8vw, 44px); }
  h2 { font-size: clamp(27px, 7.6vw, 34px); }
  .eyebrow { font-size: 15px; margin-bottom: 8px; }
  .lead { font-size: 17px; line-height: 1.65; margin-top: 14px; }
  .fine { font-size: 14px; }
  .count { font-size: 14px; }
  .hero { padding: 16px var(--gut) 44px; }
  .scales-wrap { width: clamp(150px, 42vw, 190px); margin-bottom: 16px; }
  .sec { padding: 52px 0; }
  .wrap { padding-left: max(var(--gut), env(safe-area-inset-left)); padding-right: max(var(--gut), env(safe-area-inset-right)); }
  .sec-head { margin-bottom: 26px; }
  .actions { gap: 6px 22px; margin-top: 24px; }
  .btn-pill { min-height: 48px; padding: 11px 26px; }
  .btn-pill.sm { min-height: 44px; padding: 8px 18px; }
  .link-arrow { display: inline-flex; align-items: center; min-height: 44px; font-size: 17px; }
  .stats { margin-top: 36px; gap: 18px 12px; }

  /* --- คลังกฎหมาย: ค้นหา / ตัวกรองเลื่อนแนวนอน / การ์ดแน่นขึ้น --- */
  .search input { padding: 15px 16px 15px 46px; -webkit-appearance: none; appearance: none; }
  .chips { align-items: stretch; gap: 12px; margin-bottom: 18px; }
  .kindseg { display: flex; }
  .kindseg button { flex: 1; min-height: 44px; padding: 6px 4px; font-size: 15.5px; }
  .lawrow { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--gut) * -1); padding: 2px var(--gut) 6px; scroll-padding: 0 var(--gut); scroll-snap-type: x proximity; }
  .lawrow::-webkit-scrollbar { display: none; }
  .lawrow > * { flex: none; scroll-snap-align: start; }
  .chip { min-height: 44px; padding: 0 16px; font-size: 15px; }
  .pillsel select { min-height: 44px; font-size: 16px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 12px; }
  .card { padding: 18px 18px 16px; border-radius: 20px; min-height: 44px; }
  .card .sec-no { font-size: 30px; }
  .card h3 { font-size: 18px; }
  .card p { font-size: 15px; }
  .card.skel { min-height: 130px; }
  .tag { font-size: 12.5px; }
  .more { margin-top: 20px; }

  /* --- เขตอำนาจศาล --- */
  .finder { padding: 16px; gap: 16px; }
  .finder-top { flex-wrap: nowrap; gap: 10px; }
  .seg { display: flex; flex: 1; }
  .seg label { flex: 1; }
  .seg span { min-height: 44px; display: grid; place-items: center; padding: 6px 12px; font-size: 16px; }
  .sel > span { font-size: 15px; }
  .sel small { font-size: 13px; }
  .sel select { min-height: 50px; }
  .court { font-size: 15.5px; }
  .court small { font-size: 13px; }
  .badge { font-size: 12px; }
  .rules { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); margin-top: 20px; }
  .rule { padding: 18px; border-radius: 20px; }

  /* --- ขั้นตอน / ไทล์ --- */
  .steps li { padding: 16px 16px 16px 62px; border-radius: 20px; }
  .steps li::before { left: 14px; top: 14px; width: 36px; height: 36px; font-size: 16px; }
  .steps h3 { font-size: 18px; }
  .steps p { font-size: 15.5px; line-height: 1.65; }
  .steps .ref { font-size: 13.5px; }
  .tile { min-height: 0; padding: 24px 22px 26px; border-radius: 24px; }
  .tile h3 { font-size: 23px; }
  .feat { grid-template-columns: 1fr; gap: 12px; }
  .actions.center { margin-top: 28px; }

  /* --- ท้ายเว็บ: ลิงก์ 2 คอลัมน์ ปุ่มกดสบายนิ้ว --- */
  .foot.sf { padding: 40px 0 calc(28px + env(safe-area-inset-bottom, 0px)); }
  .sf-grid { grid-template-columns: 1fr 1fr; gap: 28px 16px; }
  .sf-brand, .sf-firm { grid-column: 1 / -1; }
  .sf-col ul { gap: 0; }
  .sf-col a { display: flex; align-items: center; min-height: 44px; font-size: 15px; overflow-wrap: anywhere; }
  .sf-col ul.sf-contacts a { min-height: 40px; }
  .sf-h { font-size: 14px; margin-bottom: 6px; }
  .sf-desc { font-size: 14px; }
  .sf-links { gap: 0 20px !important; }
  .sf-links a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px !important; }
  .foot .sf-legal { font-size: 13px; }
  .sf-addr { font-size: 14px; }

  /* --- แผ่นรายละเอียดมาตรา (dialog) = bottom sheet --- */
  dialog article { display: flex; flex-direction: column; width: 100%; max-height: 92vh; max-height: 92dvh; padding: 0; overflow: hidden; border-radius: 24px 24px 0 0; box-shadow: 0 -12px 50px rgba(0, 0, 0, .3); animation: sheet-up .34s var(--ease) both; }
  dialog article::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 22%, transparent); pointer-events: none; z-index: 2; }
  #sheetBody { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 30px max(var(--gut), env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom, 0px)) max(var(--gut), env(safe-area-inset-left)); }
  .x { top: 8px; right: max(8px, env(safe-area-inset-right)); width: 44px; height: 44px; font-size: 16px; z-index: 3; }
  .detail h3 { font-size: 24px; margin: 6px 0 14px; padding-right: 44px; }
  .detail dl { font-size: 16px; }
  .detail .cta .btn-pill { flex: 1 1 100%; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (max-width: 400px) {
  .logo-text .lt-th { font-size: 13.5px; }
  .nav-cta { padding: 5px 11px; }
  .stat b { font-size: 30px; }
}
@media (max-width: 340px) { .nav-cta { display: none; } }
/* จอแนวนอนเตี้ย ๆ (โทรศัพท์หมุนข้าง): ลดความสูงแถบเมนูและแผ่นรายละเอียด */
@media (max-height: 480px) and (max-width: 1000px) {
  .nav-in { min-height: 48px; }
  dialog article { max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .hero { padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-links, .nav-links.open { transition: none; }
  dialog article { animation: none; }
}

/* การ์ดมาตรา (มือถือ): เลขมาตราซ้าย · ป้ายกฎหมายขวา — ลดความสูงต่อการ์ด */
@media (max-width: 760px) {
  .cards > .card:not(.skel) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; align-items: center; }
  .card .sec-no { grid-column: 1; grid-row: 1; }
  .card .law { grid-column: 2; grid-row: 1; justify-self: end; }
  .card h3, .card p { grid-column: 1 / -1; }
  .sf-logo { min-height: 44px; }
}
/* จอสัมผัสที่กว้างกว่า 760px (โทรศัพท์หมุนข้าง / แท็บเล็ต): ขยายพื้นที่กดเป็น 44px และช่องกรอก 16px */
@media (pointer: coarse) and (max-width: 1023px) and (min-width: 761px) {
  .chip, .kindseg button, .pillsel select, .btn-pill.sm, .seg span { min-height: 44px; }
  .pillsel select, .sel select { font-size: 16px; }
  .seg span { display: grid; place-items: center; }
  .nav-cta { padding: 8px 16px; }
  .sf-col a, .sf-links a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (max-width: 760px) {
  .hero { padding-left: max(var(--gut), env(safe-area-inset-left)); padding-right: max(var(--gut), env(safe-area-inset-right)); }
}
/* หน้าจอกลาง 761–940px (โทรศัพท์หมุนข้าง / แท็บเล็ตแนวตั้ง): เมนูลิงก์ต้องไม่ตัดบรรทัดกลางคำ */
.nav-links a { white-space: nowrap; }
@media (min-width: 761px) and (max-width: 940px) {
  .nav-in { gap: 14px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .nav-links { gap: 14px; }
  .logo-text .lt-th { font-size: 13.5px; }
  .logo { gap: 7px; }
}

/* ตราชั่งหัวหน้า: พ้นจอแล้วหยุดโยก (site.js สลับคลาส .off) */
.scales-wrap.off .scales.play .beam, .scales-wrap.off .scales.play .pan, .scales-wrap.off .scales.play .dish { animation-play-state: paused; }
/* ประกาศบนหัวเว็บ (แอดมินตั้งจากหลังบ้าน) และเวลาทำการท้ายเว็บ */
.announce { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 8px 16px; background: var(--ink); color: var(--bg); font-size: 14px; line-height: 1.5; text-align: center; }
.announce p { margin: 0; }
.announce a { color: inherit; text-decoration: underline; font-weight: 600; }
.announce button { border: 0; background: transparent; color: inherit; opacity: .7; cursor: pointer; padding: 6px 8px; font-size: 14px; }
.announce button:hover { opacity: 1; }
.sf-hours { margin: 10px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.sf-hours b { color: var(--ink); font-weight: 600; }

/* หน้าติดต่อปรึกษากฎหมาย — ใช้โทเคนจาก site.css (รองรับโหมดมืดอัตโนมัติ) */
.ct-main { padding-bottom: clamp(56px, 9vw, 110px); min-height: 70vh; }
.ct-hero { text-align: center; padding: clamp(36px, 6vw, 72px) 0 clamp(24px, 4vw, 40px); }
.ct-hero h1 { font-size: clamp(34px, 6vw, 60px); }
.ct-hero .lead { margin-top: 14px; }

.ct-cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.ct-card { background: var(--bg-alt); border-radius: 28px; padding: clamp(22px, 3.4vw, 36px); }
.ct-card form[hidden], .ct-done[hidden] { display: none; }

.ct-row, .ct-grid2, .ct-grid3, .ct-set { margin: 0 0 20px; }
.ct-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ct-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ct-f { display: grid; gap: 6px; align-content: start; min-width: 0; }
.ct-f > label, .ct-set > legend { font-size: 15px; font-weight: 600; line-height: 1.4; }
.ct-f > label small { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.ct-f em, .ct-set em, .ct-chk em { font-style: normal; color: var(--err); margin-left: 2px; }
.ct-set { border: 0; padding: 0; min-width: 0; }
.ct-set > legend { padding: 0; margin-bottom: 2px; }
.ct-set .ct-grid3 { margin-top: 10px; }
.ct-set .ct-f > label { font-weight: 500; font-size: 14px; color: var(--ink-2); }

.ct-card input[type=text], .ct-card input[type=tel], .ct-card input[type=email], .ct-card input[type=date], .ct-card select, .ct-card textarea {
  width: 100%; border: 0; background: var(--card); color: var(--ink); border-radius: 12px; padding: 12px 14px; font-size: 16px; line-height: 1.5;
  box-shadow: 0 0 0 1px var(--line) inset; transition: box-shadow .2s; font-family: inherit; }
.ct-card textarea { resize: vertical; min-height: 150px; line-height: 1.65; }
.ct-card input::placeholder, .ct-card textarea::placeholder { color: var(--ink-3); }
.ct-card input:hover, .ct-card select:hover, .ct-card textarea:hover { box-shadow: 0 0 0 1px var(--ink-3) inset; }
.ct-card input:focus-visible, .ct-card select:focus-visible, .ct-card textarea:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 55%, transparent); }
.ct-card [aria-invalid=true] { box-shadow: 0 0 0 2px var(--err) inset !important; }
.ct-card select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2386868b' stroke-width='2'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
.ct-card select option { color: #1d1d1f; background: #fff; }
.ct-card input[type=date] { min-height: 48px; }

.ct-hint, .ct-count { font-size: 13px; line-height: 1.55; color: var(--ink-3); }
.ct-meta { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.ct-count { flex: none; font-variant-numeric: tabular-nums; }
.ct-count.near { color: var(--crim); font-weight: 600; }
.ct-err { font-size: 13.5px; line-height: 1.5; color: var(--err); font-weight: 500; }
.ct-warn { font-size: 13.5px; line-height: 1.6; color: var(--ink); background: color-mix(in srgb, var(--crim) 11%, transparent); border-radius: 12px; padding: 9px 13px; }
.ct-warn[hidden], .ct-err[hidden] { display: none; }

.ct-alert { margin: 0 0 20px; padding: 14px 18px; border-radius: 16px; background: color-mix(in srgb, var(--err) 10%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--err) 35%, transparent) inset; font-size: 14.5px; line-height: 1.6; }
.ct-alert:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 2px; }
.ct-alert ul { margin: 6px 0 0; padding-left: 1.3em; }
.ct-alert a { color: var(--err); text-decoration: underline; text-underline-offset: 2px; }

.ct-consent { margin: 4px 0 22px; }
.ct-chk { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.ct-chk input { flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--blue); cursor: pointer; }
.ct-chk a { text-decoration: underline; text-underline-offset: 2px; }
.ct-consent .ct-err { display: block; margin: 6px 0 0 34px; }

.ct-actions { display: flex; gap: 14px 18px; align-items: center; flex-wrap: wrap; }
.ct-actions .btn-pill { min-width: 170px; }
.ct-actions .btn-pill:disabled { opacity: .65; cursor: progress; transform: none; }
.ct-actions .btn-pill.busy::after { content: ''; width: 15px; height: 15px; margin-left: 10px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: ct-spin .8s linear infinite; }
.ct-status { margin: 0; font-size: 14.5px; color: var(--ink-2); min-height: 1.5em; }
.ct-status.err { color: var(--err); font-weight: 500; }
.ct-fine { margin: 14px 0 0; }
@keyframes ct-spin { to { transform: rotate(360deg); } }

/* ช่องล่อบอท: นอกจอ ไม่ใช้ display:none เพื่อให้บอทยังเห็น */
.ct-hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ส่งสำเร็จ */
.ct-done { text-align: center; padding: clamp(20px, 5vw, 44px) clamp(4px, 2vw, 16px); }
.ct-done { scroll-margin-top: 90px; }
.ct-done:focus-visible { outline: none; }
.ct-done h2 { font-size: clamp(26px, 4vw, 36px); margin: 14px 0 10px; }
.ct-done p { margin: 0 auto 10px; max-width: 32em; color: var(--ink-2); font-size: 16.5px; line-height: 1.7; }
.ct-done .ct-done-sub { font-size: 14.5px; }
.ct-done-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.ct-check { width: 72px; height: 72px; color: var(--ok); }
.ct-check .ring { stroke-dasharray: 140; stroke-dashoffset: 140; animation: ct-draw .7s var(--ease) forwards; }
.ct-check .tick { stroke-dasharray: 40; stroke-dashoffset: 40; animation: ct-draw .5s var(--ease) .5s forwards; }
@keyframes ct-draw { to { stroke-dashoffset: 0; } }

/* คอลัมน์ข้อมูลประกอบ */
.ct-aside { display: grid; gap: 14px; position: sticky; top: 64px; }
.ct-box { background: var(--bg-alt); border-radius: 24px; padding: 22px 24px; }
.ct-box h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 12px; }
.ct-box p { margin: 0; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.ct-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: cs; }
.ct-steps li { position: relative; padding-left: 38px; counter-increment: cs; display: grid; gap: 1px; font-size: 14.5px; line-height: 1.6; }
.ct-steps li::before { content: counter(cs); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.ct-steps span { color: var(--ink-2); }
.ct-list { margin: 0; padding-left: 1.2em; display: grid; gap: 7px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.ct-list.plain { list-style: none; padding: 0; }
.ct-list.plain span { color: var(--ink-3); margin-right: 4px; }
.ct-urgent { background: color-mix(in srgb, var(--err) 10%, var(--bg-alt)); border: 1px solid color-mix(in srgb, var(--err) 20%, transparent); }
.ct-urgent h2, .ct-urgent a b { color: var(--err); }

@media (max-width: 900px) {
  .ct-cols { grid-template-columns: 1fr; }
  .ct-aside { position: static; }
}
@media (max-width: 640px) {
  .ct-grid2, .ct-grid3 { grid-template-columns: 1fr; }
  .ct-card { border-radius: 24px; }
  .ct-actions .btn-pill { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ct-check .ring, .ct-check .tick { animation: none; stroke-dashoffset: 0; }
  .ct-actions .btn-pill.busy::after { animation-duration: 2s; }
}

/* ==========================================================================
   มือถือ (portrait) — ฟอร์มติดต่อปรึกษา: คอลัมน์เดียว ช่องกรอกใหญ่ กดนิ้วโป้งได้สบาย
   ========================================================================== */
@media (max-width: 900px) { .ct-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .ct-main { padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }
  .ct-hero { padding: 28px 0 20px; }
  .ct-hero h1 { font-size: clamp(30px, 8.8vw, 40px); }
  .ct-cols { gap: 14px; }
  .ct-card { padding: 22px 16px 20px; border-radius: 24px; }
  .ct-row, .ct-grid2, .ct-grid3, .ct-set { margin-bottom: 18px; }
  .ct-f > label, .ct-set > legend { font-size: 16px; }
  .ct-set .ct-f > label { font-size: 15px; }
  .ct-f > label small { font-size: 14px; }
  .ct-card input[type=text], .ct-card input[type=tel], .ct-card input[type=email], .ct-card input[type=date], .ct-card select, .ct-card textarea { min-height: 52px; padding: 13px 14px; border-radius: 14px; font-size: 16px; }
  .ct-card input[type=date] { -webkit-appearance: none; appearance: none; display: block; min-height: 52px; }
  .ct-card textarea { min-height: 170px; }
  .ct-hint, .ct-count { font-size: 14px; }
  .ct-err, .ct-warn { font-size: 14.5px; }
  .ct-alert { font-size: 15px; padding: 14px 16px; }
  .ct-chk { font-size: 15.5px; gap: 14px; min-height: 44px; }
  .ct-chk input { width: 26px; height: 26px; margin-top: 0; }
  .ct-consent .ct-err { margin-left: 40px; }
  .ct-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .ct-actions .btn-pill { min-height: 54px; font-size: 18px; width: 100%; }
  .ct-status { text-align: center; }
  .ct-fine { font-size: 14px; }
  .ct-box { padding: 20px 18px; border-radius: 22px; }
  .ct-box p, .ct-steps li, .ct-list { font-size: 15.5px; }
  .ct-urgent a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
  .ct-done-actions .btn-pill { width: 100%; }
}

/* ไฮไลต์เล็กน้อยที่เหลือ: ลิงก์ในกล่องแจ้งข้อผิดพลาดของฟอร์ม และขอบจอที่มีรอยบากเมื่อหมุนจอ */
@media (max-width: 760px) {
  .ct-alert li { margin-bottom: 2px; }
  .ct-alert a { display: inline-block; padding: 10px 0; }
}
/* ความสมูทร่วมทั้งเว็บสาธารณะและหลังบ้าน: ไม่ให้ข้อความ/หน้าโผล่พรึบ */

/* 1) ซ่อนหน้าไว้จนฟอนต์ไทยโหลดเสร็จ แล้วค่อย ๆ ปรากฏ (กันตัวอักษรเปลี่ยนหน้าตาตอนโหลด) — เปิดด้วย smooth.js, ไม่มี JS ก็เห็นปกติ */
html.fw:not(.fr) body { opacity: 0; }
html.fw.fr body { opacity: 1; transition: opacity .38s ease; }

/* 2) เปลี่ยนหน้าระหว่างหน้าเว็บ: จางเข้า-ออกแทนการกะพริบขาว (เบราว์เซอร์ที่รองรับ View Transitions) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .16s ease both; }
::view-transition-new(root) { animation: vt-in .3s ease both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

/* 3) เลื่อนไปยังหัวข้ออย่างนุ่มนวล */
html { scroll-behavior: smooth; }

/* 4) ปุ่ม/ลิงก์/การ์ด/ช่องกรอก เปลี่ยนสถานะอย่างนุ่ม + กดแล้วยุบเล็กน้อย */
a, button, summary, select, input, textarea, label { transition: background-color .2s ease, color .2s ease, box-shadow .2s ease, border-color .2s ease, opacity .2s ease, transform .16s ease; }
button:active:not(:disabled):not([aria-disabled=true]), .btn:active, .btn-pill:active, a.card:active, .chip:active { transform: scale(.97); }

/* 5) กล่องที่พับ/ขยาย (details) เนื้อหาค่อย ๆ ลื่นลงมา */
details[open] > :not(summary) { animation: sm-open .32s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes sm-open { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* 6) หน้าต่างโต้ตอบ/เมนูที่โผล่ขึ้น */
dialog[open] { animation: sm-pop .26s cubic-bezier(.2, .9, .3, 1.15) both; }
dialog::backdrop { animation: vt-in .26s ease both; }
@keyframes sm-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.fw:not(.fr) body { opacity: 1; }
  html.fw.fr body, details[open] > :not(summary), dialog[open], dialog::backdrop { animation: none; transition: none; }
  @view-transition { navigation: none; }
  a, button, summary, select, input, textarea, label { transition: none; }
}

/* ส่วนที่ morph เพิ่มเข้ามาใหม่ (js/morph.js) ค่อย ๆ ปรากฏ */
[data-mi] { animation: mi-in .32s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes mi-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { [data-mi] { animation: none; } }

/* เปลี่ยนหน้าในหลังบ้าน (หน้าแรก ↔ พื้นที่ทำงาน ↔ สมุดรายชื่อ ↔ ล็อกอิน): จางเข้า ไม่ใช้ transform เพราะจะทำให้ sticky/fixed ในหน้าเพี้ยน */
#app > .home, #app > .work, #app > .bookpage, #app > .login, #app > .conn-fail { animation: page-fade .36s ease both; }
@keyframes page-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #app > .home, #app > .work, #app > .bookpage, #app > .login, #app > .conn-fail { animation: none; } }
/* .enter animation */
.enter > * { animation: sm-open .32s cubic-bezier(.2, .8, .2, 1) both; }
.enter > *:nth-child(1) { animation-delay: 0s; }
.enter > *:nth-child(2) { animation-delay: 0.04s; }
.enter > *:nth-child(3) { animation-delay: 0.08s; }
.enter > *:nth-child(4) { animation-delay: 0.12s; }
.enter > *:nth-child(5) { animation-delay: 0.16s; }
.enter > *:nth-child(6) { animation-delay: 0.20s; }
.enter > *:nth-child(7) { animation-delay: 0.24s; }
.enter > *:nth-child(n+8) { animation-delay: 0.28s; }
@media (prefers-reduced-motion: reduce) { .enter > * { animation: none; } }

/* หน้าโหลด (ทุกหน้า): โลโก้สำนักงาน + แถบสีวิ่งไปทางขวา + "กำลังโหลด…ชื่อหน้า"
   ใช้ร่วมกันหลังบ้าน (js/loading.js) และหน้าเว็บสาธารณะ (.splash ใน 4 หน้า) — ไม่พึ่งตัวแปรสีของไฟล์อื่น */
.lcl {
  --lcl-bg: #fff; --lcl-ink: #1d1d1f; --lcl-muted: #6e6e73; --lcl-track: #ececf0; --lcl-bar: #1d1d1f;
  position: fixed; inset: 0; z-index: 100000; background: var(--lcl-bg);
  display: grid; place-items: center; align-content: center; gap: 0;
  transition: opacity .28s ease, visibility .28s;
}
.lcl[hidden] { display: none; }
.lcl.out { opacity: 0; visibility: hidden; pointer-events: none; }
/* แบบฝัง: อยู่ในกล่องของหน้า ไม่คลุมจอ (inlineLoading ใน js/loading.js) */
.lcl.lcl-inline { position: relative; inset: auto; z-index: auto; min-height: 36vh; background: transparent; }
.lcl-box { display: grid; justify-items: center; gap: 28px; width: min(320px, 78vw); text-align: center; }
.lcl-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--lcl-ink); text-align: left; }
.lcl-brand svg { width: 38px; height: 38px; flex: none; }
.lcl-brand .th { display: block; font-weight: 700; font-size: 20px; line-height: 1.25; letter-spacing: -.01em; }
.lcl-brand .en { display: block; font-size: 13px; line-height: 1.3; color: var(--lcl-muted); letter-spacing: .01em; }
.lcl-track { position: relative; width: 100%; height: 4px; border-radius: 99px; background: var(--lcl-track); overflow: hidden; }
.lcl-track::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 36%; border-radius: 99px; background: var(--lcl-bar);
  transform: translateX(-100%); animation: lcl-run 1.15s cubic-bezier(.45, 0, .25, 1) infinite; will-change: transform;
}
.lcl-text { margin: 0; font-size: 15px; color: var(--lcl-muted); }
.lcl-text b { font-weight: 600; color: var(--lcl-ink); }
@keyframes lcl-run { 0% { transform: translateX(-100%); } 100% { transform: translateX(280%); } }
/* ตัวโหลดเป็นสัญญาณสถานะ ไม่ใช่ลูกเล่น: แม้เครื่องตั้งลดการเคลื่อนไหว (กฎส่วนกลางใน app.css ปิดทุกแอนิเมชันด้วย !important) แถบก็ยังต้องวิ่งซ้ายไปขวา — แค่ช้าลงและนุ่มลง */
@media (prefers-reduced-motion: reduce) {
  .lcl-track::after { animation: lcl-run 1.9s linear infinite !important; }
  .lcl { transition: none !important; }
}

/* หน้าเว็บสาธารณะ: โผล่เฉพาะเมื่อโหลดนานเกิน ~0.35 วินาที (โหลดเร็ว = ไม่เห็น) แล้วจางหายเมื่อ load เสร็จ (js/splash.js);
   ถ้าสคริปต์ไม่ทำงาน จะหายเองที่ 7 วินาที */
.splash { visibility: hidden; opacity: 0; animation: splash-in .01s .35s forwards, splash-off .3s 7s forwards; }
.splash.out { animation: none; opacity: 0; visibility: hidden; transition: opacity .28s ease, visibility .28s; pointer-events: none; }
@keyframes splash-in { to { visibility: visible; opacity: 1; } }
@keyframes splash-off { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-color-scheme: dark) { html:not([data-theme=light]) .splash { --lcl-bg: #000; --lcl-ink: #f5f5f7; --lcl-muted: #a1a1a6; --lcl-track: #2a2a2d; --lcl-bar: #f5f5f7; } }
