/*
 * The application's own palette, so the page and what it shows agree. The values
 * are those of `apps/desktop/src/styles/tokens.css`, contrast included: the
 * amber of the light theme is the darkened one (#157), which is what small text
 * needs on a pale ground.
 */
:root {
  --ground: #14131a;
  --raised: #1d1c26;
  --line: #33313f;
  --text: #eceaf2;
  --muted: #9691a6;
  --faint: #918da0;
  --accent: #f2a33c;
  --accent-ink: #14131a;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 18px 48px rgb(0 0 0 / 34%);

  /* Code, coloured when the site is built. */
  --code-ground: #100f15;
  --token-keyword: #c4a7ff;
  --token-string: #9fd49a;
  --token-number: #f2a33c;
  --token-function: #7cc7ff;
  --token-class: #6fd3c4;
  --token-variable: #f38ba8;
  --token-comment: #7f7a90;
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #faf9fb;
    --raised: #fff;
    --line: #e2dfe8;
    --text: #1a1822;
    --muted: #645e72;
    --faint: #6f6a7e;
    --accent: #985c08;
    --accent-ink: #fff;
    --shadow: 0 1px 2px rgb(26 24 34 / 8%), 0 18px 48px rgb(26 24 34 / 10%);

    --code-ground: #f6f5f9;
    --token-keyword: #7b3fd1;
    --token-string: #2f7d32;
    --token-number: #985c08;
    --token-function: #1f6fb2;
    --token-class: #0f7a6c;
    --token-variable: #b4235a;
    --token-comment: #736d82;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-inline: 20px;
  padding-block: 0 72px;
  background: var(--ground);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

main,
header,
footer {
  max-width: 860px;
  margin-inline: auto;
}

a {
  color: var(--accent);
}

code,
pre,
.command,
.mono {
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  /* `--ignore-missing` must read as typed: a ligature makes it a dash. */
  font-variant-ligatures: none;
}

/* A name or a value inside a sentence, set apart without shouting. */
:not(pre) > code {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  font-size: 0.88em;
}

/* ---------------------------------------------------------------- header */

header {
  padding-block: 72px 40px;
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}

header img {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 12px 44px rgb(242 163 60 / 28%);
}

h1 {
  font-size: clamp(34px, 6vw, 48px);
  line-height: 1.05;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 2.4vw, 20px);
  text-wrap: balance;
}

.latin {
  margin: 6px 0 0;
  color: var(--faint);
  font-size: 14px;
}

/* ---------------------------------------------------------------- the live keyboard */

/* The canvas draws the keyboard and the light it throws around it; the figure
   only gives it room. */
.live {
  margin: -32px 0 24px;
}

.live canvas {
  display: block;
  width: 100%;
  height: auto;
}

.live figcaption {
  text-align: center;
  margin-top: 0;
}

/* ---------------------------------------------------------------- sections */

section {
  padding-block: 40px;
  border-top: 1px solid var(--line);
}

h2 {
  font-size: 22px;
  margin: 0 0 16px;
}

h3 {
  font-size: 16px;
  margin: 24px 0 6px;
}

p {
  margin: 0 0 14px;
}

.lead {
  font-size: 18px;
}

figure {
  margin: 0 0 28px;
}

figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: block;
}

figcaption {
  margin-top: 8px;
  color: var(--faint);
  font-size: 13px;
}

ul {
  margin: 0 0 14px;
  padding-left: 20px;
}

li {
  margin-bottom: 8px;
}

li::marker {
  color: var(--accent);
}

/* ---------------------------------------------------------------- getting started */

/* What to do next, where the eye lands after the promise. */
.cta {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.cta .download {
  font-size: 16px;
  padding: 10px 18px;
}

/* Three steps, numbered as the eye reads them. */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 0;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
}

.steps li::before {
  content: counter(step);
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
}

kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--raised);
}

/* ---------------------------------------------------------------- install */

.ways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}

.way {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}

.way h3 {
  margin-top: 0;
}

/* A sentence after the cards belongs to them, not glued to them. */
.ways + p {
  margin-top: 16px;
}

/* A row of keys lit the way the effects in the card light them. */
.way[style*="--tint"]::before {
  content: "";
  display: block;
  height: 10px;
  margin-bottom: 14px;
  border-radius: 2px;
  background: var(--tint);
  mask: repeating-linear-gradient(90deg, #000 0 14px, transparent 14px 18px);
  box-shadow: 0 0 12px rgb(255 255 255 / 10%);
}

.way p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}

.command,
pre {
  background: var(--code-ground);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 44px 10px 12px;
  font-size: 13px;
  overflow-x: auto;
}

pre {
  padding: 16px 48px 16px 16px;
  line-height: 1.55;
}

/* A block named after the file it would be: the header is part of the block. */
.code {
  margin: 1em 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--code-ground);
}

.code .file {
  padding: 7px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
  color: var(--faint);
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  font-size: 12px;
}

.code pre {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.hljs-keyword,
.hljs-meta,
.hljs-selector-tag {
  color: var(--token-keyword);
}

.hljs-string,
.hljs-regexp {
  color: var(--token-string);
}

.hljs-number,
.hljs-literal {
  color: var(--token-number);
}

.hljs-title.function_,
.hljs-built_in {
  color: var(--token-function);
}

.hljs-title.class_,
.hljs-type {
  color: var(--token-class);
}

.hljs-variable,
.hljs-template-variable,
.hljs-params .hljs-variable {
  color: var(--token-variable);
}

.hljs-attr,
.hljs-property {
  color: var(--muted);
}

.hljs-comment {
  color: var(--token-comment);
  font-style: italic;
}

/* ---------------------------------------------------------------- copying */

.copyable {
  position: relative;
}

/* The button sits on the block, not in it: inside a `pre` it would scroll away
   with a long line, and become part of what a selection picks up. */
.copy {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--raised);
  color: var(--muted);
  cursor: pointer;
}

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

.copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.copy svg {
  width: 15px;
  height: 15px;
}

.copy .check,
.copy.done .mark {
  display: none;
}

.copy.done .check {
  display: block;
}

/* Named for a screen reader, silent on screen. */
.said {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.download {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
}

.note {
  color: var(--faint);
  font-size: 13px;
  margin-top: 10px;
}

/* ---------------------------------------------------------------- devices */

.filter {
  display: flex;
  gap: 14px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter input {
  width: min(320px, 100%);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.filter input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.filter .note {
  margin: 0;
}

/* A table is a list: a row a thing, a column a fact. A narrow screen scrolls it
   rather than folding the columns into an unreadable stack. */
.scroller {
  overflow-x: auto;
  margin-bottom: 14px;
}

.scroller table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

.scroller th {
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  padding: 0 20px 8px 0;
  border-bottom: 1px solid var(--line);
}

.scroller td {
  padding: 12px 20px 12px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

/* The model is what someone scans for. */
.devices td:nth-child(2) {
  font-weight: 500;
}

/* Two answers, kept on one line: each opens the report form already answered. */
.devices td.answers {
  white-space: nowrap;
}

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

/* ---------------------------------------------------------------- automations */

/* A rule as the tab reads it: the sentence someone builds, set apart. */
.sentence {
  margin: 0 0 18px;
  padding: 14px 18px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 500;
}

/* A page under the landing one: same furniture, a quieter title. */
.subpage h1 {
  font-size: 32px;
  margin-bottom: 10px;
}

.subpage .lead {
  color: var(--muted);
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------- the pages' bar */

/* Every page but the landing one: where it sits among the others, one click from each. */
nav.docs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

nav.docs a {
  color: var(--muted);
  text-decoration: none;
}

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

nav.docs a[aria-current="page"] {
  color: var(--accent);
  font-weight: 500;
}

nav.docs .home {
  margin-right: 8px;
}

/* ---------------------------------------------------------------- footer */

footer {
  padding-top: 32px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 14px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: baseline;
}

footer .spacer {
  flex: 1;
}

/* ---------------------------------------------------------------- the policy */

.policy h1 {
  font-size: 32px;
  margin-bottom: 20px;
}

.policy h2 {
  font-size: 20px;
  margin-top: 32px;
}

.policy table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 16px;
  display: block;
  overflow-x: auto;
}

.policy th,
.policy td {
  border-bottom: 1px solid var(--line);
  padding: 8px 12px 8px 0;
  text-align: left;
  font-size: 15px;
  vertical-align: top;
}

.policy th {
  color: var(--faint);
  font-weight: 500;
}

.back {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
