/* Keel site. One dark palette (a dim phosphor terminal), one column of
   reading width, code in mono, prose in sans. */

:root {
  --bg: #050a07;
  --panel: #0a130d;
  --rule: #1a2a1f;
  --text: #dde6df;
  --text-dim: #93a598;
  --green: #6fe398;
  --green-dim: #4c9f69;
  --red: #f06a6a;
  --amber: #e8c66a;

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --small: 0.875rem;
  --base: 1rem;
  --large: 1.25rem;
  --h2: clamp(1.5rem, 1.25rem + 1vw, 1.875rem);
  --h1: clamp(2.75rem, 2rem + 3.5vw, 4.5rem);

  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));

  color-scheme: dark;
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--base);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--green);
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--green);
}

p {
  margin: 0;
  max-width: 64ch;
}

h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}

.dim {
  color: var(--text-dim);
}

/* Header */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: rgba(5, 10, 7, 0.9);
  border-bottom: 1px solid var(--rule);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}

.logo {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--green);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: 20px;
  font-size: var(--small);
}

.site-header nav a {
  color: var(--text-dim);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--text);
}

/* Hero */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.3;
}

/* Keeps the text side dark so the rain never sits behind words. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg) 0%, rgba(5, 10, 7, 0.8) 50%, rgba(5, 10, 7, 0.2) 100%);
}

.hero .container {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 20px;
  padding-block: clamp(56px, 9vw, 112px);
}

.hero h1 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: var(--h1);
  line-height: 1;
  letter-spacing: 0.14em;
  color: var(--green);
}

.tagline {
  font-size: var(--h2);
  font-weight: 500;
  line-height: 1.35;
  max-width: 24ch;
}

.tagline em {
  font-style: normal;
  color: var(--green);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--small);
  color: var(--text-dim);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-weight: 500;
  font-size: var(--small);
  text-decoration: none;
}

/* The red pill: the one place the film shows through. */
.button.primary {
  color: var(--red);
}

.button.primary::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.button.secondary {
  color: var(--text-dim);
  border-color: var(--rule);
}

/* Sections */

.section {
  border-bottom: 1px solid var(--rule);
  /* Keep headings clear of the sticky header when jumping to a section. */
  scroll-margin-top: 64px;
}

.section .container {
  display: grid;
  gap: 20px;
  padding-block: clamp(48px, 7vw, 80px);
}

.label {
  font-family: var(--mono);
  font-size: var(--small);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-dim);
}

.section h2 {
  font-size: var(--h2);
  font-weight: 600;
  line-height: 1.25;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 20px;
  align-items: start;
}

.columns > * {
  min-width: 0;
}

/* Code panels */

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: var(--small);
  color: var(--text-dim);
}

.panel pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: var(--small);
  line-height: 1.6;
}

.panel pre code {
  color: var(--text);
  font-size: 1em;
}

/* Syntax and terminal colors, applied by hand in the HTML. */
.kw { color: var(--green); }
.ty { color: #8fc9d8; }
.cm { color: #6c8a74; font-style: italic; }
.ok { color: var(--green); }
.err { color: var(--red); }
.cex { color: var(--amber); }
.sh { color: var(--green-dim); }

.copy-button {
  font: inherit;
  font-size: var(--small);
  color: var(--green);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1px 10px;
  cursor: pointer;
}

.copy-button:hover {
  border-color: var(--green-dim);
}

/* Bar chart: each bar's width is set from --share (fraction of the slowest). */

.bars {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--small);
}

.bars li {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr) 4rem;
  gap: 12px;
  align-items: center;
}

.bars .bar {
  height: 10px;
  background: rgba(111, 227, 152, 0.08);
  border-radius: 2px;
}

.bars .bar::before {
  content: "";
  display: block;
  height: 100%;
  width: calc(var(--share) * 100%);
  min-width: 2px;
  background: var(--green-dim);
  border-radius: 2px;
}

.bars .ours .bar::before {
  background: var(--green);
}

.bars .time {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: var(--small);
}

th,
td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule);
}

th {
  font-weight: 500;
  color: var(--text-dim);
}

tr:last-child td {
  border-bottom: 0;
}

td.number {
  font-variant-numeric: tabular-nums;
}

/* Feature list */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.features h3 {
  font-size: var(--base);
  font-weight: 600;
}

.features p {
  font-size: var(--small);
  color: var(--text-dim);
}

.note {
  border-left: 2px solid var(--amber);
  padding-left: 16px;
}

/* Footer */

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 28px;
  padding-block: 32px;
  font-size: var(--small);
  color: var(--text-dim);
}

@media (max-width: 600px) {
  .site-header nav {
    display: none;
  }

  .bars li {
    grid-template-columns: minmax(0, 1fr) 4rem;
  }

  .bars .bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
