/* Whitechain x402 Facilitator site. No framework, no web fonts, no JavaScript required. */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --bg-raised: #ffffff;
  --bg-sunk: #f1efe9;
  --ink: #14171a;
  --ink-soft: #454b54;
  --ink-faint: #6a717c;
  --line: #dedbd2;
  --accent: #0a6b52;
  --accent-ink: #ffffff;
  --accent-soft: #e2f3ec;
  --warn: #8a4b00;
  --code-bg: #14171a;
  --code-ink: #e9ecef;
  --code-dim: #9aa4b1;
  --code-key: #7ee2bd;
  --code-str: #f3c98b;
  --radius: 10px;
  --measure: 68ch;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1013;
    --bg-raised: #151a1f;
    --bg-sunk: #0a0c0f;
    --ink: #eceef1;
    --ink-soft: #b9c0c9;
    --ink-faint: #8b94a0;
    --line: #262d35;
    --accent: #5fe0b4;
    --accent-ink: #062018;
    --accent-soft: #10271f;
    --warn: #f0b561;
    --code-bg: #07090b;
    --code-ink: #e9ecef;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 0.9rem;
  z-index: 10;
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.wrap {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.brand svg {
  width: 1.6rem;
  height: 1.6rem;
  flex: none;
}

.top nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.95rem;
  overflow-x: auto;
}

.top nav a {
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0;
}

.top nav a:hover,
.top nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

@media (max-width: 34rem) {
  .brand span {
    display: none;
  }
}

/* Hero */

.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 720;
  text-wrap: balance;
}

.lede {
  margin: 1.25rem 0 0;
  max-width: 44rem;
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.9rem;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.15rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--ink-faint);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  filter: brightness(1.07);
}

.endpoint {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.8rem;
  font-size: 0.95rem;
  color: var(--ink-faint);
}

.endpoint code {
  font-size: 1rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-raised);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0;
  margin: 2.5rem 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
}

.facts div {
  padding: 0.9rem 1.1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 -1px -1px 0;
}

.facts dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

.facts dd {
  margin: 0.15rem 0 0;
  font-weight: 620;
}

/* Sections */

main section {
  padding: 3.25rem 0;
  border-bottom: 1px solid var(--line);
}

main section:last-of-type {
  border-bottom: 0;
}

h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.3;
}

h4 {
  margin: 1.5rem 0 0.4rem;
  font-size: 1rem;
}

p,
ul,
ol {
  max-width: var(--measure);
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}

li {
  margin: 0.3rem 0;
}

.muted {
  color: var(--ink-faint);
}

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.card {
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.card h3 {
  margin-top: 0;
}

.card p:last-child {
  margin-bottom: 0;
}

/* Flow */

.flow {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  max-width: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

.flow li {
  counter-increment: step;
  margin: 0;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.flow li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  margin-bottom: 0.6rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.flow strong {
  display: block;
}

.flow span {
  color: var(--ink-soft);
  font-size: 0.97rem;
}

/* Code */

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 0.12em 0.36em;
  border-radius: 4px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

pre {
  margin: 1rem 0 1.25rem;
  padding: 1.05rem 1.15rem;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--line);
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
  tab-size: 2;
}

pre code {
  font-size: inherit;
}

pre .c {
  color: var(--code-dim);
}

pre .k {
  color: var(--code-key);
}

pre .s {
  color: var(--code-str);
}

.label {
  display: inline-block;
  margin: 1.5rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.label + pre {
  margin-top: 0.45rem;
}

/* Tables */

.table {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

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

caption {
  caption-side: top;
  text-align: left;
  padding: 0.8rem 1rem 0;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

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

thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  white-space: nowrap;
}

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

tbody th {
  font-weight: 620;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.pill.wait {
  background: var(--bg-sunk);
  color: var(--warn);
}

.method {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

/* FAQ */

.faq {
  max-width: 50rem;
}

.faq h3 {
  margin-top: 1.75rem;
  font-size: 1.1rem;
}

.faq p {
  color: var(--ink-soft);
}

/* Callout */

.note {
  margin: 1.25rem 0;
  padding: 0.9rem 1.1rem;
  max-width: var(--measure);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.note p:last-child {
  margin-bottom: 0;
}

/* Docs layout */

.docs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.toc {
  font-size: 0.93rem;
}

.toc h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2 12rem;
}

.toc a {
  color: var(--ink-soft);
  text-decoration: none;
}

.toc a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (min-width: 62rem) {
  .docs {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 3rem;
  }

  .toc {
    position: sticky;
    top: 5rem;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
  }

  .toc ol {
    columns: 1;
  }
}

.docs article > section {
  padding: 0 0 2.5rem;
  margin-bottom: 2.5rem;
}

.docs article > section:first-of-type {
  margin-top: 1.5rem;
}

.docs article h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  margin-bottom: 1rem;
}

/* Footer */

footer {
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--line);
  background: var(--bg-sunk);
  font-size: 0.92rem;
  color: var(--ink-faint);
}

footer .cols {
  margin-top: 0;
}

footer h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

footer ul {
  list-style: none;
  padding: 0;
}

footer p {
  max-width: 60rem;
}

.legal {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}
