/* ==========================================================================
   UX-слой (подключается на всех страницах после custom.min.css).
   Чтобы откатить — уберите подключение ux.css / ux.js в header.php и footer.php.
   Только оформление: формы, обработчики заявок и разметка контента не затрагиваются.
   ========================================================================== */

:root {
  --ux-red: #D01E1B;
  --ux-red-dark: #A81614;
  --ux-ease: cubic-bezier(.22, .61, .36, 1);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- 1. Видимые ссылки в текстах (все типы страниц) ---------- */
.rich-text a:not([class]),
.detail-text a:not([class]),
.svp-desc__text a:not([class]),
.skz-faq__a-inner a:not([class]),
.section-block__body a:not([class]),
.page-content a:not([class]) {
  color: var(--ux-red);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(208, 30, 27, .45);
  transition: color .2s var(--ux-ease), text-decoration-color .2s var(--ux-ease), background-color .2s var(--ux-ease);
}
.rich-text a:not([class]):hover,
.detail-text a:not([class]):hover,
.svp-desc__text a:not([class]):hover,
.skz-faq__a-inner a:not([class]):hover,
.section-block__body a:not([class]):hover,
.page-content a:not([class]):hover {
  color: var(--ux-red-dark);
  text-decoration-color: currentColor;
  background-color: rgba(208, 30, 27, .07);
}

/* Ссылки в блоке «Читайте также / Другие модели»: маркер-стрелка, чтобы было видно, что это переходы */
.section-related .rich-text ul { list-style: none; padding-left: 0; }
.section-related .rich-text li { position: relative; padding-left: 22px; margin: 6px 0; }
.section-related .rich-text li::before {
  content: "";
  position: absolute; left: 0; top: .62em;
  width: 12px; height: 12px;
  background: var(--ux-red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6h8M6.5 2.5L10 6l-3.5 3.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6h8M6.5 2.5L10 6l-3.5 3.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform .2s var(--ux-ease);
}
.section-related .rich-text li:hover::before { transform: translateX(4px); }
.section-related .rich-text a { font-size: 16px; }

/* ---------- 2. Видимый фокус с клавиатуры ---------- */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ux-red);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- 3. Кнопки и карточки: отклик на наведение ---------- */
.btn, .vacancy-form__submit {
  transition: transform .2s var(--ux-ease), box-shadow .2s var(--ux-ease), background-color .2s, color .2s, border-color .2s;
}
@media (hover: hover) {
  .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(45, 45, 45, .16);
  }
  .btn:active { transform: translateY(0); box-shadow: none; }
}

/* Стрелка → у основных кнопок-переходов (CTA) */
.btn--primary:not(.ux-no-arrow)::after,
.btn--ghost.js-anchor::after {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 10px;
  vertical-align: -2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 7h10M7.5 2.5L12 7l-4.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 7h10M7.5 2.5L12 7l-4.5 4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform .2s var(--ux-ease);
}
.btn--ghost.js-anchor::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 2v10M2.5 7.5L7 12l4.5-4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 2v10M2.5 7.5L7 12l4.5-4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.btn--primary:hover::after { transform: translateX(4px); }
.btn--ghost.js-anchor:hover::after { transform: translateY(3px); }

/* Ссылка «читать дальше / подробнее» в карточках — стрелка сдвигается */
.next-card__link, .next-card__foot { transition: color .2s; }
@media (hover: hover) {
  .next-card:hover .next-card__link,
  .next-card__link:hover { color: var(--ux-red); }
}

/* Карточки документов и фото: подсказка «увеличить» */
.doc-card, .docs-preview-item, .plant-gallery__thumb-btn { position: relative; cursor: zoom-in; }
.doc-card::after, .docs-preview-item::after {
  content: "";
  position: absolute; right: 8px; top: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, .92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='5.5' fill='none' stroke='%232d2d2d' stroke-width='2'/%3E%3Cpath d='M15 15l5 5M10.5 8v5M8 10.5h5' stroke='%232d2d2d' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/18px no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  opacity: .0; transform: scale(.85);
  transition: opacity .2s, transform .2s var(--ux-ease);
  pointer-events: none;
}
@media (hover: hover) {
  .doc-card:hover::after, .docs-preview-item:hover::after { opacity: 1; transform: none; }
}
@media (hover: none) {
  .doc-card::after, .docs-preview-item::after { opacity: .95; transform: none; }
}

/* Галерея фото: подсказка на карточках */
.media-gallery-item { cursor: zoom-in; }

/* ---------- 4. Подсказки (ux.js) ---------- */
.ux-hint {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 12px;
  font-size: 14px; line-height: 1.3;
  color: #6B7280;
}
.ux-hint svg { width: 16px; height: 16px; flex: none; color: var(--ux-red); }
.ux-hint--swipe svg { animation: ux-nudge 1.6s var(--ux-ease) infinite; }
@keyframes ux-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

/* Подсказка о горизонтальной прокрутке таблиц */
.table-scroll, .rich-text table { position: relative; }
.ux-table-hint { display: none; }
@media (max-width: 900px) {
  .ux-table-hint { display: inline-flex; }
}

/* ---------- 5. Кнопка «Наверх» ---------- */
.ux-top {
  position: fixed;
  right: 18px; bottom: 90px;            /* выше плавающей кнопки заявки */
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; padding: 0; cursor: pointer;
  background: #2D2D2D; color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s, transform .25s var(--ux-ease), visibility .25s, background-color .2s;
  z-index: 90;
}
.ux-top svg { width: 20px; height: 20px; }
.ux-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.ux-top:hover { background: var(--ux-red); }
.ux-top__label {
  position: absolute; right: 54px; top: 50%; transform: translateY(-50%);
  background: #2D2D2D; color: #fff; font-size: 13px; padding: 5px 10px; border-radius: 4px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s;
}
@media (hover: hover) { .ux-top:hover .ux-top__label { opacity: 1; } }
@media (max-width: 600px) {
  .ux-top { right: 12px; bottom: 84px; width: 42px; height: 42px; }
}

/* ---------- 6. Полоса прогресса чтения (статьи, новости, карточки) ---------- */
.ux-progress {
  position: fixed; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--ux-red), #ff6a3d);
  transform-origin: 0 50%; transform: scaleX(0);
  z-index: 1000; pointer-events: none;
}

/* ---------- 7. Появление блоков при прокрутке ---------- */
@media (prefers-reduced-motion: no-preference) {
  .ux-reveal {
    opacity: 0; transform: translateY(18px);
    transition: opacity .6s var(--ux-ease), transform .6s var(--ux-ease);
  }
  .ux-reveal.is-in { opacity: 1; transform: none; }
}

/* ---------- 8. Внешние / служебные ссылки: пометки ---------- */
.rich-text a[href^="tel:"]:not([class])::before,
.detail-text a[href^="tel:"]:not([class])::before { content: "☎ "; text-decoration: none; display: inline-block; }
.rich-text a[href^="mailto:"]:not([class])::before,
.detail-text a[href^="mailto:"]:not([class])::before { content: "✉ "; text-decoration: none; display: inline-block; }
.rich-text a[href$=".pdf"]:not([class])::after,
.detail-text a[href$=".pdf"]:not([class])::after {
  content: "PDF"; margin-left: 6px; padding: 1px 5px; border-radius: 3px;
  background: #F2F3F5; color: #6B7280; font-size: 11px; font-weight: 600; text-decoration: none; display: inline-block;
}

/* ---------- 9. Исправления контраста и шапки ---------- */

/* Кнопка «Запросить расчёт» в футере: белый текст, при наведении чёрный
   (правило `.sk-footer a` по специфичности перебивало цвет кнопки) */
.sk-footer a.sk-footer__btn--primary { color: #fff; }
.sk-footer a.sk-footer__btn--primary:hover,
.sk-footer a.sk-footer__btn--primary:focus-visible { color: #111; }

/* Заголовок «Сертификаты» на тёмном фоне: глобальное правило h2 { color:#2d2d2d !important } делало его невидимым */
.certificates-section__title { color: #fff !important; }
.certificates-section__subtitle { color: #fff; }

/* Шапка при блокировке прокрутки (открыт попап/просмотр документа): позиция страницы сбрасывается в 0,
   шапка теряла белый фон и сливалась с содержимым. Пока страница прокручена — держим белый фон. */
body[data-body-scroll-fix]:not([data-body-scroll-fix="0"]) .header {
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, .5);
}
body[data-body-scroll-fix]:not([data-body-scroll-fix="0"]) .header .header-order-dropdown .dropdown__button {
  color: #fff;
  background-color: #D01E1B;
  border-color: #D01E1B;
}

/* Кнопка «Заказать звонок» в шапке: без подъёма и тени при наведении — меняется только цвет текста */
.header .header-order-dropdown .dropdown__button,
.header .header-order-dropdown .dropdown__button:hover {
  transform: none !important;
}
/* Блок контактов в шапке: email, телефон и город выровнены по левому краю номера телефона */
.header .header-phone-wrapper { align-items: flex-start; }
.header .header-phone-wrapper .header__email,
.header .header-phone-wrapper .header__phone,
.header .header-phone-wrapper .header-city-dropdown { text-align: left; }