:root {
  --bg: #faf7f0;
  --bg-2: #f2ede2;
  --bg-3: #e8e0d0;
  --card: #ffffff;
  --card-border: #1a1a1a;
  --accent: var(--brand-primary, #c8362d);
  --accent-2: var(--brand-accent, #1a1a1a);
  --text: #1a1a1a;
  --text-2: #3a352f;
  --text-3: #6a6258;
  --border: #1a1a1a;
  --border-light: #d4cdb8;
  --red: #c8362d;
  --green: #2d6b3c;
  --radius: 0;
  --font-serif: 'Playfair Display', 'Georgia', serif;
  --font-headline: 'Playfair Display', 'Georgia', serif;
  --font-sans: 'Inter', 'Helvetica Neue', sans-serif;
  --max-w: 1280px;
}

*, *::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: 16px; -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 36px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.header { background: var(--bg); border-bottom: 4px solid var(--text); }
.header-inner { max-width: var(--max-w); margin: 0 auto; padding: 24px 36px 18px; display: flex; align-items: center; justify-content: space-between; gap: 32px; border-bottom: 1px solid var(--text); }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-headline); font-size: 32px; font-weight: 900; color: var(--text); text-decoration: none; letter-spacing: -0.03em; }
.logo:hover { color: var(--text); }
.logo-img { display: block; height: 50px; max-width: 220px; object-fit: contain; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a { color: var(--text); font-family: var(--font-sans); font-size: 12px; font-weight: 700; text-decoration: none; padding: 4px 0; text-transform: uppercase; letter-spacing: 0.15em; }
.nav a:hover, .nav a.active { color: var(--accent); }
.header-right { display: flex; gap: 14px; align-items: center; }
.lang-switch { display: flex; gap: 0; border: 1px solid var(--text); }
.lang-btn { background: transparent; border: none; padding: 6px 12px; font-size: 11px; color: var(--text-2); font-family: var(--font-sans); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.lang-btn:not(:last-child) { border-right: 1px solid var(--text); }
.lang-btn.active { background: var(--text); color: var(--bg); }
.nav-toggle { display: none; background: transparent; border: 2px solid var(--text); padding: 8px; }
.nav-toggle-bar { display: block; width: 18px; height: 2px; background: var(--text); margin: 3px 0; }

main { min-height: 60vh; }
.section { padding: 64px 0; }
.section-title { font-family: var(--font-headline); font-size: 44px; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 40px; text-align: center; line-height: 1.05; }
.section-title::before { content: ''; display: block; width: 60px; height: 4px; background: var(--accent); margin: 0 auto 16px; }

.hero { padding: 64px 0; background: var(--bg); border-bottom: 1px solid var(--text); position: relative; }
.hero .container { max-width: 980px; text-align: center; }
.hero::before { content: 'ISSUE'; position: absolute; top: 32px; left: 36px; font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: 0.2em; color: var(--accent); }
.hero::after { content: 'NO. 01'; position: absolute; top: 32px; right: 36px; font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: 0.2em; color: var(--text-2); }
.hero h1 { font-family: var(--font-headline); font-size: 72px; font-weight: 900; line-height: 1; letter-spacing: -0.04em; margin: 20px 0; }
.hero p { font-size: 19px; color: var(--text-2); font-style: italic; line-height: 1.6; margin-bottom: 32px; max-width: 700px; margin-left: auto; margin-right: auto; font-family: var(--font-serif); }

.exchange-selector { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 16px; align-items: end; padding: 28px; background: var(--card); border: 2px solid var(--text); margin-top: 28px; text-align: left; }
.selector-group { display: flex; flex-direction: column; gap: 6px; }
.selector-label { font-size: 10px; color: var(--text); text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; font-family: var(--font-sans); }
.selector-select { padding: 12px 14px; border: 1px solid var(--text); background: var(--card); font-family: var(--font-sans); font-size: 14px; color: var(--text); }
.selector-swap { background: var(--accent); color: white; border: none; width: 48px; height: 46px; font-size: 18px; font-weight: 700; }

.btn-primary { display: inline-block; padding: 14px 36px; background: var(--accent); color: white; border: none; font-family: var(--font-sans); font-size: 12px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; cursor: pointer; text-decoration: none; transition: background .15s ease; }
.btn-primary:hover { background: var(--text); color: white; }
.btn-secondary { display: inline-block; padding: 13px 36px; background: transparent; color: var(--text); border: 2px solid var(--text); font-family: var(--font-sans); font-size: 12px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; cursor: pointer; text-decoration: none; }
.btn-secondary:hover { background: var(--text); color: var(--bg); }
.btn-go { display: inline-block; padding: 7px 16px; background: var(--text); color: var(--bg) !important; font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; }
.btn-go:hover { background: var(--accent); }

.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 32px 0; border-top: 4px solid var(--text); border-bottom: 4px solid var(--text); }
.stat-item { text-align: center; padding: 0 24px; border-right: 1px solid var(--text); }
.stat-item:last-child { border-right: none; }
.stat-value { font-family: var(--font-headline); font-size: 56px; font-weight: 900; line-height: 1; letter-spacing: -0.03em; }
.stat-label { font-family: var(--font-sans); font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.2em; margin-top: 8px; font-weight: 700; }

.pairs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; border: 2px solid var(--text); border-bottom: none; }
.pair-card { display: flex; align-items: center; gap: 10px; padding: 20px 22px; text-decoration: none; color: var(--text); border-right: 1px solid var(--text); border-bottom: 1px solid var(--text); font-size: 14px; transition: background .15s ease; }
.pair-card:hover { background: var(--accent); color: white; }
.pair-card:hover .pair-arrow, .pair-card:hover .pair-count { color: white; }
.pair-codes { font-family: var(--font-headline); font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.pair-arrow { color: var(--text-2); }
.pair-count { margin-left: auto; font-family: var(--font-sans); font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; }

.rate-table-wrap { border: 2px solid var(--text); background: var(--card); overflow-x: auto; }
.rate-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rate-table thead th { background: var(--text); color: var(--bg); padding: 14px 16px; text-align: left; font-family: var(--font-sans); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; }
.rate-table tbody td { padding: 16px 16px; border-bottom: 1px solid var(--text); }
.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-headline); font-size: 18px; font-weight: 700; }
.rate-best { color: var(--accent); }

.exchanger-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.exchanger-name a { color: var(--text); font-family: var(--font-headline); font-size: 17px; font-weight: 700; text-decoration: none; }
.exchanger-name a:hover { color: var(--accent); text-decoration: underline; }
.trusted-badge, .licensed-badge { display: inline-block; padding: 2px 8px; font-family: var(--font-sans); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; border: 1px solid currentColor; }
.trusted-badge { color: var(--green); }
.licensed-badge { color: var(--accent); }

.exchanger-profile { padding: 40px 0; border-bottom: 4px solid var(--text); margin-bottom: 40px; }
.exchanger-profile h1 { font-family: var(--font-headline); font-size: 52px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 14px; }

.back-link { display: inline-block; color: var(--text); font-family: var(--font-sans); font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; margin-bottom: 28px; text-decoration: none; padding-bottom: 4px; border-bottom: 1px solid var(--text); }
.back-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

.faq-list { max-width: 820px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--text); padding: 28px 0; }
.faq-item:first-child { border-top: 1px solid var(--text); }
.faq-item summary { cursor: pointer; font-family: var(--font-headline); font-size: 24px; font-weight: 700; list-style: none; position: relative; padding-right: 40px; letter-spacing: -0.01em; line-height: 1.25; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '→'; position: absolute; right: 0; top: 0; font-size: 24px; color: var(--accent); transition: transform .2s ease; }
.faq-item[open] summary::after { transform: rotate(90deg); }
.faq-answer { margin-top: 16px; color: var(--text-2); font-size: 16px; line-height: 1.75; font-family: var(--font-serif); }

.exchanger-form { max-width: 680px; margin: 0 auto; padding: 40px; background: var(--card); border: 2px solid var(--text); }
.field { margin-bottom: 24px; }
.field-label { display: block; font-family: var(--font-sans); font-size: 11px; color: var(--text); text-transform: uppercase; letter-spacing: 0.2em; font-weight: 800; margin-bottom: 8px; }
.field-hint { display: block; font-size: 13px; color: var(--text-2); margin-top: 4px; font-family: var(--font-serif); font-style: italic; }
.field input, .field textarea { width: 100%; padding: 12px 14px; background: var(--bg); border: 1px solid var(--text); font-family: var(--font-sans); font-size: 15px; color: var(--text); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); border-width: 2px; padding: 11px 13px; }
.req { color: var(--red); }
.form-check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 32px; }
.form-error, .form-success { padding: 14px 18px; font-family: var(--font-sans); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 18px; border: 2px solid currentColor; }
.form-error { color: var(--accent); }
.form-success { color: var(--green); }
.honeypot { position: absolute; left: -9999px; }

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

.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 40px; }
.article-card { border-top: 4px solid var(--text); padding-top: 24px; }
.article-card-link { display: block; text-decoration: none; color: var(--text); }
.article-card-link:hover .article-card-title { color: var(--accent); }
.article-card-title { font-family: var(--font-headline); font-size: 26px; font-weight: 900; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 12px; }
.article-card-excerpt { color: var(--text-2); font-size: 15px; line-height: 1.7; margin-bottom: 14px; font-family: var(--font-serif); }
.article-card-meta { display: flex; gap: 12px; font-family: var(--font-sans); font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.15em; font-weight: 700; }
.article-body { max-width: 760px; margin: 0 auto; }
.article-head { margin-bottom: 36px; padding-bottom: 24px; border-bottom: 4px solid var(--text); text-align: center; }
.article-head h1 { font-family: var(--font-headline); font-size: 56px; font-weight: 900; line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 14px; }
.article-meta { display: flex; gap: 18px; font-family: var(--font-sans); font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.2em; justify-content: center; font-weight: 700; }
.article-content { font-size: 17px; line-height: 1.8; font-family: var(--font-serif); }
.article-content p { margin-bottom: 20px; }
.article-content p:first-of-type::first-letter { font-family: var(--font-headline); font-size: 68px; font-weight: 900; float: left; line-height: 0.85; padding: 6px 12px 0 0; color: var(--accent); }
.article-content h2 { font-family: var(--font-headline); font-size: 32px; font-weight: 900; margin: 36px 0 16px; letter-spacing: -0.02em; }
.article-content h3 { font-family: var(--font-headline); font-size: 24px; font-weight: 700; margin: 28px 0 12px; }
.article-content blockquote { font-family: var(--font-headline); font-size: 24px; font-style: italic; padding: 20px 0; margin: 28px 0; border-top: 1px solid var(--text); border-bottom: 1px solid var(--text); text-align: center; line-height: 1.4; }

.pricing-card { max-width: 480px; margin: 0 auto; padding: 48px 36px; background: var(--card); border: 4px solid var(--text); text-align: center; position: relative; }
.pricing-badge { display: inline-block; font-family: var(--font-sans); font-size: 11px; color: var(--accent); font-weight: 800; letter-spacing: 0.25em; text-transform: uppercase; margin-bottom: 16px; }
.pricing-price { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-bottom: 6px; }
.pricing-amount { font-family: var(--font-headline); font-size: 72px; font-weight: 900; line-height: 1; letter-spacing: -0.04em; }
.pricing-currency { font-family: var(--font-sans); font-size: 18px; font-weight: 700; color: var(--text-2); }
.pricing-period { font-family: var(--font-sans); font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 28px; }
.pricing-features { text-align: left; margin: 28px 0; font-size: 14px; line-height: 1.9; }
.pricing-features li { padding-left: 24px; position: relative; }
.pricing-features li::before { content: '◆'; position: absolute; left: 0; color: var(--accent); }
.subscribe-form { display: flex; flex-direction: column; gap: 14px; }
.subscribe-submit { padding: 14px; }
.subscribe-note { font-family: var(--font-sans); font-size: 11px; color: var(--text-3); text-align: center; text-transform: uppercase; letter-spacing: 0.15em; }

.footer { background: var(--text); color: var(--bg); padding: 60px 0 28px; margin-top: 80px; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 36px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px; }
.footer-title { font-family: var(--font-headline); font-size: 22px; font-weight: 700; margin-bottom: 14px; letter-spacing: -0.01em; color: var(--bg); }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-family: var(--font-sans); font-size: 13px; color: var(--bg-3); text-decoration: none; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.footer-links a:hover { color: var(--bg); text-decoration: underline; }
.footer-text { font-family: var(--font-serif); font-size: 14px; color: var(--text-2); line-height: 1.65; font-style: italic; }
.footer .footer-text { color: var(--bg-3); }

@media (max-width: 768px) {
  .nav { display: none; position: absolute; top: 90px; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--bg); border-bottom: 4px solid var(--text); padding: 8px 0; z-index: 100; }
  .nav.open { display: flex; }
  .nav a { padding: 14px 36px; border-bottom: 1px solid var(--text); }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 44px; }
  .hero::before, .hero::after { display: none; }
  .section-title { font-size: 32px; }
  .stats-strip { grid-template-columns: 1fr; gap: 24px; }
  .stat-item { border-right: none; border-bottom: 1px solid var(--text); 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%; }
  .article-head h1 { font-size: 38px; }
}


/* ==== 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; }

/* ===== v3: fix swap pill + form-actions wrap ===== */
@media (max-width: 768px) {
  .selector-swap {
    width: auto !important;
    min-width: 48px;
    max-width: 120px;
    justify-self: center !important;
    margin: 4px auto !important;
  }

  .form-actions {
    flex-direction: column-reverse !important;
    gap: 10px !important;
  }
  .form-actions > * { width: 100% !important; text-align: center; }

  .exchanger-form .form-actions { flex-direction: column-reverse; }
}

/* ===== v4: compact "Сайт" button on mobile (exchangers list) ===== */
@media (max-width: 768px) {
  .btn-go {
    padding: 6px 10px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }
  .rate-table td:last-child,
  .rate-table th:last-child {
    padding-right: 8px !important;
    padding-left: 6px !important;
    text-align: center;
  }
}
