/* ---------- Шиммеры при загрузке ----------
   1) картинки и логотипы: мерцающая плашка, пока файл грузится (класс is-loaded ставит скрипт в <head>);
   2) цены, цифры, счётчики: мерцают, пока идут свежие данные из Directus дольше 0,3 с (html.is-syncing, assets/js/live.js);
   3) кнопки отправки: блик по кнопке, пока идёт запрос (aria-busy);
   4) окно демо-базы: «скелет» окна программы вместо крутилки. */
:root { --sk-base: #eceef6; --sk-hi: #fafbff; }
/* тёмные блоки: полупрозрачный белый */
.tb, .hero, .prv-pricebox__main, .pp-hero, .sp-hero,
[data-cv="d"] .calc .calc-tile:not(.is-active), [data-cv="d"] .calc .calc-opt:not(.is-active) { --sk-base: rgba(255, 255, 255, .1); --sk-hi: rgba(255, 255, 255, .26); }

@keyframes sk-move { from { background-position: 100% 0; } to { background-position: 0 0; } }
.sk, .js .sk-img:has(> img:not(.is-loaded)) {
  background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-hi) 50%, var(--sk-base) 70%) 0 0 / 300% 100%;
  animation: sk-move 1.3s ease-in-out infinite;
}

/* 1. картинки: обёртки логотипов мерцают, сама картинка проявляется после загрузки */
.js :is(.pcard__logo, .logo-cover, .pc__av--logo):has(> img:not(.is-loaded)) {
  background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-hi) 50%, var(--sk-base) 70%) 0 0 / 300% 100%;
  animation: sk-move 1.3s ease-in-out infinite; border-radius: 10px;
}
.js .pcard__logo:has(> img:not(.is-loaded)) { min-width: 110px; }
.js img[loading="lazy"] { transition: opacity .35s ease; }
.js img[loading="lazy"]:not(.is-loaded) { opacity: 0; }
/* логотип без обёртки (в строке «кто внедряет», логотип продукта) - мерцает сам */
.js img[loading="lazy"]:not(.is-loaded):is(.logo-wide, .prv-who img) {
  opacity: 1; color: transparent; border-radius: 8px; min-width: 36px; min-height: 20px;
  background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-hi) 50%, var(--sk-base) 70%) 0 0 / 300% 100%;
  animation: sk-move 1.3s ease-in-out infinite;
}

/* 2. свежие данные из Directus: цены, цифры, счётчики */
html.is-syncing :is(
  .pcard__price, .calc .calc-tile strong, .calc-opt strong, .calc-opt__save, .total__value, .calc .breakdown dd,
  .prv-pricebox__v, .prv-pricebox__parts b, .sp-period__price, .sp-period__pm,
  .tb__num, .pp-stats b, .pmx__big, .pmx__v, .evb-stats b, .prv-ring__c b, .prv-fx b,
  .pc__stats b, .pcs__big, .pc__score, .results-count, .toolbar__meta, .jr__label em
) {
  color: transparent !important; -webkit-text-fill-color: transparent; text-shadow: none !important; border-radius: 6px;
  background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-hi) 50%, var(--sk-base) 70%) 0 0 / 300% 100% !important;
  animation: sk-move 1.3s ease-in-out infinite;
}
html.is-syncing :is(.pcard__price, .calc .breakdown dd, .prv-pricebox__parts b, .tb__num, .pp-stats b) * { visibility: hidden; }
html.is-syncing .tb__num { display: inline-block; min-width: 2.2em; }
html.is-syncing .pcard__price { display: inline-block; }

/* 3. кнопка, пока идёт отправка */
:is(.btn, button)[aria-busy="true"] { position: relative; overflow: hidden; }
:is(.btn, button)[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%) 0 0 / 300% 100%;
  animation: sk-move 1.1s linear infinite;
}

/* 4. окно демо-базы, пока грузится: шапка, меню и строки таблицы */
.demo-sk { width: min(560px, 86%); display: grid; gap: 10px; padding: 16px; border-radius: 16px; background: #fff; box-shadow: 0 20px 40px -24px rgba(16, 16, 42, .35); }
.demo-sk i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(100deg, #eceef6 30%, #fafbff 50%, #eceef6 70%) 0 0 / 300% 100%; animation: sk-move 1.3s ease-in-out infinite; }
.demo-sk i:nth-child(1) { height: 22px; width: 45%; }
.demo-sk i:nth-child(2) { height: 32px; }
.demo-sk i:nth-child(3) { width: 92%; } .demo-sk i:nth-child(4) { width: 80%; } .demo-sk i:nth-child(5) { width: 88%; } .demo-sk i:nth-child(6) { width: 70%; }

@media (prefers-reduced-motion: reduce) {
  .sk, .demo-sk i, html.is-syncing *, .js :is(.pcard__logo, .logo-cover, .pc__av--logo):has(> img:not(.is-loaded)), .js img[loading="lazy"]:not(.is-loaded) { animation: none !important; }
  :is(.btn, button)[aria-busy="true"]::after { display: none; }
}

/* 5. блоки с появлением при прокрутке: пока не показаны - шиммер той же формы вместо пустого места,
      затем шиммер гаснет, а содержимое плавно проявляется со сдвигом (класс is-visible ставит main.js) */
.js .reveal:not(.is-visible) {
  opacity: 1; transform: none; border-radius: 20px;
  background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-hi) 50%, var(--sk-base) 70%) 0 0 / 300% 100% !important;
  animation: sk-move 1.3s ease-in-out infinite;
}
.js .reveal > * { transition: opacity .55s var(--ease, ease), transform .55s var(--ease, ease); transition-delay: inherit; }
.js .reveal:not(.is-visible) > * { opacity: 0; transform: translateY(10px); }
.js .reveal.is-visible { animation: none; }
html.lang-switch .reveal:not(.is-visible) { background: none !important; animation: none; }
html.lang-switch .reveal > * { opacity: 1 !important; transform: none !important; }

/* 6. пока скрипт страницы не запустился: счётчики с нулями мерцают */
html.is-loading :is(.pmx__v, .pmx__big, [data-ring-v]) {
  color: transparent !important; -webkit-text-fill-color: transparent; border-radius: 6px;
  background: linear-gradient(100deg, var(--sk-base) 30%, var(--sk-hi) 50%, var(--sk-base) 70%) 0 0 / 300% 100% !important;
  animation: sk-move 1.3s ease-in-out infinite;
}

/* 7. свежие данные пришли после шиммера: значения проявляются плавно */
@keyframes sk-in { from { opacity: 0; filter: blur(3px); transform: translateY(3px); } to { opacity: 1; filter: none; transform: none; } }
html.is-synced :is(
  .pcard__price, .calc .calc-tile strong, .calc-opt strong, .calc-opt__save, .total__value, .calc .breakdown dd,
  .prv-pricebox__v, .prv-pricebox__parts b, .sp-period__price, .sp-period__pm,
  .tb__num, .pp-stats b, .pmx__big, .pmx__v, .evb-stats b, .prv-ring__c b, .prv-fx b,
  .pc__stats b, .pcs__big, .pc__score, .results-count, .toolbar__meta, .jr__label em
) { animation: sk-in .5s ease both; }

/* мягкая смена страницы при свежих данных: только растворение */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal:not(.is-visible) { background: none !important; }
  .js .reveal > * { opacity: 1 !important; transform: none !important; }
  html.is-synced * { animation: none !important; }
}
