/* คู่มือนักพัฒนา: อ่านง่าย มีโหมดมืด ใช้แบบอักษรของเครื่อง เพื่อให้เบาและไม่ต้องโหลดจากที่อื่น */
:root {
  --coral: #ff795e;
  --accent: #c8452c;
  --bg: #ffffff;
  --soft: #fbf6f2;
  --ink: #2c1c29;
  --muted: #6f5d6b;
  --line: #eee3dc;
  --code-bg: #2a1d28;
  --code-ink: #f6edf2;
  --inline-bg: #fbeee8;
  --tip: #1f7a52;
  --tip-bg: #e9f7f0;
  --warn: #9a6200;
  --warn-bg: #fff6e0;
  --info: #2f5fa8;
  --info-bg: #eaf1fb;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #ff9b85;
    --bg: #1b141a;
    --soft: #241b23;
    --ink: #f3ebf0;
    --muted: #b7a8b3;
    --line: #3a2e37;
    --code-bg: #120d11;
    --inline-bg: #3a2a33;
    --tip: #71d6a6;
    --tip-bg: #1b2f26;
    --warn: #f0c060;
    --warn-bg: #33291a;
    --info: #8db7f2;
    --info-bg: #1c2839;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #ff9b85;
  --bg: #1b141a;
  --soft: #241b23;
  --ink: #f3ebf0;
  --muted: #b7a8b3;
  --line: #3a2e37;
  --code-bg: #120d11;
  --inline-bg: #3a2a33;
  --tip: #71d6a6;
  --tip-bg: #1b2f26;
  --warn: #f0c060;
  --warn-bg: #33291a;
  --info: #8db7f2;
  --info-bg: #1c2839;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.75 "Noto Sans Thai", "Sarabun", -apple-system, "Segoe UI", Tahoma, sans-serif; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
button, input { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.top-links { display: flex; gap: 16px; font-size: 14px; }
.top-links a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.top-links a:hover { color: var(--accent); }
.search { position: relative; margin-left: auto; width: 240px; }
.search input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.results { position: absolute; top: 44px; right: 0; width: 320px; max-width: 90vw; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
.results a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.results a:hover { background: var(--soft); }
.results p { margin: 0; padding: 8px 10px; color: var(--muted); font-size: 14px; }
.theme, .menu { height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 13px; white-space: nowrap; }
.menu { display: none; }

.wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; max-width: 1400px; margin: 0 auto; }
.side { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 20px 16px 40px 20px; border-right: 1px solid var(--line); }
.side h2 { margin: 18px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.side section:first-child h2 { margin-top: 0; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.5; }
.side a:hover { background: var(--soft); }
.side a[aria-current="page"] { background: var(--inline-bg); color: var(--accent); font-weight: 600; }

.content { min-width: 0; padding: 32px 40px 60px; }
article { max-width: 780px; }
.crumb { margin: 0 0 4px; color: var(--accent); font-size: 14px; font-weight: 600; }
h1 { font-size: 34px; line-height: 1.3; margin: 0 0 16px; font-weight: 700; }
h2 { font-size: 24px; line-height: 1.35; margin: 40px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); font-weight: 700; }
h3 { font-size: 19px; margin: 28px 0 8px; font-weight: 600; }
.anchor { margin-left: 8px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
p { margin: 0 0 14px; }
ul, ol { margin: 0 0 14px; padding-left: 24px; }
li { margin-bottom: 4px; }
code { background: var(--inline-bg); padding: 1px 6px; border-radius: 6px; font: 14px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; overflow-wrap: anywhere; }

.endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.endpoint code { background: transparent; padding: 0; font-size: 15px; font-weight: 600; }
.method { padding: 2px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; color: #fff; }
.method.get { background: #1f7a52; }
.method.post { background: #c8452c; }
.scope { margin-left: auto; color: var(--muted); font-size: 14px; }

.code { position: relative; margin: 0 0 18px; border-radius: 12px; overflow: hidden; background: var(--code-bg); color: var(--code-ink); }
.code-tabs, .code-head { display: flex; flex-wrap: wrap; gap: 2px; min-height: 40px; padding: 4px 90px 0 8px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.code-head span { padding: 6px 8px; color: #c8b9c4; font-size: 13px; }
.code-tabs button { border: 0; background: transparent; color: #c8b9c4; padding: 6px 12px; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; }
.code-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--coral); font-weight: 600; }
.copy { position: absolute; top: 6px; right: 8px; border: 1px solid rgba(255, 255, 255, .24); background: transparent; color: #f6edf2; border-radius: 8px; padding: 3px 10px; font-size: 13px; cursor: pointer; }
.copy:hover { background: rgba(255, 255, 255, .1); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.code pre code { background: transparent; padding: 0; color: inherit; overflow-wrap: normal; white-space: pre; font-size: 14px; line-height: 1.65; }

.box { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; border-left: 4px solid; }
.box p { margin: 0; }
.box-title { font-weight: 700; margin-bottom: 4px !important; }
.box.tip { background: var(--tip-bg); border-color: var(--tip); }
.box.tip .box-title { color: var(--tip); }
.box.warning { background: var(--warn-bg); border-color: var(--warn); }
.box.warning .box-title { color: var(--warn); }
.box.info { background: var(--info-bg); border-color: var(--info); }
.box.info .box-title { color: var(--info); }

.table { overflow-x: auto; margin: 0 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 12px; border: 1px solid var(--line); vertical-align: top; }
th { background: var(--soft); font-weight: 600; }

.toc { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 32px 16px; font-size: 14px; }
.toc h2 { margin: 0 0 8px; padding: 0; border: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 3px 10px; color: var(--muted); text-decoration: none; line-height: 1.5; margin-left: -1px; border-left: 2px solid transparent; }
.toc a:hover, .toc a.on { color: var(--accent); border-left-color: var(--accent); }

.pager { display: flex; justify-content: space-between; gap: 12px; max-width: 780px; margin-top: 48px; }
.pager a { flex: 1; max-width: 50%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; font-weight: 600; }
.pager a:hover { border-color: var(--accent); }
.pager a span { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.pager .next { text-align: right; margin-left: auto; }

.hero { padding: 24px 0 16px; }
.hero h1 { font-size: 38px; }
.hero p { font-size: 18px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button { display: inline-block; padding: 10px 20px; border-radius: 12px; border: 1px solid var(--line); text-decoration: none; font-weight: 600; font-size: 16px; color: var(--ink); }
.button.primary { background: var(--coral); border-color: var(--coral); color: #2c1c29; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--accent); }
.card strong { display: block; margin-bottom: 4px; }
.card span { color: var(--muted); font-size: 14px; line-height: 1.5; display: block; }

.foot { padding: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }

@media (max-width: 1180px) {
  .wrap { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .wrap { grid-template-columns: minmax(0, 1fr); }
  .top { padding: 0 12px; gap: 8px; }
  .menu { display: block; }
  .top-links { display: none; }
  .brand span { display: none; }
  .search { width: auto; flex: 1; }
  .theme { padding: 0 8px; }
  .side { display: none; position: fixed; top: 60px; left: 0; right: 0; bottom: 0; height: auto; background: var(--bg); z-index: 15; border: 0; }
  .menu-open .side { display: block; }
  .content { padding: 20px 16px 40px; }
  h1, .hero h1 { font-size: 28px; }
  h2 { font-size: 21px; }
  .scope { margin-left: 0; width: 100%; }
  .pager a { max-width: none; }
}
