:root {
  --bg: #FFF8EC;
  --surface: #ffffff;
  --sand: #FCE3DE;
  --stone: #d7cfc6;
  --ink: #22304F;
  --muted: #5B6476;
  --olive: #F4A7A0;
  --olive-dark: #A8475A;
  --line: #06c755;
  --line-dark: #05a548;
  --red: #c0392b;
  --yellow: #c98a12;
  --green: #3f8f5a;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(61, 52, 43, .06), 0 8px 24px rgba(61, 52, 43, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.75 "IBM Plex Sans Thai Looped", "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--olive-dark); }
h1, h2, h3 { font-family: "Mali", "IBM Plex Sans Thai Looped", sans-serif; font-weight: 700; line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: clamp(30px, 6vw, 46px); letter-spacing: -.01em; }
h2 { font-size: clamp(24px, 4.4vw, 32px); }
h3 { font-size: 19px; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

/* language: show only the chosen one */
html[lang="th"] .en, html[lang="en"] .th { display: none !important; }

/* ---------- header ---------- */
header.top {
  position: sticky; top: 0; z-index: 10; background: rgba(255, 248, 236, .92);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--sand);
}
header.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 22px "Mali", sans-serif; }
.brand img { width: 30px; }
nav.links { margin-left: auto; display: none; gap: 20px; font-size: 15px; }
nav.links a { color: var(--muted); text-decoration: none; }
nav.links a:hover { color: var(--ink); }
@media (min-width: 860px) { nav.links { display: flex; } }
.lang { display: flex; margin-left: auto; border: 1px solid var(--stone); border-radius: 999px; overflow: hidden; }
@media (min-width: 860px) { .lang { margin-left: 8px; } }
.lang button {
  font: 500 13px "IBM Plex Sans Thai", sans-serif; border: 0; background: transparent; color: var(--muted);
  padding: 6px 12px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px;
  padding: 0 24px; border-radius: 999px; font: 500 17px "IBM Plex Sans Thai", sans-serif;
  text-decoration: none; border: 1.5px solid transparent; cursor: pointer; transition: background .15s;
}
.btn-line { background: var(--line); color: #fff; }
.btn-line:hover { background: var(--line-dark); }
.btn-ghost { border-color: var(--stone); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { background: var(--sand); }
.btn svg { width: 22px; height: 22px; }

/* ---------- hero ---------- */
.hero { padding: 48px 0 56px; }
.hero .wrap { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.05fr .95fr; } .hero { padding: 72px 0 80px; } }
.eyebrow { display: inline-block; font-size: 14px; color: var(--olive-dark); background: var(--sand); padding: 4px 12px; border-radius: 999px; margin-bottom: 16px; }
.lead { font-size: 19px; color: var(--muted); max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 18px; }
.cta .btn { flex: 1 1 220px; }
@media (min-width: 560px) { .cta .btn { flex: 0 0 auto; } }
.qrbox { display: none; align-items: center; gap: 16px; margin-top: 8px; color: var(--muted); font-size: 15px; }
.qrbox #qr { padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--sand); }
@media (min-width: 900px) and (hover: hover) { .qrbox { display: flex; } }
.fine { font-size: 14px; color: var(--muted); }

/* ---------- chat mock ---------- */
.phone {
  background: #8ea6c1; border-radius: 28px; padding: 18px 14px; box-shadow: var(--shadow);
  max-width: 400px; width: 100%; margin: 0 auto; font-size: 15px; line-height: 1.55;
}
.phone .bar { color: #fff; font-weight: 500; text-align: center; margin: -2px 0 12px; font-size: 14px; opacity: .95; }
.msg { display: flex; margin: 8px 0; }
.msg.me { justify-content: flex-end; }
.bubble { max-width: 82%; padding: 9px 13px; border-radius: 18px; }
.bubble > span { white-space: pre-line; }
.me .bubble { background: #a6e07c; border-top-right-radius: 6px; }
.bot .bubble { background: #fff; border-top-left-radius: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.chips > span { background: #fff; border: 1px solid #cfd9e4; border-radius: 999px; padding: 3px 10px; font-size: 13px; color: #3c5a7a; }

/* ---------- sections ---------- */
section { padding: 56px 0; }
section.alt { background: var(--surface); border-top: 1px solid var(--sand); border-bottom: 1px solid var(--sand); }
.sec-head { max-width: 42em; margin-bottom: 28px; }
.sec-head p { color: var(--muted); }
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--sand); border-radius: var(--radius); padding: 22px; }
section.alt .card { background: var(--bg); }
.card .ico { font-size: 28px; line-height: 1; margin-bottom: 10px; }
.card p:last-child { margin-bottom: 0; }
.card h3 { margin-bottom: 6px; }

/* steps */
ol.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; display: grid; gap: 16px; }
@media (min-width: 860px) { ol.steps.row { grid-template-columns: repeat(3, 1fr); } }
ol.steps > li { counter-increment: s; position: relative; padding: 22px 22px 22px 74px; background: var(--surface); border: 1px solid var(--sand); border-radius: var(--radius); }
section.alt ol.steps > li { background: var(--bg); }
ol.steps > li::before {
  content: counter(s); position: absolute; left: 22px; top: 20px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: #FFF8EC; font: 700 18px/36px "Mali", sans-serif; text-align: center;
}
ol.steps h3 { margin-bottom: 4px; }
ol.steps p:last-child { margin-bottom: 0; }

/* examples */
code.cmd {
  display: inline-block; font: 500 15px "IBM Plex Sans Thai", sans-serif; background: #f3efe8; color: var(--ink);
  border: 1px solid var(--stone); border-radius: 10px; padding: 1px 9px; margin: 2px 2px; cursor: pointer;
  white-space: nowrap;
}
code.cmd:hover, code.cmd:focus { background: #e9e2d7; outline: none; }
table.ex { width: 100%; border-collapse: collapse; font-size: 16px; }
table.ex td { padding: 10px 0; border-top: 1px solid var(--sand); vertical-align: top; }
table.ex td:first-child { width: 46%; padding-right: 12px; }
table.ex tr:first-child td { border-top: 0; }
@media (max-width: 520px) {
  table.ex, table.ex tbody, table.ex tr, table.ex td { display: block; width: 100% !important; }
  table.ex td:first-child { padding-bottom: 0; }
  table.ex td + td { border-top: 0; padding-top: 2px; color: var(--muted); }
}
.tip { background: #FFFFFF; border-left: 4px solid var(--olive); padding: 12px 16px; border-radius: 10px; font-size: 16px; margin: 16px 0 0; }

/* menu */
.menu-wrap { display: grid; gap: 24px; align-items: center; }
@media (min-width: 860px) { .menu-wrap { grid-template-columns: 1fr 1fr; } }
.menu-wrap img { border-radius: var(--radius); border: 1px solid var(--sand); }
dl.menu { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; }
dl.menu dt { font-weight: 600; white-space: nowrap; }
dl.menu dd { margin: 0; color: var(--muted); }

/* safety */
.levels { display: grid; gap: 12px; }
@media (min-width: 760px) { .levels { grid-template-columns: repeat(3, 1fr); } }
.level { border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--sand); background: var(--surface); }
.level b { display: block; font: 700 18px "Mali", sans-serif; margin-bottom: 4px; }
.level.g b { color: var(--green); } .level.y b { color: var(--yellow); } .level.r b { color: var(--red); }
.emergency {
  margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; justify-content: space-between;
  background: #fbeceb; border: 1px solid #f0c9c4; border-radius: var(--radius); padding: 18px 22px;
}
.emergency p { margin: 0; }
.btn-red { background: var(--red); color: #fff; }

/* faq */
details { background: var(--surface); border: 1px solid var(--sand); border-radius: 14px; padding: 0 20px; margin-bottom: 10px; }
section.alt details { background: var(--bg); }
summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; position: relative; padding-right: 28px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 0; top: 12px; font-size: 22px; color: var(--muted); }
details[open] summary::after { content: "–"; }
details > div { padding-bottom: 16px; color: var(--muted); }

/* final cta + footer */
.final { text-align: center; }
.final .cta { justify-content: center; }
footer { padding: 32px 0 48px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--sand); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
footer .brand { font-size: 16px; }
footer .brand img { width: 22px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 15px; transition: .2s;
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* privacy page */
.doc { max-width: 760px; padding-top: 40px; padding-bottom: 64px; }
.doc h2 { font-size: 22px; margin-top: 36px; }
.doc li { margin-bottom: 6px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0 16px; }
.doc th, .doc td { text-align: left; border: 1px solid var(--sand); padding: 8px 10px; vertical-align: top; }
.doc th { background: var(--sand); font-weight: 600; }
.ph { background: #fff3c4; border-radius: 4px; padding: 0 3px; }
