/* ==========================================================================
   checkout-verify / agents: machine-first API reference (J14-076)
   Audience: AI agents and integration engineers. No marketing copy.
   Dials: DESIGN_VARIANCE 4 / MOTION_INTENSITY 1 (this is a static reference
          document; the only transitions are focus and hover) /
          VISUAL_DENSITY 7 (every row on the page carries contract facts).
   System: the zero-build rule rules out every third-party design kit, so the
          tokens below ARE the system. Icons are Tabler Icons (MIT) glyphs
          embedded verbatim at stroke-width 1.5, never hand-drawn, same
          convention as ../style.css.
   Shape rule (one scale): 4px on chips and controls, 8px on panels.
   Colour rule: one accent (amber) on a cool ink ramp. Status codes are
          deliberately NOT colour-coded: a 200 that carries nulls is not
          "success green" and a 429 that still carries four data lines is not
          "error red". The meaning is in the prose.
   CSP rule: no inline style, no inline script, no remote font, no CDN, no
          data: URIs. Deployed edge: default-src 'self'; style-src 'self';
          font-src 'self'; script-src 'self'; connect-src 'none'.
   ========================================================================== */

/* 1. Fonts: Geist / Geist Mono (SIL OFL 1.1, latin subset, self-hosted).
      Relative to this file: docs/landing/agents/ -> docs/landing/fonts/.
      CJK falls through to the system CJK stack: the subset above carries no
      ideographs, and the quoted engine samples contain Chinese values. */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-sans-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-mono-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 2. Tokens */
:root {
  --bg: #0a0c10;
  --panel: #0e1218;
  --panel-2: #121821;
  --code-bg: #141b26;
  --text: #dde4ee;
  --bright: #eef3f9;
  --muted: #94a3b5;
  --faint: #7d8ca0;
  --line: #232d3b;
  --line-soft: #1a2230;
  --accent: #f0a63c;
  --accent-deep: #7d5a1e;
  --accent-wash: rgba(240, 166, 60, 0.09);
  --on-accent: #0a0c10;

  /* Monospace leads on this surface; sans is used for running prose only. */
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", "PingFang TC", "Noto Sans TC", monospace;
  --sans: "Geist", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei",
    "Source Han Sans TC", system-ui, -apple-system, sans-serif;

  --r-chip: 4px;
  --r-panel: 8px;
  --wrap: 70rem;
  --read: 45rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  color-scheme: dark;
}

/* 3. Base */
* { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.7;
  font-variant-ligatures: none;
}

/* 4. Layout: one centred sheet, a left accent spine, hairline section rules */
.sheet {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
  border-inline: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, var(--accent) 0, var(--accent) 5rem,
      transparent 5rem) no-repeat top left / 2px 100%;
}

main { display: block; }

section,
header.masthead,
footer.colophon {
  border-top: 1px solid var(--line);
  padding-inline: clamp(0rem, 2.5vw, 1.75rem);
  padding-block: clamp(2.75rem, 6vw, 4.25rem);
}

.masthead { border-top: 0; }

/* 5. Masthead */
.ident {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.625rem;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.ident .mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--bright);
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* --line is a border token (1.4:1 on the panel); a *visible glyph* must not
   inherit it. impeccable flagged this as low-contrast, and it is right. */
.ident .sep { color: var(--muted); }

.ident .pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.5rem;
  color: var(--faint);
  font-size: 0.75rem;
}

h1 {
  margin: 1.75rem 0 0;
  font-size: clamp(1.5rem, 5.2vw, 2.625rem);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.015em;
  color: var(--bright);
  max-width: 26ch;
}

h1 .verb { color: var(--accent); font-weight: 600; }

.abstract {
  margin: 1.375rem 0 0;
  max-width: var(--read);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
}

/* The invariants block: read this and you can answer most contract questions
   without calling the API. Rendered as a definition list, not a card grid. */
dl.invariants {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16.5rem), 1fr));
  gap: 1px;
  margin: 2.5rem 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
  background: var(--line-soft);
}

dl.invariants > div {
  padding: 1.125rem 1.25rem;
  background: var(--panel);
  min-width: 0;
}

dl.invariants dt {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

dl.invariants dd {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}

dl.invariants dd strong { color: var(--accent); font-weight: 600; }

/* 6. Headings and prose */
h2 {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: clamp(1.125rem, 2.6vw, 1.4375rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--bright);
}

/* impeccable 的 all-caps-body / flat-type-hierarchy 兩條 claim 查下來在 h3 上是真的：
   欄位群的標題用 <h3>（螢幕閱讀器的導覽結構），卻被排成 13px 全大寫標籤。
   標籤該是 dt／th 的形狀，h3 該有 h3 的尺寸。 */
h3 {
  margin: 2.75rem 0 0;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--accent);
}

h3 code {
  font-size: 1rem;
}

h3 + p, h3 + .table-wrap, h3 + dl.fields, h3 + figure.code { margin-top: 1rem; }

h2 + p { margin-top: 1.25rem; }


p {
  margin: 1.125rem 0 0;
  max-width: var(--read);
  font-family: var(--sans);
}

.note {
  margin: 1.25rem 0 0;
  max-width: var(--read);
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--muted);
}

.note strong, p strong { color: var(--bright); font-weight: 600; }

/* 7. Links and focus */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-deep);
  text-underline-offset: 0.18em;
}

a:hover { border-bottom-color: var(--accent); text-decoration: underline; }

a:active { background: var(--accent-wash); }

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

.skip {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  z-index: 5;
  translate: 0 -300%;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: var(--r-chip);
  padding: 0.5rem 0.875rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
}

.skip:focus { translate: 0 0; }

/* 8. Icons: Tabler glyphs, inlined verbatim, stroke-width 1.5 */
.sprite { position: absolute; }

.icon {
  width: 1em;
  height: 1em;
  flex: none;
  translate: 0 0.125em;
}

/* 9. Inline code */
code, kbd {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

code { font-size: 0.875rem; }

:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-chip);
  padding: 0.0625rem 0.3125rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

:not(pre) > code[data-role="field"] { color: var(--bright); }

a code { padding: 0; border: 0; background: none; }

kbd {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  padding: 0.0625rem 0.375rem;
  font-size: 0.8125rem;
}

/* 10. Code blocks: the only surfaces allowed to scroll sideways */
figure.code { margin: 1.75rem 0 0; max-width: 100%; }

figure.code > figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem 0.875rem;
  padding: 0 0 0.625rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

figure.code > figcaption .at {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
}

pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.75;
  font-variant-ligatures: none;
  padding: 1.125rem 1.25rem;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow-x: auto;
  overflow-y: hidden;
  tab-size: 4;
}

/* Scrollable regions are keyboard-reachable and named. */
pre[tabindex="0"]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

pre::-webkit-scrollbar { height: 10px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

pre code { color: var(--text); font-size: 0.8125rem; line-height: 1.75; }

/* 11. Tables */
.table-wrap {
  margin: 1.75rem 0 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: var(--panel);
  scrollbar-width: thin;
}

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

table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

caption {
  padding: 1.125rem 1.25rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  caption-side: top;
  text-align: left;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
}

caption b { color: var(--bright); font-weight: 600; }

thead th {
  padding: 0.75rem 1.25rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  vertical-align: bottom;
}

tbody th {
  padding: 0.9375rem 1.25rem;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 600;
  color: var(--bright);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

tbody td {
  padding: 0.9375rem 1.25rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--text);
  overflow-wrap: anywhere;
}

tbody tr:last-child > th, tbody tr:last-child > td { border-bottom: 0; }

tbody tr:hover > td, tbody tr:hover > th { background: rgba(255, 255, 255, 0.017); }

td code, th code { font-size: 0.8125rem; }

.chip {
  display: inline-block;
  padding: 0 0.375rem;
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  background: var(--panel-2);
  color: var(--bright);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.chip[data-kind="method"] {
  color: var(--accent);
  border-color: var(--accent-deep);
  background: var(--accent-wash);
}

/* 12. Field semantics as a two-column definition list */
dl.fields {
  margin: 1.75rem 0 0;
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
  background: var(--line-soft);
}

dl.fields > div {
  padding: 1.125rem 1.25rem;
  background: var(--panel);
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

dl.fields > div > dt { font-weight: 600; color: var(--bright); overflow-wrap: anywhere; }

dl.fields > div > dt .ty {
  display: block;
  margin-top: 0.3125rem;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--faint);
}

dl.fields > div > dd { margin: 0; font-family: var(--sans); color: var(--text); }

dl.fields .not {
  display: block;
  margin-top: 0.5rem;
  padding-left: 0.6875rem;
  border-left: 2px solid var(--accent-deep);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--muted);
}

@media (min-width: 46rem) {
  dl.fields > div { grid-template-columns: 15.5rem minmax(0, 1fr); gap: 1.5rem; }
}

/* 13. Red lines: the statements the repo insists on repeating */
ul.rules {
  margin: 1.75rem 0 0;
  display: grid;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
}

ul.rules > li {
  margin: 0;
  padding: 1.25rem;
  background: var(--panel);
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  align-items: start;
  max-width: none;
}

ul.rules > li > .icon {
  color: var(--accent);
  width: 1.25rem;
  height: 1.25rem;
  translate: 0 0.25rem;
}

ul.rules > li[data-icon="dim"] > .icon { color: var(--muted); }

ul.rules .say { font-family: var(--mono); font-size: 0.9375rem; font-weight: 600; color: var(--bright); }

ul.rules .why { font-family: var(--sans); color: var(--text); }

ul.rules .src {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
}

/* 14. Index of entry points */
ul.index {
  margin: 1.75rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
}

ul.index > li {
  margin: 0;
  padding: 1.125rem 1.25rem;
  background: var(--panel);
  display: grid;
  gap: 0.375rem;
  align-content: start;
  max-width: none;
}

ul.index > li > a {
  justify-self: start;
  font-size: 0.9375rem;
  font-weight: 600;
  border-bottom: 0;
}

ul.index > li > a:hover { text-decoration: underline; }

ul.index .where { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); }

ul.index .what { font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); }

/* 14b. In-page contents (the document is long; agents deep-link). */
nav.toc { margin: 2.25rem 0 0; }
nav.toc > h2 { margin: 0; }
nav.toc ol {
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
  background: var(--line-soft);
}
nav.toc li { background: var(--panel); min-width: 0; }
nav.toc a {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  border-bottom: 0;
  color: var(--text);
}
nav.toc a:hover { color: var(--accent); background: var(--accent-wash); }
nav.toc a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
nav.toc .n {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}
nav.toc a:hover .n { color: var(--accent); }

/* 15. Footer */
.colophon { border-bottom: 1px solid var(--line); }

.colophon p { font-size: 0.875rem; color: var(--muted); }

.colophon .stamp {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.125rem;
  margin: 1.75rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--faint);
}

/* 17. Narrow viewports: the page itself never scrolls sideways */
@media (max-width: 30rem) {
  body { font-size: 0.875rem; }
  .sheet { border-inline: 0; }
  section, header.masthead, footer.colophon { padding-inline: 0; }
  dl.invariants > div, dl.fields > div, ul.rules > li, ul.index > li { padding-inline: 1rem; }
  pre { padding: 0.9375rem 1rem; }
  table { min-width: 30rem; }
  .ident { font-size: 0.75rem; }
  ul.rules > li { grid-template-columns: 1rem minmax(0, 1fr); }
  ul.rules > li > .icon { width: 1rem; height: 1rem; }
}

/* 18. Resilience: reduced motion, forced colors, print */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  pre, table, dl.invariants, dl.fields, ul.rules, ul.index, .chip { border: 1px solid CanvasText; }
  .skip { background: Highlight; color: HighlightText; }
  a { color: LinkText; border-bottom-color: LinkText; }
  h1 .verb, .ident .mark, h3, ul.rules > li > .icon { color: AccentColor; }
}

@media print {
  :root { --bg: #fff; --panel: #fff; --panel-2: #fff; --code-bg: #fff; --text: #111; --bright: #000; --muted: #333; --faint: #444; --line: #999; --line-soft: #ccc; --accent: #8a5a00; --accent-deep: #8a5a00; }
  body { background: #fff; }
}