:root {
  --cabinet: #e3e6e2;
  --sheet: #f5f6f3;
  --graphite: #1d2329;
  --wire: #5e6a73;
  --rule: #c3c9c4;
  --energized: #17863f;
  --energized-ink: #0f6a31;
  --editor: #1f1f1f;
  --code-ink: #d4d4d4;

  --font-body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --font-head: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;
  --font-code: "JetBrains Mono", Consolas, "Cascadia Mono", monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --rail-x: clamp(16px, 4vw, 48px);
  --measure: 68ch;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cabinet: #191d21;
    --sheet: #20252a;
    --graphite: #e4e8e5;
    --wire: #9aa5ad;
    --rule: #39424a;
    --energized: #3fbf6a;
    --energized-ink: #63d488;
  }
}

:root[data-theme="dark"] {
  --cabinet: #191d21;
  --sheet: #20252a;
  --graphite: #e4e8e5;
  --wire: #9aa5ad;
  --rule: #39424a;
  --energized: #3fbf6a;
  --energized-ink: #63d488;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--graphite);
  background: var(--cabinet);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

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

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: var(--cabinet);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--graphite);
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-size: 0.98rem;
}

.top-nav a {
  color: var(--graphite);
  text-decoration: none;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: var(--energized-ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.top-nav .button,
.top-nav .button:hover {
  color: #fff;
  text-decoration: none;
}

/* Buttons */

.button {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--energized);
  border-radius: var(--radius);
  background: var(--energized);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--energized-ink);
  border-color: var(--energized-ink);
}

.button--quiet {
  background: transparent;
  color: var(--graphite);
  border-color: var(--rule);
}

.button--quiet:hover {
  background: var(--sheet);
  border-color: var(--wire);
}

.button--small {
  padding: 5px 14px;
}

/* Screenshot frames: a dark editor window, the only dark surface on the page. */

.window {
  margin: 0;
  overflow: hidden;
  border: 1px solid #000;
  border-radius: var(--radius);
  background: var(--editor);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), 0 18px 40px -24px rgba(17, 25, 30, 0.55);
}

.window__tab {
  display: inline-block;
  padding: 7px 16px 6px;
  border-top: 2px solid var(--energized);
  background: #1f1f1f;
  color: #e6e6e6;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.8rem;
}

.window:has(.window__tab) {
  background: #181818;
}

.window img {
  width: 100%;
  background: var(--editor);
}

/* Home: a power rail runs down the left edge and every section hangs off it as a rung. */

.home {
  position: relative;
  padding: 0 var(--gutter) 0 calc(var(--rail-x) + var(--gutter));
}

.home::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--rail-x);
  width: 3px;
  background: var(--graphite);
  content: "";
}

.hero,
.workflow,
.rung-section {
  max-width: 1240px;
}

.hero {
  padding: clamp(40px, 8vw, 96px) 0 clamp(48px, 7vw, 88px);
}

.hero__copy {
  max-width: 46rem;
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lede {
  max-width: var(--measure);
  margin: 0 0 28px;
  color: var(--graphite);
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero__meta {
  margin: 18px 0 40px;
  color: var(--wire);
  font-size: 0.95rem;
}

.hero__meta a {
  color: inherit;
}

/* Section headings are connected to the rail by a horizontal rung. */

.rung-section,
.workflow {
  position: relative;
  padding: clamp(40px, 6vw, 72px) 0;
  border-top: 1px solid var(--rule);
}

.rung-section > h2,
.workflow > h2 {
  position: relative;
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
}

.rung-section > h2::before,
.workflow > h2::before {
  position: absolute;
  top: 0.58em;
  right: calc(100% + 12px);
  width: calc(var(--gutter) - 12px);
  height: 3px;
  background: var(--graphite);
  content: "";
}

.section-intro {
  max-width: var(--measure);
  margin: 0 0 clamp(28px, 4vw, 48px);
  color: var(--wire);
  font-size: 1.15rem;
}

.section-more {
  margin: 16px 0 0;
}

.feature-row {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 0 clamp(20px, 4vw, 56px);
  align-items: start;
  padding: clamp(24px, 3vw, 40px) 0;
}

.feature-row + .feature-row {
  border-top: 1px dashed var(--rule);
}

.feature-row h3 {
  margin: 0 0 10px;
  font-size: 1.45rem;
}

.feature-row p {
  max-width: var(--measure);
  margin: 0 0 12px;
}

.feature-row > .window {
  grid-column: 1 / -1;
  margin-top: 16px;
}

.feature-row--side {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.feature-row--side h3,
.feature-row--side .feature-row__text {
  grid-column: 1;
}

.feature-row--side > .window img {
  width: auto;
}

.feature-row--side > .window {
  grid-column: 2;
  grid-row: 1 / span 3;
  justify-self: start;
  max-width: 100%;
  margin-top: 0;
}

/* Workflow rung: contacts in series ending in a coil. */

.workflow-rung {
  --wire-color: var(--graphite);
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.workflow-rung::before {
  position: absolute;
  top: 21px;
  left: calc(-1 * var(--gutter));
  right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--energized) 50%, var(--wire-color) 50%) right / 200% 100% no-repeat;
  content: "";
}

.workflow-rung.is-energized::before {
  background-position: left;
  transition: background-position 1.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.workflow-rung li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10px;
  text-align: center;
}

.workflow-rung__symbol {
  position: relative;
  z-index: 1;
  display: block;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  background: var(--cabinet);
}

/* Contact: | | */
.workflow-rung__contact .workflow-rung__symbol {
  border-inline: 3px solid var(--graphite);
  width: 30px;
  margin-inline: 7px;
}

/* Coil: ( ) */
.workflow-rung__coil .workflow-rung__symbol {
  width: 44px;
  border: 3px solid var(--graphite);
  border-block-color: transparent;
  border-radius: 50%;
}

.workflow-rung.is-energized .workflow-rung__symbol {
  border-inline-color: var(--energized);
  transition: border-color 0.2s ease;
}

.workflow-rung.is-energized li:nth-child(1) .workflow-rung__symbol { transition-delay: 0.25s; }
.workflow-rung.is-energized li:nth-child(2) .workflow-rung__symbol { transition-delay: 0.55s; }
.workflow-rung.is-energized li:nth-child(3) .workflow-rung__symbol { transition-delay: 0.85s; }
.workflow-rung.is-energized li:nth-child(4) .workflow-rung__symbol { transition-delay: 1.15s; }
.workflow-rung.is-energized li:nth-child(5) .workflow-rung__symbol { transition-delay: 1.5s; }

.workflow-rung strong {
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 600;
}

.workflow-rung span:last-child {
  max-width: 24ch;
  color: var(--wire);
  font-size: 0.97rem;
  line-height: 1.45;
}

/* Language section */

.spec-list dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(20px, 4vw, 56px);
  margin: 0 0 32px;
}

.spec-list dl > div {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}


.spec-list dt {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
}

.spec-list dd {
  margin: 2px 0 0;
}

pre.cli {
  max-width: 62rem;
}

/* Code blocks use the editor colours of the screenshots. */

pre {
  position: relative;
  overflow-x: auto;
  margin: 0 0 20px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--editor);
  color: var(--code-ink);
  font-size: 0.9rem;
  line-height: 1.55;
}

pre code {
  font-size: inherit;
}

.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border: 1px solid #454545;
  border-radius: 4px;
  background: #2a2a2a;
  color: #cccccc;
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0;
}

pre:hover .copy-button,
.copy-button:focus-visible {
  opacity: 1;
}

/* Footer */

.site-footer {
  padding: 32px var(--gutter) 48px;
  border-top: 1px solid var(--rule);
  color: var(--wire);
  font-size: 0.95rem;
}

.site-footer p {
  max-width: var(--measure);
  margin: 0 0 6px;
}

.is-home .site-footer {
  padding-left: calc(var(--rail-x) + var(--gutter));
}

/* Docs */

.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 220px;
  gap: clamp(24px, 3vw, 48px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px var(--gutter) 64px;
}

.docs-nav,
.docs-toc {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.docs-nav a {
  padding: 6px 0 6px 14px;
  border-left: 3px solid var(--rule);
  color: var(--graphite);
  text-decoration: none;
}

.docs-nav a:hover {
  border-left-color: var(--wire);
}

.docs-nav a[aria-current="page"] {
  border-left-color: var(--energized);
  color: var(--energized-ink);
  font-weight: 600;
}

.docs-toc {
  gap: 2px;
  font-size: 0.92rem;
}

.docs-toc p {
  margin: 0 0 6px;
  color: var(--wire);
  font-weight: 600;
}

.docs-toc a {
  padding: 3px 0;
  color: var(--wire);
  text-decoration: none;
}

.docs-toc a:hover {
  color: var(--energized-ink);
}

.docs-content {
  min-width: 0;
  max-width: 50rem;
}

.docs-content h1 {
  margin: 0 0 8px;
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 700;
}

.docs-description {
  margin: 0 0 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  color: var(--wire);
  font-size: 1.15rem;
}

.markdown-body h2 {
  margin: 48px 0 12px;
  font-size: 1.75rem;
  scroll-margin-top: 16px;
}

.markdown-body h3 {
  margin: 32px 0 8px;
  font-size: 1.3rem;
  scroll-margin-top: 16px;
}

.markdown-body h4 {
  margin: 24px 0 8px;
  font-size: 1.1rem;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  max-width: var(--measure);
  margin: 0 0 16px;
}

.markdown-body li {
  margin-bottom: 6px;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin-top: 6px;
}

.markdown-body li pre {
  margin-top: 10px;
}

.markdown-body :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 3px;
  background: var(--sheet);
  border: 1px solid var(--rule);
}

.markdown-body img {
  margin: 20px 0 28px;
  border: 1px solid #000;
  border-radius: var(--radius);
  background: var(--editor);
}

.markdown-body blockquote {
  max-width: var(--measure);
  margin: 0 0 16px;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--rule);
  color: var(--wire);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 20px;
}

.markdown-body table {
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  border-bottom: 2px solid var(--graphite);
  font-family: var(--font-head);
  font-size: 1.02rem;
  font-weight: 600;
}

/* Narrow screens */

@media (max-width: 1180px) {
  .docs-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .feature-row,
  .feature-row--side,
  .spec-list dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .feature-row--side > .window {
    grid-column: 1;
    grid-row: auto;
    margin-top: 16px;
  }

  /* The rung turns vertical and hangs off the power rail. */
  .workflow-rung {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .workflow-rung::before {
    display: none;
  }

  .workflow-rung li {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 16px;
    align-items: start;
    padding: 0;
    text-align: left;
  }

  .workflow-rung__symbol {
    grid-row: span 2;
    margin-bottom: 0;
  }

  .workflow-rung span:last-child {
    max-width: none;
  }

  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 24px;
  }

  .docs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 0;
    max-height: none;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rule);
  }

  .docs-nav a {
    padding: 4px 12px;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .docs-nav a[aria-current="page"] {
    border-bottom-color: var(--energized);
  }
}

@media (max-width: 560px) {
  .home::before {
    width: 2px;
  }

  .rung-section > h2::before,
  .workflow > h2::before {
    height: 2px;
  }

  .top-nav {
    gap: 4px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workflow-rung.is-energized::before,
  .workflow-rung.is-energized .workflow-rung__symbol {
    transition: none;
  }
}
