:root {
  --bg: #0b0f14;
  --bg-elev: #0f141a;
  --bg-2: #121821;
  --text: #e6f1ff;
  --text-dim: #a2b3c2;
  --muted: #7f8b97;
  --border: #1f2a36;
  --primary: #8b5cf6;
  --primary-2: #3bd9b1;
  --accent: #22d3ee;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --code-bg: #0e131a;
  --link: #c4b5fd;
  --maxw: 1120px;
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  overflow-x: hidden;
}
html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  margin: 0;
  font-family:
    "Bai Jamjuree",
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    "Noto Sans";
  color: var(--text);
  background:
    radial-gradient(
      1200px 600px at 10% -20%,
      rgba(139, 92, 246, 0.15),
      transparent 60%
    ),
    radial-gradient(
      1000px 500px at 90% 10%,
      rgba(59, 217, 177, 0.12),
      transparent 60%
    ),
    var(--bg);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.site {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(
    to right,
    rgba(18, 24, 33, 0.9),
    rgba(11, 15, 20, 0.9)
  );
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.header-inner {
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-start;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-text small {
  color: var(--text-dim);
}
.top-nav {
  display: flex;
  gap: 12px;
  margin-left: 0;
}
.top-nav a {
  padding: 8px 10px;
  border-radius: 10px;
}
.top-nav a:hover {
  background: rgba(139, 92, 246, 0.12);
  text-decoration: none;
}
.menu-btn {
  display: none;
}
.search {
  margin-left: 12px;
  position: relative;
}
.search input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  min-width: 220px;
}
.header-inner .btn {
  margin-left: 8px;
}

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 64px);
}
.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(18, 24, 33, 1) 0%,
    rgba(11, 15, 20, 1) 100%
  );
  padding: 18px 16px;
}
.sidebar nav h6 {
  margin: 18px 10px 8px;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.8px;
}
.sidebar nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  margin: 2px 0;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--text);
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.15),
    rgba(59, 217, 177, 0.06)
  );
}

main {
  max-width: 100vw;
  margin: 0 auto;
  padding: 40px 24px 96px;
}
.breadcrumbs {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}
.breadcrumbs a {
  color: var(--text-dim);
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 12px;
}
h1 {
  font-size: 34px;
}
h2 {
  font-size: 24px;
  margin-top: 22px;
}
h3 {
  font-size: 18px;
  margin-top: 14px;
}
section {
  margin-bottom: 28px;
}
p {
  color: var(--text-dim);
  margin: 0 0 12px;
}
ul {
  padding-left: 18px;
  margin: 8px 0 12px;
  color: var(--text-dim);
}
li {
  margin: 8px 0;
}

.hero {
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(20, 26, 36, 0.9) 0%,
    rgba(13, 18, 24, 0.9) 100%
  );
  border-radius: var(--radius);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.hero .cta {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.15),
    rgba(59, 217, 177, 0.1)
  );
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.btn.primary {
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.75),
    rgba(59, 217, 177, 0.65)
  );
  border-color: transparent;
}
.card {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.grid {
  display: grid;
  gap: 20px;
}
.grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 1000px) {
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .menu-btn {
    display: inline-flex;
  }
  .top-nav {
    display: none;
  }
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  overflow: auto;
}
code {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Consolas, Monaco, "Courier New",
    monospace;
  font-size: 13px;
  color: #d9e0ee;
}

.note {
  border-left: 3px solid var(--primary-2);
  padding: 12px 14px;
  background: rgba(59, 217, 177, 0.06);
  border-radius: 8px;
  color: var(--text-dim);
  max-width: 100vw;
}
.footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 28px 20px;
  max-width: var(--maxw);
  margin: 40px auto 0;
}

.anchor {
  opacity: 0;
  margin-left: 6px;
  font-size: 0.8em;
}
h2:hover .anchor,
h3:hover .anchor {
  opacity: 1;
}

[id] {
  scroll-margin-top: 72px;
}

.section-reveal {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}
.section-reveal.visible {
  opacity: 1;
  transform: none;
}

/* make sure horizontal scrool is not there */
/* 2) Header: allow wrapping + prevent items from forcing width */
@media (max-width: 1000px) {
  .header-inner {
    flex-wrap: wrap;
  }
  .header-inner > * {
    min-width: 0;
  } /* lets items shrink */
  .header-inner .btn {
    order: 2;
  } /* buttons drop before search */
}

/* 3) Code blocks: scroll horizontally instead of expanding layout */
pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
pre code {
  display: block;
  white-space: pre;
}
code {
  word-break: normal;
} /* keep code readable */

/* 4) Make images/tables responsive so they don’t force width */
img,
table {
  max-width: 100%;
  height: auto;
}
table {
  display: block;
  overflow-x: auto;
}

/* 6) Long links in text/results can wrap without breaking layout */
a {
  overflow-wrap: anywhere;
}
img.guide {
  width: 300px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
video.guide {
  max-width: 100%;
}