
:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f6f6f6;
  --ink: #171717;
  --muted: #686868;
  --rule: #e6e6e6;
  --accent: #171717;
  --accent-strong: #111111;
  --accent-soft: #f2f2f2;
  --warning: #8b5b10;
  --warning-bg: #fff8e8;
  --danger: #9f312d;
  --danger-bg: #fff0ef;
  --info-bg: #f5f7f7;
  --code: #111111;
  --code-ink: #f5f5f5;
  --shadow: 0 18px 48px rgba(0, 0, 0, .12);
  --font-ui: "Sarabun", Tahoma, sans-serif;
  --font-code: "Noto Sans Mono", "SFMono-Regular", Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #090909;
  --surface: #0b0b0b;
  --surface-muted: #151515;
  --ink: #f2f2f2;
  --muted: #a4a4a4;
  --rule: #272727;
  --accent: #f2f2f2;
  --accent-strong: #ffffff;
  --accent-soft: #181818;
  --warning: #f0c66f;
  --warning-bg: #302616;
  --danger: #ffaaa4;
  --danger-bg: #34201e;
  --info-bg: #14191a;
  --code: #050505;
  --code-ink: #f4f4f4;
  --shadow: 0 18px 48px rgba(0, 0, 0, .38);
}

@font-face {
  font-family: "Sarabun";
  src: url("../fonts/sarabun-thai-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: "Sarabun";
  src: url("../fonts/sarabun-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Sarabun";
  src: url("../fonts/sarabun-thai-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: "Sarabun";
  src: url("../fonts/sarabun-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Sarabun";
  src: url("../fonts/sarabun-thai-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: "Sarabun";
  src: url("../fonts/sarabun-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Sarabun";
  src: url("../fonts/sarabun-thai-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: "Sarabun";
  src: url("../fonts/sarabun-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

::selection {
  color: var(--surface);
  background: var(--accent-strong);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 100;
  transform: translateY(-180%);
  padding: .65rem 1rem;
  color: var(--surface);
  background: var(--accent-strong);
}

.skip-link:focus {
  transform: translateY(0);
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 3.8rem;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.masthead-inner {
  width: 100%;
  height: 100%;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -.02em;
}

.brand svg {
  width: 1.7rem;
  height: 1.7rem;
  color: var(--accent);
}

.brand small {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
}

.control {
  min-height: 2.6rem;
  border: 1px solid var(--rule);
  border-radius: .55rem;
  padding: .5rem .8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 180ms ease-out, background 180ms ease-out;
}

.control:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.control svg {
  width: 1.1rem;
  height: 1.1rem;
}


.top-tabs {
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 1.5rem;
  margin-left: clamp(1rem, 4vw, 4rem);
}

.top-tabs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}

.top-tabs a:first-child { color: var(--ink); }
.top-tabs a:first-child::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--ink);
}
.top-tabs a:hover { color: var(--ink); }

.theme-switcher {
  display: inline-grid;
  grid-template-columns: repeat(3, 2rem);
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface-muted);
}

.theme-switcher button {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.theme-switcher button:hover { color: var(--ink); }
.theme-switcher button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.14);
}
.theme-switcher svg { width: 1rem; height: 1rem; }

.sidebar-search {
  width: 100%;
  min-height: 2.55rem;
  margin-bottom: 1.35rem;
  padding: .55rem .7rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  border: 1px solid var(--rule);
  border-radius: .7rem;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.sidebar-search:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 28%, var(--rule)); }
.sidebar-search svg { width: 1rem; height: 1rem; flex: none; }
.sidebar-search span { flex: 1; }
.sidebar-search kbd {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: .76rem;
}

.nav-toggle {
  display: none;
}

.docs-shell {
  width: 100%;
  padding: 0 10px;
  display: grid;
  grid-template-columns: minmax(15rem, 17rem) minmax(0, 1fr) minmax(13rem, 17rem);
  gap: clamp(2rem, 3.5vw, 4.5rem);
  align-items: start;
}

.sidebar,
.toc-wrap {
  position: sticky;
  top: 3.8rem;
  height: calc(100vh - 3.8rem);
  overflow: auto;
  padding: 1.55rem 0 3rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.sidebar-title,
.toc-title {
  margin: 0 0 .8rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 720;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-group {
  border-top: 1px solid var(--rule);
  padding: 1rem 0 .65rem;
}

.sidebar-group summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 680;
}

.sidebar-group summary::-webkit-details-marker {
  display: none;
}

.sidebar-group summary::after {
  content: "+";
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 400;
}

.sidebar-group[open] summary::after {
  content: "−";
}

.sidebar-list,
.toc {
  list-style: none;
  padding: 0;
  margin: .55rem 0 0;
}

.sidebar-list a {
  display: block;
  margin: .08rem 0;
  padding: .42rem .55rem;
  border-radius: .35rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
  text-decoration: none;
}

.sidebar-list a:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.sidebar-list a[aria-current="page"] {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 2px 0 0 var(--ink);
  font-weight: 700;
}

.nav-close {
  display: none;
}

.nav-backdrop {
  display: none;
}

.article {
  min-width: 0;
  width: min(100%, 72rem);
  justify-self: center;
  padding: clamp(2.6rem, 5vw, 4.5rem) 0 7rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: .84rem;
}

.breadcrumbs a {
  color: inherit;
}

.breadcrumbs span[aria-hidden] {
  color: var(--rule);
}

.article-header {
  padding-bottom: 1.65rem;
  border-bottom: 0;
}

.article-header h1 {
  max-width: 24ch;
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.article-lead {
  max-width: 64ch;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem 1rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .8rem;
}

.tag {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .16rem .55rem;
  color: var(--muted);
  font-size: .75rem;
}

.prose {
  max-width: 72ch;
  overflow-wrap: anywhere;
}

.prose>h1:first-child {
  display: none;
}

.prose h2,
.prose h3,
.prose h4 {
  scroll-margin-top: 6rem;
  text-wrap: balance;
}

.prose h2 {
  margin: 3.6rem 0 1rem;
  padding-top: .8rem;
  border-top: 1px solid var(--rule);
  font-size: 1.72rem;
  line-height: 1.32;
  letter-spacing: -.025em;
}

.prose h3 {
  margin: 2.4rem 0 .7rem;
  font-size: 1.28rem;
  line-height: 1.4;
}

.prose h4 {
  margin: 2rem 0 .6rem;
  font-size: 1.06rem;
}

.prose p,
.prose ul,
.prose ol {
  margin: .75rem 0 1.15rem;
}

.prose li+li {
  margin-top: .32rem;
}

.prose hr {
  margin: 2.8rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.prose img {
  max-width: 100%;
  height: auto;
}

.table-wrap {
  max-width: 100%;
  margin: 1.25rem 0 2rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

th,
td {
  min-width: 8rem;
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink);
  background: var(--surface-muted);
  font-weight: 720;
}

tr:last-child td {
  border-bottom: 0;
}

.code-frame {
  position: relative;
  margin: 1.25rem 0 2rem;
}

.code-frame pre {
  overflow-x: auto;
  margin: 0;
  padding: 1.2rem;
  border-radius: .65rem;
  color: var(--code-ink);
  background: var(--code);
  line-height: 1.55;
  tab-size: 2;
}

.code-frame code {
  font-family: var(--font-code);
  font-size: .84rem;
}

.copy-button {
  position: absolute;
  top: .55rem;
  right: .55rem;
  border: 1px solid #405454;
  border-radius: .4rem;
  padding: .25rem .55rem;
  color: #d7e7e5;
  background: #183031;
  font-size: .72rem;
  cursor: pointer;
}

.copy-button:hover {
  background: #234443;
}

.prose :not(pre)>code {
  border: 1px solid var(--rule);
  border-radius: .3rem;
  padding: .08rem .32rem;
  color: var(--ink);
  background: var(--surface-muted);
  font-family: var(--font-code);
  font-size: .86em;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal {
  color: #6dd5ca;
}

.hljs-string,
.hljs-title {
  color: #f4cb78;
}

.hljs-comment {
  color: #91a6a3;
}

.hljs-number,
.hljs-attr {
  color: #ef9d91;
}

.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  background: var(--info-bg);
}

.callout-title {
  margin: 0 0 .35rem;
  font-weight: 760;
}

.callout> :last-child {
  margin-bottom: 0;
}

.callout-warning {
  color: var(--warning);
  background: var(--warning-bg);
}

.callout-important,
.callout-danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.diagram-frame {
  margin: 1.5rem 0 2.2rem;
  border: 1px solid var(--rule);
  background: #fff;
}

.diagram-toolbar {
  min-height: 2.6rem;
  padding: .45rem .65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  color: #425555;
  background: #edf4f3;
  font-size: .8rem;
}

.diagram-frame>img {
  display: block;
  width: 100%;
  max-height: 42rem;
  padding: 1rem;
  object-fit: contain;
}

.diagram-source {
  border-top: 1px solid var(--rule);
  color: var(--ink);
  background: var(--surface);
}

.diagram-source summary {
  cursor: pointer;
  padding: .6rem .8rem;
  font-size: .82rem;
}

.diagram-source pre {
  overflow-x: auto;
  margin: 0;
  padding: 1rem;
  color: var(--code-ink);
  background: var(--code);
}

.diagram-frame dialog {
  width: min(96vw, 90rem);
  max-width: none;
  max-height: 92vh;
  border: 1px solid var(--rule);
  padding: 0;
  background: #fff;
  box-shadow: var(--shadow);
}

.diagram-frame dialog::backdrop,
.search-dialog::backdrop {
  background: rgba(3, 13, 14, .72);
}

.diagram-expanded-head {
  padding: .65rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  border-bottom: 1px solid #d9e2e1;
  color: #273b3c;
}

.diagram-pan {
  --diagram-zoom: 1;
  width: 100%;
  height: calc(92vh - 3.9rem);
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
}

.diagram-pan img {
  display: block;
  width: calc(70rem * var(--diagram-zoom));
  max-width: none;
  height: auto;
  padding: 2rem;
}

.zoom-status {
  min-width: 3.4rem;
  color: #425555;
  text-align: center;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}

.toc li {
  margin-bottom: .35rem;
}

.toc a {
  display: block;
  padding: .18rem 0 .18rem .7rem;
  border-left: 1px solid var(--rule);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
  text-decoration: none;
}

.toc a:hover,
.toc a.is-active {
  color: var(--accent-strong);
  border-color: var(--accent);
}

.toc .toc-level-3 a {
  padding-left: 1.25rem;
}

.home-hero {
  padding: clamp(3rem, 8vw, 7rem) 0 3rem;
}

.home-hero h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: .98;
  letter-spacing: -.04em;
  text-wrap: balance;
}

.home-hero p {
  max-width: 60ch;
  margin: 1.6rem 0 0;
  color: var(--muted);
  font-size: 1.15rem;
}

.evidence-strip {
  margin: 2.5rem 0 4rem;
  padding: 1.1rem 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.evidence-strip div {
  padding: .3rem 1.2rem;
  border-right: 1px solid var(--rule);
}

.evidence-strip div:first-child {
  padding-left: 0;
}

.evidence-strip div:last-child {
  border-right: 0;
}

.evidence-strip strong {
  display: block;
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
}

.evidence-strip span {
  color: var(--muted);
  font-size: .82rem;
}

.start-path {
  margin: 3rem 0 4rem;
}

.start-path h2,
.catalog h2 {
  margin-bottom: 1rem;
  font-size: 1.6rem;
  letter-spacing: -.02em;
}

.path-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: path;
  border-top: 1px solid var(--rule);
}

.path-list li {
  counter-increment: path;
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}

.path-list li::before {
  content: counter(path, decimal-leading-zero);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
}

.path-list a {
  color: var(--ink);
  font-weight: 680;
  text-decoration: none;
}

.path-list a:hover {
  color: var(--accent-strong);
}

.path-list span {
  color: var(--muted);
  font-size: .84rem;
}

.catalog-group {
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
}

.catalog-group h3 {
  margin: 0 0 .7rem;
  font-size: 1.05rem;
}

.catalog-list {
  columns: 2;
  column-gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.catalog-list li {
  break-inside: avoid;
  margin: 0 0 .65rem;
}

.catalog-list a {
  color: var(--muted);
  text-decoration: none;
}

.catalog-list a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.search-dialog {
  width: min(92vw, 46rem);
  max-height: 82vh;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: .8rem;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-dialog-head {
  padding: .8rem;
  display: flex;
  gap: .6rem;
  border-bottom: 1px solid var(--rule);
}

.search-dialog input {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid var(--rule);
  border-radius: .5rem;
  padding: .55rem .75rem;
  color: var(--ink);
  background: var(--paper);
}

.search-results {
  max-height: 64vh;
  overflow: auto;
  padding: .55rem;
}

.search-result {
  display: block;
  padding: .8rem .9rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

.search-result:hover {
  background: var(--surface-muted);
}

.search-result span {
  color: var(--accent-strong);
  font-size: .72rem;
  font-weight: 720;
}

.search-result strong {
  display: block;
}

.search-result p {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
}

.search-empty {
  padding: 2.2rem 1.2rem;
  text-align: center;
}

.search-empty p {
  color: var(--muted);
}


@media (max-width: 1120px) {
  .docs-shell {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 2.5rem;
  }

  .toc-wrap {
    display: none;
  }
}

@media (max-width: 760px) {
  .masthead {
    height: 3.8rem;
  }

  .masthead-inner {
    padding: 0 10px;
  }

  .brand small { display: none; }

  .top-tabs { display: none; }

  .theme-switcher { grid-template-columns: repeat(3, 1.8rem); }
  .theme-switcher button { width: 1.8rem; height: 1.8rem; }

  .nav-toggle {
    display: inline-flex;
  }

  .docs-shell {
    display: block;
    padding: 0 10px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(88vw, 20rem);
    height: 100vh;
    padding: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 220ms ease-out;
  }

  .sidebar[data-open="true"] {
    transform: translateX(0);
  }

  .nav-close {
    display: flex;
    width: 100%;
    margin-bottom: 1rem;
    justify-content: space-between;
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(3, 13, 14, .62);
  }

  body.nav-open .nav-backdrop {
    display: block;
  }

  .article {
    padding-top: 2rem;
  }

  .article-header h1 {
    font-size: clamp(1.75rem, 7vw, 2.25rem);
  }

  .home-hero {
    padding-top: 3rem;
  }

  .evidence-strip {
    grid-template-columns: 1fr;
  }

  .evidence-strip div,
  .evidence-strip div:first-child {
    padding: .7rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .evidence-strip div:last-child {
    border-bottom: 0;
  }

  .path-list li {
    grid-template-columns: 2.3rem 1fr;
  }

  .path-list span {
    display: none;
  }

  .catalog-list {
    columns: 1;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

@media print {

  .masthead,
  .sidebar,
  .toc-wrap,
  .breadcrumbs,
  .copy-button,
  .diagram-toolbar {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 11pt;
  }

  .docs-shell {
    display: block;
    width: auto;
    padding: 0;
  }

  .article {
    padding: 0;
  }

  .article-header h1 {
    max-width: none;
    font-size: 26pt;
  }

  .prose {
    max-width: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .diagram-frame,
  .table-wrap {
    break-inside: avoid;
  }
}

/* Reference-style documentation shell */
@media (min-width: 761px) {
  :root { --sidebar-width: 282px; --topbar-height: 46px; }

  .masthead {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    z-index: 40;
    background: var(--paper);
    backdrop-filter: none;
  }

  .masthead-inner {
    padding: 0 44px;
  }

  .top-tabs {
    margin-left: 0;
    gap: 1.55rem;
  }

  .top-tabs a {
    font-size: .88rem;
    font-weight: 560;
  }

  .docs-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 268px;
    gap: 0;
    padding: 0;
    min-height: 100vh;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 0;
    overflow: hidden;
    border-right: 1px solid var(--rule);
    background: var(--paper);
    z-index: 50;
  }

  .sidebar-head {
    height: 78px;
    padding: 18px 25px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    justify-content: center;
    border-radius: 10px;
    color: var(--ink);
    background: var(--ink);
  }

  .brand-mark svg {
    width: 24px;
    height: 24px;
    color: var(--paper);
  }

  .theme-switcher {
    grid-template-columns: repeat(3, 1.45rem);
    gap: 0;
    padding: 1px;
    background: transparent;
  }

  .theme-switcher button {
    width: 1.45rem;
    height: 1.45rem;
  }

  .theme-switcher svg {
    width: .82rem;
    height: .82rem;
  }

  .sidebar-search {
    width: calc(100% - 48px);
    margin: 8px 24px 18px;
    min-height: 36px;
    border-radius: 8px;
    font-size: .86rem;
  }

  .sidebar-scroll {
    height: calc(100vh - 140px);
    overflow-y: auto;
    padding: 0 24px 30px;
    scrollbar-width: thin;
  }

  .sidebar-title {
    margin: 8px 0 8px 5px;
    color: var(--ink);
    font-size: .84rem;
    letter-spacing: 0;
    text-transform: none;
  }

  .sidebar-group {
    border-top: 0;
    padding: .5rem 0 .65rem;
  }

  .sidebar-group summary {
    padding: 0 5px .35rem;
    font-size: .84rem;
    font-weight: 600;
  }

  .sidebar-group summary::after { display: none; }

  .sidebar-list {
    margin-top: .15rem;
    border-left: 1px solid var(--rule);
  }

  .sidebar-list a {
    margin: 0;
    padding: .31rem .7rem .31rem .95rem;
    border-radius: 0;
    font-size: .82rem;
  }

  .sidebar-list a[aria-current="page"] {
    position: relative;
    background: transparent;
    color: var(--ink);
  }

  .sidebar-list a[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--ink);
  }

  .article {
    grid-column: 2;
    width: min(100%, 700px);
    justify-self: center;
    padding: 86px 34px 7rem;
  }

  .toc-wrap {
    grid-column: 3;
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    width: 268px;
    height: calc(100vh - var(--topbar-height));
    padding: 47px 26px 3rem 22px;
    overflow: auto;
  }

  .toc-title {
    margin-bottom: .45rem;
    color: var(--ink);
    font-size: .82rem;
    letter-spacing: 0;
    text-transform: none;
  }

  .toc a {
    font-size: .78rem;
    padding: .18rem 0 .18rem .8rem;
  }

  .home .article {
    width: min(100%, 700px);
  }

  .home-hero {
    padding: 0 0 2.2rem;
  }

  .home-hero h1 {
    max-width: none;
    font-size: clamp(2.05rem, 3vw, 2.55rem);
    line-height: 1.08;
  }

  .home-hero p {
    margin-top: 1.6rem;
    font-size: 1rem;
  }
}

/* Typography refinement: keep Sarabun for Thai, match modern developer-doc proportions */
:root {
  --ink: #161616;
  --muted: #666666;
  --rule: #e5e5e5;
  --toc-heading: #3e3e3e;
}

:root[data-theme="dark"] {
  --ink: #ededed;
  --muted: #a1a1a1;
  --rule: #262626;
  --toc-heading: #c7c7c7;
}

body {
  font-size: 16px;
  line-height: 24px;
}

.article-header h1,
.home-hero h1 {
  font-size: 36px;
  line-height: 40px;
  font-weight: 600;
  letter-spacing: -.8px;
  color: var(--ink);
}

.article-lead,
.home-hero p,
.prose {
  font-size: 16px;
  line-height: 24px;
}

.article-lead,
.home-hero p {
  color: var(--muted);
}

.prose h2,
.start-path h2,
.catalog h2 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -.3px;
}

.prose h3,
.catalog-group h3 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -.15px;
}

.prose h4 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

.top-tabs a {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

.sidebar-title {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.sidebar-group summary {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

.sidebar-list a {
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  color: var(--muted);
}

.sidebar-list a[aria-current="page"] {
  font-weight: 600;
  color: var(--ink);
}

.toc-title {
  font-size: 14px;
  line-height: 24px;
  font-weight: 500;
  color: var(--toc-heading);
  letter-spacing: 0;
  text-transform: none;
}

.toc a {
  font-size: 14px;
  line-height: 24px;
  font-weight: 400;
  color: var(--muted);
}

.meta,
.tag,
.breadcrumbs {
  line-height: 20px;
}

@media (max-width: 760px) {
  .article-header h1,
  .home-hero h1 {
    font-size: 32px;
    line-height: 36px;
    letter-spacing: -.6px;
  }
}

@media print {
  body {
    font-size: 11pt;
    line-height: 1.5;
  }
}

/* Wider reading column: expand evenly from the center on desktop */
@media (min-width: 1121px) {
  .article,
  .home .article {
    width: min(980px, calc(100% - 96px));
    max-width: 980px;
    justify-self: center;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .article-header,
  .home-hero {
    max-width: 100%;
  }

  .prose {
    max-width: calc(84ch + 60px);
  }

  .article-lead,
  .home-hero p {
    max-width: calc(78ch + 60px);
  }

  .article-header h1,
  .home-hero h1 {
    max-width: 30ch;
  }
}

/* Sidebar brand: place project name below the logo */
@media (min-width: 761px) {
  .sidebar-brand {
    min-width: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    color: var(--ink);
    text-decoration: none;
  }

  .sidebar-brand .brand-mark {
    flex: 0 0 42px;
  }

  .sidebar-brand-name {
    white-space: nowrap;
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    color: var(--ink);
  }

  .sidebar-head {
    height: 100px;
    align-items: flex-start;
    gap: 10px;
  }

  .theme-switcher {
    margin-top: 7px;
  }

  .sidebar-scroll {
    height: calc(100vh - 162px);
  }
}
