/* loxx.run: the stylesheet every page uses. The fonts are served from this
   site, so pages make no requests to anyone else. Every size, gap and radius
   comes from the scales below. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Spacing: only these. */
  --s-25: 2px;
  --s-50: 4px;
  --s-75: 8px;
  --s-100: 12px;
  --s-200: 16px;
  --s-300: 24px;
  --s-400: 32px;
  --s-500: 40px;
  --s-600: 48px;
  --s-700: 64px;
  --s-800: 80px;
  --s-900: 96px;

  /* Radius: Tailwind's steps. */
  --r: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-2xl: 16px;
  --r-3xl: 24px;
  --r-full: 9999px;

  /* Motion: one curve, with mass. */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --slow: 700ms;

  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wide: 1120px;
  --text: 680px;

  --bg: #ffffff;
  --surface: #f5f5f5;
  --raised: #ffffff;
  --line: #e5e5e5;
  --fg: #0a0a0a;
  --muted: #5c5c5c;
  --accent: #0b6b66;
  --glass: rgb(255 255 255 / 0.72);
  --overlay: rgb(255 255 255 / 0.8);
  --head-from: #000000;
  --head-to: #666666;

  --term-bg: #181818;
  --term-line: #313131;
  --term-fg: #e6e6e6;
  --term-dim: #8a8a8a;
  --ok: #4cbf78;
  --bad: #e2675f;
  --sug: #d75f87;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #181818;
    --raised: #1f1f1f;
    --line: #313131;
    --fg: #ededed;
    --muted: #a3a3a3;
    --accent: #5cc3b8;
    --glass: rgb(24 24 24 / 0.72);
    --overlay: rgb(0 0 0 / 0.8);
    --head-from: #ffffff;
    --head-to: #9b9b9b;
    --term-bg: #131209;
    --term-line: #313131;
    color-scheme: dark;
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--s-900); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/24px var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, figure, blockquote, pre { margin: 0; }
h1, h2, h3 { font-weight: 600; text-wrap: balance; letter-spacing: -0.02em; }
p, li, dd, figcaption, td { text-wrap: pretty; }
em, i, cite, var, dfn { font-style: normal; }
b, strong { font-weight: 600; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { display: block; max-width: 100%; }
code, kbd, pre { font-family: var(--mono); }
code { font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
kbd {
  display: inline-block;
  padding: 0 var(--s-75);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r); }

/* Big headings: a left to right gradient on the text, never the background. */
.grad {
  background: linear-gradient(90deg, var(--head-from), var(--head-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: var(--s-75); /* room for descenders inside the clipped text */
}
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.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; }
.icon { width: 20px; height: 20px; flex: none; fill: currentColor; }

.wrap { width: 100%; max-width: var(--wide); margin-inline: auto; padding-inline: var(--s-300); }
@media (max-width: 639px) { .wrap { padding-inline: var(--s-200); } }

.skip {
  position: absolute;
  left: var(--s-200);
  top: var(--s-200);
  z-index: 50;
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-lg);
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--slow) var(--ease);
}
.skip:focus { transform: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-75) var(--s-100);
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  background: var(--fg);
  color: var(--bg);
  font: 600 16px/24px var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--slow) var(--ease), background-color var(--slow) var(--ease), opacity var(--slow) var(--ease);
}
.btn:hover { transform: translateY(-1px); opacity: 0.88; }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface); opacity: 1; }
.btn.sm { font-size: 14px; line-height: 20px; }

/* Fluid island nav: a floating glass pill */
.island {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: var(--s-300) var(--s-200) 0;
  pointer-events: none;
}
.pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--s-75);
  width: max-content;
  max-width: 100%;
  padding: var(--s-50);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  position: relative;
  isolation: isolate;
}
/* The glass sits on a layer behind the pill: a backdrop filter on the pill
   itself would trap the full screen menu inside it. */
.pill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-50) var(--s-100) var(--s-50) var(--s-50);
  border-radius: var(--r-full);
  color: var(--fg);
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand img { width: 24px; height: 24px; }
.links { display: flex; align-items: center; gap: var(--s-25); }
.links a {
  padding: var(--s-50) var(--s-100);
  border-radius: var(--r-full);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--slow) var(--ease), color var(--slow) var(--ease);
}
.links a:hover { color: var(--fg); background: var(--surface); }
.links a[aria-current="page"] { color: var(--fg); background: var(--surface); font-weight: 600; }
.links .btn { color: var(--bg); background: var(--fg); margin-left: var(--s-50); font-weight: 600; }
.links .btn:hover { color: var(--bg); background: var(--fg); }

.burger { display: none; }

@media (max-width: 639px) {
  .js .pill { gap: var(--s-200); }
  .js .burger {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--s-50);
    width: 40px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--r-full);
    background: var(--surface);
    color: var(--fg);
    cursor: pointer;
  }
  .burger span {
    width: 16px;
    height: 2px;
    border-radius: var(--r-full);
    background: currentColor;
    transition: transform var(--slow) var(--ease);
  }
  .open .burger span:first-child { transform: translateY(3px) rotate(45deg); }
  .open .burger span:last-child { transform: translateY(-3px) rotate(-45deg); }

  .js .links {
    position: fixed;
    inset: 0;
    z-index: 1;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: var(--s-75);
    padding: var(--s-900) var(--s-300);
    background: var(--overlay);
    -webkit-backdrop-filter: blur(64px);
    backdrop-filter: blur(64px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--slow) var(--ease), visibility 0s linear var(--slow);
  }
  .js .open .links { opacity: 1; visibility: visible; transition: opacity var(--slow) var(--ease); }
  .js .links a {
    padding: var(--s-100) var(--s-200);
    border-radius: var(--r-xl);
    font-size: 30px;
    line-height: 36px;
    font-weight: 600;
    color: var(--fg);
    background: none;
    transform: translateY(48px);
    opacity: 0;
    transition: transform var(--slow) var(--ease), opacity var(--slow) var(--ease);
  }
  .js .links .btn { margin: var(--s-200) 0 0; justify-content: center; font-size: 16px; line-height: 24px; padding: var(--s-100) var(--s-200); border-radius: var(--r-xl); color: var(--bg); background: var(--fg); }
  .js .links a[aria-current="page"] { color: var(--accent); }
  .js .brand { position: relative; z-index: 2; }
  .js .open .links a { transform: none; opacity: 1; }
  .js .open .links a:nth-child(1) { transition-delay: 100ms; }
  .js .open .links a:nth-child(2) { transition-delay: 150ms; }
  .js .open .links a:nth-child(3) { transition-delay: 200ms; }
  .js .open .links a:nth-child(4) { transition-delay: 250ms; }
  html.menu-open { overflow: hidden; }
  /* Without JavaScript the links stay in the pill. */
  html:not(.js) .pill { flex-wrap: wrap; justify-content: center; border-radius: var(--r-3xl); }
}

/* Scroll reveal: added only when motion is welcome and the script runs. */
.motion .reveal {
  transition: transform 900ms var(--ease), opacity 900ms var(--ease), filter 900ms var(--ease);
}
.motion .reveal:not(.in) { transform: translateY(64px); opacity: 0; filter: blur(12px); }

/* Command box with a copy button */
.cmd {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-75) var(--s-75) var(--s-75) var(--s-200);
  border: 1px solid var(--term-line);
  border-radius: var(--r-xl);
  background: var(--term-bg);
  color: var(--term-fg);
}
.cmd pre {
  flex: 1;
  min-width: 0;
  padding: var(--s-75) 0;
  overflow-x: auto;
  font-size: 14px;
  line-height: 20px;
  white-space: pre;
}
.cmd pre:not(.plain)::before { content: "$ "; color: var(--term-dim); user-select: none; }
.cmd .copy {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  padding: var(--s-75) var(--s-100);
  border: 0;
  border-radius: var(--r);
  background: var(--term-line);
  color: var(--term-fg);
  font: 600 14px/20px var(--sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--slow) var(--ease), transform var(--slow) var(--ease);
}
.cmd .copy:hover { background: #3d3d3d; }
.cmd .copy:active { transform: scale(0.98); }
.cmd .copy .icon { width: 16px; height: 16px; }
.cmd.primary .copy { background: var(--term-fg); color: var(--term-bg); font-size: 16px; line-height: 24px; }
.cmd.primary .copy:hover { background: #ffffff; }
.cmd.primary pre { font-size: 16px; line-height: 24px; }

/* Tables */
.table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-xl); }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
th, td { padding: var(--s-100) var(--s-200); text-align: left; vertical-align: top; }
thead th { background: var(--surface); font-weight: 600; }
tbody tr + tr > * { border-top: 1px solid var(--line); }

/* Notes */
.note { padding: var(--s-200); border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }

/* Footer */
.foot { margin-top: var(--s-900); padding-block: var(--s-600); background: var(--surface); }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-300); color: var(--muted); font-size: 14px; line-height: 20px; }
.foot-in p { display: flex; align-items: center; gap: var(--s-75); }
.foot-in img { width: 20px; height: 20px; }
.foot nav { display: flex; flex-wrap: wrap; gap: var(--s-75) var(--s-300); }
.foot nav a { color: var(--muted); text-decoration: none; transition: color var(--slow) var(--ease); }
.foot nav a:hover { color: var(--fg); }

/* Plain pages: download, docs, 404 */
.page { max-width: 760px; }
.page > * + * { margin-top: var(--s-200); }
.page h1 { font-size: 36px; line-height: 40px; }
.page h2 { margin-top: var(--s-600); font-size: 24px; line-height: 32px; }
.page h3 { margin-top: var(--s-400); font-size: 18px; line-height: 28px; }
.page .lede { color: var(--muted); font-size: 18px; line-height: 28px; }
.page ul, .page ol { padding-left: var(--s-300); }
.page li + li { margin-top: var(--s-75); }
.page :not(pre) > code { padding: 0 var(--s-50); border-radius: var(--r); background: var(--surface); }
.plainpage { padding-top: var(--s-700); }

/* Docs: sidebar and article */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-700); padding-top: var(--s-700); }
.docs > nav { position: sticky; top: var(--s-900); align-self: start; }
.docs .label { margin-bottom: var(--s-100); color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.docs > nav ul { list-style: none; padding: 0; display: grid; gap: var(--s-25); }
.docs > nav a {
  display: block;
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-lg);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
  transition: background-color var(--slow) var(--ease), color var(--slow) var(--ease);
}
.docs > nav a:hover { color: var(--fg); background: var(--surface); }
.docs > nav a[aria-current="page"] { color: var(--fg); background: var(--surface); font-weight: 600; }
.next { display: flex; justify-content: space-between; gap: var(--s-200); margin-top: var(--s-700) !important; }
.next a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-100) var(--s-200);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--slow) var(--ease), transform var(--slow) var(--ease);
}
.next a:hover { background: var(--surface); transform: translateY(-1px); }
.next a:active { transform: scale(0.98); }
.next .icon { width: 16px; height: 16px; }
.next .back .icon { transform: rotate(180deg); }
@media (max-width: 799px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: var(--s-300); padding-top: var(--s-500); }
  .docs > nav { position: static; }
  .docs > nav ul { display: flex; flex-wrap: wrap; gap: var(--s-50); }
  .docs > nav a { border: 1px solid var(--line); border-radius: var(--r-full); }
}

/* Branded 404 */
.lost { max-width: var(--text); padding-top: var(--s-900); }
.lost > * + * { margin-top: var(--s-300); }
.lost h1 { font-size: 48px; line-height: 1; }
.lost .term-box { white-space: pre-wrap; padding: var(--s-200); border: 1px solid var(--term-line); border-radius: var(--r-xl); background: var(--term-bg); color: var(--term-fg); font: 14px/20px var(--mono); overflow-x: auto; }
.lost .dim { color: var(--term-dim); }
.lost .row-links { display: flex; flex-wrap: wrap; gap: var(--s-100); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}

/* Phones: the command gets the full width, the copy button goes below it. */
@media (max-width: 639px) {
  .cmd.primary { flex-wrap: wrap; padding: var(--s-75); }
  .cmd.primary pre { flex-basis: 100%; padding: var(--s-75); font-size: 14px; line-height: 20px; }
  .cmd.primary .copy { flex: 1; justify-content: center; }
}

/* Colour hints in text */
.c-ok { color: var(--ok); }
.c-bad { color: var(--bad); }
.c-sug { color: var(--sug); font-weight: 600; }

/* Terminal transcripts in the docs */
.page .term { padding: var(--s-200); border: 1px solid var(--term-line); border-radius: var(--r-xl); background: var(--term-bg); color: var(--term-fg); overflow-x: auto; }
.page .term pre { font-size: 14px; line-height: 20px; white-space: pre; }
.page .term .dim { color: var(--term-dim); }
.page .term .red { color: var(--bad); }
.page .term .ok { color: var(--ok); }
.page .term .sug { color: var(--sug); }
.page .term .sel { color: #ffffff; font-weight: 600; }
.page .term .cursor { display: inline-block; width: 8px; height: 16px; vertical-align: -3px; background: var(--term-fg); }
