:root {
  color-scheme: dark;
  --background: #0c0c0c;
  --surface: #141619;
  --text: #d7e2ea;
  --muted: #8a939b;
  --accent: #35b8d8;
  --hairline: rgba(215, 226, 234, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  scroll-behavior: smooth;
  overflow-wrap: break-word;
}

body {
  min-width: 0;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Noto Sans SC Variable", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
}

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

a:hover,
a:focus-visible {
  color: var(--text);
}

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

header,
main,
footer {
  width: min(100% - 40px, 820px);
  margin-inline: auto;
}

header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-block: 42px 28px;
  border-bottom: 1px solid var(--hairline);
}

.site-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.header-links {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 18px;
  font-size: 0.9rem;
}

main {
  padding-block: 46px 76px;
}

footer {
  padding-block: 24px 38px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.88rem;
}

h1,
h2,
h3 {
  color: var(--text);
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 4.7rem);
  font-weight: 650;
  letter-spacing: -0.055em;
}

h2 {
  margin: 4.25rem 0 1.25rem;
  padding-top: 0.25rem;
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  font-weight: 620;
  letter-spacing: -0.035em;
}

h3 {
  margin: 2.25rem 0 0.8rem;
  font-size: 1.12rem;
  font-weight: 620;
}

p,
ul,
ol,
table,
pre,
.callout {
  margin-block: 1rem;
}

ul,
ol {
  padding-left: 1.45rem;
}

li + li {
  margin-top: 0.38rem;
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lead {
  max-width: 720px;
  margin: 1.3rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.6vw, 1.25rem);
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.toc {
  margin-top: 2.5rem;
  padding: 1.3rem 1.4rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
}

.toc h2 {
  margin: 0 0 0.85rem;
  padding: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.toc ol {
  columns: 2;
  column-gap: 2.5rem;
  margin: 0;
  padding-left: 1.25rem;
}

.toc li {
  break-inside: avoid;
  margin-bottom: 0.36rem;
}

.callout {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--accent);
  background: var(--surface);
}

.callout strong:first-child {
  color: var(--accent);
}

.cards {
  display: grid;
  gap: 16px;
  margin-top: 2.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-groups > h3 {
  margin-top: 2.2rem;
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-groups .cards {
  margin-top: 1rem;
}

.endpoint-models {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
}

.endpoint-models h2,
.feature-strip h2 {
  margin-top: 0;
}

.endpoint-models table + table {
  margin-top: 1rem;
}

.feature-strip {
  margin-top: 3rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
}

.feature-strip p {
  margin-bottom: 0;
  color: var(--muted);
}

.feature-strip ul {
  margin: 0;
  padding-left: 1.2em;
}

.feature-strip li + li {
  margin-top: 0.5rem;
}

.feature-strip li strong {
  color: var(--text);
}

.tool-groups > h3 + p {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(22px, 5vw, 32px);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.card:hover,
.card:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}

.card h2 {
  margin: 0;
  padding: 0;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.card span {
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.86rem;
}

.key-link {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
}

code,
pre,
kbd {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

code {
  color: var(--text);
  font-size: 0.9em;
}

p code,
li code,
td code {
  padding: 0.12em 0.34em;
  background: var(--surface);
}

pre {
  max-width: 100%;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--hairline);
  background: var(--surface);
  line-height: 1.55;
  white-space: pre;
  overflow-wrap: normal;
}

pre code {
  font-size: 0.84rem;
}

.code-block {
  position: relative;
  max-width: 100%;
  min-width: 0;
  margin-block: 1rem;
}

.code-block pre {
  margin: 0;
  /* Reserve room for the copy button on the right so a one-line command sits on
     the SAME line as the button, instead of being pushed down a whole row.
     7rem clears the widest label: measured "Copy failed" = 89.5px, plus the
     0.55rem right offset and a gap. */
  padding-right: 7rem;
}

.copy-button {
  position: absolute;
  z-index: 1;
  /* Vertically centred on the first code line: pre padding-top 1rem + half of
     the 0.84rem/1.55 line box, minus half the button's own height. */
  top: 0.96rem;
  right: 0.55rem;
  max-width: calc(100% - 1.1rem);
  padding: 0.32rem 0.68rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--muted);
  font: 600 0.76rem/1.4 "Noto Sans SC Variable", "PingFang SC", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  /* No `opacity` here: the button now sits on the same line as the code, so a
     long line scrolls underneath it. A translucent button would let that text
     ghost through. The dimmed look comes from the muted colours instead. */
}

.copy-button:hover,
.copy-button:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}

.copy-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copy-button.is-copied {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-button.is-failed {
  border-color: #e08080;
  color: #f0aaaa;
}

.copy-fallback {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface);
  color: var(--text);
}

td {
  color: var(--muted);
}

hr {
  margin-block: 3rem;
  border: 0;
  border-top: 1px solid var(--hairline);
}

.guide-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
}

@media (max-width: 620px) {
  header,
  main,
  footer {
    width: min(100% - 28px, 820px);
  }

  header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-block: 28px 22px;
  }

  .header-links {
    justify-content: flex-start;
  }

  main {
    padding-block: 34px 58px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 180px;
  }

  .toc ol {
    columns: 1;
  }

  h2 {
    margin-top: 3.4rem;
  }

  th,
  td {
    padding: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (hover: none) {
  .copy-button {
    color: var(--text);
  }
}

/* Getting started (added 2026-09-02): redeem → key → install, above the guide cards. */
.start {
  margin-top: 2.75rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
}

.start h2 {
  margin-top: 0;
}

.steps {
  padding-left: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  padding-left: 3rem;
  margin-top: 1.6rem;
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.95rem;
  line-height: 2rem;
  text-align: center;
}

.steps h3 {
  margin: 0 0 0.4rem;
}

.steps figure {
  margin: 1rem 0 0;
}

.steps img {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  border: 1px solid var(--hairline);
  background: var(--surface);
}

.steps figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.open-terminal ul {
  margin: 0.7rem 0 0.5rem;
}

/* ---------------------------------------------------------------------------
   Guide page components (2026-09-13). Additive and opt-in: a page gets the wide
   two-column layout only when <body> carries .doc-page, so the older guides are
   unaffected until they adopt it.
   --------------------------------------------------------------------------- */

body.doc-page header,
body.doc-page main,
body.doc-page footer {
  width: min(100% - 40px, 1140px);
}

body.doc-page main {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 0 56px;
  align-items: start;
}

.doc-toc {
  position: sticky;
  top: 28px;
  padding-top: 40px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.doc-toc-title {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.doc-toc ol {
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--hairline);
  list-style: none;
}

.doc-toc li {
  margin: 0;
}

.doc-toc a {
  display: block;
  margin-left: -1px;
  padding: 0.28rem 0 0.28rem 0.9rem;
  border-left: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.doc-toc a:hover,
.doc-toc a:focus-visible {
  border-left-color: var(--accent);
  color: var(--text);
}

.doc-body {
  min-width: 0;
}

/* Numbered procedure: the exact-steps block. */
.procedure {
  margin: 1.2rem 0 0;
  padding: 0;
  counter-reset: procedure;
  list-style: none;
}

.procedure > li {
  position: relative;
  margin-top: 1.6rem;
  padding-left: 3rem;
  counter-increment: procedure;
}

.procedure > li::before {
  position: absolute;
  top: 0.1rem;
  left: 0;
  display: flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--accent);
  content: counter(procedure);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.92rem;
}

.procedure > li > :first-child {
  margin-top: 0;
}

.procedure h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
}

.procedure .code-block,
.procedure pre {
  margin-top: 0.7rem;
}

/* Two platforms side by side, without needing JavaScript. */
.os-grid {
  display: grid;
  margin-top: 1rem;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.os-grid > div {
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
}

.os-grid h4 {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.os-grid p {
  margin: 0.5rem 0 0;
  font-size: 0.94rem;
}

.os-grid .code-block,
.os-grid pre {
  margin-top: 0.6rem;
}

/* A labelled value the reader types somewhere: "Field — value". */
.fields {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.fields > li {
  padding: 0.6rem 0;
  border-top: 1px solid var(--hairline);
}

.fields > li:last-child {
  border-bottom: 1px solid var(--hairline);
}

.fields strong {
  display: inline-block;
  min-width: 11rem;
  color: var(--muted);
  font-weight: 500;
}

/* Previous / next guide. */
.pager {
  display: grid;
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.pager a {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
  text-decoration: none;
}

.pager a:hover,
.pager a:focus-visible {
  border-color: var(--accent);
}

.pager span {
  display: block;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pager strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--text);
  font-weight: 550;
}

/* Letter badge used on the index tool cards. */
.card-icon {
  display: flex;
  width: 2.1rem;
  height: 2.1rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  margin-bottom: 0.9rem;
  background: rgba(53, 184, 216, 0.09);
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  body.doc-page main {
    display: block;
  }

  .doc-toc {
    position: static;
    padding-top: 32px;
  }

  .doc-toc ol {
    columns: 2;
    column-gap: 24px;
  }
}

.procedure figure {
  margin: 1rem 0 0;
}

.procedure img {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  border: 1px solid var(--hairline);
  background: var(--surface);
}

.procedure figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
