/*
 * AST VPN — дизайн-токены.
 *
 * Та же система, что на AST AI (Astrafic/ast-tokens.css): графитовые
 * поверхности, один акцент, волосяные линии, шаг отступов 4px.
 * Отличие одно — палитра сдвинута в сине-стальной, потому что здесь
 * продукт про соединение, а не про текст.
 *
 * Токены живут в области страницы лендинга (body.ast-vpn-landing),
 * а не в :root: остальные страницы сайта — документы, справка —
 * сохраняют свой вид и не ломаются отсюда.
 *
 * Тема переключается атрибутом data-ast-theme на <html>.
 */

html[data-ast-theme] {
    /* === ПОВЕРХНОСТИ ================================================ */

    --ast-bg:            #101114;   /* страница */
    --ast-bg-deep:       #0b0c0e;   /* подвал, панели */
    --ast-surface:       #17181c;   /* карточка */
    --ast-raised:        #1f2026;   /* поле, активная строка */
    --ast-raised-strong: #2a2b32;   /* наведение на поле */

    /* Волосяные линии: белый на 8–14%. */
    --ast-line:          rgba(255, 255, 255, 0.075);
    --ast-line-strong:   rgba(255, 255, 255, 0.14);

    /* Три текстовые роли. */
    --ast-text:          #e9eaee;   /* основной — 15.7:1 */
    --ast-text-2:        #9ea1aa;   /* вторичный — 7.3:1 */
    --ast-text-3:        #92949d;   /* приглушённый — 6.0:1 */

    /* Акцент. Заливка затемнена, чтобы белый текст на ней держал 5.0:1. */
    --ast-accent:        #4f46e5;
    --ast-accent-text:   #a5a0ff;   /* акцент как текст — 8.7:1 */
    --ast-accent-ink:    #ffffff;   /* текст на акценте */
    --ast-accent-soft:   rgba(129, 122, 255, 0.18);
    --ast-accent-line:   rgba(129, 122, 255, 0.40);

    /* Главное действие: заливка акцентом. В обеих темах действие
       выглядит одинаково — так кнопка читается как кнопка. */
    --ast-primary:       #4f46e5;
    --ast-primary-ink:   #ffffff;
    --ast-primary-hover: #6366f1;

    /* Смысловые цвета. */
    --ast-ok:            #4cc38a;
    --ast-warn:          #d9ab55;
    --ast-danger:        #e5484d;
    --ast-danger-soft:   rgba(229, 72, 77, 0.14);
    --ast-danger-line:   rgba(229, 72, 77, 0.42);
    --ast-ok-line:       rgba(76, 195, 138, 0.34);
    --ast-ok-soft:       rgba(76, 195, 138, 0.16);

    /* === ПАСТЕЛЬНЫЕ ПОВЕРХНОСТИ ========================================
       Тот же набор, что на AST AI. Цветные подложки — только для
       карточек-категорий, на текст и границы они не переносятся. */
    --ast-mint:          #2c4032;
    --ast-sky:           #243740;
    --ast-lavender:      #322f49;
    --ast-periwinkle:    #2a2e47;
    --ast-cornflower:    #2c3454;
    --ast-aqua:          #21383c;
    --ast-peony:         #3b2a3f;
    --ast-periwinkle-wash: #30304c;
    --ast-cotton-candy:  #3e2c44;

    /* Свет лучей на схеме разделения трафика. В тёмной теме лучи
       светятся, в светлой — остаются цветными, но не слепят. */
    --ast-beam-in:       #dfe4ff;
    --ast-beam-vpn:      #8f7cff;
    --ast-beam-direct:   #6fc7f5;
    --ast-arc:           #5b6bff;
    --ast-arc-2:         #4f7dff;

    /* Плотность фактуры финального блока. В тёмной теме лучи
       светятся, и фактура держится на полной яркости. */
    --ast-beam-opacity:  0.85;
    --ast-beam-glow:     0.75;

    /* Затемнение подложки. */
    --ast-scrim:         rgba(6, 6, 8, 0.7);
    --ast-overlay:       rgba(10, 10, 12, 0.9);
    --ast-shadow-color:  rgba(0, 0, 0, 0.5);

    /* Маска фактуры в финальном блоке. В тёмной теме она плотная:
       иначе свет полос проступает сквозь текст. */
    --ast-cta-veil:      rgba(10, 10, 12, 0.72);

    /* === ОТСТУПЫ: ШАГ 4px ========================================== */

    --ast-space-1:       4px;
    --ast-space-2:       8px;
    --ast-space-3:       12px;
    --ast-space-4:       16px;
    --ast-space-5:       20px;
    --ast-space-6:       24px;
    --ast-space-8:       32px;
    --ast-space-10:      40px;
    --ast-space-12:      48px;
    --ast-space-16:      64px;

    /* === РАДИУСЫ ==================================================== */

    --ast-radius-xs:     4px;
    --ast-radius-sm:     6px;
    --ast-radius-md:     8px;
    --ast-radius-lg:     12px;
    --ast-radius-card:   24px;   /* карточка — крупный, «мастеровый» радиус */
    --ast-radius-panel:  24px;   /* панель */
    --ast-radius-full:   999px;
    --ast-radius-pill:   160px;  /* кнопки-пилюли */

    /* === ТИПОГРАФИКА ================================================ */

    --ast-font: Poppins, Manrope, "DM Sans", "Plus Jakarta Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ast-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    /* === ДВИЖЕНИЕ =================================================== */

    --ast-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ast-dur-fast: 120ms;
    --ast-dur:       180ms;
    --ast-dur-slow:  320ms;

    /* === ТЕНЬ ======================================================= */

    --ast-shadow-object: 0 18px 40px -12px var(--ast-shadow-color);
    --ast-shadow-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.6),
                       0 0 0 1px rgba(129, 122, 255, 0.06);
}

/* ================================================================
   СВЕТЛАЯ ТЕМА
   Молочно-белая база вместо чистого белого: на экране чистый белый
   слепит, а бумажный подтон спокойнее.
   ================================================================ */

html[data-ast-theme="light"] {
    --ast-bg:            #f5f6f8;
    --ast-bg-deep:       #ffffff;
    --ast-surface:       #ffffff;
    --ast-raised:        #f5f6f8;
    --ast-raised-strong: #eceef2;

    --ast-line:          rgba(20, 20, 24, 0.09);
    --ast-line-strong:   rgba(20, 20, 24, 0.16);

    --ast-text:          #333333;
    --ast-text-2:        #535768;
    --ast-text-3:        #808080;

    --ast-accent:        #6161ff;
    --ast-accent-text:   #4b4bdd;
    --ast-accent-ink:    #ffffff;
    --ast-accent-soft:   rgba(97, 97, 255, 0.10);
    --ast-accent-line:   rgba(97, 97, 255, 0.34);

    --ast-primary:       #6161ff;
    --ast-primary-ink:   #ffffff;
    --ast-primary-hover: #4b4bdd;

    --ast-scrim:         rgba(28, 28, 32, 0.42);
    --ast-overlay:       rgba(245, 246, 248, 0.92);
    --ast-shadow-color:  rgba(205, 208, 223, 0.4);
    --ast-shadow-object: 0 14px 32px -14px rgba(20, 20, 24, 0.22);
    --ast-shadow-pop: 0 2px 48px rgba(205, 208, 223, 0.4),
                       0 0 0 1px rgba(97, 97, 255, 0.04);

    --ast-ok:            #1a8a5c;
    --ast-warn:          #9a6a10;
    --ast-danger:        #c9302f;
    --ast-danger-soft:   rgba(201, 48, 47, 0.10);
    --ast-danger-line:   rgba(201, 48, 47, 0.34);
    --ast-ok-line:       rgba(26, 138, 92, 0.32);
    --ast-ok-soft:       rgba(26, 138, 92, 0.14);

    /* Пастель на светлом: насыщенная, но не кричащая. Слишком
       бледные тона на белом фоне не читаются как цвет. */
    --ast-mint:          #c2f7a0;
    --ast-sky:           #b2ecff;
    --ast-lavender:      #e5d3f7;
    --ast-periwinkle:    #dbe3ff;
    --ast-cornflower:    #a6c8ff;
    --ast-aqua:          #cdf6ff;
    --ast-peony:         #f9d0f4;
    --ast-periwinkle-wash: #d9d9ff;
    --ast-cotton-candy:  #eea6fb;

    /* Светлая тема: лучи становятся плотнее и темнее, иначе на белом
       фоне они почти не видны. */
    --ast-beam-in:       #3d4668;
    --ast-beam-vpn:      #6d55e8;
    --ast-beam-direct:   #1e9fd4;
    --ast-arc:           #6d78ff;
    --ast-arc-2:         #3f9bf0;

    /* Плотность фактуры. В светлой теме полосы должны быть
       заметно темнее фона, иначе карточка читается как пустая. */
    --ast-beam-opacity:  1;
    --ast-beam-glow:     0.9;

    /* Маска фактуры на светлой подложке — почти незаметная:
       фактура должна быть видна целиком. */
    --ast-cta-veil:      rgba(255, 255, 255, 0.30);
}

/* ================================================================
   ИЗОЛЯЦИЯ ОТ НАСЛЕДИЯ style.css
   Там `html, body { background: #020617 !important; }` и body::before
   с цветными radial-градиентами. Без перекрытия страница остаётся
   тёмно-синей с пятнами — то есть старым видом.
   ================================================================ */

html[data-ast-theme] body.ast-vpn-landing {
    background: var(--ast-bg) !important;
    color: var(--ast-text) !important;
}

/* Шрифт на всей странице — Poppins, как на AST AI. Наследие
   style.css задаёт Inter, поэтому перекрываем его явно: без этого
   внутренние страницы остаются на Inter, а лендинг — на Poppins,
   и сайт выглядит собранным из двух разных проектов. */
html[data-ast-theme] body,
html[data-ast-theme] body.ast-vpn-landing,
html[data-ast-theme] body.ast-vpn-docs {
    font-family: var(--ast-font) !important;
}

html[data-ast-theme] body h1,
html[data-ast-theme] body h2,
html[data-ast-theme] body h3,
html[data-ast-theme] body h4,
html[data-ast-theme] body h5,
html[data-ast-theme] body h6,
html[data-ast-theme] body p,
html[data-ast-theme] body li,
html[data-ast-theme] body span,
html[data-ast-theme] body a,
html[data-ast-theme] body button,
html[data-ast-theme] body input,
html[data-ast-theme] body textarea,
html[data-ast-theme] body label,
html[data-ast-theme] body td,
html[data-ast-theme] body th {
    font-family: var(--ast-font) !important;
}

/* Числа и технические подписи — моноширинный, как на AST AI. */
html[data-ast-theme] body .ast-app-meter-legend,
html[data-ast-theme] body .ast-plan-price,
html[data-ast-theme] body .ast-faq-num {
    font-family: var(--ast-font-mono) !important;
}

/* Наследие красит и корневой элемент в индиго — иначе за пределами
   body видна полоса старого фона. */
html[data-ast-theme] {
    background: var(--ast-bg, #101114) !important;
    color-scheme: dark;
}

html[data-ast-theme="light"] {
    background: var(--ast-bg, #f5f6f8) !important;
    color-scheme: light;
}

/* Декоративная подложка с цветными пятнами — здесь не нужна. */
html[data-ast-theme] body.ast-vpn-landing::before,
html[data-ast-theme] body.ast-vpn-landing::after {
    content: none !important;
    background: none !important;
}

/* Полосы прокрутки: наследие красит их в индиго-градиент. */
html[data-ast-theme] body.ast-vpn-landing::-webkit-scrollbar-track {
    background: transparent !important;
    border-radius: 0 !important;
}

html[data-ast-theme] body.ast-vpn-landing::-webkit-scrollbar-thumb {
    background: var(--ast-raised-strong) !important;
    border-radius: 999px;
    border: 0 !important;
    box-shadow: none !important;
}

html[data-ast-theme] body.ast-vpn-landing::-webkit-scrollbar-thumb:hover {
    background: var(--ast-accent-line) !important;
}

/* ================================================================
   ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ
   Два квадрата: солнце и луна. Не текст — тема читается сразу.
   ================================================================ */

.ast-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--ast-line-strong);
    border-radius: var(--ast-radius-md);
    background: var(--ast-raised);
    flex: none;
}

.ast-theme-toggle button {
    width: 28px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: calc(var(--ast-radius-md) - 2px);
    background: transparent;
    color: var(--ast-text-3);
    cursor: pointer;
    transition: background var(--ast-dur-fast) var(--ast-ease), color var(--ast-dur-fast) var(--ast-ease);
}

.ast-theme-toggle button:hover { color: var(--ast-text); }

.ast-theme-toggle button[aria-pressed="true"] {
    background: var(--ast-surface);
    color: var(--ast-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

html[data-ast-theme="light"] .ast-theme-toggle button[aria-pressed="true"] {
    box-shadow: 0 1px 2px rgba(20, 20, 24, 0.12);
}

.ast-theme-toggle svg { display: block; }

/* В тёмной теме светит солнце, в светлой — луна. */
.ast-theme-toggle .ast-i-sun  { display: none; }
html[data-ast-theme="light"] .ast-theme-toggle .ast-i-sun  { display: block; }
html[data-ast-theme="light"] .ast-theme-toggle .ast-i-moon { display: none; }

.ast-theme-toggle:focus-visible {
    outline: 2px solid var(--ast-accent);
    outline-offset: 2px;
}
