/* Tarin Hills Units API docs. Tokens follow the sales app (apps/web/src/th/styles/brand.css, tokens.css). */
@font-face { font-family: 'Brand Title'; src: url('/fonts/favorit-ext-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Brand Title'; src: url('/fonts/favorit-ext-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Brand Subtitle'; src: url('/fonts/victor-serif-400i.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Brand Text'; src: url('/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Brand Text'; src: url('/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Brand Text'; src: url('/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --mist: #edebe2; --stone: #d1cebf; --clay: #a79f8c; --golden: #cc8944; --ember: #bc502f; --walnut: #511d0b;
  --canvas: var(--mist); --surface: #f8f7f2; --raised: #ffffff; --sunken: #e2dfd3;
  --text: #1b1a16; --muted: #5a5446; --subtle: #7f7866;
  --line: var(--stone); --line-strong: #bcb7a6;
  --primary: var(--walnut); --primary-hover: #6b2a15; --accent-soft: #f5e9e3;
  --code-bg: #241008; --code-line: rgb(245 236 231 / 0.12); --code-text: #f5ece7; --code-muted: #d1ad9c;
  --hero-text: #f5ece7; --hero-muted: #e2c9bd; --hero-line: rgb(245 236 231 / 0.16);
  --available: #3f7049; --reserved: #8c5419; --sold: #9b3f22;
  --font-title: 'Brand Title', system-ui, sans-serif;
  --font-sub: 'Brand Subtitle', Georgia, serif;
  --font-text: 'Brand Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, Menlo, monospace;
  --radius: 8px; --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgb(27 26 24 / 0.06), 0 0 0 1px rgb(27 26 24 / 0.05);
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 400 15px/1.6 var(--font-text); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--font-mono); font-size: 0.86em; background: var(--sunken); border-radius: 4px; padding: 1px 5px; word-break: break-word; }
code.nw { white-space: nowrap; word-break: normal; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 10; background: var(--raised); padding: 8px 12px; border-radius: var(--radius); }
.skip:focus { left: 8px; }

/* ---------- Hero ---------- */
.hero { background: var(--walnut); color: var(--hero-text); position: relative; overflow: hidden; }
.hero::after {
  content: ''; position: absolute; inset: auto -120px -180px auto; width: 520px; height: 620px; pointer-events: none;
  background: url('/brand/01-white.svg') no-repeat center / contain; opacity: 0.05;
}
.hero :focus-visible { outline-color: var(--golden); }
.bar { max-width: 1200px; margin: 0 auto; padding: 22px 32px; display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.lockup { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.lockup img { height: 20px; width: auto; display: block; }
.lockup .sep { width: 1px; height: 18px; background: var(--hero-line); }
.lockup .prod { font: 400 12px/1 var(--font-title); text-transform: uppercase; letter-spacing: 0; color: var(--hero-muted); }
.ver { margin-left: auto; font: 500 11px/1 var(--font-text); letter-spacing: 0.08em; padding: 5px 9px; border: 1px solid var(--hero-line); border-radius: 999px; color: var(--hero-muted); }
.hero-in {
  width: calc(100% - 64px); max-width: 1136px; margin: 0 auto; padding: 36px 0 48px; position: relative; z-index: 1;
  border-top: 1px solid var(--hero-line);
}
.hero h1 { margin: 0; font: 400 44px/1.05 var(--font-title); text-transform: uppercase; letter-spacing: 0; color: #fff; }
.lede { margin: 16px 0 0; max-width: 560px; color: var(--hero-muted); font-size: 16px; line-height: 1.6; }
.bases { margin-top: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.base { display: inline-flex; align-items: center; gap: 12px; max-width: 100%; padding: 8px 8px 8px 10px; border-radius: var(--radius-lg); background: rgb(0 0 0 / 0.22); border: 1px solid var(--hero-line); }
.base code { background: none; padding: 0; color: #fff; font-size: 14px; overflow-x: auto; white-space: nowrap; }
.method { flex: none; display: inline-block; min-width: 44px; text-align: center; font: 600 11px/1 var(--font-mono); letter-spacing: 0.04em; padding: 6px 8px; border-radius: 6px; background: #3f7049; color: #fff; }
.method.post { background: var(--golden); color: #2a0e05; }
.method.sm { font-size: 10.5px; padding: 4px 6px; min-width: 40px; }
.base .method { min-width: 48px; }

/* ---------- Layout ---------- */
.layout { max-width: 1200px; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 56px; }
.toc { position: sticky; top: 0; align-self: start; padding: 40px 0 24px; max-height: 100vh; overflow: auto; }
.toc-h { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--subtle); font-weight: 500; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.toc a { display: block; padding: 6px 12px; border-radius: 6px; font-size: 14px; color: var(--muted); text-decoration: none; position: relative; transition: background 140ms var(--ease), color 140ms var(--ease); }
.toc a:hover { background: var(--sunken); color: var(--text); }
.toc a.on { color: var(--primary); font-weight: 500; background: transparent; }
.toc a.on::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--golden); }

.doc { min-width: 0; padding: 40px 0 64px; max-width: 820px; }
.doc section { padding: 8px 0 32px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.doc section:last-of-type { border-bottom: 0; }
.doc h2 { margin: 0 0 14px; font: 400 26px/1.15 var(--font-title); text-transform: uppercase; letter-spacing: 0; }
.doc h3 { margin: 28px 0 10px; font: 500 15px/1.3 var(--font-text); }
.doc p { margin: 0 0 14px; max-width: 70ch; }
.doc .small { font-size: 13.5px; color: var(--muted); }

.cards3, .cards2 { display: grid; gap: 12px; margin: 20px 0 8px; }
.cards3 { grid-template-columns: repeat(3, 1fr); }
.cards2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: 16px 18px; display: grid; gap: 4px; align-content: start; }
.card b { font-weight: 500; }
.card span { font-size: 13.5px; color: var(--muted); }

.note { margin: 18px 0; padding: 14px 18px 14px 20px; border-radius: var(--radius-lg); background: var(--raised); box-shadow: var(--shadow-1); position: relative; overflow: hidden; }
.note::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--golden); }
.note b { font-weight: 600; color: var(--text); }
.note p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- Endpoint rows ---------- */
.ep { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 8px; background: var(--raised); border-radius: var(--radius); box-shadow: var(--shadow-1); flex-wrap: wrap; }
.ep code { background: none; padding: 0; font-size: 14px; color: var(--text); }
.ep-d { margin-left: auto; font-size: 13px; color: var(--subtle); }

/* ---------- Tables ---------- */
.tbl { margin: 14px 0 18px; background: var(--raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; letter-spacing: 0.04em; color: var(--subtle); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
td { padding: 11px 16px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
td code { white-space: nowrap; word-break: normal; }
.fields td:nth-child(2) { color: var(--muted); font-size: 13px; white-space: nowrap; }
.status td:last-child { white-space: nowrap; }
.fields td:first-child code, .status td:first-child code { background: none; padding: 0; color: var(--primary); font-weight: 500; }
.tag.req { background: var(--sunken); color: var(--muted); }
.steps { margin: 16px 0 18px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; max-width: 70ch; }
.steps li { counter-increment: s; position: relative; padding-left: 36px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 500 12px/1 var(--font-text); background: var(--walnut); color: #fff; }
.steps b { font-weight: 600; }
.tag { display: inline-block; margin-left: 6px; font-size: 10.5px; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 999px; background: #f3e4d0; color: var(--reserved); vertical-align: 1px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dot.av { background: var(--available); } .dot.re { background: #e3b37c; box-shadow: inset 0 0 0 1.5px var(--reserved); } .dot.co { background: var(--reserved); }
.dot.so { background: var(--sold); } .dot.na { background: var(--clay); }
.http { font: 600 12px/1 var(--font-mono); padding: 3px 6px; border-radius: 4px; }
.http.c2 { background: var(--sunken); color: var(--available); }
.http.c4 { background: var(--sunken); color: var(--reserved); } .http.c5 { background: var(--sunken); color: var(--sold); }

/* ---------- Code ---------- */
.code { margin: 14px 0 18px; border-radius: var(--radius-lg); background: var(--code-bg); overflow: hidden; }
.tabs { display: flex; align-items: center; gap: 2px; padding: 6px 6px 0 10px; border-bottom: 1px solid var(--code-line); min-height: 40px; }
.tabs [role='tab'] { font: 500 12.5px/1 var(--font-text); color: var(--code-muted); background: none; border: 0; padding: 9px 10px 11px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs [role='tab'][aria-selected='true'] { color: #fff; border-bottom-color: var(--golden); }
.tabs .lbl { font: 500 12px/1 var(--font-text); color: var(--code-muted); padding: 8px 2px 12px; }
.copy { margin-left: auto; margin-bottom: 6px; font: 500 12px/1 var(--font-text); color: var(--code-muted); background: transparent; border: 1px solid var(--code-line); border-radius: 6px; padding: 6px 10px; cursor: pointer; transition: color 140ms var(--ease), border-color 140ms var(--ease); }
.copy:hover { color: #fff; border-color: rgb(245 236 231 / 0.3); }
.copy.done { color: #9ed3a7; border-color: #9ed3a7; }
.copy-dark { margin: 0; }
pre { margin: 0; padding: 16px 18px 18px; overflow-x: auto; color: var(--code-text); font: 400 13px/1.65 var(--font-mono); tab-size: 2; }
pre code { background: none; padding: 0; font-size: inherit; word-break: normal; }
.t-m { color: var(--code-muted); }
.t-k { color: #e3b37c; } .t-s { color: #b9dcb9; } .t-n { color: #f0a58a; } .t-c { color: #fff; font-weight: 600; }
.j-key { color: #e2c9bd; } .j-str { color: #b9dcb9; } .j-num { color: #f0a58a; } .j-lit { color: #e3b37c; }

/* ---------- Footer ---------- */
.foot { display: flex; align-items: center; gap: 12px; padding-top: 8px; color: var(--subtle); font-size: 13px; }
.foot img { height: 26px; width: auto; }

/* ---------- Narrow ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }
  .toc { position: sticky; top: 0; z-index: 5; padding: 10px 0; margin: 0 -16px; background: color-mix(in srgb, var(--canvas) 88%, transparent); backdrop-filter: saturate(1.5) blur(14px); border-bottom: 1px solid var(--line); max-height: none; }
  .toc-h { display: none; }
  .toc ol { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px; scrollbar-width: none; }
  .toc ol::-webkit-scrollbar { display: none; }
  .toc a { white-space: nowrap; padding: 6px 10px; font-size: 13px; }
  .toc a.on::before { display: none; }
  html { scroll-padding-top: 64px; }
  .bar, .hero-in { padding-left: 16px; padding-right: 16px; }
  .hero-in { padding-top: 24px; padding-bottom: 32px; width: calc(100% - 32px); padding-inline: 0; }
  .hero h1 { font-size: 34px; }
  .hero::after { display: none; }
  .bases { align-items: stretch; }
  .cards3, .cards2 { grid-template-columns: 1fr; }
  .doc { padding-top: 28px; }
  .base { display: flex; }
  .base code { white-space: normal; word-break: break-all; font-size: 13px; }
  .ep-d { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
