/* Colours come from the logo's gradient (#47C4DF → #21AE58), as in api-docs/brand.css; text-bearing
   colours are darker shades of it, since the logo tones themselves read at ~2-3:1 on white.
   System fonts rather than Barlow: the only Barlow files we host are Latin-only, and the site is Cyrillic first. */

:root {
  --blue: #47c4df;
  --green: #21ae58;
  --gradient: linear-gradient(90deg, var(--blue), var(--green));
  --text: #2d3134;
  --muted: #4a5055;
  --link: #0b7a9e;
  --accent: #16803f;
  --bg: #ffffff;
  --surface: #f4f7f6;
  --border: #e3e8e6;
  --max: 1080px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6eaec;
    --muted: #a9b2b7;
    --link: #6fd3ea;
    --accent: #5fd08b;
    --bg: #14181a;
    --surface: #1c2225;
    --border: #2c3438;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font: 17px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-top: 4px solid transparent;
  border-image: var(--gradient) 1;
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
}

.site-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-left: auto;
}

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

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

.lang {
  display: flex;
  gap: 8px;
  font-size: 14px;
}

.lang a,
.lang span {
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
}

.lang span {
  background: var(--surface);
  color: var(--text);
}

/* Sections */

section {
  padding: 64px 0;
}

section + section {
  border-top: 1px solid var(--border);
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 16px;
}

h1 {
  font-size: clamp(32px, 6vw, 52px);
}

h2 {
  font-size: clamp(24px, 4vw, 34px);
}

h3 {
  font-size: 20px;
}

.lead {
  font-size: clamp(18px, 2.4vw, 22px);
  color: var(--muted);
  max-width: 44em;
}

.hero {
  padding: 96px 0 80px;
}

.hero h1 span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}

.button {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
}

.button.primary {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.card {
  padding: 24px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.card a {
  font-weight: 600;
}

.card-media {
  display: block;
  width: calc(100% + 48px);
  max-width: none;
  height: auto;
  aspect-ratio: 4 / 3;
  margin: -24px -24px 20px;
  object-fit: cover;
  border-radius: 11px 11px 0 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 24px 0 0;
  list-style: none;
}

.tags li {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 15px;
}

/* Legal pages: body HTML is WordPress output copied verbatim, so style its plain elements */

.legal {
  max-width: 48em;
  padding-top: 48px;
  padding-bottom: 64px;
}

.legal h1 {
  font-size: clamp(26px, 4.5vw, 38px);
  margin-bottom: 32px;
}

.legal h2,
.legal h3 {
  margin-top: 40px;
  font-size: 22px;
}

.legal blockquote {
  margin: 24px 0;
  padding: 12px 20px;
  border-left: 4px solid var(--green);
  background: var(--surface);
}

.legal code {
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.legal hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.legal p:empty {
  display: none;
}

/* FAQ: native <details>, so questions open without JavaScript and Ctrl+F finds closed answers in most browsers */

.faq {
  max-width: 48em;
  padding-top: 48px;
  padding-bottom: 64px;
}

.faq h1 {
  font-size: clamp(26px, 4.5vw, 38px);
}

.faq h2 {
  margin-top: 48px;
  font-size: 22px;
}

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq summary {
  cursor: pointer;
  padding: 14px 0;
  font-weight: 600;
  list-style-position: outside;
  margin-left: 1.1em;
}

.faq summary:hover {
  color: var(--accent);
}

.faq details[open] {
  padding-bottom: 16px;
}

.faq details[open] summary {
  color: var(--accent);
}

.faq figure {
  margin: 16px 0;
}

.faq img {
  display: block;
  border-radius: 8px;
}

.faq table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}

.faq td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}

.faq code,
.faq pre {
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.faq pre {
  white-space: pre-wrap;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface);
}

/* Guides (DIY, flasher): long-form instructions with tables, steps and notes */

.doc {
  max-width: 48em;
  padding-top: 48px;
  padding-bottom: 64px;
}

.doc h1 {
  font-size: clamp(28px, 5vw, 42px);
}

.doc h2 {
  margin-top: 56px;
  font-size: 26px;
}

.doc h3 {
  margin-top: 32px;
}

.doc li + li {
  margin-top: 6px;
}

.doc .table-scroll {
  overflow-x: auto;
  margin: 16px 0;
}

.doc table {
  border-collapse: collapse;
  width: 100%;
  font-size: 16px;
}

.doc th,
.doc td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.doc th {
  background: var(--surface);
}

.doc code {
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

.doc pre {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--surface);
  overflow-x: auto;
  font-size: 14px;
}

.doc pre code {
  padding: 0;
  background: none;
}

.note {
  margin: 20px 0;
  padding: 12px 20px;
  border-left: 4px solid var(--green);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
}

.note.warn {
  border-left-color: #d98c00;
}

.note p {
  margin: 0;
}

.note p + p {
  margin-top: 8px;
}

.flash-box {
  margin: 32px 0;
  padding: 28px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}

.flash-box .button {
  font-size: 18px;
  cursor: pointer;
}

.flash-box button.button {
  font-family: inherit;
}

/* News: imported WordPress posts (figures, captions, galleries, quotes) and the /news/ index */

.post {
  max-width: 48em;
  padding-top: 48px;
  padding-bottom: 64px;
}

.post h1 {
  font-size: clamp(26px, 4.5vw, 38px);
  margin-bottom: 8px;
}

.post h2,
.post h3,
.post h4 {
  margin-top: 36px;
}

.post-date,
.news-meta {
  color: var(--muted);
  font-size: 15px;
}

.post figure {
  margin: 24px 0;
}

.post img {
  display: block;
  border-radius: 8px;
}

.post figcaption {
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}

.post ul.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
}

.post ul.gallery figure {
  margin: 0;
}

.post ul.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post blockquote {
  margin: 24px 0;
  padding: 12px 20px;
  border-left: 4px solid var(--green);
  background: var(--surface);
}

.post .video-link a {
  font-weight: 600;
}

.post-back {
  margin-top: 48px;
}

.news-index {
  padding-top: 48px;
  padding-bottom: 64px;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.news-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
}

.news-card:hover {
  border-color: var(--accent);
}

.news-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.news-card > :not(img) {
  padding: 0 16px;
}

.news-card strong {
  font-size: 18px;
  line-height: 1.3;
}

.news-excerpt {
  color: var(--muted);
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer */

.site-footer {
  padding: 40px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 15px;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  justify-content: space-between;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 640px) {
  .site-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 6px 14px;
    padding-bottom: 12px;
    font-size: 14px;
  }

  .lang {
    margin-left: auto;
  }

  section {
    padding: 48px 0;
  }
}
