/* MARS-ALL-PAGES-FONT-NORMALIZE-V1 START */

/*
 * Chrome Android ранее получал
 * font-variant-emoji: emoji.
 *
 * Значение normal сохраняет обычные emoji,
 * но цифры, даты, идентификаторы и коды
 * отображаются текстовыми глифами.
 */

:root,
html,
body {
    font-variant:
        normal !important;

    font-variant-emoji:
        normal !important;

    font-variant-ligatures:
        normal !important;

    font-synthesis:
        auto;

    -webkit-text-size-adjust:
        100%;

    text-size-adjust:
        100%;
}


/*
 * Основной стек сайта без generic-family emoji.
 * Настоящие emoji продолжат работать через
 * системный fallback.
 */

body,
button,
input,
textarea,
select,
option {
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Roboto",
        "Segoe UI",
        Arial,
        sans-serif !important;

    font-variant-emoji:
        normal !important;
}


/*
 * Все видимые текстовые элементы страниц:
 * кабинет, карточки ключей, инструкция,
 * выбор устройства, QR и подписка.
 */

body :where(
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p,
    span,
    strong,
    b,
    em,
    small,
    label,
    button,
    a,
    time,
    dt,
    dd,
    li,
    code,
    pre,
    kbd,
    samp,
    input,
    textarea,
    select,
    option
) {
    font-variant-emoji:
        normal !important;
}


/*
 * Элементы внутренних страниц ключа.
 * Селекторы специально охватывают разные
 * варианты имён классов и ID.
 */

body :where(
    [class*="key"],
    [id*="key"],
    [class*="vpn"],
    [id*="vpn"],
    [class*="device"],
    [id*="device"],
    [class*="instruction"],
    [id*="instruction"],
    [class*="subscription"],
    [id*="subscription"],
    [class*="install"],
    [id*="install"],
    [class*="connect"],
    [id*="connect"],
    [class*="date"],
    [id*="date"],
    [class*="time"],
    [id*="time"],
    [class*="duration"],
    [id*="duration"],
    [class*="value"],
    [id*="value"],
    [class*="code"],
    [id*="code"],
    [class*="uid"],
    [id*="uid"],
    [class*="qr"],
    [id*="qr"]
) {
    font-variant:
        normal !important;

    font-variant-emoji:
        normal !important;

    font-variant-numeric:
        normal !important;

    font-feature-settings:
        normal !important;

    font-variation-settings:
        normal !important;

    font-stretch:
        normal !important;

    letter-spacing:
        normal !important;

    word-spacing:
        normal !important;
}


/*
 * Названия ключей, устройства, протокол,
 * локация, срок действия и даты.
 */

body :where(
    [class*="key-title"],
    [class*="key-name"],
    [class*="key-header"],
    [class*="key-details"],
    [class*="device-title"],
    [class*="device-name"],
    [class*="instruction-title"],
    [class*="subscription-title"],
    [class*="session"],
    [class*="expires"],
    [class*="created"]
) {
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Roboto",
        "Segoe UI",
        Arial,
        sans-serif !important;

    font-variant:
        normal !important;

    font-variant-emoji:
        normal !important;

    font-variant-numeric:
        normal !important;

    font-feature-settings:
        normal !important;

    letter-spacing:
        normal !important;

    word-spacing:
        normal !important;
}


/*
 * URL, UUID, UID и конфигурационные строки
 * остаются моноширинными, но без emoji-цифр.
 */

body :where(
    code,
    pre,
    kbd,
    samp,
    [class*="mono"],
    [class*="uuid"],
    [class*="token"],
    [class*="config"],
    [class*="subscription-url"]
) {
    font-family:
        "Roboto Mono",
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace !important;

    font-variant:
        normal !important;

    font-variant-emoji:
        normal !important;

    font-variant-numeric:
        normal !important;

    font-feature-settings:
        normal !important;

    letter-spacing:
        normal !important;

    word-spacing:
        normal !important;
}


/*
 * Защита от автоматически распознанных
 * телефонных номеров и дат.
 */

a[x-apple-data-detectors],
a[x-apple-data-detectors-type],
*[x-apple-data-detectors],
*[x-apple-data-detectors-type],
a[href^="tel:"],
a[href^="sms:"],
a[href^="facetime:"] {
    color:
        inherit !important;

    font-family:
        inherit !important;

    font-size:
        inherit !important;

    font-weight:
        inherit !important;

    font-style:
        inherit !important;

    font-variant:
        normal !important;

    font-variant-emoji:
        normal !important;

    letter-spacing:
        normal !important;

    word-spacing:
        normal !important;

    text-decoration:
        none !important;
}


/*
 * Мобильная адаптация внутренних страниц.
 */

@media (max-width: 760px) {
    body :where(
        [class*="key-title"],
        [class*="key-name"],
        [class*="device-title"],
        [class*="instruction-title"],
        [class*="subscription-title"]
    ) {
        line-height:
            1.25 !important;

        overflow-wrap:
            anywhere;
    }

    body :where(
        [class*="key-details"],
        [class*="instruction"],
        [class*="device"],
        [class*="subscription"],
        [class*="session"]
    ) {
        line-height:
            1.5;
    }

    body :where(
        code,
        pre,
        [class*="subscription-url"],
        [class*="config"],
        [class*="uuid"]
    ) {
        font-size:
            clamp(11px, 3.2vw, 14px);

        line-height:
            1.45;

        overflow-wrap:
            anywhere;

        word-break:
            break-word;
    }
}

/* MARS-ALL-PAGES-FONT-NORMALIZE-V1 END */
