/* ============================================================
   Kreo — дизайн-система
   Один слой токенов для всех страниц: главная, правовые, кабинет,
   админки. Правится только здесь, страницы токены не переопределяют.

   Правила, которые нельзя нарушать при доработке:
   • одна акцентная краска (лайм) и только на действиях, числах и фокусе;
   • один набор радиусов: поля и кнопки 12, карточки 18, теги — капсула;
   • тёмная и светлая тема равноправны, обе проверяются перед выкладкой;
   • движение только по transform и opacity, всё гасится prefers-reduced-motion.
   ============================================================ */

/* ---------- 1. Токены ---------- */

:root {
    color-scheme: dark;

    /* Поверхности идут слоями: чем ближе к глазу, тем светлее. */
    --bg:            #0b0c0e;
    --bg-sunk:       #08090a;
    --surface-1:     #111317;
    --surface-2:     #171a1f;
    --surface-3:     #1f232a;
    --line:          #262a32;
    --line-strong:   #363b45;

    --text:          #f4f5f7;
    --text-2:        #a5abb6;
    --text-3:        #838994;

    /* Сигнальная краска. На тёмном — заливка, текст поверх неё почти чёрный. */
    --accent:        #c9f24d;
    --accent-hi:     #d8ff62;
    --accent-ink:    #101204;
    --accent-soft:   rgba(201, 242, 77, .12);
    --accent-line:   rgba(201, 242, 77, .32);

    --danger:        #ff6b5e;
    --warn:          #ffbb33;
    --ok:            #4ade80;

    --radius-sm:     10px;
    --radius:        12px;
    --radius-lg:     18px;
    --radius-xl:     24px;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, .7);
    --shadow-3: 0 30px 70px -28px rgba(0, 0, 0, .85);

    --font-display: 'Manrope', 'Inter', system-ui, sans-serif;
    --font-text:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

    /* Шаг сетки — 4px. Все отступы кратны ему. */
    --gap-1: 4px;   --gap-2: 8px;   --gap-3: 12px;  --gap-4: 16px;
    --gap-5: 24px;  --gap-6: 32px;  --gap-7: 48px;  --gap-8: 64px;
    --gap-9: 96px;  --gap-10: 128px;

    --page: 1240px;
    --pad: clamp(20px, 5vw, 48px);

    --ease: cubic-bezier(.16, 1, .3, 1);
    --dur: .45s;
}

:root[data-theme="light"] {
    color-scheme: light;

    --bg:            #fbfbf9;
    --bg-sunk:       #f2f2ee;
    --surface-1:     #ffffff;
    --surface-2:     #f6f6f3;
    --surface-3:     #eeeeea;
    --line:          #e3e3dd;
    --line-strong:   #cdcdc5;

    --text:          #14161a;
    --text-2:        #545a64;
    --text-3:        #63686f;

    /* На светлом лайм остаётся заливкой кнопок, но текстом не работает:
       для ссылок и цифр берём затемнённый оттенок той же краски. */
    --accent:        #b4e02a;
    --accent-hi:     #a5d016;
    --accent-ink:    #17200a;
    --accent-soft:   rgba(140, 180, 20, .14);
    --accent-line:   rgba(120, 160, 10, .38);
    --accent-text:   #4d6b06;

    --danger:        #c8352a;
    --warn:          #9a6b00;
    --ok:            #1c7a42;

    --shadow-1: 0 1px 2px rgba(20, 22, 26, .06);
    --shadow-2: 0 12px 28px -14px rgba(20, 22, 26, .22);
    --shadow-3: 0 30px 70px -30px rgba(20, 22, 26, .3);
}

:root { --accent-text: var(--accent); }
:root[data-theme="light"] { --accent-text: #4d6b06; }

/* ---------- 2. База ---------- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Липкая шапка не должна накрывать якорь, к которому перешли. */
    scroll-padding-top: 88px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-text);
    font-size: 16px;
    line-height: 1.6;
    font-feature-settings: 'liga' 1, 'kern' 1;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

:where(h1, h2, h3, h4, p, ul, ol, figure, blockquote) { margin: 0; }

ul, ol { padding: 0; list-style: none; }

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

::selection { background: var(--accent); color: var(--accent-ink); }

/* Фокус видно всегда и одинаково — по клавиатуре его теряют чаще всего. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
    position: absolute; left: var(--gap-4); top: -100px; z-index: 200;
    padding: 12px 20px; border-radius: var(--radius);
    background: var(--accent); color: var(--accent-ink); font-weight: 700;
    transition: top .2s var(--ease);
}
.skip-link:focus { top: var(--gap-4); }

/* ---------- 3. Типографика ---------- */

.display,
h1.display { font-family: var(--font-display); font-weight: 800; letter-spacing: -.03em; line-height: 1.04; }

.h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.03em; line-height: 1.06;
      font-size: clamp(2.15rem, 6.2vw, 4.1rem); }
.h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.025em; line-height: 1.1;
      font-size: clamp(1.7rem, 4.2vw, 2.9rem); }
.h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.2;
      font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
.h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; line-height: 1.3;
      font-size: 1.06rem; }

.lead { font-size: clamp(1.02rem, 1.6vw, 1.2rem); line-height: 1.62; color: var(--text-2); max-width: 62ch; }
.body { color: var(--text-2); max-width: 68ch; }
.small { font-size: .875rem; line-height: 1.55; color: var(--text-2); }
.tiny  { font-size: .8125rem; line-height: 1.5; color: var(--text-3); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.eyebrow {
    font-family: var(--font-mono);
    /* Ровно 400: начертание 500 у JetBrains тянуло 39 КБ ради одной строки. */
    font-size: .75rem; font-weight: 400;
    letter-spacing: .16em; text-transform: uppercase;
    color: var(--text-3);
}

.accent { color: var(--accent-text); }

/* ---------- 4. Раскладка ---------- */

.wrap { width: 100%; max-width: var(--page); margin-inline: auto; padding-inline: var(--pad); }
.wrap-wide { max-width: 1480px; }

.section { padding-block: clamp(56px, 9vw, 112px); position: relative; }
.section--tight { padding-block: clamp(40px, 6vw, 72px); }
.section--sunk { background: var(--bg-sunk); }

.section-head { display: grid; gap: var(--gap-4); max-width: 68ch; margin-bottom: clamp(28px, 4vw, 52px); }

.rule { height: 1px; background: var(--line); }

/* ---------- 5. Кнопки ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 48px; padding: 12px 22px;
    border: 1px solid transparent; border-radius: var(--radius);
    font-family: var(--font-text); font-weight: 650; font-size: .97rem;
    letter-spacing: -.01em; white-space: nowrap;
    cursor: pointer; user-select: none;
    transition: transform .16s var(--ease), background-color .16s, border-color .16s, color .16s;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .45; }
.btn[disabled]:active { transform: none; }

.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not([disabled]) { background: var(--accent-hi); }

.btn--ghost { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover:not([disabled]) { background: var(--surface-3); border-color: var(--text-3); }

.btn--quiet { background: transparent; color: var(--text-2); border-color: var(--line); }
.btn--quiet:hover:not([disabled]) { color: var(--text); border-color: var(--line-strong); }

.btn--sm { min-height: 40px; padding: 8px 16px; font-size: .9rem; }
.btn--wide { width: 100%; }

.btn__icon { width: 18px; height: 18px; flex: none; }

/* Текстовая ссылка с подчёркиванием, которое растёт от наведения. */
.link {
    color: var(--text); font-weight: 550;
    background-image: linear-gradient(var(--accent-text), var(--accent-text));
    background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 100%;
    padding-bottom: 1px;
    transition: background-size .25s var(--ease), color .2s;
}
.link:hover { background-size: 100% 2px; }

/* ---------- 6. Плитки и метки ---------- */

.card {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(20px, 2.6vw, 30px);
}
.card--flat { background: transparent; }

.tag {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 30px; padding: 4px 12px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface-2);
    font-size: .8125rem; color: var(--text-2); white-space: nowrap;
}
.tag--on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.chip-row { display: flex; flex-wrap: wrap; gap: var(--gap-2); }

/* Крупное число с подписью. Цифры моноширинные, иначе они «пляшут». */
.stat { display: grid; gap: 2px; }
.stat__num {
    font-family: var(--font-display); font-weight: 800;
    font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1;
    letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.stat__label { font-size: .8125rem; color: var(--text-3); line-height: 1.4; }

/* ---------- 7. Поля ---------- */

.field { display: grid; gap: 8px; }
.field__label { font-size: .875rem; font-weight: 600; color: var(--text); }
.field__hint { font-size: .8125rem; color: var(--text-3); }
.field__error { font-size: .8125rem; color: var(--danger); font-weight: 550; }

.input, .textarea, .select {
    width: 100%; min-height: 48px; padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--text);
    transition: border-color .16s, background-color .16s;
}
.textarea { min-height: 112px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }

/* Согласие: галочка крупная, вся строка кликается, ссылки внутри — отдельно. */
.consent {
    display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
    padding: 14px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface-2);
}
.consent input[type="checkbox"] {
    /* Вся строка согласия — это <label>, поэтому нажимается она целиком.
       Саму галочку всё равно держим крупной: по ней целятся в первую очередь. */
    width: 24px; height: 24px; margin: 0; flex: none;
    accent-color: var(--accent); cursor: pointer;
}
.consent__text { font-size: .8125rem; line-height: 1.55; color: var(--text-2); }
.consent__text a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* Выбор одного из нескольких: радиокнопки выглядят как теги, но остаются
   радиокнопками — со стрелками, чтением с экрана и обязательностью.
   Живёт в системе, а не на странице: тем же набором пользуется форма
   обращения субъекта на правовой странице. */
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick label {
    display: inline-flex; align-items: center; min-height: 40px; padding: 8px 15px;
    border: 1px solid var(--line-strong); border-radius: 999px;
    font-size: .88rem; color: var(--text-2); cursor: pointer;
    transition: background-color .18s, border-color .18s, color .18s;
}
.pick label:hover { color: var(--text); border-color: var(--text-3); }
.pick input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.pick input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- 8. Движение ---------- */

/* Появление при прокрутке. Прятать содержимое разрешено только тогда, когда
   есть кому его показать: класс на <html> ставит скрипт в <head>. Без JS,
   при его ошибке или у поисковика разделы остаются видимыми — иначе половина
   страницы просто исчезает. */
.js .reveal { opacity: 0; transform: translateY(18px); }
.js .reveal.is-in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .js .reveal, .js .reveal.is-in { opacity: 1; transform: none; transition: none; }
    *, *::before, *::after {
        animation-duration: .001ms !important; animation-iteration-count: 1 !important;
        transition-duration: .001ms !important; scroll-behavior: auto !important;
    }
}

/* ---------- 9. Шапка ---------- */

.nav {
    position: sticky; top: 0; z-index: 60;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid transparent;
    transition: border-color .25s, background-color .25s;
}
.nav.is-stuck { border-bottom-color: var(--line); }
@supports not (backdrop-filter: blur(1px)) { .nav { background: var(--bg); } }

.nav__in {
    display: flex; align-items: center; gap: var(--gap-5);
    height: 68px;
}
.nav__brand { display: flex; align-items: center; gap: 10px; min-height: 44px; font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
.nav__mark { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.nav__links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav__link {
    padding: 8px 12px; border-radius: 9px;
    font-size: .92rem; color: var(--text-2); white-space: nowrap;
    transition: color .16s, background-color .16s;
}
.nav__link:hover { color: var(--text); background: var(--surface-2); }
.nav__actions { display: flex; align-items: center; gap: var(--gap-2); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; flex: none;
    background: transparent; border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--text-2); cursor: pointer;
    transition: color .16s, border-color .16s, background-color .16s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

.nav__burger { display: none; }

/* Выдвижное меню на узких экранах. */
.nav__drawer {
    display: none; position: fixed; inset: 68px 0 auto; z-index: 59;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: var(--gap-4) var(--pad) var(--gap-6);
}
.nav__drawer.is-open { display: block; }
.nav__drawer a {
    display: block; padding: 14px 0; font-size: 1.05rem; font-weight: 600;
    border-bottom: 1px solid var(--line);
}
.nav__drawer .btn { margin-top: var(--gap-4); }

@media (max-width: 1000px) {
    .nav__links { display: none; }
    .nav__burger { display: inline-flex; margin-left: auto; }
}

/* ---------- 10. Подвал ---------- */

.foot { border-top: 1px solid var(--line); background: var(--bg-sunk); padding-block: var(--gap-8) var(--gap-6); }
.foot__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: var(--gap-7); }
.foot__col { display: grid; gap: 0; align-content: start; }
.foot__title { font-size: .8125rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
/* Ссылки подвала — полноценные цели нажатия: 24px строки пальцем
   промахиваются, а в подвале лежат все правовые документы. */
.foot__col a { display: inline-flex; align-items: center; min-height: 44px;
               color: var(--text-2); font-size: .92rem; transition: color .16s; }
.foot__col a:hover { color: var(--text); }
.foot__legal { margin-top: var(--gap-7); padding-top: var(--gap-5); border-top: 1px solid var(--line); }
.foot__req { font-size: .8125rem; color: var(--text-3); line-height: 1.7; max-width: 78ch; }

@media (max-width: 860px) {
    .foot__grid { grid-template-columns: 1fr 1fr; gap: var(--gap-6); }
    .foot__col:first-child { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .foot__grid { grid-template-columns: 1fr; }
}

/* ---------- 11. Cookie-полоса ---------- */

/* Равноправные «Принять» и «Отклонить»: одинаковый размер и вес, разный только
   фон. Требование закона, а не вкусовщина. */
.cookiebar {
    position: fixed; z-index: 120; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(140%);
    width: min(760px, calc(100vw - 32px));
    display: grid; grid-template-columns: 1fr auto; gap: var(--gap-4) var(--gap-5); align-items: center;
    padding: 18px 20px;
    background: var(--surface-1); border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
    transition: transform .5s var(--ease);
}
.cookiebar.is-shown { transform: translateX(-50%) translateY(0); }
.cookiebar__text { font-size: .875rem; line-height: 1.55; color: var(--text-2); }
.cookiebar__text a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.cookiebar__acts { display: flex; gap: var(--gap-2); }
.cookiebar__acts .btn { min-width: 132px; }

@media (max-width: 700px) {
    .cookiebar { grid-template-columns: 1fr; bottom: 12px; }
    .cookiebar__acts .btn { flex: 1; min-width: 0; }
}

/* ---------- 12. Всплывающее окно ---------- */

.sheet {
    position: fixed; inset: 0; z-index: 140;
    display: grid; place-items: center;
    padding: var(--gap-4);
    background: rgba(4, 5, 6, .72);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; visibility: hidden;
    transition: opacity .3s var(--ease), visibility .3s;
}
.sheet.is-open { opacity: 1; visibility: visible; }
.sheet__box {
    width: min(560px, 100%); max-height: min(86dvh, 860px); overflow-y: auto;
    background: var(--surface-1); border: 1px solid var(--line-strong);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-3);
    padding: clamp(22px, 3.6vw, 34px);
    transform: translateY(16px) scale(.985);
    transition: transform .35s var(--ease);
}
.sheet.is-open .sheet__box { transform: none; }
.sheet__head { display: flex; align-items: start; justify-content: space-between; gap: var(--gap-4); margin-bottom: var(--gap-5); }

/* ---------- 13. Уведомления ---------- */

.toasts { position: fixed; z-index: 160; right: 16px; bottom: 16px; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast {
    display: flex; gap: 12px; align-items: start;
    padding: 14px 16px; border-radius: var(--radius);
    background: var(--surface-3); border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-2); font-size: .9rem;
    animation: toast-in .4s var(--ease);
}
.toast--ok { border-left: 3px solid var(--ok); }
.toast--bad { border-left: 3px solid var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- 14. Заглушки загрузки ---------- */

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- 15. Пустое и ошибочное состояние ---------- */

.state { display: grid; gap: 12px; justify-items: center; text-align: center; padding: var(--gap-8) var(--gap-4); }
.state__icon { width: 44px; height: 44px; color: var(--text-3); }
.state__title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.state__text { color: var(--text-2); font-size: .92rem; max-width: 46ch; }

/* ---------- 16. Правовые страницы ---------- */

.doc { max-width: 78ch; }
.doc h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; margin-top: var(--gap-7); margin-bottom: var(--gap-3); scroll-margin-top: 96px; }
.doc h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin-top: var(--gap-5); margin-bottom: var(--gap-2); }
.doc p { margin-bottom: var(--gap-3); color: var(--text-2); }
.doc ul { margin: 0 0 var(--gap-4); display: grid; gap: 8px; }
.doc ul li { position: relative; padding-left: 22px; color: var(--text-2); }
.doc ul li::before { content: ''; position: absolute; left: 4px; top: .68em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.doc ol { margin: 0 0 var(--gap-4); display: grid; gap: 8px; counter-reset: n; }
.doc ol li { position: relative; padding-left: 30px; color: var(--text-2); counter-increment: n; }
.doc ol li::before { content: counter(n) '.'; position: absolute; left: 0; top: 0; font-family: var(--font-mono); font-size: .82rem; color: var(--text-3); }
.doc strong { color: var(--text); font-weight: 650; }
.doc table { width: 100%; border-collapse: collapse; margin-bottom: var(--gap-5); font-size: .9rem; }
.doc th, .doc td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { font-weight: 650; color: var(--text); background: var(--surface-2); }
.doc td { color: var(--text-2); }
.doc__meta { display: flex; flex-wrap: wrap; gap: var(--gap-4); padding: 16px 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--gap-6); font-size: .875rem; color: var(--text-2); }

.doc-scroll { overflow-x: auto; }

/* ---------- 17. Мелочи ---------- */

.stack   { display: grid; gap: var(--gap-4); }
.stack-2 { display: grid; gap: var(--gap-2); }
.stack-5 { display: grid; gap: var(--gap-5); }
.row     { display: flex; align-items: center; gap: var(--gap-3); flex-wrap: wrap; }
.row-end { margin-left: auto; }
.hide-sm { display: initial; }
@media (max-width: 640px) { .hide-sm { display: none; } }
