/* Fonts, reset and the shared primitives: wrap, type, buttons, chips, and
   the scroll reveal every section uses. */

@font-face {
  font-family: "Inter Variable";
  src: url("/assets/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 24px); -webkit-tap-highlight-color: transparent; }
/* Scrollbars in the site's colors: thin, dark and rounded, a little brighter
   on hover, and quiet in the light theme. With a mouse, the page's own is
   hidden and shell/scrollbar.rs draws one that starts below the nav. */
@media (hover: hover) and (pointer: fine) {
  html { scrollbar-width: none; }
  html::-webkit-scrollbar { display: none; }
  /* The app (signed-in pages, the trading screen) draws none of its own:
     it keeps the browser's, thin and in the site's colours. */
  html:has(.kapp) { scrollbar-width: thin; scrollbar-color: #4A464A transparent; }
  html[data-theme="light"]:has(.kapp) { scrollbar-color: #CFC6CF transparent; }
  html:has(.kapp)::-webkit-scrollbar { display: block; }
}
.scrollbar { position: fixed; right: 0; z-index: 70; width: 16px; display: flex; justify-content: center; opacity: 0; transition: opacity 400ms var(--ease); }
.scrollbar.on { opacity: 1; transition-duration: 120ms; }
.scrollbar-thumb { position: absolute; top: 0; width: 6px; border-radius: 6px; background: rgba(236, 231, 236, 0.28); transition: width 160ms var(--ease-ui), background-color 160ms var(--ease-ui); }
.scrollbar.wide .scrollbar-thumb { width: 9px; background: rgba(236, 231, 236, 0.42); }
[data-theme="light"] .scrollbar-thumb { background: rgba(30, 29, 30, 0.28); }
[data-theme="light"] .scrollbar.wide .scrollbar-thumb { background: rgba(30, 29, 30, 0.42); }
@media not ((hover: hover) and (pointer: fine)) { .scrollbar { display: none !important; } }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 8px; background: #3D3A3D; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #524E52; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #D6CED6; }
::-webkit-scrollbar-corner { background: transparent; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--accent-wash); }
img, svg, canvas { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
code { font-family: var(--font-mono); font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: fixed; left: 16px; top: -48px; z-index: 100;
  padding: 8px 16px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--on-accent); font-weight: 600;
}
.skip:focus { top: 12px; }
/* The mark's symbol (shell/mod.rs): there for every Mark to draw, never seen. */
.mark-symbol { position: absolute; width: 0; height: 0; overflow: hidden; }
.mark { flex: none; }

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

/* A page of the same bundle replaces the last at once. One of another
   bundle (lib.rs bundle_for) is a separate load, and the browser cross-fades
   to it from the last where it can; the header is the same on both, so it
   holds still (it isn't captured on its own: its glass would lose what's
   behind it mid-fade). */
@view-transition { navigation: auto; }
.accent { color: var(--accent-ink); }
.ico { width: 1.15em; height: 1.15em; flex: none; }
.up { color: var(--positive); }
.down { color: var(--negative); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: var(--step--1); font-weight: 500;
  color: var(--muted);
}
.eyebrow .chip { height: 22px; font-size: 12px; }
/* The second, quieter half of a two-tone heading. */
.dim { color: var(--dim-title); }
/* A two-part heading ("Four ways in." "Pick the one that fits.") keeps
   each part whole: the second starts its own line when it doesn't fit
   beside the first, and each balances its own lines when it needs more
   than one, so no word is left alone and no sentence is split oddly. */
:is(h1, h2, h3) > :is(.first, .dim) { display: inline-block; text-wrap: balance; }
.lede { color: var(--muted); font-size: var(--step-0); line-height: 1.6; max-width: 38em; }
/* No paragraph ends on a word alone on its line. */
p, li { text-wrap: pretty; }
.lede code { color: var(--text); background: var(--card); border: 1px solid var(--border); padding: 0.05em 0.35em; border-radius: var(--radius-s); }

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  height: 42px; padding: 0 20px;
  border-radius: var(--radius-pill);
  font-size: var(--step--1); font-weight: 500; line-height: 1; letter-spacing: -0.005em;
  white-space: nowrap;
  transition:
    background-color 220ms var(--ease-ui), border-color 220ms var(--ease-ui), color 220ms var(--ease-ui),
    box-shadow 220ms var(--ease-ui), transform 220ms var(--ease-ui);
}
/* Buttons stay put on hover (only their color answers) and give a little
   when pressed. */
.btn:active { transform: scale(0.97); transition-duration: 90ms; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }
.btn .ico { width: 17px; height: 17px; transition: transform 260ms var(--ease-ui); }
.btn:hover .ico:last-child:not(:first-child) { transform: translateX(3px); }
.btn.sm { height: 34px; padding: 0 15px; font-size: 14px; }
.btn.lg { height: 50px; padding: 0 26px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn.primary:hover { background: #F293F2; }
.btn.white { background: var(--white); color: var(--kblack); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08); }
.btn.white:hover { background: #F4EFF4; }
[data-theme="light"] .btn.white { background: var(--kblack); color: var(--white); }
[data-theme="light"] .btn.white:hover { background: #000; }
.btn.dark { background: var(--kblack); color: var(--white); }
.btn.dark:hover { background: #000; }
.btn.ghost { border: 1px solid rgba(255, 255, 255, 0.14); color: var(--text); background: rgba(255, 255, 255, 0.03); }
[data-theme="light"] .btn.ghost { border-color: rgba(30, 29, 30, 0.14); background: rgba(255, 255, 255, 0.7); }
.btn.ghost:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.07); }
.btn.text { height: 36px; padding: 0 12px; color: var(--muted); background: none; }
.btn.text:hover:not(:disabled) { color: var(--text); }
.spinner { display: block; width: 16px; height: 16px; border-radius: 50%; border: 1.75px solid rgba(127, 127, 127, 0.25); border-top-color: currentColor; border-right-color: currentColor; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chip {
  display: inline-flex; align-items: center; gap: 0.4em;
  height: 26px; padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: var(--step--2); font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur-medium) var(--ease), color var(--dur-medium) var(--ease);
}

.link-arrow {
  display: inline-flex; align-items: center; gap: 0.4em;
  color: var(--accent-ink); font-weight: 600; font-size: var(--step--1);
}
.link-arrow .ico { transition: transform var(--dur-quick) var(--ease-ui); }
.link-arrow:hover .ico { transform: translateX(3px); }
/* On white, Strong Kpurple (accent text) is too light for words this size:
   they read in Kblack and the arrow keeps the accent. */
[data-theme="light"] .link-arrow { color: var(--text); }
[data-theme="light"] .link-arrow .ico { color: var(--accent-ink); }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* A list of short facts, each with a check. */
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin: 0 2px; border-radius: 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; font-family: var(--font-mono); font-size: 11px; color: var(--text); }

/* Scroll reveal (motion reference, Landing): once, on first sight — fade
   in, sharpen from an 8 px blur, rise 12 px; siblings 40 ms apart through
   --i. Only what's below the screen when a page is shown waits for it
   (`.wait`, app.rs observe_reveals): what you can see is never hidden to
   be faded back in, and without scripts nothing is hidden at all. */
.js .reveal {
  transition:
    opacity var(--dur-very-slow) var(--ease) calc(var(--i, 0) * var(--stagger)),
    filter var(--dur-very-slow) var(--ease) calc(var(--i, 0) * var(--stagger)),
    transform var(--dur-very-slow) var(--ease) calc(var(--i, 0) * var(--stagger));
}
.js .reveal.wait { opacity: 0; filter: blur(8px); transform: translateY(12px); transition: none; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 150ms !important; transition-delay: 0ms !important; }
  .js .reveal.wait { filter: none; transform: none; }
}

/* Read by screen readers, not shown. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
