/* Ledger sheet, stamp ink, signal yes/no.
   Display: Besley. Body: Atkinson Hyperlegible. Exchange: Red Hat Mono.
   Tokens live on :root. Dark values replace them under prefers-color-scheme. */

@font-face {
  font-family: "Besley";
  src: url("/fonts/besley-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Red Hat Mono";
  src: url("/fonts/red-hat-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #d7e0e6;
  --slip: #f2f5f7;
  --ink: #1a2433;
  --muted: #3a4a5c;
  --line: #3e5368;
  --yes: #0d5c3d;
  --no: #8e1830;
  --link: #0c4f78;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;
  --space-7: 5rem;
  --text-sm: 0.9375rem;
  --text-body: 1.125rem;
  --text-h3: 1.25rem;
  --text-h2: 1.75rem;
  --text-h1: 2.125rem;
  --measure: 40rem;
  --page: 62rem;
  --leading: 1.6;
  --display: "Besley", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Red Hat Mono", "Cascadia Mono", "Segoe UI Mono", "Source Code Pro", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #161d27;
    --slip: #1e2833;
    --ink: #e6eef3;
    --muted: #b4c3d1;
    --line: #8eabc4;
    --yes: #8fd4b0;
    --no: #f3b3c0;
    --link: #a9d2ee;
  }
}

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

html {
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 400;
  font-size: var(--text-body);
  line-height: var(--leading);
  font-synthesis: none;
  text-align: left;
}

::selection {
  background: var(--line);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  transform: translateY(-150%);
  background: var(--slip);
  color: var(--ink);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--line);
}

.skip:focus {
  transform: none;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

.mast,
main,
.colophon {
  width: min(var(--page), calc(100% - var(--space-6)));
  margin-inline: auto;
}

.mast {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}

.mark {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-decoration: none;
}

.mark:hover {
  text-decoration: underline;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
}

nav a {
  color: var(--ink);
  text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

main {
  padding: var(--space-6) 0 var(--space-7);
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1,
h2,
.stamp {
  font-family: var(--display);
}

h1 {
  max-width: 20em;
  margin: 0 0 var(--space-5);
  font-size: clamp(1.75rem, 1.15rem + 1.5vw, var(--text-h1));
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
  hyphens: none;
}

h2 {
  max-width: var(--measure);
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--text-h2);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

h3 {
  margin: var(--space-4) 0 var(--space-1);
  font-family: var(--body);
  font-size: var(--text-h3);
  font-weight: 700;
  line-height: 1.3;
}

p,
ul,
ol,
dl,
.draft,
.note {
  max-width: var(--measure);
}

p {
  margin: 0 0 var(--space-2);
}

.note {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin: 0 0 var(--space-6);
}

.product {
  margin: 0;
  padding: var(--space-4);
  background: var(--slip);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
}

.product-route {
  border-left-color: var(--yes);
}

.product h2 {
  max-width: none;
  margin: 0 0 var(--space-2);
}

.product p:last-child {
  margin-bottom: 0;
}

.exchange {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--space-4);
  margin: 0 0 var(--space-3);
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 5.5rem;
  margin: 0 0 var(--space-2);
}

.pane-head h2 {
  margin: 0;
}

.pane + .pane {
  border-left: 1px solid var(--line);
  padding-left: var(--space-4);
}

.stamp {
  display: inline-block;
  margin: 0.35rem 0.2rem;
  padding: 0.02em 0.28em 0.08em;
  border: 3px solid var(--yes);
  outline: 1px solid var(--yes);
  outline-offset: 3px;
  color: var(--yes);
  font-weight: 700;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: 1;
  letter-spacing: 0.01em;
  transform: rotate(-7deg);
  transform-origin: center center;
}

.demo {
  margin-top: var(--space-6);
}

.demo h2 {
  margin-top: 0;
  font-size: var(--text-h3);
  font-weight: 500;
}

ul,
ol {
  margin: 0 0 var(--space-2);
  padding-left: 1.25rem;
}

li {
  margin: 0 0 var(--space-1);
}

ol.flow {
  max-width: var(--measure);
}

ol.flow > li::marker {
  font-family: var(--display);
  font-weight: 700;
}

.draft {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-2);
  border-left: 4px solid var(--no);
  font-weight: 700;
}

dl.api dt {
  margin: var(--space-3) 0 0;
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

dl.api dd {
  margin: 0.15rem 0 0;
}

.sample {
  max-width: 46rem;
  margin: 0 0 var(--space-4);
}

.sample-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  max-width: 46rem;
}

.sample-bar h3 {
  margin: var(--space-2) 0;
}

button {
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
}

button:hover {
  background: var(--slip);
}

pre,
code {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

pre {
  max-width: 46rem;
  margin: 0 0 var(--space-4);
  padding: var(--space-2) 0;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: var(--text-sm);
  line-height: 1.5;
  font-weight: 400;
  tab-size: 2;
}

code {
  font-size: 0.92em;
}

.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
  padding: var(--space-3) 0 var(--space-5);
  border-top: 1px solid var(--line);
}

.colophon p {
  margin: 0;
}

@media (max-width: 46rem) {
  .mast,
  main,
  .colophon {
    width: min(var(--page), calc(100% - var(--space-4)));
  }

  .products,
  .exchange {
    grid-template-columns: 1fr;
  }

  .pane + .pane {
    border-left: 0;
    padding-left: 0;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
  }

  .stamp {
    font-size: 2.25rem;
  }
}

[hidden] {
  display: none !important;
}

.hero-fig,
.illus,
.map-fig {
  margin: 0 0 var(--space-4);
}

.hero-fig {
  max-width: 36rem;
}

.illus {
  max-width: 20rem;
}

.hero-fig svg,
.illus svg,
.threshold-map {
  width: 100%;
  height: auto;
  display: block;
  color: var(--ink);
}

.hero-svg text,
.illus-svg text {
  font-family: var(--display);
  font-weight: 700;
  fill: currentColor;
}

.hero-svg .sheet,
.illus-svg .sheet {
  fill: var(--slip);
  stroke: currentColor;
  stroke-width: 1.5;
}

.illus-svg .sheet {
  fill: var(--paper);
}

.hero-svg .hair,
.illus-svg .hair,
.illus-svg .linkline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
}

.hero-svg .hair {
  opacity: 0.45;
}

.hero-svg .meter,
.illus-svg .meter {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.hero-svg .fill-yes,
.illus-svg .fill-yes {
  fill: var(--yes);
}

.hero-svg .fill-no,
.illus-svg .fill-no {
  fill: var(--no);
}

.hero-svg .tick,
.illus-svg .tick,
.hero-svg .gate,
.illus-svg .gate {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}

.hero-svg .bar,
.illus-svg .bar {
  fill: currentColor;
}

.hero-svg .stamp-yes rect,
.illus-svg .stamp-yes rect,
.hero-svg .stamp-no rect,
.illus-svg .stamp-no rect {
  fill: none;
  stroke-width: 2;
}

.hero-svg .stamp-yes,
.illus-svg .stamp-yes,
.hero-svg .stamp-no,
.illus-svg .stamp-no {
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(-7deg);
}

.hero-svg .stamp-yes rect,
.hero-svg .stamp-yes text,
.illus-svg .stamp-yes rect,
.illus-svg .stamp-yes text {
  stroke: var(--yes);
  fill: var(--yes);
}

.hero-svg .stamp-yes rect,
.illus-svg .stamp-yes rect {
  fill: none;
}

.hero-svg .stamp-no rect,
.hero-svg .stamp-no text,
.illus-svg .stamp-no rect,
.illus-svg .stamp-no text {
  stroke: var(--no);
  fill: var(--no);
}

.hero-svg .stamp-no rect,
.illus-svg .stamp-no rect {
  fill: none;
}

.hero-svg .stamp-yes text,
.illus-svg .stamp-yes text,
.hero-svg .stamp-no text,
.illus-svg .stamp-no text {
  stroke: none;
}

.illus-svg .seal {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.hero-fill {
  transform-box: fill-box;
  transform-origin: left center;
}

.stamp-no {
  border-color: var(--no);
  outline-color: var(--no);
  color: var(--no);
}

.exchange-static .exchange + .exchange {
  margin-top: var(--space-5);
}

.exchange-controls {
  grid-column: 1 / -1;
  max-width: none;
  margin: 0;
}

.is-typing::after {
  content: "";
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  margin-left: 2px;
  background: var(--ink);
  vertical-align: text-bottom;
  animation: caret 1s steps(1) infinite;
}

.map-fig {
  max-width: none;
  margin-top: var(--space-6);
  position: relative;
}

.threshold-map {
  background: var(--slip);
  border: 1px solid var(--line);
}

.map-land,
.map-dots {
  shape-rendering: crispEdges;
}

.map-land {
  fill: var(--line);
  opacity: 0.7;
  pointer-events: none;
}

.map-dots {
  stroke: transparent;
  stroke-width: 5;
  pointer-events: all;
}

.map-dots.kind-nil { fill: var(--no); }
.map-dots.kind-sales { fill: var(--yes); }
.map-dots.kind-global { fill: var(--link); }
.map-dots.kind-blocked { fill: var(--ink); }

.map-place {
  cursor: pointer;
}

.map-place:focus-visible .map-dots {
  stroke: var(--ink);
  stroke-width: 1.25;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  max-width: none;
  margin: var(--space-2) 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.swatch {
  width: 0.8rem;
  height: 0.8rem;
  flex: none;
}

.swatch-nil { background: var(--no); }
.swatch-sales { background: var(--yes); }
.swatch-global { background: var(--link); }
.swatch-blocked { background: var(--ink); }
.swatch-land { background: var(--line); opacity: 0.7; }

.map-tip {
  position: absolute;
  z-index: 2;
  max-width: min(22rem, calc(100% - 1rem));
  margin: 0;
  padding: 0.4rem 0.6rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: var(--text-sm);
  line-height: 1.45;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-card {
    animation: hero-arrive 1.7s cubic-bezier(0.16, 0.84, 0.24, 1) both;
  }

  .hero-fill {
    animation: hero-fill 1.15s ease 0.3s both;
  }
}

@keyframes hero-arrive {
  from { transform: translateX(0); }
  to { transform: translateX(120px); }
}

@keyframes hero-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes caret {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .stamp,
  .hero-svg .stamp-yes,
  .hero-svg .stamp-no,
  .illus-svg .stamp-yes,
  .illus-svg .stamp-no {
    transform: none;
  }

  .hero-card {
    transform: translateX(120px);
  }

  .stamp {
    margin-left: 0;
  }

  .is-typing::after {
    animation: none;
  }
}
