/*
 * Remora website.
 *
 * Colour: deep water. The page starts in the shallows and is at depth a
 * screen or two down; panels that hold the product (the phone, code) are the
 * darkest thing on it. Teal is the fish; amber is the one lamp, kept for the
 * thing to press.
 *
 * Type: Archivo, set narrow, for headings and controls: the lettering of a
 * gauge bezel. Atkinson Hyperlegible for reading, because a protocol
 * reference is full of l, I, 1, 0 and O. Its mono for code only.
 */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('../fonts/archivo-latin-wdth-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: italic;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Atkinson Hyperlegible Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2') format('woff2');
}

:root {
  /* Water, from the surface down. */
  --shallows: #11414e;
  --deep: #0b2a34;
  --trench: #061920;
  --hull: #153e4a;
  --line: #2b5763;
  --line-soft: #1d4651;
  /* Things in the water. */
  --foam: #ecf4f1;
  --silt: #a9c3c5;
  --remora: #62e0cd;
  --lamp: #ffb84a;
  --lamp-ink: #1c1303;
  --coral: #ff9079;

  --display: 'Archivo', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --text: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Atkinson Hyperlegible Mono', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;

  /* Type scale: 17px reading size, 1.25 steps, with the two display sizes fluid. */
  --size-small: 0.875rem;
  --size-body: 1.0625rem;
  --size-lede: 1.25rem;
  --size-h4: 1.2rem;
  --size-h3: 1.55rem;
  --size-h2: clamp(2rem, 1.45rem + 2.6vw, 3.1rem);
  --size-h1: clamp(2.7rem, 1.5rem + 6vw, 5.4rem);

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --measure: 68ch;
  --radius: 10px;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background-color: var(--deep);
  background-image: linear-gradient(180deg, var(--shallows) 0, var(--deep) 100%);
  background-size: 100% 64rem;
  background-repeat: no-repeat;
  color: var(--foam);
  font-family: var(--text);
  font-size: var(--size-body);
  line-height: 1.6;
  overflow-wrap: break-word;
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- type ------------------------------------------------------------------------ */

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 680;
  line-height: 1.04;
  text-wrap: balance;
}

h1 {
  font-size: var(--size-h1);
  font-stretch: 66%;
  font-weight: 720;
  line-height: 0.96;
  letter-spacing: -0.005em;
}

h2 {
  font-size: var(--size-h2);
  font-stretch: 70%;
}

h3 {
  font-size: var(--size-h3);
  font-stretch: 78%;
  line-height: 1.12;
}

h4 {
  font-size: var(--size-h4);
  font-stretch: 86%;
  line-height: 1.2;
  font-weight: 640;
}

p,
ul,
ol,
dl,
figure,
blockquote {
  margin: 0;
}

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

a:hover {
  color: var(--foam);
}

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

strong {
  font-weight: 700;
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 0.08em 0.32em;
  border-radius: 5px;
  background: rgba(6, 25, 32, 0.62);
  color: #d9ece8;
  overflow-wrap: anywhere;
}

a > code {
  color: inherit;
}

.lede {
  max-width: 34em;
  font-size: var(--size-lede);
  line-height: 1.45;
  color: var(--foam);
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 50;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--lamp);
  color: var(--lamp-ink);
  font-family: var(--display);
  font-stretch: 86%;
  font-weight: 650;
}

.skip:focus {
  top: 0.75rem;
}

/* --- header: above the waterline ------------------------------------------------- */

.site-header {
  position: relative;
  padding-block: 0.7rem 1.15rem;
}

/* The waterline: a small wave, repeated. */
.site-header::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='8' viewBox='0 0 44 8'%3E%3Cpath d='M0 5.5c5.500 0 5.500-3 11-3s5.500 3 11 3 5.500-3 11-3 5.500 3 11 3' fill='none' stroke='%232b5763' stroke-width='1.4'/%3E%3C/svg%3E") repeat-x left center;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: auto;
  color: var(--foam);
  font-family: var(--display);
  font-stretch: 72%;
  font-weight: 720;
  font-size: 1.7rem;
  line-height: 1;
  text-decoration: none;
}

/* Holds the mark's drawing, which the header, the footer and the landing page all reuse. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.brand .mark {
  width: 3.1rem;
  height: auto;
  aspect-ratio: 512 / 354.6;
  color: var(--remora);
}

.site-nav {
  order: 3;
  flex-basis: 100%;
  min-width: 0;
  margin-inline: calc(var(--gutter) * -1);
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0 calc(var(--gutter) - 0.6rem);
  list-style: none;
  width: max-content;
}

.site-nav a,
.header-repo {
  display: block;
  padding: 0.5rem 0.6rem;
  color: var(--foam);
  font-family: var(--display);
  font-stretch: 84%;
  font-weight: 560;
  font-size: 1.05rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 6px;
}

.site-nav a:hover,
.header-repo:hover {
  color: var(--remora);
}

.site-nav a[aria-current='page'] {
  color: var(--lamp);
  box-shadow: inset 0 -2px 0 var(--lamp);
  border-radius: 0;
}

.header-repo {
  border: 1px solid var(--line);
  padding-inline: 0.85rem;
}

@media (min-width: 46em) {
  .site-header {
    padding-block: 1rem 1.5rem;
  }

  .header-repo {
    order: 4;
  }

  .site-nav {
    order: 0;
    flex-basis: auto;
    margin-inline: 0;
    overflow: visible;
  }

  .site-nav ul {
    padding: 0;
    gap: 0.5rem;
  }
}

/* --- buttons ----------------------------------------------------------------------- */

.button,
button.quiet,
a.quiet,
.demo-switch button,
.tab-list button,
.copy {
  font-family: var(--display);
  font-stretch: 86%;
  font-weight: 620;
  line-height: 1.15;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.7rem 1.3rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--foam);
  font-size: 1.12rem;
  text-decoration: none;
  text-align: center;
}

.button:hover {
  border-color: var(--remora);
  color: var(--foam);
}

.button.primary {
  border-color: var(--lamp);
  background: var(--lamp);
  color: var(--lamp-ink);
}

.button.primary:hover {
  background: #ffc76e;
  border-color: #ffc76e;
  color: var(--lamp-ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

button.quiet,
a.quiet {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--foam);
  font-size: 0.98rem;
  text-decoration: none;
}

button.quiet:hover,
a.quiet:hover {
  border-color: var(--remora);
}

button.quiet[aria-pressed='true'] {
  border-color: var(--lamp);
  color: var(--lamp);
}

/* --- the phone, and the demo in it -------------------------------------------------- */

.demo {
  --screen-ratio: 1600 / 717;
  --phone-width: 100%;
  min-width: 0;
}

.demo[data-orient='portrait'] {
  --screen-ratio: 720 / 1607;
  --phone-width: min(100%, 19.5rem);
}

/* Before the script has chosen: a phone-sized screen gets the portrait screenshot where there is one. */
@media (max-width: 43.99em) {
  .demo:not([data-orient])[data-demo='emberfall'] {
    --screen-ratio: 720 / 1607;
    --phone-width: min(100%, 19.5rem);
  }
}

.phone {
  width: var(--phone-width);
  margin-inline: auto;
  padding: clamp(6px, 1.6vw, 11px);
  border-radius: clamp(18px, 4vw, 30px);
  background: #03080a;
  box-shadow:
    0 0 0 1.5px #3a5760,
    0 0 0 4px #0a1c22,
    0 28px 50px -22px rgba(0, 0, 0, 0.75);
}

.phone-screen {
  position: relative;
  aspect-ratio: var(--screen-ratio);
  overflow: hidden;
  border-radius: clamp(12px, 2.8vw, 20px);
  background: #000;
}

.phone-screen img,
.phone-screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.phone-screen img {
  object-fit: cover;
}

.phone-screen iframe {
  opacity: 0;
}

.demo.is-live .phone-screen iframe {
  opacity: 1;
}

.demo.is-live .phone-screen picture {
  visibility: hidden;
}

.demo-start {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(3, 8, 10, 0), rgba(3, 8, 10, 0.86));
}

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
}

.demo-bar:empty,
.demo-bar:not(:has(:not([hidden]))) {
  display: none;
}

.demo-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(6, 25, 32, 0.6);
}

.demo-switch button {
  min-height: 2.5rem;
  padding: 0.35rem 0.9rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--silt);
  font-size: 1rem;
}

.demo-switch button:hover {
  color: var(--foam);
}

.demo-switch button[aria-pressed='true'] {
  background: var(--hull);
  color: var(--foam);
  box-shadow: inset 0 -2px 0 var(--remora);
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.demo-note {
  max-width: 44em;
  margin: 0.8rem auto 0;
  color: var(--silt);
  font-size: var(--size-small);
  line-height: 1.5;
  text-align: center;
}

/* --- hero: the product, working ------------------------------------------------------ */

.hero {
  padding-block: clamp(1.5rem, 4vw, 3.25rem) clamp(2.5rem, 6vw, 5rem);
}

.hero-text {
  display: grid;
  gap: 1rem 3rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.75rem);
}

.hero-text .lede {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
}

.hero-side {
  display: grid;
  gap: 1.25rem;
  align-content: end;
}

.scene {
  display: grid;
  gap: 1.5rem;
}

/* The monitor: the program on the PC, shown as what it sends and receives. */
.monitor {
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--trench);
  overflow: hidden;
}

.monitor-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--display);
  font-stretch: 84%;
  font-weight: 600;
  font-size: 1rem;
  color: var(--foam);
}

.monitor-title span {
  color: var(--silt);
  font-weight: 450;
  font-size: var(--size-small);
}

.wire {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding: 0.7rem 0.9rem 0.9rem;
  list-style: none;
  min-height: 9.6rem;
  align-content: start;
}

.wire li {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: baseline;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--silt);
}

.wire .wire-empty {
  display: block;
  max-width: 34em;
  font-size: var(--size-small);
}

.wire li:last-child {
  color: var(--foam);
}

.wire b {
  font-family: var(--display);
  font-stretch: 84%;
  font-weight: 600;
  color: var(--remora);
}

.wire .is-action b,
.wire .is-action code {
  color: var(--lamp);
}

.wire code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}

.monitor-foot {
  padding: 0 0.9rem 0.9rem;
  color: var(--silt);
  font-size: var(--size-small);
  line-height: 1.45;
}

@media (min-width: 44em) {
  .hero-text {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: end;
  }
}

@media (min-width: 62em) {
  .scene {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0;
    align-items: end;
    padding-bottom: 0.5rem;
  }

  .scene .monitor {
    grid-column: 1 / 9;
    grid-row: 1;
    align-self: start;
    position: relative;
    aspect-ratio: 16 / 9.4;
    /* The stand (3.8rem) ends on the desk line, which runs under the phone. */
    margin-bottom: 7.7rem;
    border-width: 2px;
    border-radius: 16px;
    overflow: visible;
  }

  /* The stand, and the desk both things sit on. */
  .scene .monitor::before {
    content: '';
    position: absolute;
    left: 22%;
    top: 100%;
    width: 16%;
    height: 3.3rem;
    background: linear-gradient(90deg, transparent 0 34%, var(--line) 34% 66%, transparent 66%);
    border-bottom: 0.5rem solid var(--line);
    border-radius: 0 0 6px 6px;
  }

  .scene::after {
    content: '';
    grid-column: 1 / -1;
    grid-row: 1;
    align-self: end;
    height: 2px;
    margin-bottom: 3.9rem;
    background: var(--line-soft);
    z-index: 0;
  }

  .scene > .demo {
    grid-column: 6 / 13;
    grid-row: 1;
    z-index: 1;
  }

  .scene > .demo[data-orient='portrait'] {
    grid-column: 9 / 13;
  }

  .scene .demo-bar {
    justify-content: flex-end;
    min-height: 2.9rem;
    margin-top: 1rem;
  }

  .scene .demo-note {
    display: none;
  }

  .scene .wire {
    max-width: 60%;
    min-height: 0;
  }

  .scene .monitor-foot {
    position: absolute;
    left: 0;
    bottom: 0.4rem;
    max-width: 33%;
  }
}

/* --- bands of the landing page -------------------------------------------------------- */

.band {
  padding-block: clamp(2.5rem, 7vw, 5.5rem);
  border-top: 1px solid var(--line-soft);
}

.band > .wrap {
  display: grid;
  gap: 1.5rem 3rem;
}

.band-body {
  display: grid;
  gap: 1.1rem;
  min-width: 0;
  max-width: var(--measure);
}

.band-body > ul:not([class]),
.band-body > ol:not([class]) {
  padding-left: 1.2rem;
  display: grid;
  gap: 0.45rem;
}

@media (min-width: 62em) {
  .band > .wrap {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }

  .band > .wrap > h2 {
    position: sticky;
    top: 1.5rem;
  }

  .band.wide > .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .band.wide > .wrap > h2 {
    position: static;
    max-width: 16em;
  }
}

/* What people put on it: a plain run of examples, each led by the thing itself. */
.uses {
  display: grid;
  gap: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-soft);
}

.uses li {
  display: grid;
  gap: 0.1rem 1.5rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}

.uses b {
  font-family: var(--display);
  font-stretch: 80%;
  font-weight: 640;
  font-size: 1.25rem;
  line-height: 1.2;
}

.uses span {
  color: var(--silt);
}

@media (min-width: 36em) {
  .uses li {
    grid-template-columns: 11rem minmax(0, 1fr);
    align-items: baseline;
  }
}

/* Three parts. */
.parts {
  display: grid;
  gap: 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: part;
}

.parts li {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0 0.5rem;
  counter-increment: part;
}

.parts li::before {
  content: counter(part);
  font-family: var(--display);
  font-stretch: 66%;
  font-weight: 720;
  font-size: 2.4rem;
  line-height: 0.95;
  color: var(--remora);
}

.parts h3 {
  font-size: 1.35rem;
  margin-bottom: 0.2rem;
}

.parts p {
  grid-column: 2;
  color: var(--silt);
}

/* Where it stands. */
.standing {
  display: grid;
  gap: 2rem 3rem;
}

.standing h3 {
  margin-bottom: 0.75rem;
}

.standing ul {
  display: grid;
  gap: 0.6rem;
  padding: 0;
  list-style: none;
}

.standing li {
  position: relative;
  padding-left: 1.6rem;
}

.standing li::before {
  content: '';
  position: absolute;
  left: 0.1rem;
  top: 0.48em;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--remora);
}

.standing .not-yet li::before {
  background: none;
  border: 2px solid var(--coral);
}

@media (min-width: 44em) {
  .standing {
    grid-template-columns: 1fr 1fr;
  }
}

/* Help wanted. */
.jobs {
  display: grid;
  gap: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-soft);
}

.jobs li {
  display: grid;
  gap: 0.3rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--line-soft);
}

.jobs h3 {
  font-size: 1.4rem;
}

.jobs p {
  color: var(--silt);
  max-width: var(--measure);
}

.jobs p a {
  white-space: nowrap;
}

/* The name. */
.namesake {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.namesake svg {
  width: 100%;
  height: auto;
  max-width: 30rem;
  aspect-ratio: 512 / 354.6;
  color: var(--remora);
}

@media (min-width: 52em) {
  .namesake {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* --- reference and tutorial pages ---------------------------------------------------------- */

.doc {
  display: grid;
  gap: 0 3.5rem;
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding: 0 var(--gutter) clamp(3rem, 8vw, 6rem);
}

.doc-body {
  min-width: 0;
  padding-top: clamp(1.25rem, 4vw, 3rem);
}

.prose > * {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: 1.1rem;
}

.prose > h1 + p {
  margin-top: 1.25rem;
  font-size: var(--size-lede);
  line-height: 1.45;
}

.prose > h2 {
  margin-top: clamp(3rem, 7vw, 4.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-soft);
  max-width: none;
}

.prose > h3 {
  margin-top: 2.6rem;
}

.prose > h4 {
  margin-top: 1.9rem;
}

.prose > h2 + *,
.prose > h3 + *,
.prose > h4 + * {
  margin-top: 0.8rem;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li + li {
  margin-top: 0.4rem;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.4rem;
}

.prose > figure,
.prose > .table-wrap,
.prose > .tabs,
.prose > .demo {
  max-width: 54rem;
  margin-top: 1.4rem;
}

.prose > .demo {
  margin-top: 1.75rem;
}

.prose blockquote {
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--lamp);
  color: var(--foam);
}

.prose blockquote > * + * {
  margin-top: 0.6rem;
}

.prose hr {
  margin-block: 2.5rem;
  border: 0;
  border-top: 1px solid var(--line-soft);
}

.anchor {
  margin-left: 0.35em;
  color: var(--line);
  font-weight: 500;
  text-decoration: none;
}

.anchor:hover,
.anchor:focus-visible,
:is(h2, h3, h4):hover > .anchor {
  color: var(--remora);
}

:is(h2, h3, h4) > code {
  font-size: 0.94em;
  font-stretch: 100%;
  font-weight: 600;
  background: none;
  padding: 0;
  color: var(--lamp);
}

/* --- the rail: this site's own side screen --------------------------------------------------- */

.rail {
  order: -1;
  z-index: 20;
  margin-inline: calc(var(--gutter) * -1);
  min-width: 0;
}

/* With script the list folds away and rides the top edge; without, it is simply the first thing on the page. */
.js .rail {
  position: sticky;
  top: 0;
}

@media (max-width: 61.99em) {
  .js .rail-fold:not(.is-ready) nav {
    display: none;
  }
}

.rail-fold {
  background: var(--trench);
  border-bottom: 1px solid var(--line);
}

.rail-fold summary {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.7rem var(--gutter);
  cursor: pointer;
  list-style: none;
  font-family: var(--display);
  font-stretch: 84%;
  font-weight: 620;
  font-size: 1.02rem;
}

.rail-fold summary::-webkit-details-marker {
  display: none;
}

.rail-title::after {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.5em;
  border-right: 2px solid var(--remora);
  border-bottom: 2px solid var(--remora);
  transform: translateY(-0.2em) rotate(45deg);
}

.rail-fold[open] .rail-title::after {
  transform: translateY(0.1em) rotate(-135deg);
}

.rail-now {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--silt);
  font-weight: 450;
}

.rail-fold nav {
  max-height: min(60vh, 28rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.25rem var(--gutter) 1rem;
  border-top: 1px solid var(--line-soft);
}

.toc-list,
.toc-list ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-list a {
  display: block;
  padding: 0.32rem 0;
  color: var(--foam);
  text-decoration: none;
  line-height: 1.3;
}

.toc-list > li > a {
  margin-top: 0.5rem;
  font-family: var(--display);
  font-stretch: 84%;
  font-weight: 620;
}

.toc-list ol a {
  padding-left: 0.85rem;
  border-left: 1px solid var(--line-soft);
  color: var(--silt);
  font-size: 0.95rem;
}

.toc-list a:hover {
  color: var(--remora);
}

.toc-list a[aria-current='true'] {
  color: var(--lamp);
  border-left-color: var(--lamp);
}

.toc-list a code {
  background: none;
  padding: 0;
  color: inherit;
}

@media (min-width: 62em) {
  .doc {
    grid-template-columns: minmax(0, 1fr) 17.5rem;
    align-items: start;
  }

  .rail,
  .js .rail {
    order: 0;
    position: sticky;
    top: 1.25rem;
    margin: clamp(1.25rem, 4vw, 3rem) 0 0;
  }

  /* On a wide screen the rail is a phone standing beside the page. */
  .rail-fold {
    padding: 1.6rem 0.4rem 0.6rem;
    border: 1.5px solid var(--line);
    border-radius: 26px;
    background: rgba(6, 25, 32, 0.72);
    position: relative;
  }

  .rail-fold::before {
    content: '';
    position: absolute;
    top: 0.7rem;
    left: 50%;
    width: 2.6rem;
    height: 4px;
    margin-left: -1.3rem;
    border-radius: 2px;
    background: var(--line);
  }

  .rail-fold summary {
    padding: 0.2rem 0.9rem 0.5rem;
    cursor: default;
    pointer-events: none;
  }

  .rail-title::after,
  .rail-now {
    display: none;
  }

  .rail-fold nav {
    max-height: calc(100vh - 8.5rem);
    padding: 0 0.9rem 0.6rem;
    border-top: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }

  .toc-list > li:first-child > a {
    margin-top: 0;
  }
}

/* --- code ------------------------------------------------------------------------------------ */

figure.code {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--trench);
  overflow: hidden;
}

figure.code figcaption {
  display: flex;
  align-items: center;
  min-height: 2.6rem;
  padding: 0.4rem 6.2rem 0.4rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--silt);
  font-size: var(--size-small);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

figure.code figcaption a {
  color: inherit;
}

figure.code pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 4;
  color: #dcecea;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

figure.code pre:focus-visible {
  outline-offset: -3px;
}

figure.code[data-bare] pre {
  padding-right: 5.6rem;
}

.copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  min-height: 1.85rem;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--trench);
  color: var(--foam);
  font-size: 0.9rem;
}

.copy:hover {
  border-color: var(--remora);
}

.copy.is-done {
  border-color: var(--remora);
  color: var(--remora);
}

/* Syntax colours: keys and names in teal, values in amber and sand, comments in silt. */
.hljs-comment,
.hljs-quote {
  color: #86a6aa;
  font-style: normal;
}

.hljs-keyword,
.hljs-literal,
.hljs-built_in,
.hljs-type {
  color: #8fd3ff;
}

.hljs-attr,
.hljs-property,
.hljs-title,
.hljs-title.function_,
.hljs-section {
  color: var(--remora);
}

.hljs-string,
.hljs-regexp,
.hljs-meta .hljs-string {
  color: #f4d79c;
}

.hljs-number,
.hljs-symbol,
.hljs-variable.constant_ {
  color: var(--lamp);
}

.hljs-meta,
.hljs-punctuation,
.hljs-operator {
  color: #b9cfd0;
}

.hljs-subst,
.hljs-variable,
.hljs-params {
  color: #dcecea;
}

/* Tabs: one sample in several languages. Without script, every panel shows under its own title. */
.tabs {
  min-width: 0;
}

.tab-list {
  display: flex;
  gap: 0.25rem;
  margin-bottom: -1px;
  padding-left: 0.5rem;
  position: relative;
  z-index: 1;
}

.tab-list button {
  min-height: 2.6rem;
  padding: 0.4rem 1rem;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--silt);
  font-size: 1.02rem;
}

.tab-list button:hover {
  color: var(--foam);
}

.tab-list button[aria-selected='true'] {
  border-color: var(--line-soft);
  background: var(--trench);
  color: var(--foam);
  box-shadow: inset 0 2px 0 var(--remora);
}

.tab-title {
  margin: 1.2rem 0 0.5rem;
  font-family: var(--display);
  font-stretch: 86%;
  font-weight: 640;
  font-size: var(--size-h4);
}

.tabs.is-tabbed .tab-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.tabs.is-tabbed .tab-panel[hidden] {
  display: none;
}

/* --- tables ------------------------------------------------------------------------------------- */

.table-wrap {
  min-width: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
  line-height: 1.45;
}

th,
td {
  padding: 0.55rem 0.9rem 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

thead th {
  border-bottom: 1.5px solid var(--line);
  color: var(--silt);
  font-family: var(--display);
  font-stretch: 84%;
  font-weight: 600;
  font-size: 0.98rem;
  white-space: nowrap;
}

tbody th {
  font-weight: 400;
  white-space: nowrap;
}

tbody th code {
  color: var(--remora);
  font-weight: 600;
}

td:last-child,
th:last-child {
  padding-right: 0;
}

/* On a narrow screen a row becomes a small block: the first cell heads it, the rest are labelled. */
@media (max-width: 43.99em) {
  .table-wrap {
    overflow-x: visible;
  }

  table,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  tbody tr {
    padding-block: 0.7rem;
    border-bottom: 1px solid var(--line-soft);
  }

  tbody tr:first-child {
    border-top: 1.5px solid var(--line);
  }

  tbody th,
  td {
    padding: 0.1rem 0;
    border: 0;
    white-space: normal;
  }

  tbody th {
    font-weight: 600;
    margin-bottom: 0.15rem;
  }

  td {
    display: grid;
    grid-template-columns: 6.2rem minmax(0, 1fr);
    gap: 0.6rem;
  }

  td::before {
    content: attr(data-label);
    color: var(--silt);
    font-family: var(--display);
    font-stretch: 84%;
    font-weight: 560;
    font-size: 0.92rem;
  }

  td:empty {
    display: none;
  }
}

/* --- diagrams ------------------------------------------------------------------------------------- */

figure.diagram {
  min-width: 0;
}

.diagram-scroll {
  padding: clamp(0.75rem, 2.5vw, 1.5rem);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(6, 25, 32, 0.55);
}

.diagram-scroll svg {
  display: block;
  width: 100%;
  max-width: 31rem;
  height: auto;
  margin-inline: auto;
}

figure.diagram figcaption {
  margin-top: 0.6rem;
  color: var(--silt);
  font-size: var(--size-small);
  line-height: 1.5;
}

/* Shared by every diagram: the SVGs use these classes rather than their own colours. */
.d-box {
  fill: var(--hull);
  stroke: var(--line);
  stroke-width: 1.5;
}

.d-dark {
  fill: var(--trench);
  stroke: var(--line);
  stroke-width: 1.5;
}

.d-line {
  fill: none;
  stroke: var(--silt);
  stroke-width: 1.6;
}

.d-teal {
  fill: none;
  stroke: var(--remora);
  stroke-width: 2;
}

.d-amber {
  fill: none;
  stroke: var(--lamp);
  stroke-width: 2;
}

.d-dash {
  stroke-dasharray: 5 5;
}

.d-fill-teal {
  fill: var(--remora);
}

.d-fill-amber {
  fill: var(--lamp);
}

.d-fill-silt {
  fill: var(--silt);
}

.d-title {
  fill: var(--foam);
  font-family: var(--display);
  font-stretch: 80%;
  font-weight: 650;
  font-size: 19px;
}

.d-text {
  fill: var(--foam);
  font-family: var(--text);
  font-size: 14.5px;
}

.d-note {
  fill: var(--silt);
  font-family: var(--text);
  font-size: 13.5px;
}

.d-code {
  fill: #dcecea;
  font-family: var(--mono);
  font-size: 13px;
}

/* Text that crosses a line gets a halo in the panel's colour, so the line does not run through it. */
.d-over {
  paint-order: stroke;
  stroke: #0a222b;
  stroke-width: 7px;
  stroke-linejoin: round;
}

.d-teal-text {
  fill: var(--remora);
}

.d-amber-text {
  fill: var(--lamp);
}

/* --- examples page ---------------------------------------------------------------------------------- */

.page-head {
  padding-block: clamp(1.25rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem);
}

.page-head .lede {
  margin-top: 1.25rem;
}

.example {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  border-top: 1px solid var(--line-soft);
}

.example-head {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1.75rem;
  max-width: var(--measure);
}

.example-stage {
  max-width: 54rem;
  margin-inline: auto;
}

.example-stage .monitor {
  margin-top: 1.25rem;
}

.example-stage .wire {
  min-height: 8.4rem;
}

.example-try {
  display: grid;
  gap: 0.5rem;
  max-width: var(--measure);
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

.example-try li {
  position: relative;
  padding-left: 1.5rem;
}

.example-try li::before {
  content: '';
  position: absolute;
  left: 0.15rem;
  top: 0.55em;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--lamp);
}

.example-notes {
  margin-top: 2.5rem;
}

.example-notes > h3 {
  margin-top: 2.4rem;
}

/* --- not found ---------------------------------------------------------------------------------------- */

.missing {
  display: grid;
  gap: 1.25rem;
  padding-block: clamp(3rem, 10vw, 7rem);
  max-width: 44rem;
}

.missing ul {
  display: grid;
  gap: 0.4rem;
  padding-left: 1.2rem;
}

/* --- footer: the bottom ---------------------------------------------------------------------------------- */

.site-footer {
  margin-top: clamp(2rem, 6vw, 4rem);
  padding-block: clamp(2rem, 6vw, 3.5rem) 2rem;
  background: var(--trench);
  border-top: 1px solid var(--line-soft);
  color: var(--silt);
  font-size: 1rem;
}

.footer-grid {
  display: grid;
  gap: 2rem 3rem;
}

.footer-about {
  display: grid;
  gap: 0.7rem;
  max-width: 30em;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--foam);
  font-family: var(--display);
  font-stretch: 72%;
  font-weight: 720;
  font-size: 1.5rem;
  line-height: 1;
}

.footer-brand .mark {
  width: 2.8rem;
  height: auto;
  aspect-ratio: 512 / 354.6;
  color: var(--remora);
}

.site-footer h2 {
  margin-bottom: 0.6rem;
  color: var(--foam);
  font-size: 1.15rem;
  font-stretch: 84%;
  font-weight: 620;
}

.site-footer ul {
  display: grid;
  gap: 0.15rem;
  padding: 0;
  list-style: none;
}

.site-footer li a {
  display: inline-block;
  padding-block: 0.3rem;
}

.footer-small {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
  font-size: var(--size-small);
}

.footer-small p {
  max-width: 62em;
}

@media (min-width: 44em) {
  .footer-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* --- motion ------------------------------------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .phone-screen iframe {
    transition: opacity 0.35s ease;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .site-header,
  .site-footer,
  .rail,
  .demo-bar,
  .copy {
    display: none;
  }
}
