/* Caravel Pay: shared tokens, fonts, base elements, buttons, code blocks.
   Used by the landing page and the docs. No framework. */

/* ---------- Fonts (self-hosted, latin subset, SIL OFL 1.1) ---------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/inter-tight-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-latin-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* night */
  --night: #070b13;
  --night-1: #0a1120;
  --night-2: #0e192c;
  --night-3: #15233a;
  --moon: #f3eee3;            /* text on night: 16.9:1 */
  --moon-2: #b9b6ae;          /* secondary on night: 9.3:1 */
  --moon-3: #8d8c88;          /* tertiary on night: 5.6:1 */

  /* day */
  --cream: #f6f2e9;
  --cream-2: #efe9dc;
  --cream-3: #e5ddcb;
  --paper: #fffdf8;
  --ink: #141821;             /* on cream: 16.0:1 */
  --ink-2: #474d5a;           /* on cream: 7.6:1 */
  --ink-3: #626773;           /* on cream: 5.2:1, on paper 5.6:1 */
  --line: rgba(20, 24, 33, 0.1);
  --line-2: rgba(20, 24, 33, 0.06);

  /* accent: amber, used sparingly */
  --amber: #f2b544;
  --amber-ink: #8a5a06;       /* amber-family text on cream: 5.3:1 */
  --amber-wash: rgba(242, 181, 68, 0.38);

  --green: #1d7550;           /* on paper: 5.6:1 */
  --green-wash: #e4f1e8;
  --usdc: #2775ca;

  --focus: var(--ink);

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 2px rgba(20, 24, 33, 0.04), 0 14px 34px -18px rgba(20, 24, 33, 0.2);
  --shadow-float: 0 2px 6px rgba(7, 11, 19, 0.08), 0 40px 90px -36px rgba(7, 11, 19, 0.55);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
code, kbd, pre, samp { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.on-dark { --focus: var(--amber); }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--moon);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand svg { width: 26px; height: 26px; flex: none; }
.brand .brand-pay { font-weight: 400; opacity: 0.62; }

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--btn-h);
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 15.5px;
  font-weight: 550;
  letter-spacing: -0.005em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.btn svg { width: 15px; height: 15px; flex: none; transition: transform 0.18s ease; }
.btn:hover svg.arrow { transform: translateX(3px); }
.btn-sm { --btn-h: 38px; padding: 0 16px; font-size: 14.5px; }
.btn-lg { --btn-h: 54px; padding: 0 28px; font-size: 16.5px; }

.btn-moon { background: var(--moon); color: var(--ink); }
.btn-moon:hover { background: #fff; }
.btn-ink { background: var(--ink); color: var(--cream); }
.btn-ink:hover { background: #000; }
.btn-amber { background: var(--amber); color: #1b1406; }
.btn-amber:hover { background: #f6c25f; }
.btn-ghost { background: transparent; color: var(--ink); border-color: rgba(20, 24, 33, 0.16); }
.btn-ghost:hover { background: rgba(20, 24, 33, 0.04); border-color: rgba(20, 24, 33, 0.28); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 550;
  text-decoration: none;
  color: var(--ink);
}
.link-arrow svg { width: 14px; height: 14px; transition: transform 0.18s ease; }
.link-arrow:hover svg { transform: translateX(3px); }
.link-arrow:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* ---------- Eyebrow + chips ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-2);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}
.status.is-paid { color: var(--green); background: var(--green-wash); border-color: rgba(29, 117, 80, 0.18); }
.status.is-paid::before { opacity: 1; }
.status.is-warn { color: var(--amber-ink); background: #fbf0d9; border-color: rgba(138, 90, 6, 0.18); }

/* ---------- Code blocks (navy cards) ---------- */
.code {
  position: relative;
  border-radius: var(--radius);
  background: var(--night-1);
  color: #dfe3ea;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 2px rgba(7, 11, 19, 0.2);
  overflow: hidden;
  --focus: var(--amber);
}
.code-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 8px 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
}
.code-title {
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--moon-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.code-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.code-tabs::-webkit-scrollbar { display: none; }
.code-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--moon-3);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.code-tab:hover { color: var(--moon); }
.code-tab[aria-selected="true"] { color: var(--moon); background: rgba(255, 255, 255, 0.08); }
.code-copy {
  appearance: none;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--moon-2);
  font-family: var(--font-mono);
  font-size: 12px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  flex: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
html:not(.js) .code-copy { display: none; }
.code-copy:hover { color: var(--moon); border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.04); }
.code-copy svg { width: 13px; height: 13px; }
.code-copy.is-done { color: #9fe0bd; border-color: rgba(159, 224, 189, 0.35); }
.code pre {
  margin: 0;
  padding: 18px 20px 20px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  tab-size: 2;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.code pre code { font: inherit; white-space: pre; }
.code [role="tabpanel"][hidden] { display: none; }

/* syntax tokens (applied by main.js; plain text without JS) */
.tok-c { color: #7f8899; font-style: normal; }
.tok-s { color: #ecc98a; }
.tok-k { color: #a9bff0; }
.tok-n { color: #f0b48a; }
.tok-v { color: #9fd8c4; }
.tok-p { color: #c5b7ef; }
.http-ok { color: #9fe0bd; }
