/* developers.villamarket.ai: one calm dark ground for every page (home, guide, explorer, schema, status, partner
   key). Villa's own hues, lifted for the dark. Text contrast on every ground is 5.2:1 or more. */
:root {
  --bg: #0b0d17;
  --surface: #12152a;
  --surface-2: #191d36;
  --line: #262b47;
  --line-2: #343a5c;
  --ink: #f2f3f7;
  --ink-2: #b6bccb;
  --ink-3: #8f95ab;
  --red: #f0666c;
  --red-deep: #c62128;
  --gold: #f2b705;
  --green: #3fc67a;
  --navy: #8c8ae6;
  --code-bg: #0a0c1a;
  --code-ink: #e6e8f5;
  --code-dim: #8a8fb3;
  --code-key: #9ecbff;
  --code-str: #a5e3b3;
  --code-num: #f7c77e;
  --code-fn: #f5a3c0;
  --topic: var(--navy);
  --sans: 'Inter', 'Anuphan', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
[data-topic='catalogue'] { --topic: var(--green); }
[data-topic='orders'] { --topic: var(--gold); }
[data-topic='payments'] { --topic: var(--red); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
canvas { display: block; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.capture *, .capture *::before, .capture *::after { transition: none !important; }

/* ---------- Navigation (every page) ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; white-space: nowrap; }
.brand img { height: 17px; width: auto; display: block; filter: brightness(0) invert(1); }
.brand img.mark { display: none; height: 20px; }
.brand .sep { width: 1px; height: 22px; background: var(--line-2); }
.brand .name { color: var(--ink-2); font-weight: 500; }
.links { display: flex; gap: 22px; font-size: 14.5px; color: var(--ink-2); }
.links a { text-decoration: none; }
.links a:hover, .links a[aria-current] { color: var(--ink); }
.links a[aria-current] { font-weight: 600; }
.nav .cta { margin-left: auto; }
@media (max-width: 960px) { .links { display: none; } }
@media (max-width: 560px) { .brand img.full, .brand .sep { display: none; } .brand img.mark { display: block; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 10px;
  font: 600 15px/1 var(--sans); text-decoration: none; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--line-2); color: var(--ink); background: transparent;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: #fff; }
.btn.small { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 10px; background: var(--surface);
}
.eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(63, 198, 122, .18); }
h1 { font-size: clamp(36px, 6vw, 68px); line-height: 1.04; letter-spacing: -0.035em; margin: 14px 0 12px; font-weight: 700; }
h2 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -0.025em; margin: 0 0 12px; }
/* Colourful title: each letter is its own box from the first paint, so the effect moves nothing around it. */
.colourful .w { white-space: nowrap; }
.colourful .w > span { display: inline-block; }
.lede { font-size: 18.5px; color: var(--ink-2); max-width: 36em; margin: 0; }
.kicker { font: 600 12.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
code { font-family: var(--mono); }

/* ---------- Code card ---------- */
.code { min-width: 0; max-width: 100%; background: var(--code-bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.code-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); font: 500 12.5px/1 var(--mono); color: var(--code-dim); }
.code-head .file { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.code-head .file::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--topic); }
.code-head button { font: inherit; color: var(--code-dim); background: none; border: 1px solid transparent; border-radius: 6px; padding: 6px 9px; cursor: pointer; }
.code-head button[aria-selected='true'] { color: var(--code-ink); border-color: var(--line-2); background: var(--surface); }
pre { margin: 0; padding: 16px 18px; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.7 var(--mono); color: var(--code-ink); tab-size: 2; }
pre .k { color: var(--code-key); }
pre .s { color: var(--code-str); }
pre .n { color: var(--code-num); }
pre .f { color: var(--code-fn); }
pre .c { color: var(--code-dim); font-style: italic; }
.code-foot { border-top: 1px solid var(--line); padding: 12px 18px; font: 13px/1.6 var(--mono); color: var(--code-dim); background: rgba(255, 255, 255, .015); }
.code-foot b { color: var(--code-ink); font-weight: 500; }

/* ---------- Home: hero ---------- */
.hero { position: relative; padding: 36px 0 64px; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: -20% -10% auto; height: 900px; pointer-events: none;
  background: radial-gradient(closest-side at 50% 55%, color-mix(in srgb, var(--topic) 13%, transparent), transparent 70%);
  transition: background .8s;
}
.hero-head { text-align: center; position: relative; }
.hero-head .lede { margin: 0 auto; }
.ctas { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px) minmax(0, 1fr); align-items: center; gap: 28px; margin-top: 18px; }
.stage .orb { width: 100%; aspect-ratio: 1; position: relative; }
.stage .orb canvas { width: 100%; height: 100%; }
.stage .orb::after { content: ''; position: absolute; inset: 7%; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--topic) 26%, transparent); transition: border-color .8s; pointer-events: none; }
.side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.side > * { min-width: 0; }
.side.left { align-items: flex-end; text-align: right; }
.tile { width: min(100%, 300px); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: var(--surface); cursor: pointer; text-align: inherit; font: inherit; color: inherit; transition: border-color .3s, background .3s; }
.tile:hover { border-color: var(--line-2); }
.tile[aria-selected='true'] { border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 7%, var(--surface)); }
.tile .kicker { color: var(--c); }
.tile b { display: block; font-size: 16px; margin: 6px 0 2px; letter-spacing: -0.01em; }
.tile code { font-size: 12.5px; color: var(--code-key); display: block; margin-top: 4px; }
.facts { display: flex; gap: 28px; flex-wrap: wrap; justify-content: center; margin-top: 20px; color: var(--ink-3); font-size: 14px; }
.facts b { display: block; color: var(--ink); font-size: 22px; letter-spacing: -0.02em; font-weight: 600; }
.chips { display: none; justify-content: center; }
.topics { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.topics button { font: 600 14.5px/1 var(--sans); color: var(--ink-2); background: none; border: 0; border-radius: 9px; padding: 11px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.topics button i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .55; }
.topics button[aria-selected='true'] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.topics button[aria-selected='true'] i { opacity: 1; }
@media (max-width: 1080px) {
  .stage { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .stage .orb { width: min(76vw, 400px); margin: 0 auto; order: 1; }
  .side.left { display: none; }
  .chips { display: flex; order: 2; }
  .side.right { order: 3; }
}
@media (max-width: 560px) {
  .hero { padding-top: 24px; }
  .stage .orb { width: min(70vw, 300px); }
  .topics button { padding: 10px 12px; font-size: 14px; }
  .lede { font-size: 16.5px; }
  pre { font-size: 12.5px; padding: 14px 16px; }
  .btn { height: 42px; padding: 0 15px; font-size: 14.5px; }
}

/* ---------- Home: sections ---------- */
section.band { padding: 88px 0; border-top: 1px solid var(--line); }
.sub { color: var(--ink-2); font-size: 17px; max-width: 42em; margin: 0; }
.grid { display: grid; gap: 16px; margin-top: 32px; }
.steps { grid-template-columns: repeat(4, minmax(0, 1fr)); counter-reset: s; }
.cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.steps .box::before { counter-increment: s; content: '0' counter(s); font: 600 13px var(--mono); color: var(--ink-3); }
.box h3 { margin: 10px 0 6px; font-size: 17px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cards .box h3 { margin-top: 0; }
.box p { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; }
.box code, .box .api { font: 13px var(--mono); color: var(--code-key); }
.tag { font: 600 11.5px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: 4px 8px; border: 1px solid currentColor; }
.tag.live { color: var(--green); }
.tag.sandbox { color: var(--gold); }
@media (max-width: 900px) { .steps, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .steps, .cards { grid-template-columns: minmax(0, 1fr); } section.band { padding: 64px 0; } }

.tablewrap { border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; margin-top: 24px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
@media (max-width: 560px) { th, td { padding: 10px 12px; } }
th { background: var(--surface); color: var(--ink-3); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
td { color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }
td code { color: var(--code-key); font-size: 13.5px; }

.rules { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
.rules li { display: flex; gap: 14px; align-items: baseline; color: var(--ink-2); font-size: 16.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.rules li::before { content: '→'; color: var(--navy); }
.rules b { color: var(--ink); }
.rules code { color: var(--code-key); font-size: .9em; }
.cta-band { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px; }
.cta-band p { margin: 0; color: var(--ink-2); }
.cta-band .ctas { margin: 0; }

footer.foot { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-3); font-size: 14px; }
footer.foot .wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
footer.foot a { text-decoration: none; color: var(--ink-2); }
footer.foot img { height: 14px; width: auto; filter: brightness(0) invert(1); opacity: .8; }
footer.foot .spacer { margin-left: auto; }

/* ---------- Reading pages: guide, schema, status, partner key ---------- */
.layout { width: min(1240px, 100% - 32px); margin: 0 auto; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; }
.toc { position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 64px); overflow-y: auto; padding: 32px 0; font-size: 14px; }
.toc .label { font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 6px 12px; border-left: 2px solid var(--line); color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); border-left-color: var(--ink-3); }
.toc a.on { color: var(--ink); border-left-color: var(--navy); font-weight: 600; background: var(--surface); }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { position: static; max-height: none; padding: 20px 0 0; min-width: 0; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 8px; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
  .toc .label { display: none; }
}
article { padding: 32px 0 96px; min-width: 0; max-width: 800px; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.meta canvas { width: 40px; height: 40px; }
.pill { font: 600 12px/1 var(--sans); padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.pill.live { color: var(--green); }
article h1 { font-size: clamp(32px, 4.4vw, 44px); line-height: 1.15; letter-spacing: -.025em; margin: 12px 0 16px; }
article h2 { font-size: 24px; line-height: 1.3; letter-spacing: -.015em; margin: 56px 0 12px; padding-top: 24px; border-top: 1px solid var(--line); }
article h3 { font-size: 18px; margin: 32px 0 8px; }
article p, article li { color: var(--ink-2); overflow-wrap: anywhere; }
article strong { color: var(--ink); }
article a { color: var(--navy); }
article hr { display: none; }
article :not(pre) > code { font: 500 .86em var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--ink); word-break: break-word; }
.pre { position: relative; margin: 18px 0; }
article pre { background: var(--code-bg); border: 1px solid var(--line); color: var(--code-ink); border-radius: 12px; padding: 18px 20px; font-size: 13.5px; }
.pre button { position: absolute; top: 10px; right: 10px; font: 500 12px/1 var(--sans); color: var(--code-dim); background: var(--code-bg); border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 10px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.pre:hover button, .pre button:focus-visible { opacity: 1; }
@media (hover: none) { .pre button { opacity: 1; } }
.pre pre { padding-right: 76px; }
@media (max-width: 560px) { .pre pre { padding: 44px 16px 16px; } }
article .table { border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; margin: 18px 0; }
article table { font-size: 14.5px; }
article th { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); }
blockquote { margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--red); background: var(--surface); border-radius: 0 10px 10px 0; }
blockquote p { margin: 0; }

/* Schema */
.sdl-block { margin: 18px 0; }
.sdl .kw { color: var(--code-key); }
.sdl .ty { color: var(--code-fn); }
.sdl .st { color: var(--code-str); }
.sdl .dim { color: var(--code-dim); font-style: italic; }

/* Status */
.checks { display: grid; gap: 12px; margin-top: 24px; }
.check { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.check .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none; }
.check[data-state='ok'] .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(63, 198, 122, .16); }
.check[data-state='down'] .dot { background: var(--red); }
.check b { color: var(--ink); font-weight: 600; }
.check span { color: var(--ink-2); }
.check code { margin-left: auto; color: var(--code-key); font-size: 13px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
