/* GoldRatch — stone (mid-tone) theme. Colours are tokens; change them here only. */
:root {
  --bg: #d3ccbf;                          /* warm stone */
  --bg-2: #e3ded3;                        /* drop-down menus */
  --card: #dfd9cd;
  --card-2: #e6e1d7;
  --field-bg: #ebe7df;                    /* form fields */
  --code-bg: #1a1f2a;                     /* terminal and code blocks stay dark */
  --code-text: #dbe1ea;
  --header-bg: rgba(211, 204, 191, .9);
  --footer-bg: #c6bfb1;
  --tint: rgba(40, 46, 58, .07);          /* hover, table heads, subtle fills */
  --tint-2: rgba(40, 46, 58, .12);
  --line: rgba(40, 46, 58, .18);
  --line-strong: rgba(40, 46, 58, .32);
  --text: #1b212b;
  --muted: #3f4755;
  --faint: #4b5360;
  --gold: #74520b;                        /* gold for text on light backgrounds */
  --honey: #e2b866;                       /* gold for fills (buttons) */
  --honey-2: #f0d29a;
  --gold-dim: rgba(130, 90, 18, .13);
  --gold-line: rgba(130, 90, 18, .42);
  --cyan: #1b5f6d;                        /* teal: links and accents */
  --cyan-dim: rgba(27, 95, 109, .12);
  --cyan-line: rgba(27, 95, 109, .40);
  --green: #1c5d39;
  --red: #983a37;
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1180px;
  --font: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --shadow: 0 6px 22px rgba(30, 34, 44, .16);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
/* circuit grid + glows behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(27, 95, 109, .08), transparent 60%),
    radial-gradient(700px 500px at -10% 20%, rgba(226, 184, 102, .12), transparent 60%),
    linear-gradient(rgba(40, 46, 58, .05) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(40, 46, 58, .05) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .6em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code, kbd, pre { font-family: var(--mono); }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 28px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--honey); color: #241a08; padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- header / navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.22rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand b { color: var(--gold); font-weight: 700; }
.nav { margin-left: auto; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav > ul { display: flex; gap: 4px; align-items: center; }
.nav a, .nav .nav-label {
  display: flex; align-items: center; gap: 6px;
  color: var(--text); padding: 8px 14px; border-radius: 8px; font-size: .97rem; white-space: nowrap;
}
.nav a:hover { text-decoration: none; background: var(--tint-2); }
.nav li { position: relative; }
.nav > ul > li.active > a { color: var(--gold); }
.nav > ul > li.active > a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--cyan)); border-radius: 2px;
}
.caret { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.caret.side { transform: rotate(135deg); order: -1; margin-right: 4px; }
.nav .sub {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 250px;
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 12px; padding: 8px;
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: .16s ease;
}
/* the menu sits at the right edge of the header, so second-level menus open to the left */
.nav .sub .sub { top: -9px; left: auto; right: calc(100% + 8px); }
.nav > ul > li:last-child > .sub, .nav > ul > li:nth-last-child(2) > .sub { left: auto; right: 0; }
.nav li:hover > .sub, .nav li:focus-within > .sub { opacity: 1; visibility: visible; transform: none; }
.nav .sub a { font-size: .94rem; padding: 8px 12px; }
.nav .sub a .tag { margin-left: auto; }
.nav-toggle {
  display: none; margin-left: auto; background: none; border: 1px solid var(--line-strong); color: var(--text);
  width: 44px; height: 40px; border-radius: 10px; cursor: pointer; align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; transition: .2s;
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -6px; } .nav-toggle span::after { top: 6px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { top: 0; transform: rotate(45deg); }
.nav-open .nav-toggle span::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 899px) {
  .nav-toggle { display: inline-flex; }
  /* absolute, not fixed: the header's backdrop-filter makes it the containing block of its children */
  .nav {
    position: absolute; top: 100%; left: 0; right: 0; height: calc(100vh - 66px); height: calc(100dvh - 66px);
    background: var(--bg); overflow-y: auto; border-top: 1px solid var(--line);
    padding: 12px 16px 40px; display: none; margin: 0;
  }
  .nav-open .nav { display: block; }
  .nav-open { overflow: hidden; }
  .nav > ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav a { padding: 12px 10px; font-size: 1.05rem; }
  .nav .sub, .nav .sub .sub {
    position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none;
    border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; margin-left: 14px; padding: 0 0 0 6px; min-width: 0; background: none;
  }
  .caret { display: none; }
  .nav > ul > li.active > a::after { display: none; }
}

/* ---------- generic blocks ---------- */
main { flex: 1; }
.section { padding: 72px 0; }
.section-tight { padding: 44px 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .8rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 720px; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.grad {
  background: linear-gradient(100deg, var(--gold), #93681d 45%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 10px;
  font-weight: 600; font-size: 1rem; border: 1px solid transparent; cursor: pointer; font-family: inherit; line-height: 1.2;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-gold { background: linear-gradient(180deg, var(--honey-2), var(--honey)); color: #241a08; box-shadow: 0 4px 14px rgba(176, 125, 36, .18); }
.btn-gold:hover { box-shadow: 0 6px 20px rgba(176, 125, 36, .28); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); background: var(--card); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: .72rem; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; line-height: 1.5;
}
.tag-gold { color: var(--gold); border-color: var(--gold-line); background: var(--gold-dim); }
.tag-cyan { color: var(--cyan); border-color: var(--cyan-line); background: var(--cyan-dim); }
.tag-green { color: var(--green); border-color: rgba(47, 138, 91, .34); background: rgba(47, 138, 91, .08); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.card {
  position: relative; background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; transition: border-color .2s, transform .2s;
}
a.card { color: var(--text); display: block; }
a.card:hover { text-decoration: none; border-color: var(--cyan-line); transform: translateY(-2px); }
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.card .more { font-family: var(--mono); font-size: .85rem; color: var(--cyan); margin-top: 14px; display: inline-block; }
.icon-box {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 16px;
  background: var(--cyan-dim); color: var(--cyan); font-family: var(--mono); font-weight: 700; font-size: .95rem;
  border: 1px solid var(--cyan-line);
}
.icon-box.gold { background: var(--gold-dim); color: var(--gold); border-color: var(--gold-line); }
.icon-box svg { width: 24px; height: 24px; }

/* ---------- page header & breadcrumbs ---------- */
.page-head { padding: 54px 0 34px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: .3em; }
.crumbs { font-family: var(--mono); font-size: .82rem; color: var(--faint); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { color: var(--faint); }

/* ---------- home hero ---------- */
.hero { padding: 90px 0 70px; }
.hero .wrap { display: grid; gap: 48px; align-items: center; grid-template-columns: 1.1fr .9fr; }
@media (max-width: 899px) { .hero .wrap { grid-template-columns: 1fr; } .hero { padding: 56px 0 40px; } }
.hero h1 { margin-bottom: .35em; }
.hero .lead { margin-bottom: 30px; }
.terminal {
  background: var(--code-bg); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 12px 34px rgba(45, 52, 66, .16);
  overflow: hidden; font-family: var(--mono); font-size: .86rem; line-height: 1.75;
}
.terminal-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .04); }
.terminal-bar i { width: 11px; height: 11px; border-radius: 50%; background: #334155; display: block; }
.terminal-bar i:nth-child(1) { background: #e59a9a; } .terminal-bar i:nth-child(2) { background: #e8c77a; } .terminal-bar i:nth-child(3) { background: #8fd0aa; }
.terminal-bar span { margin-left: 10px; color: #8a93a3; font-size: .78rem; }
.terminal pre { margin: 0; padding: 18px 20px; overflow-x: auto; color: var(--code-text); white-space: pre; }
.t-p { color: #8fd0aa; } .t-c { color: #8a93a3; } .t-k { color: #7cc6d6; } .t-s { color: #f0d29a; }
.cursor { display: inline-block; width: 8px; height: 1.1em; background: #7cc6d6; vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.stats { display: flex; flex-wrap: wrap; gap: 18px 34px; margin-top: 40px; }
@media (max-width: 480px) { .stats { gap: 18px 22px; } .stat b { font-size: 1.4rem; } .stat span { font-size: .82rem; } }
.stat b { display: block; font-family: var(--mono); font-size: 1.7rem; color: var(--gold); line-height: 1.2; }
.stat span { color: var(--muted); font-size: .9rem; }

/* ---------- product ---------- */
.app-card { display: flex; gap: 18px; align-items: flex-start; }
.app-card img, .app-icon { width: 72px; height: 72px; border-radius: 18px; flex: none; }
.app-icon {
  display: grid; place-items: center; background: linear-gradient(160deg, #4a72b0, #6fb3cc); color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: 1.3rem; border: 1px solid rgba(255, 255, 255, .15);
}
.app-card h3 { font-size: 1.08rem; margin-bottom: .25em; }
.app-card p { font-size: .94rem; color: var(--muted); margin-bottom: .6em; }
.app-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.app-hero img { width: 128px; height: 128px; border-radius: 30px; box-shadow: var(--shadow); }
@media (max-width: 640px) { .app-hero { grid-template-columns: 1fr; } .app-hero img { width: 96px; height: 96px; border-radius: 24px; } }
.phones { display: flex; gap: 18px; overflow-x: auto; padding: 6px 2px 18px; scroll-snap-type: x mandatory; }
.phones figure { margin: 0; flex: 0 0 210px; scroll-snap-align: start; }
.phones img { border-radius: 22px; border: 6px solid #2a3245; box-shadow: var(--shadow); }
.phones figcaption { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 10px; }
.tales { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); list-style: none; padding: 0; margin: 0; }
.tales li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tales img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; background: var(--bg-2); }
.tales div { padding: 9px 12px 11px; font-size: .9rem; line-height: 1.45; display: flex; gap: 8px; align-items: baseline; }
.tales div b { font-family: var(--mono); color: var(--gold); font-size: .78rem; flex: none; }
.tales .free { margin: 0 12px 10px; }
.plan-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.coming {
  border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 34px; text-align: center; color: var(--muted);
  background: repeating-linear-gradient(-45deg, transparent 0 12px, var(--tint) 12px 24px);
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 1.4em; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--tint); font-weight: 600; color: var(--text); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }

/* ---------- article (knowledge, privacy) ---------- */
.article-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; padding: 44px 0 80px; }
@media (max-width: 960px) { .article-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 28px; } }
.toc { position: sticky; top: 90px; align-self: start; font-size: .9rem; }
.toc h2 { font-family: var(--mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; color: var(--muted); margin-left: -1px; border-left: 2px solid transparent; line-height: 1.45; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.on { color: var(--gold); border-left-color: var(--gold); }
@media (max-width: 960px) {
  .toc { position: static; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
}
.prose { max-width: 780px; }
.prose h2 { margin-top: 2.2em; padding-top: .4em; scroll-margin-top: 86px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.7em; scroll-margin-top: 86px; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .35em; }
.prose :not(pre) > code {
  background: var(--gold-dim); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: .88em; color: #634509;
  overflow-wrap: anywhere;
}
.note {
  border: 1px solid var(--cyan-line); background: var(--cyan-dim); border-radius: var(--radius-sm); padding: 14px 18px; margin: 0 0 1.4em;
}
.note.warn { border-color: var(--gold-line); background: var(--gold-dim); }
.note > :last-child { margin-bottom: 0; }
.note strong:first-child { color: var(--text); }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a { font-family: var(--mono); font-size: .9rem; }

/* code blocks */
.code { position: relative; margin: 0 0 1.4em; }
.code pre {
  margin: 0; padding: 18px 20px; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow-x: auto; font-size: .86rem; line-height: 1.7; color: var(--code-text); tab-size: 4;
}
.code[data-lang]::before {
  content: attr(data-lang); position: absolute; top: 0; left: 16px; transform: translateY(-50%);
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--cyan); padding: 1px 8px; border-radius: 999px;
}
.copy-btn {
  position: absolute; top: 8px; right: 8px; font-family: var(--mono); font-size: .72rem; padding: 4px 10px; border-radius: 6px;
  background: rgba(255, 255, 255, .08); color: #aab3c2; border: 1px solid rgba(255, 255, 255, .12); cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }
/* Prism tokens */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #8a93a3; font-style: italic; }
.token.keyword, .token.important, .token.atrule, .token.rule { color: #c792ea; }
.token.string, .token.char, .token.attr-value, .token.regex { color: #c3e88d; }
.token.number, .token.boolean, .token.constant, .token.symbol { color: #f78c6c; }
.token.function, .token.class-name { color: #82aaff; }
.token.operator, .token.punctuation { color: #89ddff; }
.token.builtin, .token.property, .token.tag, .token.selector { color: #ffcb6b; }
.token.variable, .token.parameter { color: #f07178; }
.token.directive, .token.macro, .token.annotation { color: #7cc6d6; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 28px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.mail-big { font-family: var(--mono); font-size: clamp(1rem, 2.6vw, 1.25rem); word-break: break-all; color: var(--gold); }
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: .92rem; color: var(--muted); }
.form input, .form select, .form textarea {
  font: inherit; color: var(--text); background: var(--field-bg); border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 14px; width: 100%;
}
.form textarea { min-height: 150px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-dim); }
.form-msg { font-size: .9rem; color: var(--muted); min-height: 1.5em; margin: 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 28px; margin-top: 40px; background: var(--footer-bg); font-size: .93rem; }
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 30px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > :first-child { grid-column: 1 / -1; } }
.site-footer h4 { font-family: var(--mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.foot-bottom { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: .85rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .cursor { animation: none; }
  a.card:hover, .btn:hover { transform: none; }
}
