/* Маскот DOGS 2.0.
   Моргание по очереди, цикл 6.4s: на ~27% цикла моргает только X, на ~69% — только O.
   Плавно: открытый глаз мягко сплющивается по вертикали и перетекает в закрытую дугу,
   затем так же мягко открывается. Одно моргание ≈ 0.26s.
   Еле заметное движение: голова чуть покачивается (±1°) и «дышит» вверх-вниз на 1–1.5px, цикл 5.2s. */
.mascot { display: inline-block; flex: none; }
.mascot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.mascot .eye .open, .mascot .eye .closed { transform-box: fill-box; transform-origin: center; }
.mascot .eye .closed { opacity: 0; }

/* --- еле заметное движение головы --- */
.mascot.is-animated svg { transform-origin: 50% 90%; animation: mascot-idle 5.2s ease-in-out infinite; }
@keyframes mascot-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%      { transform: translateY(-1.5px) rotate(-1deg); }
  50%      { transform: translateY(0) rotate(0deg); }
  75%      { transform: translateY(-1px) rotate(.8deg); }
}

/* --- плавное моргание по очереди --- */
.mascot.is-animated .eye-x .open   { animation: mascot-x-open   6.4s infinite; }
.mascot.is-animated .eye-x .closed { animation: mascot-x-closed 6.4s infinite; }
.mascot.is-animated .eye-o .open   { animation: mascot-o-open   6.4s infinite; }
.mascot.is-animated .eye-o .closed { animation: mascot-o-closed 6.4s infinite; }

/* X: с 25.5% закрывается → 27.3–27.9% закрыт → к 29.5% снова открыт */
@keyframes mascot-x-open {
  0%, 25.5%   { transform: scaleY(1); opacity: 1; animation-timing-function: cubic-bezier(.45, 0, .7, .4); }
  27.3%       { transform: scaleY(.12); opacity: 0; }
  27.9%       { transform: scaleY(.12); opacity: 0; animation-timing-function: cubic-bezier(.3, .6, .55, 1); }
  29.5%, 100% { transform: scaleY(1); opacity: 1; }
}
@keyframes mascot-x-closed {
  0%, 26.6%    { opacity: 0; transform: scaleX(.85); }
  27.3%, 27.9% { opacity: 1; transform: scaleX(1); }
  28.7%, 100%  { opacity: 0; transform: scaleX(.85); }
}
/* O: то же самое во второй половине цикла */
@keyframes mascot-o-open {
  0%, 67.5%   { transform: scaleY(1); opacity: 1; animation-timing-function: cubic-bezier(.45, 0, .7, .4); }
  69.3%       { transform: scaleY(.12); opacity: 0; }
  69.9%       { transform: scaleY(.12); opacity: 0; animation-timing-function: cubic-bezier(.3, .6, .55, 1); }
  71.5%, 100% { transform: scaleY(1); opacity: 1; }
}
@keyframes mascot-o-closed {
  0%, 68.6%    { opacity: 0; transform: scaleX(.85); }
  69.3%, 69.9% { opacity: 1; transform: scaleX(1); }
  70.7%, 100%  { opacity: 0; transform: scaleX(.85); }
}

/* Mini App свернут — анимация на паузе */
html.is-hidden .mascot, html.is-hidden .mascot * { animation-play-state: paused !important; }

/* Уменьшение движения — собака неподвижна, X и O открыты */
@media (prefers-reduced-motion: reduce) {
  .mascot svg, .mascot .eye .open, .mascot .eye .closed { animation: none !important; }
  .mascot .eye .open { opacity: 1; transform: none; }
  .mascot .eye .closed { opacity: 0; }
}
