/* Retract website styles. The rules behind every value here are in DESIGN.md. */

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter.var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono.var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* Tokens */

:root {
  color-scheme: light;

  --paper: #f4f2ed;
  --paper-sunk: #ebe8e1;
  --line: #d9d5cc;
  --line-strong: #bfbab0;
  --ink: #0b0b0c;
  --ink-2: #44423e;
  --ink-3: #66635d;
  --amber: #f0a020;
  --amber-ink: #0b0b0c;
  --focus: #0b0b0c;

  --term: #111112;
  --term-line: #2a2a2d;
  --term-fg: #ece9e2;
  --term-dim: #8e8b85;
  --term-amber: #f5b03a;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --step--1: 0.8125rem;  /* 13 */
  --step-0: 0.9375rem;   /* 15 */
  --step-1: 1.0625rem;   /* 17, body */
  --step-2: 1.25rem;     /* 20 */
  --step-3: 1.5rem;      /* 24 */
  --step-4: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);   /* 28 to 36 */
  --step-5: clamp(2.5rem, 1.6rem + 3.6vw, 4rem);       /* 40 to 64 */

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;
  --s10: 128px;

  --radius: 6px;
  --radius-panel: 10px;
  --container: 1120px;
  --gutter: 24px;
  --measure: 62ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0b0b0c;
    --paper-sunk: #141416;
    --line: #262629;
    --line-strong: #3a3a3e;
    --ink: #f4f2ed;
    --ink-2: #bdbab3;
    --ink-3: #94918a;
    --focus: #f4f2ed;
    --term: #131315;
    --term-line: #2c2c30;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b0b0c;
  --paper-sunk: #141416;
  --line: #262629;
  --line-strong: #3a3a3e;
  --ink: #f4f2ed;
  --ink-2: #bdbab3;
  --ink-3: #94918a;
  --focus: #f4f2ed;
  --term: #131315;
  --term-line: #2c2c30;
}

/* Base */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-1);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd,
figure,
pre {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 600;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

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

code,
kbd,
pre,
.num {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

code {
  font-size: 0.88em;
}

.num {
  font-size: 0.92em;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--s4);
  top: -100px;
  padding: var(--s2) var(--s4);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  z-index: 10;
}

.skip:focus {
  top: var(--s4);
}

.wrap {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Header */

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
}

.brand svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.brand span {
  position: relative;
  top: -1px;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--s5);
  font-size: var(--step-0);
}

.nav a:not(.button) {
  color: var(--ink-2);
  text-decoration: none;
}

.nav a:not(.button):hover {
  color: var(--ink);
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s5);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: var(--step-0);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

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

.button-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.button-quiet:hover {
  background: var(--paper-sunk);
  border-color: var(--ink-3);
}

.button-small {
  min-height: 36px;
  padding: 0 var(--s4);
}

.button svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Hero */

.hero {
  padding: var(--s9) 0 var(--s8);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s5);
  padding: 5px var(--s3) 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: var(--step--1);
  line-height: 1.4;
}

.held-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex: none;
}

.hero h1 {
  max-width: 13ch;
  font-size: var(--step-5);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 40rem;
  margin-top: var(--s5);
  color: var(--ink-2);
  font-size: var(--step-2);
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s6);
}

.clone {
  display: flex;
  align-items: center;
  max-width: 30rem;
  margin-top: var(--s5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-sunk);
  font-size: var(--step--1);
}

.clone code {
  flex: 1;
  min-width: 0;
  padding: 10px var(--s4);
  overflow-x: auto;
  white-space: nowrap;
  font-size: inherit;
  color: var(--ink-2);
}

.clone code::before {
  content: "$ ";
  color: var(--ink-3);
}

.copy {
  align-self: stretch;
  padding: 0 var(--s4);
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-family: var(--sans);
  cursor: pointer;
}

.copy:hover {
  color: var(--ink);
  background: var(--line);
}

/* Terminal */

.terminal {
  margin-top: var(--s8);
  border: 1px solid var(--term-line);
  border-radius: var(--radius-panel);
  background: var(--term);
  color: var(--term-fg);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--term-line);
  color: var(--term-dim);
  font-size: var(--step--1);
}

.terminal-title {
  font-family: var(--mono);
}

.terminal pre {
  padding: var(--s5) var(--s5) var(--s5);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
  tab-size: 2;
}

.terminal .p {
  color: var(--term-dim);
}

.terminal .cmd {
  color: var(--term-fg);
  font-weight: 500;
}

.terminal .out {
  color: #c9c6bf;
}

.terminal .dim {
  color: var(--term-dim);
}

.terminal .held {
  color: var(--term-amber);
}

.terminal .landed {
  color: var(--term-fg);
}

.terminal .gone {
  color: var(--term-dim);
  text-decoration: line-through;
  text-decoration-color: rgba(142, 139, 133, 0.6);
}

.terminal-decide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--term-line);
  font-size: var(--step-0);
}

.terminal-decide p {
  margin-right: auto;
  color: var(--term-dim);
}

.terminal-decide button {
  min-height: 40px;
  padding: 0 var(--s4);
  border: 1px solid #3a3a3f;
  border-radius: var(--radius);
  background: transparent;
  color: var(--term-fg);
  font: inherit;
  font-family: var(--mono);
  font-size: var(--step--1);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.terminal-decide button:hover {
  border-color: #6a6a70;
}

.terminal-decide button[aria-pressed="true"] {
  background: var(--term-fg);
  border-color: var(--term-fg);
  color: var(--term);
}

.terminal-decide button:focus-visible {
  outline-color: var(--term-fg);
}

.caption {
  margin-top: var(--s3);
  color: var(--ink-3);
  font-size: var(--step--1);
}

/* Today strip */

.today {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s3) var(--s6);
  padding: var(--s6) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: var(--step-0);
}

.today dt {
  color: var(--ink-3);
}

.today dd {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
}

.today .held-dot {
  display: inline-block;
  margin-right: var(--s2);
  vertical-align: 1px;
}

.today .later {
  color: var(--ink-2);
}

/* Sections */

.section {
  padding: var(--s10) 0 0;
}

.section-head {
  max-width: 44rem;
  margin-bottom: var(--s7);
}

.section-head h2 {
  font-size: var(--step-4);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.section-head p {
  margin-top: var(--s4);
  color: var(--ink-2);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s6);
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  padding-top: var(--s5);
  border-top: 1px solid var(--ink);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: var(--s4);
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--ink-3);
}

.steps h3,
.promises h3 {
  font-size: var(--step-2);
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.steps p,
.promises p {
  margin-top: var(--s2);
  color: var(--ink-2);
  font-size: var(--step-0);
  line-height: 1.6;
}

/* Diagram */

.diagram {
  display: grid;
  grid-template-columns: 1fr auto 1.25fr auto 1fr;
  align-items: stretch;
  margin-top: var(--s8);
  font-size: var(--step-0);
}

.node {
  padding: var(--s5);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-panel);
}

.node-retract {
  border-color: var(--ink);
  background: var(--paper-sunk);
}

.node h3 {
  font-size: var(--step-1);
  line-height: 1.3;
}

.node ul {
  margin-top: var(--s3);
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: var(--step--1);
  line-height: 1.5;
}

.node li + li {
  margin-top: var(--s1);
}

.node li .held-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  vertical-align: 2px;
}

.link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-width: 112px;
  padding: 0 var(--s3);
  color: var(--ink-3);
  font-size: var(--step--1);
  text-align: center;
  line-height: 1.35;
}

.arrow {
  position: relative;
  display: block;
  width: 72px;
  height: 1px;
  background: var(--ink-3);
}

.arrow-dashed {
  background: repeating-linear-gradient(90deg, var(--ink-3) 0 4px, transparent 4px 8px);
}

.arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 7px solid var(--ink-3);
}

/* Promises */

.promises {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s7) var(--s6);
}

.promises > div {
  max-width: 22rem;
}

/* Quickstart */

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s8);
  align-items: start;
}

.split .section-head {
  margin-bottom: 0;
}

.needs {
  margin-top: var(--s5);
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: var(--step-0);
}

.needs li {
  padding: var(--s2) 0;
  border-top: 1px solid var(--line);
}

.needs li:last-child {
  border-bottom: 1px solid var(--line);
}

.text-link {
  display: inline-block;
  margin-top: var(--s5);
  font-weight: 500;
  font-size: var(--step-0);
}

.split .terminal {
  margin-top: 0;
}

.terminal-bar .copy {
  padding: var(--s1) var(--s3);
  border: 1px solid var(--term-line);
  border-radius: var(--radius);
  color: var(--term-dim);
  font-size: var(--step--1);
}

.terminal-bar .copy:hover {
  background: transparent;
  color: var(--term-fg);
  border-color: #55555b;
}

.terminal .comment {
  color: var(--term-dim);
}

/* Why */

.why {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s8);
  padding-top: var(--s7);
  border-top: 1px solid var(--line);
}

.why blockquote {
  margin: 0;
  font-size: var(--step-3);
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.why-body p + p {
  margin-top: var(--s4);
}

.why-body p {
  color: var(--ink-2);
  max-width: var(--measure);
}

.why-body .sign {
  color: var(--ink-3);
  font-size: var(--step-0);
}

/* Early builders */

.builders {
  margin-top: var(--s10);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: var(--s8) 0;
  background: var(--term);
  color: var(--term-fg);
}

.builders .split {
  align-items: center;
}

.split-even {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.builders h2 {
  font-size: var(--step-4);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.builders .section-head p {
  color: #c9c6bf;
}

.form {
  display: grid;
  gap: var(--s4);
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: #c9c6bf;
  font-size: var(--step-0);
}

.field .opt {
  color: var(--term-dim);
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s4);
  border: 1px solid #3a3a3f;
  border-radius: var(--radius);
  background: #0b0b0c;
  color: var(--term-fg);
  font: inherit;
  font-size: 1rem;
}

.field input::placeholder {
  color: #6f6c67;
}

.field input:focus {
  outline: none;
  border-color: var(--term-fg);
}

.field input:focus-visible {
  outline: 2px solid var(--term-fg);
  outline-offset: 2px;
}

.trap {
  position: absolute;
  left: -9999px;
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4);
}

.builders .button {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
  font-weight: 600;
}

.builders .button:hover {
  background: #f5b54a;
  border-color: #f5b54a;
}

.builders .button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.form-note {
  color: var(--term-dim);
  font-size: var(--step--1);
}

.form-status {
  min-height: 1.6em;
  font-size: var(--step-0);
}

.form-status.ok {
  color: var(--term-amber);
}

.form-status.err {
  color: #ff9c8a;
}

/* Footer */

.site-footer {
  padding: var(--s8) 0 var(--s7);
  color: var(--ink-2);
  font-size: var(--step-0);
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s6);
}

.footer-top .brand {
  color: var(--ink);
}

.footer-top p {
  margin-top: var(--s3);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  padding: 0;
  list-style: none;
}

.footer-links a {
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.legal {
  margin-top: var(--s7);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: var(--step--1);
}

/* Simple pages (404, joined) */

.simple {
  min-height: 70vh;
  padding: var(--s9) 0;
}

.simple h1 {
  font-size: var(--step-4);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.simple p {
  margin-top: var(--s4);
  max-width: var(--measure);
  color: var(--ink-2);
}

/* Responsive */

@media (max-width: 960px) {
  .steps,
  .promises {
    grid-template-columns: 1fr 1fr;
  }

  .split,
  .why {
    grid-template-columns: 1fr;
    gap: var(--s6);
  }

  .diagram {
    grid-template-columns: 1fr;
  }

  .link {
    flex-direction: row;
    min-height: 56px;
  }

  .arrow {
    width: 1px;
    height: 28px;
  }

  .arrow-dashed {
    background: repeating-linear-gradient(180deg, var(--ink-3) 0 4px, transparent 4px 8px);
  }

  .arrow::after {
    right: auto;
    top: auto;
    left: -4px;
    bottom: -1px;
    border-top: 7px solid var(--ink-3);
    border-left: 4.5px solid transparent;
    border-right: 4.5px solid transparent;
    border-bottom: 0;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
  }

  .nav .hide-sm {
    display: none;
  }

  .nav {
    gap: var(--s4);
  }

  .hero {
    padding: var(--s8) 0 var(--s7);
  }

  .lede {
    font-size: var(--step-1);
  }

  .actions .button {
    flex: 1 1 auto;
  }

  .steps,
  .promises {
    grid-template-columns: 1fr;
    gap: var(--s6);
  }

  .section {
    padding-top: var(--s9);
  }

  .today {
    grid-template-columns: 1fr;
    gap: var(--s2);
  }

  .today dd + dt {
    margin-top: var(--s3);
  }

  .terminal pre {
    padding: var(--s4);
    font-size: 0.75rem;
  }

  .terminal-decide {
    padding: var(--s4);
  }

  .terminal-decide p {
    flex-basis: 100%;
  }

  .terminal-decide button {
    flex: 1;
  }
}

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

  * {
    transition: none !important;
  }
}

.simple .brand + h1 {
  margin-top: var(--s8);
}
