:root {
  --bg: #ffffff;
  --surface: #f4f6f8;
  --text: #16191d;
  --muted: #6b7682;
  --line: #e3e8ed;
  --accent: #2aabee;
  --accent-strong: #1e96d4;
  --accent-soft: #e7f5fd;
  --on-accent: #ffffff;
  /* The chat mock-up: Telegram's light theme. */
  --chat-wall: linear-gradient(135deg, #d8e6c6 0%, #b8d3b0 45%, #d6dca6 100%);
  --chat-bar: #ffffff;
  --bubble-out: #e3fcd0;
  --bubble-meta: #5aa65a;
  --sticker-meta: rgba(0, 0, 0, 0.35);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1f25;
    --text: #e9edf1;
    --muted: #8d98a4;
    --line: #262d35;
    --accent: #3fb4f0;
    --accent-strong: #62c3f4;
    --accent-soft: #15293a;
    --on-accent: #0b1117;
    --chat-wall: linear-gradient(135deg, #1d2a24 0%, #22332c 45%, #2a2f22 100%);
    --chat-bar: #1f252c;
    --bubble-out: #2b5278;
    --bubble-meta: #8fbfe6;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  /* The footer stays at the bottom of a short page. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.75rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1em;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.muted {
  color: var(--muted);
}

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

.site-header {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  z-index: 10;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  border-radius: 50%;
}

.nav {
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
}

.nav a {
  color: var(--muted);
}

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

.menu-button {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
}

/* Three lines, turning into a cross when open. */
.menu-button span,
.menu-button span::before,
.menu-button span::after {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.2s, background 0.2s;
}

.menu-button span {
  position: relative;
}

.menu-button span::before,
.menu-button span::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-button span::before {
  top: -7px;
}

.menu-button span::after {
  top: 7px;
}

.menu-open .menu-button span {
  background: transparent;
}

.menu-open .menu-button span::before {
  transform: translateY(7px) rotate(45deg);
}

.menu-open .menu-button span::after {
  transform: translateY(-7px) rotate(-45deg);
}

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

.hero {
  padding: 56px 0 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 56px;
  align-items: center;
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 34em;
  margin-bottom: 1.5em;
}

.button {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transition: background 0.15s;
}

.button:hover {
  background: var(--accent-strong);
  text-decoration: none;
}

/* --- chat mock-up -------------------------------------------------------- */

.chat {
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(20, 40, 60, 0.12);
  background: var(--chat-wall);
}

.chat-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--chat-bar);
  line-height: 1.25;
}

.chat-top img {
  border-radius: 50%;
}

.chat-top strong {
  display: block;
  font-size: 0.95rem;
}

.chat-top span {
  font-size: 0.8rem;
  color: var(--muted);
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 12px;
}

.msg {
  margin: 0;
  animation: pop 0.35s ease-out both;
}

.msg:nth-child(2) { animation-delay: 0.25s; }
.msg:nth-child(3) { animation-delay: 0.5s; }
.msg:nth-child(4) { animation-delay: 0.75s; }
.msg:nth-child(5) { animation-delay: 1s; }
.msg:nth-child(6) { animation-delay: 1.25s; }

.msg time {
  font-size: 0.7rem;
  white-space: nowrap;
}

.out {
  align-self: flex-end;
  max-width: 80%;
  padding: 6px 10px 6px 12px;
  border-radius: 16px 16px 4px 16px;
  background: var(--bubble-out);
  font-size: 0.93rem;
  line-height: 1.35;
}

.out time {
  float: right;
  margin: 6px 0 -4px 10px;
  color: var(--bubble-meta);
}

.sticker {
  position: relative;
  align-self: flex-start;
  width: 150px;
  margin-bottom: 8px;
}

.sticker img {
  display: block;
  width: 100%;
  height: auto;
}

.sticker time {
  position: absolute;
  right: -4px;
  bottom: -6px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--sticker-meta);
  color: #fff;
}

.chat-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 10px 10px;
  padding: 10px 12px 10px 18px;
  border-radius: 22px;
  background: var(--chat-bar);
  color: var(--muted);
  font-size: 0.93rem;
}

.chat-input:hover {
  text-decoration: none;
  color: var(--text);
}

.chat-input svg {
  width: 24px;
  height: 24px;
  fill: var(--accent);
  flex: none;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}

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

.section {
  padding: 40px 0;
}

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

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 14px;
  align-items: center;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.steps h3 {
  margin: 0;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.tariffs {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 0 0 20px;
  padding: 0;
}

.tariff {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tariff-credits {
  color: var(--muted);
  font-size: 0.95rem;
}

.tariff-price {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.tariff-note {
  font-size: 0.85rem;
  color: var(--muted);
}

.tariff-free {
  border-color: transparent;
  background: var(--accent-soft);
}

.tariff-free .tariff-price {
  color: var(--accent-strong);
}

.prices-note {
  max-width: 46em;
  font-size: 0.95rem;
}

/* --- text pages ---------------------------------------------------------- */

.page {
  padding: 48px 0 16px;
}

.narrow {
  max-width: 760px;
}

.page h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.block {
  margin-top: 32px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
}

.block h2 {
  font-size: 1.3rem;
}

.block > :last-child {
  margin-bottom: 0;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 24px;
  margin: 0 0 1em;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.list {
  margin: 0 0 1em;
  padding-left: 1.4em;
}

.list li + li {
  margin-top: 0.4em;
}

.doc h2 {
  margin-top: 1.8em;
  font-size: 1.25rem;
}

.doc p,
.doc li {
  font-size: 0.97rem;
}

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

.site-footer {
  margin-top: 40px;
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
}

.footer-row p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 8px 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
}

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

/* --- narrow screens ------------------------------------------------------ */

@media (max-width: 880px) {
  .hero {
    padding: 32px 0 24px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero-text {
    text-align: center;
  }

  .lead {
    margin-left: auto;
    margin-right: auto;
  }

  .chat {
    max-width: 380px;
    width: 100%;
    justify-self: center;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .tariffs {
    grid-template-columns: repeat(2, 1fr);
  }

  .tariff-free {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  h1 {
    font-size: 1.9rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .lead {
    font-size: 1.05rem;
  }

  .button {
    display: block;
    max-width: 320px;
    margin: 0 auto;
  }

  .section {
    padding: 28px 0;
  }

  .steps li {
    padding: 14px 16px;
  }

  .tariff {
    padding: 16px 14px;
  }

  .tariff-price {
    font-size: 1.35rem;
  }

  .sticker {
    width: 130px;
  }

  .page {
    padding-top: 28px;
  }

  .block {
    padding: 18px 16px;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .facts dd + dt {
    margin-top: 10px;
  }

  /* The sections fold into a menu under the header. */
  .js .menu-button {
    display: block;
  }

  .js .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    box-shadow: 0 12px 24px rgba(20, 40, 60, 0.08);
  }

  .js .menu-open .nav {
    display: flex;
  }

  .js .nav a {
    padding: 12px 16px;
    color: var(--text);
    font-size: 1rem;
  }

  .nav {
    gap: 14px;
  }
}

.nowrap {
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .menu-button span,
  .menu-button span::before,
  .menu-button span::after {
    transition: none;
  }
}
