:root {
  --bg-void: #000000;
  --bg-surface: rgba(10, 13, 20, 0.88);
  --bg-elevated: rgba(17, 22, 34, 0.92);
  --bg-subtle: rgba(255, 255, 255, 0.035);
  --border-gold: rgba(226, 195, 131, 0.28);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --text-ivory: #f5f1e8;
  --text-muted: #c2bcb0;
  --gold: #e2c383;
  --gold-bright: #f3dc9f;
  --gold-ink: #0a0c12;
  --cyan-accent: #7dd3fc;
  --success-bg: rgba(10, 38, 24, 0.9);
  --success-border: rgba(74, 222, 128, 0.55);
  --success-text: #bbf7d0;
  --warning-bg: rgba(41, 28, 7, 0.92);
  --warning-border: rgba(251, 191, 36, 0.55);
  --warning-text: #fde68a;
  --error-bg: rgba(43, 12, 18, 0.92);
  --error-border: rgba(248, 113, 113, 0.6);
  --error-text: #fecaca;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.65);
}

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

html {
  background-color: var(--bg-void);
  color: var(--text-ivory);
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.68;
  color: var(--text-ivory);
  background:
    radial-gradient(ellipse 85% 42% at 50% -6%, rgba(30, 44, 78, 0.42) 0%, rgba(0, 0, 0, 0) 70%),
    radial-gradient(circle at 82% 24%, rgba(226, 195, 131, 0.08) 0%, rgba(0, 0, 0, 0) 45%),
    var(--bg-void);
  -webkit-font-smoothing: antialiased;
}

html:not([data-active-lang="en"]) [data-lang="en"],
html[data-active-lang="en"] [data-lang="ru"] {
  display: none !important;
}

[hidden] {
  display: none !important;
}

#cosmos-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.site-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 100;
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 700;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  left: 16px;
}

a {
  color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

a:hover {
  color: var(--gold-bright);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  word-break: break-word;
}

code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.9em;
  color: var(--gold-bright);
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-gold);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-ivory);
  min-width: 0;
}

.brand-emblem {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.brand-sub {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  padding: 3px;
  background: rgba(14, 18, 28, 0.92);
  flex-shrink: 0;
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 32px;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.lang-switch button:hover {
  color: var(--text-ivory);
}

.lang-switch button.is-active {
  background: var(--gold);
  color: var(--gold-ink);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.site-nav a:hover {
  color: var(--text-ivory);
  background: rgba(255, 255, 255, 0.05);
}

.site-nav a[aria-current="page"] {
  color: var(--gold-bright);
  border-color: var(--border-gold);
  background: rgba(226, 195, 131, 0.11);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 36px 0 68px;
}

.hero {
  background: linear-gradient(155deg, rgba(16, 21, 34, 0.92) 0%, rgba(6, 8, 14, 0.94) 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 44px);
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.hero h1,
.doc-header h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(27px, 4.2vw, 44px);
  line-height: 1.18;
  margin: 0 0 14px;
  color: var(--text-ivory);
}

.lead {
  font-size: clamp(16px, 1.8vw, 18.5px);
  color: var(--text-muted);
  max-width: 72ch;
  margin: 0 0 22px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(226, 195, 131, 0.11);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
}

.pill-badge.is-cyan {
  background: rgba(125, 211, 252, 0.1);
  border-color: rgba(125, 211, 252, 0.35);
  color: #bae6fd;
}

.pill-badge.is-danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.42);
  color: #fecaca;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card,
.doc-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: clamp(18px, 2.8vw, 28px);
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.card-link {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  color: var(--text-ivory);
  border-color: var(--border-gold);
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.card-link:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: var(--bg-elevated);
  color: var(--text-ivory);
}

.card-link h2,
.card-link h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 0 0 6px;
  color: var(--gold);
}

.card-link p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.card-cta {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold-bright);
}

/* Document Layout */
.doc-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3.6vw, 36px);
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 10px;
}

.doc-section {
  margin-bottom: 18px;
}

.doc-section h2,
.section-heading {
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.4vw, 25px);
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 12px;
  line-height: 1.28;
}

.doc-section h3 {
  font-family: var(--font-serif);
  font-size: 17.5px;
  color: var(--text-ivory);
  margin: 18px 0 8px;
}

.doc-section p,
.doc-section li {
  color: var(--text-ivory);
  margin-top: 0;
  margin-bottom: 10px;
}

.doc-section ul,
.doc-section ol {
  padding-left: 20px;
  margin: 8px 0 14px;
}

.doc-section li strong {
  color: var(--gold-bright);
}

/* Callouts */
.callout {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  border: 1px solid var(--border-gold);
  background: rgba(226, 195, 131, 0.08);
  margin: 16px 0;
}

.callout.is-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-text);
}

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

.callout.is-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

/* Tables & Definition Lists */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  text-align: left;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 14px 0 0;
}

.kv-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-width: 0;
}

.kv-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kv-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-ivory);
  overflow-wrap: anywhere;
}

/* Interactive Buttons, Tabs & Forms */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gold);
  color: var(--gold-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gold-bright);
  color: var(--gold-ink);
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: #ef4444;
}

.btn-secondary {
  background: rgba(226, 195, 131, 0.14);
  border-color: var(--border-gold);
  color: var(--gold-bright);
}

.btn-secondary:hover:not(:disabled),
.btn-secondary.is-active {
  background: var(--gold);
  color: var(--gold-ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-ivory);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.tab-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  min-height: 44px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.tab-btn:hover {
  color: var(--text-ivory);
  border-color: var(--border-gold);
}

.tab-btn.is-active,
.tab-btn[aria-selected="true"] {
  background: rgba(226, 195, 131, 0.16);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-ivory);
}

.field-hint {
  font-size: 13px;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-gold);
  background: rgba(4, 6, 10, 0.94);
  color: var(--text-ivory);
  font-family: var(--font-sans);
  font-size: 15px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14.5px;
  color: var(--text-ivory);
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--gold);
}

.endpoint-preview {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold-bright);
  overflow-wrap: anywhere;
}

.alert-box {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid;
  margin-top: 14px;
}

.alert-box strong {
  display: block;
  margin-bottom: 6px;
}

.alert-box p {
  margin: 0;
  font-size: 14.5px;
}

.alert-box.is-error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error-text);
}

.alert-box.is-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.alert-box.is-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.ticket-preview {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-ivory);
  white-space: pre-wrap;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-gold);
  background: rgba(4, 5, 9, 0.94);
  padding: 28px 0 36px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 28px;
  align-items: flex-start;
}

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

/* Responsive Breakpoints */
@media (max-width: 860px) {
  .header-inner {
    gap: 10px 12px;
  }

  .site-nav {
    order: 3;
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

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

@media (max-width: 640px) {
  .container {
    padding: 0 14px;
  }

  .grid-2,
  .grid-3,
  .kv-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-nav a {
    font-size: 13px;
    padding: 6px 10px;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .tab-btn {
    width: 100%;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-gold);
  }

  tbody tr:last-child {
    border-bottom: 0;
  }

  td {
    padding: 4px 0;
    border-bottom: 0;
  }

  td:first-child {
    color: var(--gold-bright);
    margin-bottom: 4px;
  }
}

/* Print Stylesheet for Bank / Acquiring Compliance */
@media print {
  * {
    box-shadow: none !important;
    text-shadow: none !important;
    backdrop-filter: none !important;
  }

  html,
  body {
    background: #ffffff !important;
    color: #111111 !important;
    font-size: 11pt;
    line-height: 1.5;
  }

  #cosmos-canvas,
  .skip-link,
  .site-nav,
  .lang-switch,
  .no-print,
  .tablist,
  .btn {
    display: none !important;
  }

  .site-header {
    position: static;
    background: #ffffff !important;
    border-bottom: 2px solid #222222;
  }

  .brand-name,
  .doc-section h2,
  .card-link h2,
  .card-link h3,
  .eyebrow,
  th {
    color: #111111 !important;
  }

  .brand-sub,
  .lead,
  .doc-meta,
  .kv-label,
  .site-footer,
  .field-hint {
    color: #444444 !important;
  }

  .hero,
  .doc-header,
  .doc-section,
  .card,
  .callout,
  .kv-item,
  .table-wrap {
    background: #ffffff !important;
    border: 1px solid #999999 !important;
    color: #111111 !important;
    break-inside: avoid;
  }

  .doc-section p,
  .doc-section li,
  .kv-value,
  td {
    color: #111111 !important;
  }

  a {
    color: #111111 !important;
    text-decoration: underline;
  }

  .pill-badge {
    background: #f3f3f3 !important;
    color: #111111 !important;
    border: 1px solid #888888 !important;
  }

  .site-footer {
    background: #ffffff !important;
    border-top: 1px solid #999999;
  }
}
