/* Colours follow img/logo.svg: dark panel, heat orange, ice blue. */
:root {
  --bg: #080b10;
  --panel: #111722;
  --line: #263040;
  --text: #d8dee9;
  --dim: #8a96a8;
  --heat: #ff8a2a;
  --heat-hi: #ffd84d;
  --ice: #3fc8ff;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--text);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #141a24 0, var(--bg) 640px) no-repeat;
}

a { color: var(--ice); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--heat-hi);
}

.hero, main, footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  padding-top: 64px;
  padding-bottom: 40px;
  text-align: center;
}

.logo { width: min(480px, 100%); height: auto; }

h1 {
  margin: 28px auto 12px;
  max-width: 760px;
  font-size: clamp(26px, 4.4vw, 40px);
  line-height: 1.2;
  color: #fff;
}

.lead {
  margin: 0 auto;
  max-width: 680px;
  color: var(--dim);
  font-size: 18px;
}

.jump {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 28px;
  margin-top: 28px;
  font-weight: 600;
}

.project {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  margin: 24px 0;
  padding: 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.repo {
  margin: 0;
  font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--heat);
  letter-spacing: 0.02em;
}

.tag {
  margin-left: 6px;
  padding: 1px 8px;
  border: 1px solid var(--heat);
  border-radius: 999px;
  font-size: 12px;
}

h2 {
  margin: 6px 0 8px;
  font-size: clamp(24px, 3.2vw, 30px);
  line-height: 1.2;
  color: #fff;
}

.project ul { margin: 16px 0 24px; padding-left: 20px; }
.project li { margin: 6px 0; }
.project li::marker { color: var(--heat); }

.links { display: flex; flex-wrap: wrap; gap: 10px; }

/* A project card's four actions: what needs no device in the first row, what needs one in the second. */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 480px; }
.actions .btn { display: flex; align-items: center; justify-content: center; text-align: center; }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  background: #1a2230;
}
.btn:hover { text-decoration: none; border-color: var(--ice); }

.btn.primary {
  color: #10131a;
  border-color: transparent;
  background: linear-gradient(90deg, var(--heat-hi), var(--heat));
}
.btn.primary:hover { filter: brightness(1.08); }

.more { margin: 16px 0 0; font-size: 15px; color: var(--dim); }

.screens {
  display: grid;
  gap: 16px;
  margin: 0;
}

/* The device screens are pixel art: keep the pixels sharp. */
.screens img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 10px solid #000;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--line);
}

.notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 40px 0;
}

.notes h3 { margin: 0 0 8px; color: #fff; font-size: 19px; }
.notes p { margin: 0; color: var(--dim); }

.devices {
  margin: 24px 0;
  padding: 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.devices h2 { margin-top: 0; }
.devices > p { margin: 0 0 16px; color: var(--dim); }

.matrix { width: 100%; border-collapse: collapse; font-size: 15px; }
.matrix th, .matrix td { text-align: left; vertical-align: middle; padding: 12px; border-bottom: 1px solid var(--line); }
.matrix thead th { color: var(--dim); font-weight: 600; vertical-align: bottom; }
.matrix tbody tr:last-child > * { border-bottom: 0; }

/* The answer in a cell: a pill that opens its details in a popover. */
.st {
  padding: 2px 11px;
  border: 1px solid;
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.st:hover { filter: brightness(1.25); }
.st.yes { color: #6ee7a8; border-color: #2f6b4f; }
.st.part { color: var(--heat-hi); border-color: #6b5a22; }
.st.no { color: #ff7a7a; border-color: #6b2f2f; }

.tip {
  max-width: min(440px, calc(100vw - 32px));
  padding: 18px 20px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.5);
}
.tip::backdrop { background: rgb(0 0 0 / 0.45); }
.tip strong { display: block; margin-bottom: 8px; color: #fff; }
.tip p { margin: 0; color: var(--dim); font-size: 15px; }

.vote {
  margin: 24px 0;
  padding: 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.vote h2 { margin-top: 0; }
.vote > p { max-width: 720px; }
.poll { margin: 20px 0 0; padding: 0; list-style: none; }
.poll li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.poll li:last-child { border-bottom: 0; }
.poll a { font-weight: 600; }
.poll .what { color: var(--dim); font-size: 15px; }
.poll .votes { margin-left: auto; font-weight: 600; white-space: nowrap; }

.donate {
  margin: 24px 0 48px;
  padding: 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.donate h2 { margin-top: 0; }
.donate > p { max-width: 720px; }

.wallets { margin: 24px 0 0; display: grid; gap: 14px; }
.wallets dt { color: var(--dim); font-size: 15px; }
.wallets dd { margin: 2px 0 0; }
/* Addresses: one click selects the whole address, long ones wrap on phones. */
.wallets code {
  user-select: all;
  word-break: break-all;
  font-size: 15px;
  color: var(--text);
}

footer {
  padding-top: 24px;
  padding-bottom: 48px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 15px;
  text-align: center;
}

@media (max-width: 820px) {
  .hero { padding-top: 40px; }
  .hero .lang { margin-top: -16px; }
  .project { grid-template-columns: 1fr; gap: 28px; padding: 24px 20px; }
  .notes { grid-template-columns: 1fr; }
  .donate, .vote { padding: 24px 20px; }
  .wallets code { font-size: 13px; }
  .devices { padding: 24px 20px; }
  .matrix { font-size: 14px; }
  .matrix th, .matrix td { padding: 10px 6px; }
  .st { font-size: 13px; padding: 2px 8px; white-space: normal; border-radius: 10px; }
}

/* ---- Inner pages: device hardware and emulators ---- */

.topbar {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
}
.topbar img { height: 40px; width: auto; display: block; }

/* Language switcher: the same page in English, Russian and Chinese. */
.lang { display: flex; gap: 14px; margin-left: auto; font-size: 14px; font-weight: 600; }
.lang a[aria-current] { color: var(--text); }
.hero .lang { justify-content: flex-end; margin: -44px 0 20px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 15px; font-weight: 600; }

.doc { max-width: 900px; margin: 0 auto; padding: 8px 24px 56px; }
.doc h1 { margin: 28px 0 12px; font-size: clamp(28px, 4.4vw, 40px); }
.doc h2 { margin: 48px 0 12px; }
.doc h3 { margin: 28px 0 8px; color: #fff; font-size: 19px; }
.doc .lead { margin: 0 0 16px; max-width: none; text-align: left; }
.doc ul { padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--heat); }

.doc table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 12px 0 20px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.doc th { color: var(--dim); font-weight: 600; }
.doc td:first-child { white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* A long reply with no spaces breaks anywhere rather than widen its table. */
.doc td code.wrap { overflow-wrap: anywhere; }

/* Command examples: raw lines, scrolled sideways rather than wrapped. */
.doc pre {
  margin: 12px 0 20px;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}

.doc figure { margin: 20px 0; }
.doc figure img { display: block; max-width: 100%; height: auto; border-radius: 10px; }
.doc figcaption { margin-top: 8px; color: var(--dim); font-size: 14px; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.photos figure { margin: 0; }

/* Block diagrams are wide: they scroll sideways on a phone instead of shrinking to nothing. */
.diagram {
  width: min(1440px, calc(100vw - 32px));
  margin: 20px 0 20px 50%;
  transform: translateX(-50%);
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}
/* At most the width in the tag (7/8 of the natural size, 13 px line tags), shrinking to the page, never below
   1100 px: a phone scrolls. */
.diagram img { display: block; margin: 0 auto; max-width: 100%; min-width: 1100px; height: auto; }

.screens-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.screens-row img { display: block; width: 100%; min-width: 0; height: auto; image-rendering: pixelated; border: 8px solid #000; }

/* Where a fact comes from. */
.src {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid;
  border-radius: 999px;
  font: 600 11px/18px ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  vertical-align: 2px;
}
.src.m { color: #6ee7a8; border-color: #2f6b4f; }
.src.c { color: var(--heat-hi); border-color: #6b5a22; }
.src.t { color: var(--ice); border-color: #24506b; }
.src.h { color: var(--dim); border-color: var(--line); }
.legend { display: grid; gap: 6px; margin: 16px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }

@media (max-width: 820px) {
  .photos, .screens-row { grid-template-columns: 1fr; }
  .doc td:first-child { white-space: normal; }
}
.src.p { color: #c4a7ff; border-color: #4b3b73; }
