:root {
  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #f4f4f4;
  --card: #ffffff;
  --card-border: #ececec;
  --accent: var(--brand-primary, #0a0a0a);
  --accent-2: var(--brand-accent, #555);
  --text: #111;
  --text-2: #555;
  --text-3: #888;
  --border: #ececec;
  --border-strong: #d4d4d4;
  --red: #c0392b;
  --green: #2c8a4a;
  --radius: 2px;
  --radius-sm: 2px;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, 'Inter', system-ui, sans-serif;
  --max-w: 960px;
  --max-text: 680px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.7; min-height: 100vh; font-size: 17px; -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); transition: text-decoration-color .15s ease; }
a:hover { text-decoration-color: var(--accent); }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 32px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.sr-only:focus { position: fixed; top: 12px; left: 12px; width: auto; height: auto; padding: 10px 18px; clip: auto; overflow: visible; white-space: normal; background: var(--text); color: var(--bg); z-index: 2000; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.header { border-bottom: 1px solid var(--border); background: var(--bg); }
.header-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 22px; font-weight: 400; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.logo:hover { color: var(--text); }
.logo-img { display: block; height: 36px; max-width: 200px; object-fit: contain; }
.nav { display: flex; align-items: center; gap: 24px; }
.nav a { color: var(--text-2); font-size: 14px; font-weight: 400; text-decoration: none; padding: 4px 0; position: relative; }
.nav a:hover, .nav a.active { color: var(--text); }
.nav a.active::after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 1px; background: var(--text); }
.header-right { display: flex; align-items: center; gap: 16px; }
.lang-switch { display: flex; gap: 4px; }
.lang-btn { background: transparent; border: none; padding: 4px 8px; font-size: 12px; color: var(--text-3); font-weight: 500; letter-spacing: 0.05em; }
.lang-btn.active { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--border-strong); padding: 8px 10px; cursor: pointer; }
.nav-toggle-bar { display: block; width: 18px; height: 1px; background: var(--text); margin: 3px 0; }

main { min-height: 60vh; }
.section { padding: 56px 0; }
.section:first-of-type { padding-top: 80px; }
.section-title { font-family: var(--font-serif); font-size: 32px; font-weight: 400; letter-spacing: -0.02em; margin-bottom: 32px; text-align: center; }

.hero { padding: 88px 0 56px; border-bottom: 1px solid var(--border); }
.hero .container { max-width: var(--max-text); text-align: center; }
.hero h1 { font-family: var(--font-serif); font-size: 44px; font-weight: 400; letter-spacing: -0.025em; line-height: 1.15; margin-bottom: 20px; }
.hero p { font-size: 18px; color: var(--text-2); margin-bottom: 32px; line-height: 1.65; }

.exchange-selector { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 12px; align-items: end; padding: 24px; background: var(--bg-2); border: 1px solid var(--border); margin-top: 24px; }
.selector-group { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.selector-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.selector-select { padding: 10px 12px; border: 1px solid var(--border-strong); background: var(--bg); font-family: inherit; font-size: 15px; color: var(--text); border-radius: var(--radius); }
.selector-swap { background: transparent; border: 1px solid var(--border-strong); width: 42px; height: 42px; font-size: 16px; color: var(--text-2); }

.btn-primary { display: inline-block; padding: 12px 28px; background: var(--text); color: var(--bg); border: none; font-size: 14px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; transition: background .15s ease; font-family: inherit; text-decoration: none; border-radius: var(--radius); }
.btn-primary:hover { background: var(--accent); color: var(--bg); }
.btn-secondary { display: inline-block; padding: 12px 28px; background: transparent; color: var(--text); border: 1px solid var(--border-strong); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; border-radius: var(--radius); }
.btn-secondary:hover { border-color: var(--text); }
.btn-go { display: inline-block; padding: 6px 14px; background: var(--text); color: var(--bg) !important; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: var(--radius); }
.btn-go:hover { background: var(--accent); }

.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 32px 0; }
.stat-item { text-align: center; padding: 0 16px; border-right: 1px solid var(--border); }
.stat-item:last-child { border-right: none; }
.stat-value { font-family: var(--font-serif); font-size: 36px; font-weight: 400; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }

.pairs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; border: 1px solid var(--border); border-bottom: none; }
.pair-card { display: flex; align-items: center; gap: 10px; padding: 18px 20px; text-decoration: none; color: var(--text); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 14px; transition: background .15s ease; }
.pair-card:hover { background: var(--bg-2); }
.pair-codes { font-weight: 600; }
.pair-arrow { color: var(--text-3); }
.pair-count { margin-left: auto; font-size: 12px; color: var(--text-3); }

.rate-table-wrap { border: 1px solid var(--border); overflow-x: auto; }
.rate-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rate-table thead th { background: var(--bg-2); padding: 14px 16px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); border-bottom: 1px solid var(--border); }
.rate-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rate-table tbody tr:last-child td { border-bottom: none; }
.rate-table tbody tr:hover { background: var(--bg-2); }
.rate-value { font-family: var(--font-serif); font-size: 16px; }
.rate-best { color: var(--green); font-weight: 600; }

.exchanger-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exchanger-name a { color: var(--text); text-decoration: none; font-weight: 500; }
.exchanger-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.trusted-badge, .licensed-badge { display: inline-block; padding: 2px 8px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border-radius: var(--radius); }
.trusted-badge { background: var(--green); color: white; }
.licensed-badge { background: var(--text); color: var(--bg); }

.exchanger-profile { padding: 32px 0; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.exchanger-profile h1 { font-family: var(--font-serif); font-size: 36px; font-weight: 400; margin-bottom: 12px; }

.back-link { display: inline-block; color: var(--text-2); text-decoration: none; font-size: 14px; margin-bottom: 24px; }
.back-link:hover { color: var(--text); }

.faq-list { max-width: var(--max-text); margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); padding: 24px 0; }
.faq-item summary { cursor: pointer; font-family: var(--font-serif); font-size: 19px; font-weight: 400; list-style: none; position: relative; padding-right: 32px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; position: absolute; right: 0; top: 0; font-size: 22px; font-weight: 300; color: var(--text-3); transition: transform .2s ease; }
.faq-item[open] summary::after { content: '−'; }
.faq-answer { margin-top: 12px; color: var(--text-2); font-size: 16px; line-height: 1.75; }

.exchanger-form { max-width: var(--max-text); margin: 0 auto; }
.field { margin-bottom: 20px; }
.field-label { display: block; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 6px; }
.field-hint { display: block; font-size: 13px; color: var(--text-3); margin-top: 4px; }
.field input[type=text], .field input[type=email], .field input[type=url], .field textarea { width: 100%; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border-strong); font-family: inherit; font-size: 15px; color: var(--text); border-radius: var(--radius); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--text); }
.req { color: var(--red); }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 32px; }
.form-error, .form-success { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.form-error { background: #fdf2f2; border: 1px solid #f8c8c8; color: var(--red); }
.form-success { background: #f0faf3; border: 1px solid #bce5c8; color: var(--green); }
.honeypot { position: absolute; left: -9999px; }

.empty-state { padding: 60px 0; text-align: center; color: var(--text-3); font-style: italic; font-family: var(--font-serif); font-size: 18px; }

.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0; border: 1px solid var(--border); }
.article-card { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.article-card-link { display: block; padding: 28px 24px; text-decoration: none; color: var(--text); height: 100%; transition: background .15s ease; }
.article-card-link:hover { background: var(--bg-2); }
.article-card-title { font-family: var(--font-serif); font-size: 21px; font-weight: 400; line-height: 1.3; margin-bottom: 10px; letter-spacing: -0.01em; }
.article-card-excerpt { color: var(--text-2); font-size: 14px; line-height: 1.6; margin-bottom: 14px; }
.article-card-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.article-body { max-width: var(--max-text); margin: 0 auto; }
.article-head { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.article-head h1 { font-family: var(--font-serif); font-size: 38px; font-weight: 400; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 12px; }
.article-meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.article-content { font-size: 17px; line-height: 1.8; color: var(--text); }
.article-content p { margin-bottom: 18px; }
.article-content h2 { font-family: var(--font-serif); font-size: 26px; font-weight: 400; margin: 32px 0 14px; letter-spacing: -0.01em; }
.article-content h3 { font-family: var(--font-serif); font-size: 21px; font-weight: 400; margin: 24px 0 10px; }
.article-content a { color: var(--text); text-decoration: underline; }
.article-content code { background: var(--bg-2); padding: 1px 6px; font-size: 0.9em; border-radius: var(--radius); }
.article-content blockquote { border-left: 2px solid var(--text-3); padding-left: 18px; margin: 24px 0; color: var(--text-2); font-style: italic; font-family: var(--font-serif); }

.pricing-card { max-width: 460px; margin: 0 auto; padding: 40px 32px; border: 1px solid var(--border); text-align: center; }
.pricing-badge { display: inline-block; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 12px; }
.pricing-price { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-bottom: 4px; }
.pricing-amount { font-family: var(--font-serif); font-size: 56px; font-weight: 400; color: var(--text); letter-spacing: -0.02em; }
.pricing-currency { font-size: 18px; color: var(--text-3); }
.pricing-period { font-size: 14px; color: var(--text-3); margin-bottom: 24px; }
.pricing-features { text-align: left; margin: 24px 0 28px; font-size: 14px; line-height: 1.8; }
.pricing-features li { padding-left: 18px; position: relative; color: var(--text-2); }
.pricing-features li::before { content: '–'; position: absolute; left: 0; color: var(--text-3); }
.subscribe-form { display: flex; flex-direction: column; gap: 12px; }
.subscribe-submit { padding: 14px; font-size: 14px; }
.subscribe-note { font-size: 12px; color: var(--text-3); text-align: center; }

.footer { border-top: 1px solid var(--border); margin-top: 80px; padding: 56px 0; background: var(--bg-2); }
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px; }
.footer-title { font-family: var(--font-serif); font-size: 16px; font-weight: 400; margin-bottom: 14px; letter-spacing: -0.01em; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { font-size: 14px; color: var(--text-2); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-text { font-size: 13px; color: var(--text-3); line-height: 1.7; }

@media (max-width: 768px) {
  .nav { display: none; position: absolute; top: 72px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 0; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 32px; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 32px; }
  .section-title { font-size: 26px; }
  .stats-strip { grid-template-columns: 1fr; }
  .stat-item { border-right: none; border-bottom: 1px solid var(--border); padding: 16px; }
  .stat-item:last-child { border-bottom: none; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .exchange-selector { grid-template-columns: 1fr; }
  .selector-swap { width: 100%; }
}


/* ==== shared from app.js dynamic rendering ==== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 8px;
}
.how-card {
  text-align: center;
  padding: 32px 24px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}
.how-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}
.how-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm, var(--radius));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--accent);
}
.how-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.how-card p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}
@media (max-width: 768px) {
  .how-grid { grid-template-columns: 1fr; gap: 14px; }
  .how-card { padding: 20px 18px; }
}


.exchanger-form .field-check { flex-direction: row; align-items: center; }
.exchanger-form .form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.exchanger-form .form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}
.exchanger-form .honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}
.exchanger-form .field-hint {
  display: block;
  margin-top: 4px;
}


.subscription-page .pricing-card { margin-top: 8px; }
.page-payment main { padding-top: 12px; }
.subscribe-error { padding: 10px 14px; border-radius: var(--radius-sm, var(--radius)); font-size: 14px; margin-top: 10px; color: var(--red, #c00); background: rgba(255,0,0,0.08); }


/* logo is white by default — invert for light themes */
.header .logo-img { filter: brightness(0) saturate(0); }


/* ===== stats-strip: ensure single row for 4 items ===== */
.stats-strip {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  flex-wrap: nowrap !important;
}
.stats-strip .stat-item { min-width: 0; }
@media (max-width: 768px) {
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 480px) {
  .stats-strip { grid-template-columns: 1fr !important; }
}

/* ===== universal mobile safety ===== */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }

@media (max-width: 768px) {
  .container { padding-left: 16px !important; padding-right: 16px !important; }
  .header-inner { padding-left: 16px !important; padding-right: 16px !important; }
  .footer-inner { padding-left: 16px !important; padding-right: 16px !important; }

  /* tables always scroll horizontally on mobile */
  .rate-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .rate-table { min-width: 480px; }

  /* prevent rogue overflow */
  img, video, iframe { max-width: 100%; height: auto; }
  pre, code { max-width: 100%; overflow-x: auto; }

  /* shadows must not leak past viewport edge */
  .hero, .exchanger-profile, .article-body, .exchanger-form, .pricing-card, .rate-table-wrap, .article-card, .stat-item {
    box-shadow: none !important;
  }
  .hero { margin-left: 0 !important; margin-right: 0 !important; }

  /* tame oversized headings */
  h1, .article-head h1, .exchanger-profile h1 { word-wrap: break-word; overflow-wrap: break-word; }
  .hero h1 { font-size: clamp(26px, 8vw, 44px) !important; line-height: 1.15 !important; }
  .section-title { font-size: clamp(20px, 6vw, 30px) !important; }
  .article-head h1 { font-size: clamp(24px, 7vw, 38px) !important; line-height: 1.2 !important; }
}

@media (max-width: 480px) {
  .container { padding-left: 12px !important; padding-right: 12px !important; }
  .header-inner { padding-left: 12px !important; padding-right: 12px !important; }
  .footer-inner { padding-left: 12px !important; padding-right: 12px !important; }
  .hero h1 { font-size: clamp(22px, 7vw, 32px) !important; }
}

/* ===== mobile grid collapse (v2) ===== */
@media (max-width: 768px) {
  .article-grid { grid-template-columns: 1fr !important; }
  .pairs-grid { grid-template-columns: 1fr !important; }
  .exchange-selector { grid-template-columns: 1fr !important; }
  .selector-swap { width: 100% !important; }

  /* anything with min-width on grid items should collapse */
  [class*="-grid"] > *, [class*="-list"] > * { min-width: 0; }
}

/* ===== mobile header order: logo | lang | burger ===== */
@media (max-width: 768px) {
  .header-inner > .logo { order: 1; }
  .header-inner > .header-right { order: 2; }
  .header-inner > .nav-toggle { order: 3; }
  .header-inner > .nav { order: 4; }
}

/* ===== exchanger badges: на новой строке после названия ===== */
.exchanger-name {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center;
  gap: 4px 6px;
}
.exchanger-name > a:first-child {
  flex-basis: 100%;
  min-width: 0;
}
.exchanger-name .trusted-badge,
.exchanger-name .licensed-badge {
  flex-shrink: 0;
}

.exchanger-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 10px;
}
.exchanger-profile h1 + .exchanger-badges { margin-top: 12px; }
