/* ==========================================================================
   Стили страниц-статей. Основа: design-system/landing/MASTER.md
   (палитра, заголовочный шрифт, отступы). Сверху CTA, ниже текст статьи.
   ========================================================================== */

/* ---------- Шрифты (локально, font-display: swap) ---------- */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Russo One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/russo-one-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Russo One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/russo-one-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Токены ---------- */
:root {
  --color-primary: #7c3aed;
  --color-secondary: #a78bfa;
  --color-accent: #f43f5e;
  --color-accent-light: #fb7185;
  --color-on-accent: #1a0510;
  --color-background: #0f0f23;
  --color-foreground: #e2e8f0;
  --color-heading: #ffffff;
  --color-card: #1e1c35;
  --color-muted: #27273b;
  --color-muted-foreground: #a3b0c2;
  --color-border-soft: rgba(167, 139, 250, 0.22);
  --color-ring: #c4b5fd;

  --font-heading: "Russo One", "Arial Black", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --dur: 200ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --measure: 46rem;
  --gutter: 1rem;
}

/* ---------- База ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-foreground);
  background-color: var(--color-background);
  background-image: radial-gradient(1000px 520px at 50% -180px, rgba(124, 58, 237, 0.32), transparent 70%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
  body {
    font-size: 1.0625rem;
  }
}

a {
  color: var(--color-secondary);
  text-underline-offset: 0.18em;
  transition: color var(--dur) ease;
}

a:hover {
  color: #c4b5fd;
}

a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 768px) {
  :root {
    --gutter: 1.5rem;
  }
}

.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -100px;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-heading);
  color: var(--color-background);
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-md);
}

/* ---------- CTA сверху ---------- */
.site-header {
  padding-top: var(--space-md);
}

.cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md);
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.30), rgba(244, 63, 94, 0.14)),
    var(--color-card);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px -20px rgba(124, 58, 237, 0.65);
}

.cta-brand {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--color-heading);
  text-decoration: none;
}

.cta-brand:hover {
  color: var(--color-heading);
}

.cta-text {
  margin: var(--space-xs) 0 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--color-foreground);
}

/* Место под кнопку держим заранее, чтобы не было сдвига вёрстки. */
.cta-slot {
  min-height: 48px;
}

.btn-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px -10px rgba(244, 63, 94, 0.85), 0 1px 0 rgba(255, 255, 255, 0.25) inset;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--dur) ease, box-shadow var(--dur) ease;
}

.btn-cta:hover {
  color: var(--color-on-accent);
  background: var(--color-accent-light);
  box-shadow: 0 14px 34px -10px rgba(251, 113, 133, 0.95), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
}

.btn-cta:active {
  background: #e11d48;
}

.btn-cta:focus-visible {
  outline: 3px solid var(--color-heading);
  outline-offset: 3px;
}

.btn-cta .icon {
  flex: none;
  transition: transform var(--dur) var(--ease-out);
}

.btn-cta:hover .icon {
  transform: translateX(3px);
}

@media (min-width: 640px) {
  .cta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
  }

  .cta-slot {
    flex: none;
    min-width: 13rem;
  }
}

/* ---------- Статья ---------- */
.article {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
  overflow-wrap: break-word;
}

.article-header {
  margin-bottom: var(--space-lg);
}

h1,
h2,
h3 {
  color: var(--color-heading);
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(1.625rem, 1.2rem + 2vw, 2.375rem);
  line-height: 1.2;
}

h2 {
  margin: var(--space-2xl) 0 var(--space-md);
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(1.3125rem, 1.1rem + 0.9vw, 1.6875rem);
  line-height: 1.25;
}

h3 {
  margin: var(--space-xl) 0 var(--space-sm);
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.35;
}

.article-meta {
  margin: var(--space-sm) 0 0;
  font-size: 0.875rem;
  color: var(--color-muted-foreground);
}

.article p {
  margin: 0 0 var(--space-md);
}

.article .disclosure {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-muted-foreground);
}

.article strong {
  color: var(--color-heading);
  font-weight: 700;
}

.article ul,
.article ol {
  margin: 0 0 var(--space-md);
  padding-left: 1.4em;
}

.article li {
  margin-bottom: var(--space-sm);
  padding-left: 0.2em;
}

.article li::marker {
  color: var(--color-secondary);
  font-weight: 700;
}

.article .ref-link {
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* ---------- Таблицы ---------- */
.table-wrap {
  margin: var(--space-lg) 0;
  padding: 0;
  overflow-x: auto;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.table-wrap th,
.table-wrap td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
}

.table-wrap th {
  background: var(--color-muted);
  color: var(--color-heading);
  font-weight: 700;
}

.table-wrap td {
  border-top: 1px solid var(--color-border-soft);
}

.table-wrap tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}

/* ---------- Подвал ---------- */
.site-footer {
  padding: var(--space-lg) 0 var(--space-xl);
  border-top: 1px solid var(--color-border-soft);
  font-size: 0.875rem;
  color: var(--color-muted-foreground);
}

.site-footer p {
  margin: 0 0 var(--space-xs);
}

/* ---------- 404 ---------- */
.not-found {
  padding: var(--space-2xl) 0;
  text-align: center;
}

.not-found-code {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(4rem, 3rem + 6vw, 7rem);
  line-height: 1;
  color: var(--color-secondary);
}

.not-found h1 {
  margin: var(--space-md) 0;
}

.link-home {
  display: inline-block;
  min-height: 44px;
  padding: 0.6rem 1.25rem;
  border: 2px solid var(--color-secondary);
  border-radius: var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--dur) ease, color var(--dur) ease;
}

.link-home:hover {
  background: var(--color-secondary);
  color: var(--color-background);
}

/* ---------- Уменьшение анимаций ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
