:root {
  color-scheme: light dark;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --fg: #151a21;
  --fg-muted: #5a6473;
  --line: #d9dee6;
  --line-strong: #bdc5d1;
  --field-bg: #ffffff;
  --field-disabled: #f1f3f6;
  --accent: #1f5fd8;
  --accent-hover: #1a52bd;
  --accent-fg: #ffffff;
  --ring: rgba(31, 95, 216, 0.28);
  --danger: #a81f16;
  --danger-line: #e8b4b0;
  --danger-bg: #fdf2f1;
  --ok: #10603a;
  --ok-line: #aed3bf;
  --ok-bg: #f1f8f4;
  --shadow: 0 1px 2px rgba(18, 24, 33, 0.06), 0 8px 24px rgba(18, 24, 33, 0.06);

  --radius: 8px;
  --card-width: 384px;
  --page-width: 1100px;
  --glow: rgba(31, 95, 216, 0.13);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1116;
    --surface: #161b22;
    --fg: #e4e8ee;
    --fg-muted: #99a3b1;
    --line: #2a313b;
    --line-strong: #3b4552;
    --field-bg: #0f141a;
    --field-disabled: #1b212a;
    --accent: #4c8dff;
    --accent-hover: #679dff;
    --accent-fg: #0a0f16;
    --ring: rgba(76, 141, 255, 0.35);
    --danger: #ff9a90;
    --danger-line: #5b2a26;
    --danger-bg: #241514;
    --ok: #74d6a0;
    --ok-line: #24503a;
    --ok-bg: #11201a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.32);
    --glow: rgba(76, 141, 255, 0.16);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* Layout */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 16px 24px;
}

.card {
  width: 100%;
  max-width: var(--card-width);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wordmark img {
  display: block;
}

h1 {
  margin: 20px 0 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.lede {
  margin: 8px 0 0;
  color: var(--fg-muted);
  font-size: 13.5px;
}

/* Forms */

form {
  margin-top: 22px;
}

.field {
  position: relative;
  margin-bottom: 16px;
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}

.field-head label {
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  background: var(--field-bg);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

select {
  appearance: none;
  padding-right: 32px;
}

.field:has(select)::after {
  content: "";
  position: absolute;
  right: 13px;
  bottom: 16px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--fg-muted);
  border-bottom: 1.5px solid var(--fg-muted);
  transform: rotate(45deg);
  pointer-events: none;
}

input::placeholder {
  color: var(--fg-muted);
  opacity: 0.75;
}

input:hover:not(:disabled),
select:hover:not(:disabled) {
  border-color: var(--fg-muted);
}

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
input:user-invalid,
select:user-invalid {
  border-color: var(--danger);
}

input[aria-invalid="true"]:focus-visible,
select[aria-invalid="true"]:focus-visible,
input:user-invalid:focus-visible,
select:user-invalid:focus-visible {
  box-shadow: 0 0 0 3px rgba(168, 31, 22, 0.18);
}

input:disabled,
select:disabled {
  background: var(--field-disabled);
  color: var(--fg-muted);
  border-color: var(--line);
  cursor: not-allowed;
}

/* Buttons */

.primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  margin-top: 4px;
  padding: 9px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.primary:disabled {
  opacity: 0.65;
  cursor: default;
}

.primary[data-busy]::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 1.75px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Links and notices */

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

a:hover {
  text-decoration: underline;
}

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

.muted-link {
  color: var(--fg-muted);
  font-size: 12.5px;
}

.muted-link:hover {
  color: var(--accent);
}

.notice {
  margin: 0 0 16px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--fg);
}

.notice[hidden] {
  display: none;
}

.notice.is-error {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.notice.is-ok {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-bg);
}

.aside {
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: 13px;
}

.foot {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-muted);
  font-size: 12.5px;
}

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

.foot a:hover {
  color: var(--accent);
}

/* Home page */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 13px 24px;
}

.bar-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.bar-cta {
  padding: 7px 13px;
  font-size: 13px;
}

.page {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* First screen */

.hero {
  position: relative;
  overflow: hidden;
  padding: 92px 24px 80px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 70% at 50% -8%, var(--glow), transparent 70%),
    var(--bg);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--line-strong) 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(ellipse 82% 82% at 50% 24%, #000 18%, transparent 76%);
  mask-image: radial-gradient(ellipse 82% 82% at 50% 24%, #000 18%, transparent 76%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 50px);
  font-weight: 600;
  letter-spacing: -0.032em;
  line-height: 1.08;
}

.hero .lede {
  max-width: 620px;
  margin: 18px auto 0;
  font-size: 16.5px;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 32px 0 0;
}

.cta {
  width: auto;
  margin-top: 0;
  text-decoration: none;
}

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

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 16px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.12s ease;
}

.secondary:hover {
  border-color: var(--fg-muted);
  text-decoration: none;
}

.secondary:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.actions .primary,
.actions .secondary,
.band-inner .primary {
  min-height: 42px;
  padding: 11px 22px;
  font-size: 14.5px;
}

/* Sections */

.section-title {
  margin: 0;
  text-align: center;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-note {
  max-width: 520px;
  margin: 9px auto 0;
  text-align: center;
  color: var(--fg-muted);
  font-size: 13.5px;
}

/* Request path diagram */

.band-flow {
  padding: 40px 0 0;
}

.diagram-wrap {
  margin-top: 34px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.diagram {
  display: block;
  width: 100%;
  max-width: 920px;
  height: auto;
  margin: 0 auto;
  color: var(--fg-muted);
}

.diagram .d-box {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1;
}

.diagram .d-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
}

.diagram .d-dash {
  stroke-dasharray: 5 5;
}

.diagram text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  fill: currentColor;
}

.diagram .d-name {
  fill: var(--fg);
  font-size: 13px;
}

.diagram .d-sub,
.diagram .d-tag {
  font-size: 10.5px;
}

/* Capabilities */

.band-features {
  padding: 60px 0 0;
}

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
}

.feature-icon {
  display: block;
  margin-bottom: 14px;
  color: var(--accent);
}

.feature h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feature p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 13.5px;
}

/* API example */

.band-api {
  padding: 60px 0 0;
}

.api {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 40px;
  align-items: start;
}

.api-text h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.api-text p {
  margin: 11px 0 0;
  color: var(--fg-muted);
  font-size: 14px;
}

.api-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.api-card-head {
  margin: 0;
  padding: 9px 14px;
  background: var(--field-disabled);
  border-bottom: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.api-card-head-mid {
  border-top: 1px solid var(--line);
}

.code {
  margin: 0;
  padding: 14px;
  color: var(--fg);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.75;
  -webkit-overflow-scrolling: touch;
}

/* Closing strip */

.band-beta {
  margin-top: 76px;
  padding: 56px 24px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.band-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
}

.band-inner p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 14.5px;
}

.page-foot {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 24px;
}

@media (max-width: 880px) {
  .api {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }
}

@media (max-width: 780px) {
  .diagram {
    min-width: 700px;
  }
}

@media (max-width: 620px) {
  .features {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Narrow viewports */

@media (max-width: 420px) {
  .shell {
    padding: 24px 16px 20px;
  }

  .card {
    padding: 22px 18px;
  }

  .foot {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .bar {
    gap: 10px;
    padding: 11px 16px;
  }

  .bar-nav {
    gap: 14px;
  }

  .page {
    padding: 0 16px;
  }

  .hero {
    padding: 56px 16px 52px;
  }

  .hero .lede {
    margin-top: 14px;
    font-size: 15px;
  }

  .actions {
    gap: 10px;
  }

  .actions .primary,
  .actions .secondary,
  .band-inner .primary {
    padding: 10px 17px;
    font-size: 14px;
  }

  .band-flow {
    padding-top: 36px;
  }

  .band-features,
  .band-api {
    padding-top: 44px;
  }

  .feature {
    padding: 20px;
  }

  .band-beta {
    margin-top: 52px;
    padding: 44px 16px;
  }

  .page-foot {
    padding: 22px 16px 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .primary[data-busy]::before {
    animation: none;
    border-top-color: currentColor;
    border-right-color: transparent;
  }
}

/* Reference pages: side navigation plus a prose column */

.docs {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding-top: 44px;
  padding-bottom: 56px;
}

.docs-nav {
  position: sticky;
  top: 84px;
  font-size: 13px;
}

.docs-nav-head {
  margin: 0 0 10px;
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav ul {
  margin: 0;
  padding: 0 0 0 1px;
  list-style: none;
  border-left: 1px solid var(--line);
}

.docs-nav li + li {
  margin-top: 2px;
}

.docs-nav a {
  display: block;
  margin-left: -1px;
  padding: 5px 0 5px 13px;
  border-left: 2px solid transparent;
  color: var(--fg-muted);
  text-decoration: none;
}

.docs-nav a:hover {
  border-left-color: var(--line-strong);
  color: var(--fg);
}

.docs-body {
  min-width: 0;
  max-width: 740px;
}

.docs-body h1 {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.docs-body > .lede {
  margin: 0 0 8px;
}

.docs-body section {
  padding-top: 36px;
}

.docs-body h2 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  scroll-margin-top: 80px;
}

.docs-body p {
  margin: 0 0 14px;
  color: var(--fg-muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.docs-body .code {
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.code-head {
  margin: 0 0 6px !important;
  color: var(--fg) !important;
  font-size: 12.5px !important;
  font-weight: 600;
}

code.inline {
  padding: 1px 5px;
  background: var(--field-disabled);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  white-space: nowrap;
}

.ui {
  color: var(--fg);
  font-weight: 500;
}

/* Endpoint list */

.endpoints {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.endpoint {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0 !important;
  padding: 9px 12px;
  background: var(--surface);
}

.endpoint + .endpoint {
  border-top: 1px solid var(--line);
}

.endpoint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--fg);
}

.method {
  flex: none;
  min-width: 52px;
  padding: 2px 0;
  border-radius: 4px;
  background: var(--field-disabled);
  border: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-align: center;
}

/* Field tables */

.params {
  width: 100%;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 13.5px;
  text-align: left;
}

.params-caption {
  padding: 0 0 6px;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
}

.params th,
.params td {
  padding: 9px 12px;
  vertical-align: top;
  font-weight: 400;
  color: var(--fg-muted);
}

.params thead th {
  background: var(--field-disabled);
  color: var(--fg);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.params tbody th {
  color: var(--fg);
  white-space: nowrap;
}

.params tbody tr + tr th,
.params tbody tr + tr td,
.params thead + tbody th,
.params thead + tbody td {
  border-top: 1px solid var(--line);
}

.docs-foot-note {
  margin: 40px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: 13.5px;
}

/* Short hero for secondary pages */

.hero-short {
  padding-bottom: 8px;
}

.hero-short h1 {
  font-size: 34px;
}

@media (max-width: 880px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-top: 32px;
  }

  .docs-nav {
    position: static;
  }

  .docs-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 0;
    border-left: 0;
  }

  .docs-nav li + li {
    margin-top: 0;
  }

  .docs-nav a {
    margin-left: 0;
    padding: 4px 10px 4px 0;
    border-left: 0;
  }

  .docs-body h1 {
    font-size: 26px;
  }
}

@media (max-width: 620px) {
  .params {
    display: block;
    overflow-x: auto;
  }
}

/* Narrow viewports: the bar carries four entries since the reference and
   pricing pages were added, which no longer fit next to the wordmark. */

@media (max-width: 720px) {
  .bar {
    gap: 12px;
    padding: 11px 16px;
  }

  .bar-nav {
    gap: 14px;
    font-size: 13.5px;
  }
}

@media (max-width: 560px) {
  .bar {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .bar-nav {
    width: 100%;
    gap: 16px;
    justify-content: flex-start;
  }

  .bar-cta {
    margin-left: auto;
  }

  .page {
    padding: 0 16px;
  }

  .foot.page-foot {
    flex-wrap: wrap;
    row-gap: 4px;
  }
}

/* Pricing: a short hero, then cards, then a closing note without a second
   button — one call to action per page is enough. */

.hero-short + .band-features {
  padding-top: 40px;
}

.band-close {
  margin-top: 48px;
  padding: 32px 24px;
}

/* Карточки под заголовком секции: на главной отступ задавала схема, у карточек
   своего не было, и на странице тарифов они прилипали к подзаголовку. */

.section-title + .features,
.section-note + .features {
  margin-top: 34px;
}
