:root {
  --paper: #f6f8fd;
  --surface: #ffffff;
  --ink: #1e3a8a;
  --text: #24305c;
  --muted: #56628c;
  --line: #d6ddef;
  --string: #0f6f6b;
  --py: #0b9ad8;
  --ts: #b88300;
  --go: #00837e;
  --kit: #16a34a;
  --focus: #0b9ad8;
  --sans: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1840;
    --surface: #10214f;
    --ink: #ffffff;
    --text: #d5ddf6;
    --muted: #9ba9d6;
    --line: #26387a;
    --string: #7fd8d3;
    --ts: #f7df1e;
    --go: #00a29c;
    --kit: #22c55e;
    --focus: #7fd8ff;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

code {
  font-family: var(--mono);
  font-size: 0.88em;
}

h1,
h2,
h3 {
  color: var(--ink);
  margin: 0;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--surface);
  padding: 8px 12px;
  z-index: 10;
}

.skip:focus {
  left: 16px;
}

.top,
main,
.foot {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 28px;
  padding-bottom: 28px;
}

.brand img {
  display: block;
  height: 34px;
  width: auto;
}

.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-size: 0.95rem;
  font-weight: 500;
}

.top nav a {
  text-decoration: none;
}

.top nav a:hover {
  text-decoration: underline;
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
  padding: 48px 0 24px;
}

h1 {
  font-size: clamp(2.15rem, 4.2vw, 3.45rem);
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -0.022em;
  max-width: 19ch;
  text-wrap: balance;
}

.lede {
  margin: 28px 0 0;
  max-width: 54ch;
  font-size: 1.125rem;
}

.starts {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 0.975rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.start::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
}

.start:hover {
  background: var(--ink);
  color: var(--paper);
}

.py { --dot: var(--py); }
.ts { --dot: var(--ts); }
.go { --dot: var(--go); }
.kit { --dot: var(--kit); }

/* The rail: one message in three languages, flowing to one frame */

.rail {
  position: relative;
  margin: 8px 0 0;
}

.rail ol {
  list-style: none;
  margin: 0;
  padding: 0 0 0 38px;
  position: relative;
}


.stop {
  position: relative;
}

.stop + .stop {
  margin-top: 18px;
}

.stop.wire {
  margin-top: 30px;
}

/* The rail runs from each dot down to the next one. */
.stop:not(.wire)::after {
  content: "";
  position: absolute;
  left: -27px;
  top: 11px;
  bottom: -29px;
  width: 2px;
  background: var(--line);
}

.stop.go::after {
  bottom: -41px;
}

.stop::before {
  content: "";
  position: absolute;
  left: -33px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dot);
  z-index: 1;
}

.stop.wire::before {
  width: 18px;
  height: 18px;
  left: -35px;
  top: 2px;
  background: var(--paper);
  border: 3px solid var(--ink);
}

.where {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.wire .where {
  color: var(--ink);
}

.rail pre {
  margin: 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  font: 400 0.8125rem/1.6 var(--mono);
  color: var(--text);
  tab-size: 4;
}

.stop:not(.wire) pre {
  transition: border-color 0.15s;
}

.stop:not(.wire):hover pre,
.stop:not(.wire) pre:focus-visible {
  border-color: var(--dot);
}

.wire pre {
  border: 1.5px solid var(--ink);
  font-size: 0.875rem;
  transition: box-shadow 0.25s;
}

.wire.arrived pre {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 18%, transparent);
}

.k { color: var(--ink); font-weight: 600; }
.t { color: var(--ink); }
.s { color: var(--string); }

.packet {
  position: absolute;
  left: 5px;
  top: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dot);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}

/* Sections */

main > section + section {
  margin-top: 120px;
}

h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  max-width: 30ch;
  text-wrap: balance;
}

.section-lede {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 60ch;
}

/* Projects */

.project-list {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.project {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(0, 390px);
  gap: 28px;
  align-items: start;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

.mark img {
  display: block;
  width: 44px;
  height: 44px;
}

.about h3 {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.2;
}

.about h3 a {
  text-decoration: none;
}

.about h3 a:hover {
  text-decoration: underline;
}

.lang {
  font-weight: 400;
  color: var(--muted);
}

.about p {
  margin: 8px 0 0;
  max-width: 56ch;
}

.cmd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--dot);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: copy;
}

.cmd code {
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow-x: auto;
}

.cmd:hover {
  border-color: var(--muted);
  border-left-color: var(--dot);
}

.copied {
  flex: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.copied:empty::after {
  content: "Copy";
}

.note {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Mix: any server, one document, any client */

.flow {
  --row: 64px;
  --row-gap: 12px;
  --link: 32px;
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 240px) minmax(0, 1fr);
  column-gap: calc(var(--link) * 2);
  align-items: center;
  margin-top: 40px;
}

.flow-side {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: var(--row);
  row-gap: var(--row-gap);
  position: relative;
}

.end {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s;
}

.end::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dot);
}

.end:hover {
  border-color: var(--dot);
}

.end-name {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.end-sub {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.servers .end {
  flex-wrap: wrap;
  align-content: center;
  row-gap: 0;
  column-gap: 12px;
  line-height: 1.3;
}

.servers .end-sub {
  flex-basis: 100%;
  padding-left: 24px;
}

/* Clients: TypeScript leads (most people want a typed frontend), Python and Go follow
   as compact rows. Row heights are fixed so the bracket can meet each row's centre. */
.clients {
  --main: 104px;
  --minor: 48px;
  grid-template-rows: var(--main) var(--minor) var(--minor);
  grid-auto-rows: unset;
}

.clients .end {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label dot" "code dot";
  align-content: center;
  row-gap: 4px;
}

.clients .end::before {
  grid-area: dot;
  align-self: center;
}

.end-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.clients .end-label {
  grid-area: label;
}

.clients code {
  grid-area: code;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow-x: auto;
  min-width: 0;
}

/* The main row: bigger name, its own colour on the border and on the line into it. */
.clients .main {
  padding: 0 18px;
  border: 1.5px solid var(--dot);
  row-gap: 8px;
}

.clients .main::before {
  width: 14px;
  height: 14px;
}

.clients .main .end-name {
  font-size: 1.125rem;
}

.clients .main .end-sub {
  white-space: normal;
}

.clients .main code {
  justify-self: start;
  padding: 3px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--dot) 12%, transparent);
  color: var(--ink);
}

/* Python and Go: one line each, quieter. */
.clients .end:not(.main) {
  grid-template-areas: "label code dot";
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 14px;
}

.clients .end:not(.main) .end-label {
  flex-direction: row;
  align-items: baseline;
  column-gap: 8px;
}

.clients .end:not(.main) .end-name {
  font-size: 0.9375rem;
}

.clients .end:not(.main) .end-sub {
  display: none;
}

.clients .end:not(.main) code {
  color: var(--muted);
  text-align: right;
}

.doc {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  transition: box-shadow 0.15s;
}

/* Wires: one curve per row into the document, drawn by main.js. Rows sit above them. */
.flow {
  position: relative;
}

.wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.wires path {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
  transition: stroke 0.15s;
}

.wires path.lit {
  stroke: var(--dot);
}

.wires path.reach {
  stroke: color-mix(in srgb, var(--ink) 40%, var(--line));
}

.flow-side,
.doc {
  position: relative;
  z-index: 1;
}

.doc code {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
}

.doc span {
  font-size: 0.875rem;
  color: var(--muted);
}

.flow:has(.end:hover) .doc {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 14%, transparent);
}

.also {
  margin: 32px 0 0;
  max-width: 62ch;
  color: var(--muted);
}

/* Demo */

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 28px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 10px 16px;
  font: 600 1rem var(--sans);
  color: var(--muted);
  cursor: pointer;
}

.tabs button:hover {
  color: var(--ink);
}

.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--dot);
}

#demo-panel {
  margin-top: 24px;
}

#demo-panel video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

/* Spec */

.spec p {
  margin: 16px 0 0;
  max-width: 62ch;
}

.plain {
  font-weight: 600;
}

/* Footer */

.foot {
  margin-top: 120px;
  padding-top: 32px;
  padding-bottom: 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

.foot p {
  margin: 0;
}

/* Smaller screens */

@media (max-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .project {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .project .get {
    grid-column: 2;
  }

  .flow {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--link);
    max-width: 560px;
  }

  /* Stacked: rows feed down into the document and out of it. */
  .wires {
    display: none;
  }

  .doc::before,
  .doc::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 2px;
    height: var(--link);
    margin-left: -1px;
    background: var(--line);
  }

  .doc::before { bottom: 100%; }
  .doc::after { top: 100%; }
}

@media (max-width: 600px) {
  .top,
  main,
  .foot {
    padding: 0 16px;
  }

  .top {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 20px;
    padding-bottom: 8px;
  }

  .foot {
    padding-top: 28px;
    padding-bottom: 40px;
  }

  .hero {
    padding-top: 24px;
  }

  .project {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .project .get {
    grid-column: 1;
  }

  .cmd code {
    font-size: 0.75rem;
  }

  .clients {
    grid-template-rows: none;
    grid-auto-rows: auto;
  }

  .clients .end,
  .clients .end:not(.main) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label dot" "code dot";
    padding: 12px 14px;
  }

  .clients .end:not(.main) code {
    text-align: left;
  }

  .clients code {
    font-size: 0.75rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .rail pre {
    padding: 12px 14px;
    font-size: 0.75rem;
  }

  .wire pre {
    white-space: pre-wrap;
    font-size: 0.8125rem;
  }

  main > section + section {
    margin-top: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .start,
  .wire pre {
    transition: none;
  }
}
