/* Variable, weight 100–900. */
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2-variations"),
    url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f3f3f1;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --hairline: rgb(0 0 0 / 0.08);
  --red: #e0261c;
  --code-bg: #1d1d1f;
  --code-ink: #f5f5f7;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 30px rgb(0 0 0 / 0.06);
  --header-bg: rgb(251 251 250 / 0.72);
  --display: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --wrap: 1080px;
  --gutter: 20px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0b;
    --surface: #161618;
    --surface-2: #1d1d20;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --hairline: rgb(255 255 255 / 0.1);
    --red: #ff453a;
    --code-bg: #1d1d20;
    --code-ink: #f5f5f7;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 30px rgb(0 0 0 / 0.35);
    --header-bg: rgb(10 10 11 / 0.72);
    color-scheme: dark;
  }
}

@media (min-width: 720px) {
  :root {
    --gutter: 32px;
  }
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.65 var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--red);
}

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wrap.narrow {
  max-width: 820px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: 8px;
  z-index: 20;
  background: var(--ink);
  color: var(--bg);
  padding: 6px 10px;
}

.red {
  color: var(--red);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.wordmark {
  font: 650 19px/1 var(--display);
  letter-spacing: -0.03em;
}
.wordmark span {
  color: var(--red);
}
.site-nav {
  display: flex;
  gap: 24px;
  font-size: 13px;
}
.site-nav a {
  color: var(--ink-2);
}
.site-nav a:hover {
  color: var(--ink);
}

/* ---------- Type ---------- */

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 650;
  margin: 0;
  color: var(--ink);
}
h1 {
  font-size: clamp(44px, 7.4vw, 84px);
  line-height: 1.03;
  letter-spacing: -0.048em;
}
h2 {
  font-size: clamp(34px, 5.2vw, 56px);
  line-height: 1.06;
  letter-spacing: -0.042em;
}
h3 {
  font-size: 21px;
  letter-spacing: -0.02em;
}
.eyebrow {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--red);
}
.sub {
  margin: 20px auto 0;
  max-width: 54ch;
  font-size: 16px;
  color: var(--ink-2);
}

code,
pre {
  font-family: var(--mono);
}
:not(pre) > code {
  font-size: 0.92em;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 6px;
  overflow-wrap: anywhere;
}
pre {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 14px;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
}

/* ---------- Sections ---------- */

section {
  padding: 96px 0;
}
@media (min-width: 900px) {
  section {
    padding: 120px 0;
  }
}
.head {
  text-align: center;
  margin-bottom: 48px;
}
@media (min-width: 900px) {
  .head {
    margin-bottom: 64px;
  }
}

.card {
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font: 500 13px/1 var(--mono);
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:hover {
  opacity: 0.86;
}
.btn:active {
  transform: scale(0.97);
}
.btn.quiet {
  background: color-mix(in srgb, var(--red) 13%, transparent);
  color: var(--red);
  font-weight: 600;
}
.btn.quiet:hover {
  opacity: 1;
  background: var(--red);
  color: #fff;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: progress;
}
.link {
  font-size: 14px;
  color: var(--red);
}
.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Hero ---------- */

.hero {
  padding: 72px 0 40px;
  text-align: center;
}
@media (min-width: 900px) {
  .hero {
    padding: 112px 0 64px;
  }
}
.cta {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.copy-url {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 100%;
  padding: 6px 6px 6px 26px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.copy-url code {
  background: none;
  padding: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* The die. The poster image shows until WebGL has drawn the first frame. */
.die-wrap {
  margin-top: 24px;
}
.die-stage {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  position: relative;
  display: block;
  width: min(440px, 88vw);
  aspect-ratio: 1;
  margin: 0 auto;
  -webkit-tap-highlight-color: transparent;
}
.die-stage:focus-visible {
  outline-offset: -12px;
  border-radius: 40px;
}
.die-stage img,
.die-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.die-stage canvas {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.die-stage.is-live canvas {
  opacity: 1;
}
.die-stage.is-live img {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.die-caption {
  margin: 0;
  min-height: 1.65em;
  font-size: 14px;
  color: var(--ink-2);
}

@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .hero .rise:nth-child(2) {
    animation-delay: 0.06s;
  }
  .hero .rise:nth-child(3) {
    animation-delay: 0.12s;
  }
  .hero .rise:nth-child(4) {
    animation-delay: 0.18s;
  }
  .die-wrap.rise {
    animation-delay: 0.24s;
  }
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
  }
}

/* ---------- Histogram ---------- */

.proof {
  background: var(--surface-2);
}
.chart {
  max-width: 880px;
  margin: 0 auto;
  padding-top: 28px;
}
.bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  height: 240px;
  align-items: end;
}
@media (min-width: 720px) {
  .bars {
    gap: 14px;
    height: 280px;
  }
}
.bars .expected {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent);
  pointer-events: none;
}
.bar {
  position: relative;
  height: 0;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--red), color-mix(in srgb, var(--red) 70%, #000));
  transition: height 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bar b {
  position: absolute;
  z-index: 1;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0 4px;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-2);
  white-space: nowrap;
}
.axis {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  text-align: center;
  font: 600 15px/1 var(--display);
  color: var(--ink-2);
}
@media (min-width: 720px) {
  .axis {
    gap: 14px;
  }
}
.chart-foot {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-2);
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.legend::before {
  content: "";
  width: 20px;
  border-top: 1px dashed color-mix(in srgb, var(--ink) 45%, transparent);
}

/* ---------- Setup ---------- */

.segmented {
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 20px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar {
  display: none;
}
.segmented button {
  appearance: none;
  flex: none;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 500 13px/1 var(--mono);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.segmented button:hover {
  color: var(--ink);
}
.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}
.tabpanel {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 22px;
  display: grid;
  gap: 14px;
}
@media (min-width: 720px) {
  .tabpanel {
    padding: 36px 40px;
  }
}
.tabpanel + .tabpanel {
  margin-top: 16px;
}
.tabpanel p {
  margin: 0;
  color: var(--ink-2);
}
.tabpanel strong {
  color: var(--ink);
  font-weight: 500;
}
.tip {
  margin: 32px auto 0;
  max-width: 760px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-2);
}
.tip em {
  font-style: normal;
  color: var(--ink);
}

/* ---------- Tools ---------- */

.tools {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 980px;
  display: grid;
  column-gap: 48px;
}
@media (min-width: 640px) {
  .tools {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 960px) {
  .tools {
    grid-template-columns: repeat(3, 1fr);
  }
}
.tools li {
  padding: 22px 0 26px;
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 8px;
  align-content: start;
}
.tools code {
  justify-self: start;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  background: none;
  padding: 0;
}
.tools p {
  margin: 0;
  font: 550 19px/1.3 var(--display);
  letter-spacing: -0.02em;
}

/* ---------- API ---------- */

pre.code {
  max-width: 760px;
  margin: 0 auto;
  background: var(--code-bg);
  border-radius: 24px;
  padding: 26px 28px;
}
pre.code .dim {
  color: #8e8e93;
}

/* ---------- FAQ ---------- */

.faq details {
  border-bottom: 1px solid var(--hairline);
}
.faq summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding: 24px 40px 24px 0;
  font: 600 21px/1.3 var(--display);
  letter-spacing: -0.02em;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.25s ease;
}
.faq details[open] summary::after {
  transform: translateY(-30%) rotate(-135deg);
}
.faq details p {
  margin: 0;
  padding: 0 0 26px;
  max-width: 64ch;
  color: var(--ink-2);
}
.faq a {
  color: var(--red);
}

/* ---------- Prose pages ---------- */

.prose {
  padding: 80px 0 120px;
}
.prose .wrap {
  max-width: 720px;
}
.prose h1 {
  font-size: clamp(40px, 7vw, 60px);
  margin-bottom: 24px;
}
.prose h2 {
  font-size: 26px;
  letter-spacing: -0.03em;
  margin: 44px 0 8px;
}
.prose p,
.prose li {
  color: var(--ink-2);
}
.prose strong {
  color: var(--ink);
  font-weight: 500;
}
.prose a {
  color: var(--red);
}
.prose .btn {
  color: var(--bg);
  display: inline-block;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 28px 0 48px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--ink-2);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.site-footer nav {
  display: flex;
  gap: 20px;
}
.site-footer a:hover {
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 30;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
