:root {
  /* one graphite ramp, tinted toward steel */
  --bg-well: #090b0c;
  --bg: #0c0e10;
  --bg-1: #111417;
  --bg-2: #181c20;
  --bg-3: #1f2429;
  --bg-5: #333a41;
  --rule: #23282d;
  --rule-2: #3a4148;
  --line: #5a636b;
  --ink-3: #8b949c;
  --ink-2: #c3c9ce;
  --ink: #eceff1;

  /* the product accent on dark surfaces: --color-accent, -hover and -on-accent from web/src/app.css, as hex for the canvas */
  --signal: #759cef;
  --signal-hi: #8ab0fe;
  --signal-ink: #0b111f;
  --error: #ff7a6b;

  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --pad: 32px;
  --pad-end: 48px;
  --gutter: 32px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 1rem/1.625 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }

::selection { background: var(--signal); color: var(--signal-ink); }

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

/* ---------- sheet: the framed drawing every section sits in ---------- */

.sheet {
  width: min(100% - 2 * var(--gutter), 1328px);
  margin-inline: auto;
  border-inline: 1px solid var(--rule);
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid transparent;
}

/* rules and column lines are pseudo-elements so they can be drawn in */
.row::before,
.join__panel::before,
.confirm::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rule-2);
  transform-origin: left;
}

.spec + .spec::after,
.isolation__figure::after,
.isolation__aside::after,
.join__copy::after,
.field--setup::after,
.form__submit::after,
.confirm p::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 1px;
  background: var(--rule);
  transform-origin: top;
}

.cell { position: relative; }

/* registration mark where a rule meets a column line */
.cell::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  width: 9px;
  height: 9px;
  background:
    linear-gradient(var(--ink-3), var(--ink-3)) center / 1px 100% no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) center / 100% 1px no-repeat;
  pointer-events: none;
}

.num {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  font: 400 0.75rem/1 var(--mono);
  font-stretch: 87.5%;
  font-variant-numeric: tabular-nums;
}

.num::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
  transform-origin: left;
}

h2,
h3 {
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 500;
  font-stretch: 108%;
  line-height: 2rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.head { padding: 32px var(--pad-end) 0 var(--pad); }
.head h2 { margin-top: 40px; }

/* the first sentence of every paragraph is set to be read on its own */
.lede {
  display: block;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.75rem;
}

/* ---------- masthead / colophon ---------- */

.masthead { border-bottom: 1px solid var(--rule); }

.masthead__row,
.colophon__row {
  display: flex;
  align-items: stretch;
  gap: 28px;
  height: 64px;
  padding-left: var(--pad);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  --zw-accent: var(--signal);
}

.wordmark__lockup {
  flex: none;
  height: 28px;
  aspect-ratio: 297 / 64;
  /* the stem starts 12/64 into the mark box; pull it onto the text edge */
  margin-left: -5px;
  overflow: visible;
}

.wordmark--quiet { color: var(--ink-2); }

.ruler {
  flex: 1;
  align-self: flex-end;
  height: 8px;
  background:
    repeating-linear-gradient(to right, var(--rule-2) 0 1px, transparent 1px 40px) left bottom / 100% 8px no-repeat,
    repeating-linear-gradient(to right, var(--rule-2) 0 1px, transparent 1px 8px) left bottom / 100% 4px no-repeat;
}

.colophon { border-top: 1px solid var(--rule-2); }

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

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 20px 0 24px;
  border: 0;
  border-radius: 2px;
  background: var(--signal);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -2px 0 rgba(0, 0, 0, .2);
  color: var(--signal-ink);
  font: 600 1rem/1 var(--sans);
  font-stretch: 104%;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  transition: background-color .14s var(--ease), transform .14s var(--ease);
}

.btn:hover { background: var(--signal-hi); }

.btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, .2);
}

.btn__icon {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform .14s var(--ease);
}

a.btn:hover .btn__icon { transform: translateY(2px); }
button.btn:hover .btn__icon { transform: translateX(2px); }

.btn.is-busy {
  background: var(--bg-3);
  box-shadow: inset 0 0 0 1px var(--rule-2);
  color: var(--ink);
  cursor: progress;
}

.btn.is-busy .btn__icon { display: none; }

.btn.is-busy::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--signal);
  transform-origin: left;
  animation: request 1s linear both;
}

@keyframes request {
  from { transform: scaleX(0); }
}

/* ---------- hero ---------- */

.hero__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  min-height: min(100svh - 65px, 800px);
}

.hero__text {
  position: relative;
  z-index: 1;
  grid-column: 1 / span 7;
  grid-row: 1;
  align-self: center;
  padding: 64px var(--pad) 72px;
}

h1 {
  max-width: 13ch;
  color: var(--ink);
  font-size: clamp(2.5rem, 1.2rem + 4vw, 4.5rem);
  font-weight: 500;
  font-stretch: 112%;
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero__sub {
  max-width: 35rem;
  margin-top: 40px;
  font-size: 1.25rem;
  line-height: 2rem;
}

.hero__cta {
  display: grid;
  justify-items: start;
  gap: 20px;
  margin-top: 44px;
}

.hero__note {
  max-width: 27rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* ---------- the branch graph ---------- */

.stage {
  position: relative;
  grid-column: 7 / -1;
  grid-row: 1;
  min-height: 620px;
}

.graph,
.still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.graph {
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.graph.is-dragging { cursor: grabbing; }

/* the still stands in wherever the canvas cannot draw: no script, or no 2D context */
.js .still,
html:not(.js) .graph,
.stage.is-static .graph { display: none; }

.stage.is-static .still { display: block; }

.still text {
  font-family: var(--mono);
  font-stretch: 87.5%;
}

/* ---------- 01 to 03: three bays side by side ---------- */

.spec__body { padding: 32px var(--pad-end) 80px var(--pad); }

/* ---------- 04: isolation, the drawing between its two notes ---------- */

.isolation {
  grid-template-rows: auto 1fr;
  background: var(--bg-1);
}

.isolation__head {
  grid-column: 1;
  grid-row: 1;
}

.isolation__text { padding: 32px var(--pad-end) 80px var(--pad); }

.isolation > .isolation__text {
  grid-column: 1;
  grid-row: 2;
}

.isolation__figure {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 48px var(--pad-end) 80px var(--pad);
}

/* the second note starts on the line of the first */
.isolation__aside {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-rows: subgrid;
}

.isolation__aside .isolation__text { grid-row: 2; }

.diagram {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  overflow: visible;
}

.d-line { fill: none; stroke: var(--line); stroke-width: 1; }
.d-box { fill: var(--bg-2); stroke: var(--line); stroke-width: 1; }
.d-hatch { stroke: var(--line); stroke-width: 1.5; }
.d-wall { stroke: var(--line); stroke-width: 1; }
.d-room { fill: var(--bg-1); stroke: var(--line); stroke-width: 1; }
.d-chip-hollow { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.d-chip { fill: var(--signal); }
.d-node { fill: var(--bg); stroke: var(--line); stroke-width: 1; }
.d-dot { fill: var(--ink-3); }

.diagram--flow {
  max-width: 300px;
  margin-top: 40px;
}

.d-label {
  fill: var(--ink-3);
  font: 400 11px/1 var(--mono);
  font-stretch: 87.5%;
}

.d-label--hi { fill: var(--ink-2); }

/* ---------- 05: waitlist ---------- */

.join__head { padding-bottom: 80px; }

.join__head h2 {
  font-size: clamp(2rem, 1.2rem + 2vw, 2.75rem);
  font-stretch: 112%;
  line-height: 1;
  letter-spacing: -0.02em;
}

.join__copy { padding: 88px var(--pad-end) 80px var(--pad); }
.join__copy--b .lede { margin-bottom: 0; }

.join__panel {
  position: relative;
  grid-column: 1 / -1;
  border-top: 1px solid transparent;
  background: var(--bg-1);
}

.form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field,
.form__submit {
  padding: 56px var(--pad-end) 64px var(--pad);
}

.field {
  display: grid;
  align-content: start;
  gap: 8px;
}

label {
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
}

input,
textarea {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: var(--bg-well);
  color: var(--ink);
  font: 400 1rem/1.5rem var(--sans);
  transition: border-color .14s var(--ease);
}

input { height: 48px; }
textarea { min-height: 96px; resize: vertical; }

::placeholder { color: var(--ink-3); opacity: 1; }

input:hover,
textarea:hover { border-color: var(--line); }

input:focus-visible,
textarea:focus-visible {
  outline-offset: 0;
  border-color: var(--signal);
}

input[aria-invalid="true"] {
  border-color: var(--error);
  outline-color: var(--error);
}

.field__help,
.form__note {
  color: var(--ink-3);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.field__error,
.form__error {
  color: var(--error);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* 84px puts the button on the line of the two inputs */
.form__submit {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 12px;
  padding-top: 84px;
}

.confirm {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  margin-top: -1px;
  border-top: 2px solid transparent;
}

.confirm::before {
  top: -2px;
  height: 2px;
  background: var(--signal);
}

.confirm h3,
.confirm p { padding: 56px var(--pad-end) 72px var(--pad); }

/* focus lands here only from the script, after the form is replaced */
.confirm h3:focus { outline: 0; }

.confirm p { position: relative; }

.confirm__email {
  color: var(--ink);
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

/* ---------- motion: lines draw themselves in once, text never moves ---------- */

@media (prefers-reduced-motion: no-preference) {
  .row::before,
  .join__panel::before,
  .num::after,
  .spec + .spec::after,
  .spec__body::after,
  .isolation::after,
  .isolation__figure::after,
  .isolation__aside::after,
  .join__copy::after,
  .field--setup::after,
  .form__submit::after {
    transition: transform .8s var(--ease);
  }

  .js :is(.row, .spec):not(.is-in) .num::after,
  .js .row:not(.is-in)::before,
  .js .join__panel:not(.is-in)::before { transform: scaleX(0); }

  .js .spec:not(.is-in)::after,
  .js .spec:not(.is-in) .spec__body::after,
  .js .row:not(.is-in) :is(.isolation__figure, .isolation__aside, .join__copy)::after,
  .js .isolation:not(.is-in)::after,
  .js .join__panel:not(.is-in) :is(.field--setup, .form__submit)::after { transform: scaleY(0); }

  /* registration marks land once the lines they sit on are there */
  .cell::before { transition: opacity .3s var(--ease) .5s; }

  .js :is(.row, .join__panel):not(.is-in) .cell::before,
  .js .spec:not(.is-in)::before { opacity: 0; }

  .confirm::before { animation: rule .8s var(--ease) both; }

  .js .diagram :is(.d-line, .d-box, .d-wall, .d-room, .d-node) {
    stroke-dasharray: 1;
    transition: stroke-dashoffset .7s var(--ease) calc(var(--i, 0) * .06s), fill-opacity .3s var(--ease) .5s;
  }

  .js .diagram :is(.d-label, .d-chip, .d-chip-hollow, .d-dot) { transition: opacity .3s var(--ease) .5s; }

  .js .diagram:not(.is-in) :is(.d-line, .d-box, .d-wall, .d-room, .d-node) {
    stroke-dashoffset: 1;
    fill-opacity: 0;
  }

  .js .diagram:not(.is-in) :is(.d-label, .d-chip, .d-chip-hollow, .d-dot) { opacity: 0; }
}

@keyframes rule {
  from { transform: scaleX(0); }
}

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  /* narrow bays keep the tighter inset so the ledes keep their measure */
  :root { --pad: 24px; --pad-end: 36px; }

  .hero__text { grid-column: 1 / span 6; }
}

@media (max-width: 1040px) {
  /* rows become label left, content right */
  .row { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

  .spec {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: subgrid;
  }

  /* between stacked bays the line turns into a rule */
  .spec + .spec::after {
    top: -1px;
    bottom: auto;
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
    background: var(--rule-2);
    transform-origin: left;
  }

  .js .spec:not(.is-in)::after { transform: scaleX(0); }

  .spec__body { position: relative; }

  .spec__body::after,
  .isolation::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -1px;
    width: 1px;
    background: var(--rule);
    transform-origin: top;
  }

  .spec__body {
    padding-top: 88px;
    padding-bottom: 72px;
  }

  /* the note, the drawing and the second note stack in the content column behind one line */
  .isolation { grid-template-rows: none; }
  .isolation::after { left: calc(100% / 3 - 1px); }
  .isolation__head { grid-row: 1 / span 3; }

  .isolation > .isolation__text,
  .isolation__figure,
  .isolation__aside {
    grid-column: 2;
    grid-row: auto;
  }

  .isolation > .isolation__text { padding: 88px var(--pad-end) 0 var(--pad); }

  .isolation__figure {
    justify-items: start;
    padding: 48px var(--pad-end) 0 var(--pad);
  }

  .isolation__aside { display: block; }
  .isolation__aside .isolation__text { padding-top: 48px; padding-bottom: 72px; }

  .isolation__figure::before,
  .isolation__figure::after,
  .isolation__aside::before,
  .isolation__aside::after,
  .form__submit::before { display: none; }

  .join__head { grid-row: 1 / span 2; }
  .join__copy { grid-column: 2; }
  .join__copy--a { padding-bottom: 0; }
  .join__copy--b { padding-top: 20px; padding-bottom: 72px; }
  .join__copy--b::before { display: none; }

  .form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field { padding-bottom: 40px; }

  .form__submit {
    grid-column: 1 / -1;
    padding-top: 0;
  }

  .form__submit::after { display: none; }

  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .hero__text {
    grid-column: 1;
    padding-bottom: 16px;
  }

  h1 { max-width: 14ch; }

  .stage {
    grid-column: 1;
    grid-row: 2;
    min-height: 600px;
  }
}

@media (max-width: 720px) {
  :root { --pad: 20px; --gutter: 0px; }

  .sheet { border-inline: 0; }
  .cell::before { display: none; }

  .masthead__row,
  .colophon__row { height: 56px; }

  .hero__text { padding-top: 48px; }
  .hero__sub { margin-top: 28px; }
  .hero__cta { margin-top: 32px; }

  .stage { min-height: 500px; }

  .lede {
    margin-bottom: 12px;
    font-size: 1.125rem;
    line-height: 1.625rem;
  }

  /* scaled down this far the still's lettering stops being readable */
  .still__labels { display: none; }

  /* one column: no column lines left to draw */
  .spec__body::after,
  .isolation::after,
  .join__copy::after,
  .field--setup::after,
  .confirm p::after { display: none; }

  .row,
  .form,
  .confirm { grid-template-columns: minmax(0, 1fr); }

  .head { padding: 28px var(--pad) 0; }
  .head h2 { margin-top: 28px; }

  .spec { display: block; }
  .spec__body { padding: 24px var(--pad) 52px; }
  .diagram--flow { margin-top: 32px; }

  .isolation__head,
  .isolation > .isolation__text,
  .isolation__figure,
  .isolation__aside { grid-column: 1; grid-row: auto; }

  .isolation > .isolation__text { padding: 24px var(--pad) 0; }
  .isolation__figure { padding: 36px var(--pad) 0; }
  .isolation__aside .isolation__text { padding: 36px var(--pad) 52px; }

  .join__head,
  .join__copy { grid-column: 1; grid-row: auto; }

  .join__head { padding-bottom: 0; }
  .join__copy--a { padding: 24px var(--pad) 0; }
  .join__copy--b { padding: 20px var(--pad) 52px; }

  .field,
  .form__submit { padding: 32px var(--pad) 0; }

  .form__submit { padding-bottom: 56px; }
  .form__submit .btn { width: 100%; }

  .confirm h3 { padding: 36px var(--pad) 0; }
  .confirm p { padding: 16px var(--pad) 56px; }
}

@media (max-width: 400px) {
  .stage { min-height: 480px; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
