/* Site styles. One palette in two themes, the accent taken from the app icon's green. Every colour
   is a variable: light is the default, dark applies to an explicit choice and to "system" on a dark
   OS. Text colours are chosen for at least 4.5:1 against the surfaces they sit on, in both themes. */

:root {
  color-scheme: light;
  --bg: #eef3f1;
  --panel: #ffffff;
  --line: #d6e0dc;
  --fg: #10181a;
  --muted: #4f5d61;
  --accent: #0a6e4d;
  --accent-fg: #ffffff;
  --accent-soft: #e2f3ec;
  --shadow: 0 1px 2px rgba(16, 24, 26, 0.06), 0 8px 24px rgba(16, 24, 26, 0.06);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1514;
  --panel: #18211f;
  --line: #2a3533;
  --fg: #d9e2df;
  --muted: #92a19d;
  --accent: #4fd1a0;
  --accent-fg: #06140f;
  --accent-soft: #14251f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0f1514;
    --panel: #18211f;
    --line: #2a3533;
    --fg: #d9e2df;
    --muted: #92a19d;
    --accent: #4fd1a0;
    --accent-fg: #06140f;
    --accent-soft: #14251f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

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

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

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--panel);
  padding: 8px 14px;
  border-radius: 8px;
}
.skip:focus { left: 8px; z-index: 10; }

/* Read out, not shown: words a screen reader needs that the design says with an icon or a code. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 20px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
}
/* The icon is a square image; the rounding is the platform's, so it is added here. */
.logo img { width: 36px; height: 36px; border-radius: 9px; }

.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1 1 auto; }
.nav a {
  color: var(--fg);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 15px;
  white-space: nowrap;
}
.nav a:hover { background: var(--panel); }
/* The page itself ("page"), or the section a guide belongs to ("true"). */
.nav a[aria-current] { background: var(--panel); box-shadow: var(--shadow); font-weight: 600; }

.tools { display: flex; align-items: center; gap: 8px; }

.picker { position: relative; }
/* Both settings controls are the same circle: one geometry, so the pair reads as a pair. 38px is a
   comfortable touch target. */
.round {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.round:hover { border-color: var(--accent); color: var(--accent); }
.round[hidden] { display: none; }

.picker summary { list-style: none; }
.picker summary::-webkit-details-marker { display: none; }
.picker ul {
  position: absolute;
  right: 0;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 160px;
  /* Right-anchored under a 38px button: never wider than the screen, whatever the button's place. */
  max-width: calc(100vw - 40px);
  z-index: 5;
}
.picker li { margin: 0; }
.picker li a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg);
  font-size: 15px;
}
.picker li a:hover { background: var(--bg); }
.picker li a[aria-current='true'] { font-weight: 600; color: var(--accent); }

.theme { font: inherit; }
/* Three icons, one visible: the script sets data-mode, CSS picks. */
.theme svg { display: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme svg .fill { fill: currentColor; stroke: none; }
.theme[data-mode='system'] .i-system,
.theme[data-mode='light'] .i-light,
.theme[data-mode='dark'] .i-dark { display: block; }

/* ---------------------------------------------------------------- content */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 72px;
}

h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
  margin: 12px 0 16px;
  letter-spacing: -0.02em;
  text-wrap: balance;
  /* A single long word ("конфиденциальности") is wider than a 320px screen at the minimum size. */
  overflow-wrap: break-word;
  hyphens: auto;
}

h2 { font-size: 24px; line-height: 1.25; margin: 40px 0 12px; text-wrap: balance; }
h3 { font-size: 17px; line-height: 1.35; margin: 0 0 6px; }

p { margin: 0 0 16px; max-width: 68ch; }

.lead { font-size: 20px; color: var(--muted); max-width: 62ch; }

ul { max-width: 68ch; padding-left: 22px; }
li { margin-bottom: 8px; }
li::marker { color: var(--accent); }

.note {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 14px 18px;
  margin: 24px 0;
  max-width: 68ch;
}
.note p { margin: 0; font-size: 16px; }

/* The three steps: numbered cards in a row, one column on a phone. The number is the list's own
   counter, so a screen reader hears "list, 3 items" and the order without any extra markup. */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 8px 0 8px;
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.steps li {
  counter-increment: step;
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.steps li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  font-size: 15px;
}
.steps p { margin: 0; font-size: 15px; color: var(--muted); }

/* Company details: label above value on a phone, side by side when there is room. */
.facts { margin: 8px 0 24px; max-width: 68ch; }
.facts div {
  display: grid;
  grid-template-columns: minmax(0, 15em) minmax(0, 1fr);
  gap: 4px 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.facts div:last-child { border-bottom: none; }
.facts dt { color: var(--muted); font-size: 15px; }
.facts dd { margin: 0; }

/* ---------------------------------------------------------------- long text (Support, Privacy) */

/* The body src/markdown.ts renders from legal/*.md: headings, paragraphs, lists, tables. */
.doc h3 { margin: 24px 0 8px; }
.doc ol { max-width: 68ch; padding-left: 26px; }
.doc li::marker { font-weight: 600; }
.doc code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

/* A table: a plain grid on a wide screen; on a phone each row becomes a card, every cell under its
   column name (the cell's data-label, shown by ::before), so nothing scrolls sideways. */
.stack {
  width: 100%;
  max-width: 920px;
  border-collapse: collapse;
  margin: 8px 0 24px;
  font-size: 15px;
  line-height: 1.5;
}
.stack th,
.stack td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.stack th { color: var(--muted); font-weight: 600; font-size: 14px; }
.stack td:first-child { width: 30%; }
.stack td:last-child { width: 24%; }

/* ---------------------------------------------------------------- download page */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 8px 0 28px;
  max-width: 760px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card h2 { margin: 0; font-size: 20px; }
.card p { margin: 0; font-size: 15px; color: var(--muted); }
/* A platform whose store listing is not public yet: the outline of a card, not a card. */
.card-muted { border-style: dashed; background: transparent; }

/* `hidden` must win over a class that sets `display` (.btn): site.js hides and reveals with it. */
[hidden] { display: none !important; }

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  text-align: center;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
/* A store button whose listing is not live yet: visible, not pressable. */
.btn-disabled, .btn-disabled:hover { opacity: 0.45; cursor: not-allowed; border-color: var(--accent); }

.file { display: flex; flex-direction: column; gap: 8px; }
.file + .file { margin-top: 8px; }
.file-head { font-size: 14px; font-weight: 600; color: var(--fg); }
.file-meta { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* The two fingerprints under the APK's button, folded away: few readers check them, and those who do
   know to look for "SHA-256". */
.sum summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.sum p { margin: 8px 0 0; font-size: 13px; }
.sum code {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  color: var(--muted);
}

/* The APK's install steps: a plain numbered list in the measure of prose. */
.install { max-width: 68ch; padding-left: 26px; }
.install li::marker { font-weight: 600; color: var(--accent); }

/* The line under the cards that leads to the guides: a sentence, not a button — a second accent
   shape beside the store buttons would compete with them. */
.guide-cta { margin: 0 0 28px; color: var(--muted); max-width: 68ch; }
.guide-cta a { font-weight: 600; white-space: nowrap; }

/* ---------------------------------------------------------------- guides */

/* The list on the Guides page: one card per guide, in a single column — a guide is picked by
   reading its summary, not by scanning across a row. */
.guides {
  list-style: none;
  padding: 0;
  margin: 8px 0 36px;
  max-width: 760px;
  display: grid;
  gap: 16px;
}
.guides li::marker { content: none; }
.guide-card {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 24px;
}
.guide-card h2 { margin: 0 0 8px; font-size: 20px; }
.guide-card h2 a { color: var(--fg); text-decoration: none; }
.guide-card h2 a:hover { color: var(--accent); text-decoration: underline; }
.guide-card p { margin: 0; color: var(--muted); font-size: 15px; }

/* A guide is read top to bottom, so it keeps the measure of prose. */
.guide { max-width: 78ch; }
.guide h2 { margin-top: 44px; }
.guide h3 { margin: 28px 0 10px; font-size: 18px; }

/* Phone screenshots are tall and narrow: side by side in a row, each at a size where the app's
   labels can still be read, one under another on a phone. The border keeps a light screenshot on a
   light page looking like a picture of a screen. */
.shots { display: flex; flex-wrap: wrap; gap: 20px; margin: 20px 0 28px; }
.shot {
  display: block;
  width: 300px;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  background: var(--panel);
}

/* The way back to the list, above the title and again at the end. */
.crumb { margin: 0 0 8px; font-size: 15px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); text-decoration: underline; }
main > .crumb:last-child { margin: 36px 0 0; padding-top: 20px; border-top: 1px solid var(--line); max-width: 78ch; }

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding: 8px 0 8px;
}
.hero-plain { grid-template-columns: minmax(0, 1fr); }

.sample { margin: 12px 0 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sample-icon { width: 128px; height: 128px; border-radius: 28px; box-shadow: var(--shadow); }
.cipher {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
/* A base64 message has no spaces; without this it would push the page sideways. */
.cipher code {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  color: var(--muted);
}
.sample figcaption { font-size: 14px; color: var(--muted); text-align: center; max-width: 36ch; }

@media (max-width: 720px) {
  /* Two header rows on a phone: logo left and the two controls right on the first, the nav across the
     whole second. Left to wrap on its own, the controls landed alone on a third row at the left edge,
     and the right-anchored language menu then opened off the screen. */
  .top { gap: 10px 12px; padding: 14px 20px 6px; }
  .tools { margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; margin-left: -10px; gap: 2px; }
  .nav a { padding: 7px 10px; }
  /* minmax(0, …), not 1fr: a 1fr track grows to its longest word, and a long Russian word in the
     h1 then pushed the whole column, and the page, sideways at 320px. */
  .hero { grid-template-columns: minmax(0, 1fr); }
  body { font-size: 16px; }
  .facts div { grid-template-columns: 1fr; }
  /* The header row is still read out (it stays in the table), just not drawn: each cell names its
     column itself. */
  .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stack,
  .stack tbody,
  .stack tr,
  .stack td { display: block; width: auto; }
  .stack tr {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 6px 16px;
    margin-bottom: 12px;
  }
  .stack td { padding: 8px 0; }
  .stack td:first-child,
  .stack td:last-child { width: auto; }
  .stack tr td:last-child { border-bottom: none; }
  .stack td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
  }
}

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

.bottom {
  border-top: 1px solid var(--line);
  padding: 28px 20px 56px;
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
}
.bottom p { margin: 0; font-size: 15px; }

/* ---------------------------------------------------------------- language root and 404 */

body.root main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
.root-logo { width: 128px; border-radius: 28px; }
.root h1 { font-size: 22px; font-weight: 600; }
.root section { margin-top: 8px; }
.root section p { margin: 0 auto; }
.langs { list-style: none; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.langs li { margin: 0; }
.langs a {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
}
.langs a:hover { border-color: var(--accent); }

@media (max-width: 360px) {
  /* Tighter at 320px. The Russian nav may still take two rows there; at 390px it fits one. */
  .nav { gap: 0; }
  .nav a { padding: 7px 7px; font-size: 14px; }
}
