/* Top Pay -- the public site.
 *
 * The filename carries a version because nginx serves everything under
 * /assets/ with `immutable` and a one-year max-age. Change this file and you
 * must change its name (v1 -> v2) and the <link> that points at it, or
 * browsers that have already been here will keep the old one until 2027.
 *
 * No web fonts, no CDN, no third-party anything. Partly because the console
 * next door runs a deny-by-default CSP and it would be odd for the front door
 * to be looser, and partly because a payments company that leaks its
 * visitors to a font host has already said something about itself. Both
 * typefaces are the ones the reader's machine already has.
 */

/* ------------------------------------------------------------------ tokens */
/* Light is the default and is defined in full here. The dark block below
 * redefines only these values, so no component ever needs to know which
 * theme it is in. */
:root {
  --paper:       #f3f6f4;   /* cool neutral, pulled a few degrees toward the
                               accent so it reads as chosen rather than grey */
  --card:        #ffffff;
  --sunk:        #eaefec;
  --ink:         #0b1411;
  --ink-2:       #48594f;
  --ink-3:       #75867c;
  --line:        #dbe4de;
  --line-strong: #c3d0c8;
  --accent:      #07806d;
  --accent-ink:  #ffffff;
  --accent-soft: #e3f0ec;
  --warn:        #9a6206;
  --warn-soft:   #fbf0dd;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  /* Everything that is a *value* is set in this: amounts, currency codes,
     status names, field names, identifiers. Prose is never set in it. */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --measure: 68ch;
  --page: 1140px;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;

  --shadow: 0 1px 2px rgba(11, 20, 17, .05),
            0 8px 24px -14px rgba(11, 20, 17, .18);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:       #0a0f0e;
    --card:        #121a17;
    --sunk:        #0e1513;
    --ink:         #e9f0ec;
    --ink-2:       #a3b3ac;
    --ink-3:       #7b8b84;
    --line:        #243029;
    --line-strong: #32423a;
    --accent:      #3ac6a9;
    --accent-ink:  #04201b;
    --accent-soft: #10241f;
    --warn:        #e0a94a;
    --warn-soft:   #241c0d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4),
              0 8px 24px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper:       #0a0f0e;
  --card:        #121a17;
  --sunk:        #0e1513;
  --ink:         #e9f0ec;
  --ink-2:       #a3b3ac;
  --ink-3:       #7b8b84;
  --line:        #243029;
  --line-strong: #32423a;
  --accent:      #3ac6a9;
  --accent-ink:  #04201b;
  --accent-soft: #10241f;
  --warn:        #e0a94a;
  --warn-soft:   #241c0d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4),
            0 8px 24px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.65 var(--sans);
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -.03em;
  font-weight: 640;
  text-wrap: balance;
}
h1 { font-size: clamp(2.35rem, 6vw, 3.9rem); letter-spacing: -.04em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.0625rem; letter-spacing: -.015em; font-weight: 620; }

p { margin: 0; text-wrap: pretty; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Every digit that sits in a column lines up. */
table, .num, .mono, code, kbd { font-variant-numeric: tabular-nums; }

.mono, code, kbd { font-family: var(--mono); }

/* --------------------------------------------------------------- utilities */
.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: 24px;
}
@media (max-width: 560px) { .wrap { padding-inline: 18px; } }

.measure { max-width: var(--measure); }

.eyebrow {
  font: 600 .6875rem/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lede {
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--ink-2);
  letter-spacing: -.012em;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 24px; top: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-sm);
  font-weight: 600;
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: 600 .9375rem/1 var(--sans);
  letter-spacing: -.01em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .16s ease, border-color .16s ease,
              transform .16s ease, color .16s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn.ghost:hover { background: var(--card); border-color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}

/* ------------------------------------------------------------------- header */
.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
@supports not (backdrop-filter: blur(1px)) {
  .masthead { background: var(--paper); }
}

.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -.028em;
  font-size: 1.0625rem;
  margin-right: auto;
}
.brand .mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}
.brand .mark svg { width: 16px; height: 16px; display: block; }

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: .9375rem;
  font-weight: 500;
}
.nav a:hover { color: var(--ink); }

@media (max-width: 820px) {
  .nav .hide-sm { display: none; }
  .masthead .wrap { gap: 16px; }
}

/* --------------------------------------------------------------- sections */
section { padding-block: 84px; }
section + section { border-top: 1px solid var(--line); }
@media (max-width: 720px) { section { padding-block: 60px; } }

.section-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 44px;
}

/* ------------------------------------------------------------------- hero */
.hero {
  padding-block: 96px 88px;
  position: relative;
  overflow: hidden;
}
/* A single soft wash behind the headline. It is the only decorative
   flourish on the page; everything else earns its space by carrying data. */
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 40% 40% -20%;
  background: radial-gradient(45% 50% at 50% 50%,
              color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
  pointer-events: none;
}
.hero > .wrap { position: relative; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 56px;
  align-items: center;
}
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
}

.hero-copy { display: flex; flex-direction: column; gap: 22px; align-items: flex-start; }
.hero-copy h1 .quiet { color: var(--ink-3); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ----------------------------------------------------- the corridor panel */
/* Presented as an instrument rather than an illustration: the same fields an
   operator would read off the console, with the same words. */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--sunk);
}
.panel-tabs button {
  flex: 1;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 14px 12px;
  font: 600 .8125rem/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.panel-tabs button:hover { color: var(--ink); }
.panel-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: var(--card);
  border-bottom-color: var(--accent);
}

.panel-body { padding: 22px 24px 24px; }

.rows { display: flex; flex-direction: column; gap: 0; }
.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
}
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row dt, .row .k {
  font-size: .875rem;
  color: var(--ink-3);
  white-space: nowrap;
}
.row dd, .row .v {
  margin: 0;
  font-family: var(--mono);
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font: 600 .6875rem/1.5 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.chip.ok   { background: var(--accent-soft); color: var(--accent); }
.chip.none { background: var(--warn-soft);   color: var(--warn); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------- the corridor table */
.table-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: .9375rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}
table.data thead th {
  font: 600 .6875rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom-color: var(--line-strong);
  white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.code { font-family: var(--mono); font-size: .875rem; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child,  table.data td:last-child  { padding-right: 0; }

.country {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -.015em;
  white-space: nowrap;
}
.country .iso {
  font: 600 .6875rem/1 var(--mono);
  letter-spacing: .08em;
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--sunk);
  color: var(--ink-3);
  border: 1px solid var(--line);
}

.note {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-2);
  font-size: .9375rem;
}

/* ------------------------------------------------------------- the sequence */
/* Numbered because a payment genuinely is a sequence -- each step cannot
   happen before the one above it. Nothing else on this page is numbered. */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 2px;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font: 600 .8125rem/1.6 var(--mono);
  letter-spacing: .06em;
  color: var(--accent);
}
.steps .body { display: flex; flex-direction: column; gap: 7px; }
.steps .body p { color: var(--ink-2); font-size: .9375rem; }
.steps .body code {
  font-size: .8125rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--sunk);
  border: 1px solid var(--line);
  color: var(--ink);
}
@media (max-width: 560px) {
  .steps li { grid-template-columns: 34px minmax(0, 1fr); gap: 14px; }
}

/* ------------------------------------------------------------ the code block */
.code-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}
@media (max-width: 900px) { .code-grid { grid-template-columns: 1fr; } }

.snippet {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.snippet header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--sunk);
}
.snippet header .title {
  font: 600 .75rem/1 var(--mono);
  letter-spacing: .06em;
  color: var(--ink-2);
  margin-right: auto;
}
.snippet .copy {
  appearance: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 4px 9px;
  font: 600 .6875rem/1.4 var(--mono);
  letter-spacing: .05em;
  color: var(--ink-2);
  cursor: pointer;
}
.snippet .copy:hover { color: var(--ink); border-color: var(--ink-3); }
.snippet pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font: 400 .8125rem/1.7 var(--mono);
  color: var(--ink);
  flex: 1;
}
.snippet .k  { color: var(--accent); }              /* json keys, http verbs */
.snippet .s  { color: var(--ink);    }              /* strings */
.snippet .n  { color: var(--warn);   }              /* numbers */
.snippet .c  { color: var(--ink-3);  }              /* comments, punctuation */

/* ------------------------------------------------------- the minor-unit demo */
.demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}
@media (max-width: 640px) {
  .demo { grid-template-columns: 1fr; align-items: stretch; }
  .demo .arrow { display: none; }
}
.demo label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font: 600 .6875rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.demo .controls { display: flex; gap: 8px; }
.demo input, .demo select, .demo output {
  /* The label above is uppercased, and text-transform inherits. Without
     this the worked example reads "AMOUNT_MINOR", which is not a field
     this API has -- the one page on the site that shows an exact value
     would be showing the wrong one. */
  text-transform: none;
}
.demo input, .demo select {
  font: 500 1rem/1.2 var(--mono);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  min-width: 0;
}
.demo input { flex: 1; }
.demo input::placeholder { color: var(--ink-3); opacity: 1; }
.demo input:focus, .demo select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.demo .arrow { color: var(--ink-3); padding-bottom: 12px; font-family: var(--mono); }
.demo output {
  display: block;
  font: 500 1rem/1.2 var(--mono);
  padding: 11px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--sunk);
  color: var(--ink);
  overflow-x: auto;
  white-space: nowrap;
}
.demo output.bad { color: var(--warn); border-color: var(--warn); }

/* -------------------------------------------------------------- feature grid */
.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 36px 40px;
}
.feature { display: flex; flex-direction: column; gap: 9px; }
.feature p { color: var(--ink-2); font-size: .9375rem; }
.feature .rule {
  width: 26px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 5px;
}

/* -------------------------------------------------------------------- close */
.close {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow);
}
.close .copy { display: flex; flex-direction: column; gap: 8px; }
.close .copy p { color: var(--ink-2); }

/* ------------------------------------------------------------------- footer */
.foot {
  border-top: 1px solid var(--line);
  padding-block: 36px 44px;
  color: var(--ink-3);
  font-size: .875rem;
}
.foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 20px; margin-left: auto; }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }

/* -------------------------------------------------------------------- motion */
/* Entrances start from a visible resting state, so the page is complete in
   its first frame whether or not this ever runs. */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .5s cubic-bezier(.2, .7, .3, 1) both; }
  .rise:nth-child(2) { animation-delay: .07s; }

  /* Settles into place rather than fading in. Animating opacity from 0
     would park the hero invisible until the animation runs, so the first
     painted frame -- the one a link preview and a screenshot capture --
     would be an empty page. It moves; it is never not there. */
  @keyframes rise {
    from { transform: translateY(9px); }
  }
}

/* ------------------------------------------------------------------ the 404 */
.oops {
  min-height: 72vh;
  display: grid;
  place-items: center;
  text-align: center;
}
.oops .wrap { display: flex; flex-direction: column; gap: 18px; align-items: center; }

/* --------------------------------------------------------------- modifiers */
/* Named rather than written inline. The console next door runs a CSP that
   forbids inline styles outright, and having the front door play by a
   different rule is how the habit comes back. */
.section-head.spaced { margin-top: 52px; }
.small-body { color: var(--ink-2); font-size: .9375rem; }
