/*!
 * Версия для слабовидящих — стили.
 * Подключается статически в <head>. Пока на <html> нет класса .special,
 * ни одно правило ниже на сайт не влияет.
 */

/* ================= цветовые схемы ================= */
html.special         { --sp-bg: #fff;    --sp-fg: #000; }
html.special-color-1 { --sp-bg: #fff;    --sp-fg: #000; }
html.special-color-2 { --sp-bg: #000;    --sp-fg: #fff; }
html.special-color-3 { --sp-bg: #e6f3ff; --sp-fg: #063462; }
html.special-color-4 { --sp-bg: #fffcf0; --sp-fg: #59422e; }
html.special-color-5 { --sp-bg: #2a1d10; --sp-fg: #a9dd38; }

/* ================= общая перекраска страницы ================= */
html.special,
html.special body,
html.special body * {
    background-color: var(--sp-bg) !important;
    background-image: none !important;
    color: var(--sp-fg) !important;
    border-color: var(--sp-fg) !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

html.special body a { text-decoration: underline !important; }

html.special body a:focus,
html.special body button:focus,
html.special body input:focus,
html.special body select:focus,
html.special body textarea:focus {
    outline: 2px solid var(--sp-fg) !important;
    outline-offset: 2px;
}

html.special body marquee,
html.special body [class*="slider"] .owl-dots,
html.special body noindex { animation: none !important; }

/* ================= шрифт ================= */
html.special-font-family-1 body,
html.special-font-family-1 body * { font-family: Arial, Helvetica, sans-serif !important; }

html.special-font-family-2 body,
html.special-font-family-2 body * { font-family: "Times New Roman", Times, serif !important; }

html.special-font-size-1 body,
html.special-font-size-1 body * { font-size: 1rem !important; }

html.special-font-size-2 body,
html.special-font-size-2 body * { font-size: 1.25rem !important; }

html.special-font-size-3 body,
html.special-font-size-3 body * { font-size: 1.5rem !important; }

/* заголовки остаются заголовками, размер считается от базового */
html.special body h1 { font-size: 1.6em !important; }
html.special body h2 { font-size: 1.4em !important; }
html.special body h3 { font-size: 1.25em !important; }
html.special body h4,
html.special body h5,
html.special body h6 { font-size: 1.1em !important; }

html.special-line-height-1 body, html.special-line-height-1 body * { line-height: 1.4 !important; }
html.special-line-height-2 body, html.special-line-height-2 body * { line-height: 1.8 !important; }
html.special-line-height-3 body, html.special-line-height-3 body * { line-height: 2.2 !important; }

html.special-letter-spacing-1 body, html.special-letter-spacing-1 body * { letter-spacing: normal !important; }
html.special-letter-spacing-2 body, html.special-letter-spacing-2 body * { letter-spacing: 1.5px !important; }
html.special-letter-spacing-3 body, html.special-letter-spacing-3 body * { letter-spacing: 3px !important; }

/* ================= изображения выключены ================= */
html.special-images-0 body img,
html.special-images-0 body picture,
html.special-images-0 body svg,
html.special-images-0 body video,
html.special-images-0 body iframe,
html.special-images-0 body object { display: none !important; }

/* иконки самой панели прячем никогда */
html.special-images-0 #special svg { display: inline-block !important; }

/* ================= панель ================= */
/* sticky, а не fixed: панель занимает место в потоке,
   поэтому контенту не нужен margin-top и он никуда не прыгает */
#special {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 999999;
    padding: 8px 12px;
    border-bottom: 2px solid var(--sp-fg) !important;
    background: var(--sp-bg) !important;
    color: var(--sp-fg) !important;
    text-align: center;
    cursor: default;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#special * {
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    letter-spacing: normal !important;
    background: transparent !important;
    color: var(--sp-fg) !important;
    box-sizing: border-box;
}

#special .special-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 18px;
}

#special .special-panel > div {
    display: flex;
    align-items: center;
    gap: 4px;
}

#special button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 32px;
    margin: 0;
    padding: 4px 8px;
    border: 1px solid var(--sp-fg) !important;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}

#special button i {
    font-style: normal;
    font-weight: bold;
    font-size: 16px !important;
}

#special button.active {
    background: var(--sp-fg) !important;
    color: var(--sp-bg) !important;
}

#special button.active i,
#special button.active svg { color: var(--sp-bg) !important; }

#special svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

/* ================= блок настроек ================= */
#special-settings-body {
    display: none;
    max-height: 60vh;
    margin-top: 10px;
    padding: 12px 4px 4px;
    overflow-y: auto;
    text-align: left;
    border-top: 1px solid var(--sp-fg) !important;
}

#special-settings-body.is-open { display: block; }

#special-settings-body h2 {
    margin: 14px 0 8px !important;
    padding-bottom: 6px;
    font-size: 16px !important;
    border-bottom: 1px solid var(--sp-fg) !important;
}

#special-settings-body > div { margin-bottom: 6px; }

#special-settings-body button {
    min-width: 104px;
    margin: 0 8px 8px 0;
    padding: 6px 10px;
}

#special-settings-body button i {
    display: block;
    font-weight: normal;
    text-align: center;
}

#special .special-settings-close { float: right; }

#special-settings-body::-webkit-scrollbar { width: 6px; }
#special-settings-body::-webkit-scrollbar-thumb { background: var(--sp-fg); border-radius: 3px; }

/* ================= адаптив ================= */
@media (max-width: 940px) {
    #special .special-panel { gap: 6px 12px; }
    #special .special-panel span { display: none; }
}

@media (max-width: 460px) {
    #special { padding: 6px 8px; }
    #special button { min-width: 32px; padding: 4px 6px; }
    #special-settings-body button { min-width: 88px; }
}

@media print {
    #special { display: none !important; }
}
