/**
 * bear-mascot.css - позиционирование маскота в 7 секциях лендинга.
 * v2 (full-body 9:16): крупнее, выпирает за границы секций (overlap).
 * Подключается через layouts/BaseLayout.astro как глобальный CSS.
 *
 * Логика:
 *  - .bear-mascot базовый класс - reveal-готовность (opacity 0 → 1)
 *  - .bear-mascot--<section> позиционирование под конкретную секцию
 *  - z-index: 1 на медведе, контент секций обычно имеет естественный stacking
 *  - mobile-strategy: 4 из 7 видны (hero, workflow, cases, cta), остальные скрыты
 */

/* picture-wrapper не должен ломать abs-позиционирование img */
picture:has(> .bear-mascot) {
  display: contents;
}

.bear-mascot {
  position: absolute;
  pointer-events: none;
  user-select: none;
  z-index: 1;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms ease, transform 600ms ease;
  will-change: opacity, transform;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.18));
  /* CSS перебивает width="N" HTML-атрибут (для CLS-фикса оставляем атрибут, aspect-ratio сохраняется через height + auto) */
  width: auto;
  max-width: 100%;
  height: auto;
}

/* ВАУ-эффекты: subtle motion после reveal */
@keyframes bearWobble {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  20% { transform: translateY(-2px) rotate(-1.5deg); }
  45% { transform: translateY(0) rotate(0.8deg); }
  70% { transform: translateY(-1px) rotate(-0.4deg); }
}
@keyframes bearPulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.015); }
}
@keyframes bearPulseFlip {
  0%, 100% { transform: translateY(0) scaleX(-1) scale(1); }
  50% { transform: translateY(-6px) scaleX(-1) scale(1.015); }
}
@keyframes bearWobbleFlip {
  0%, 100% { transform: translateY(0) scaleX(-1) rotate(0deg); }
  20% { transform: translateY(-2px) scaleX(-1) rotate(-1.5deg); }
  45% { transform: translateY(0) scaleX(-1) rotate(0.8deg); }
  70% { transform: translateY(-1px) scaleX(-1) rotate(-0.4deg); }
}
.bear-mascot.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   1. HERO - правый нижний угол, машет лапой, ПОЛНЫЙ РОСТ внутри секции
   bottom: 0 (а не -80px) чтобы медведь не обрезался overflow:hidden
   ============================================================ */
.bear-mascot--hero {
  bottom: 0;
  right: 2%;
  height: 580px;
  width: auto;
  z-index: 2;
}
@media (max-width: 1279px) {
  .bear-mascot--hero { height: 480px; right: 1%; }
}
/* tablet 768-1023: медведь крупнее, текст слева в 2-col layout */
@media (min-width: 768px) and (max-width: 1023px) {
  .bear-mascot--hero { height: 460px; right: 2%; opacity: 1; }
}
@media (max-width: 767px) {
  .bear-mascot--hero {
    position: relative;
    height: 320px;
    margin: 0 auto -16px;
    display: block;
    right: auto;
    bottom: auto;
    opacity: 1;
  }
}

/* ============================================================
   2. PROBLEMS - standing crossed-arms скептический медведь (v24)
   "Узнаёте себя хотя бы в одном из трёх?" - руки скрещены,
   приподнятая бровь, скептический взгляд через очки.
   ============================================================ */
.bear-mascot--problems {
  top: 40px;
  left: 1%;
  right: auto;
  height: 560px;
  z-index: 1;
  opacity: 1;
  transform: translateY(24px);
}
.bear-mascot--problems.is-revealed {
  opacity: 1;
  transform: translateY(0);
  animation: bearWobble 2.4s ease-out 0.7s 1;
}
@media (max-width: 1279px) {
  .bear-mascot--problems { height: 480px; left: 0; top: 30px; }
}
@media (max-width: 1023px) {
  .bear-mascot--problems { display: none; }
}

/* ============================================================
   3. SERVICES (FeatureBento) - возвращён справа (новое v20+)
   Pose: bear-services.png (suit-services standing front with floating icons)
   ============================================================ */
.bear-mascot--services {
  position: absolute;
  top: 60px;
  right: 1%;
  left: auto;
  height: 540px;
  z-index: 1;
  opacity: 1;
  transform: translateY(24px);
}
.bear-mascot--services.is-revealed {
  opacity: 1;
  transform: translateY(0);
  animation: bearPulse 2.6s ease-in-out 0.8s 1;
}
@media (max-width: 1279px) {
  .bear-mascot--services { height: 460px; right: 0; }
}
@media (max-width: 1023px) {
  .bear-mascot--services { display: none; }
}

/* ============================================================
   4. WORKFLOW (Process) - возвращён видимым справа для равномерности 6 медведей
   через каждые 2 секции на 11 секциях лендинга.
   ============================================================ */
.bear-mascot--workflow {
  position: absolute;
  top: 60px;
  left: 1%;
  right: auto;
  height: 540px;
  z-index: 1;
  opacity: 1;
  transform: translateY(24px) scaleX(-1);
}
.bear-mascot--workflow.is-revealed {
  opacity: 1;
  transform: translateY(0) scaleX(-1);
}
@media (max-width: 1279px) {
  .bear-mascot--workflow { height: 460px; left: 0; }
}
@media (max-width: 1023px) {
  .bear-mascot--workflow { display: none; }
}

/* ============================================================
   5. CASES - под кнопкой "Хочу разбор моей воронки", Soviet leaning pose
   Тело медведя наклонено вправо к cards-col (как будто облокачивается
   на колонку с карточками), голова смотрит на зрителя - flip не нужен.
   ============================================================ */
.bear-mascot--cases {
  top: 360px;
  bottom: auto;
  right: auto;
  left: 1%;
  transform: translateY(24px) scaleX(-1);
  height: 480px;
  z-index: 1;
  opacity: 1;
}
.bear-mascot--cases.is-revealed {
  opacity: 1;
  transform: translateY(0) scaleX(-1);
}
@media (max-width: 1279px) {
  .bear-mascot--cases { height: 400px; left: 0; top: 320px; }
}
@media (max-width: 1023px) {
  .bear-mascot--cases {
    position: relative;
    top: 0;
    right: auto;
    left: 50%;
    transform: translateX(-50%) translateY(24px) scaleX(-1);
    height: 320px;
    margin: 0 0 24px;
  }
  .bear-mascot--cases.is-revealed {
    transform: translateX(-50%) translateY(0) scaleX(-1);
  }
}
@media (max-width: 479px) {
  .bear-mascot--cases { height: 260px; }
}

/* ============================================================
   6. PRICING - на левой стороне (юзер: "слева выглядел лучше")
   ============================================================ */
.bear-mascot--pricing {
  position: absolute;
  display: block;
  top: 200px;
  left: 0;
  right: auto;
  margin: 0;
  height: 560px;
  width: auto;
  bottom: auto;
  z-index: 0;
  opacity: 0.9;
  transform: translateY(24px) scaleX(-1);
}
.bear-mascot--pricing.is-revealed {
  opacity: 0.9;
  transform: translateY(0) scaleX(-1);
}
@media (max-width: 1279px) {
  .bear-mascot--pricing { height: 460px; top: 160px; left: 0; }
}
@media (max-width: 1023px) {
  .bear-mascot--pricing { display: none; }
}

/* ============================================================
   7. CTA FINAL - бежит к зрителю, крупно справа
   ============================================================ */
.bear-mascot--cta {
  bottom: -40px;
  right: 4%;
  height: 580px;
  z-index: 2;
  transform: translateY(24px);
}
.bear-mascot--cta.is-revealed {
  transform: translateY(0);
}
@media (max-width: 1279px) {
  .bear-mascot--cta { height: 480px; right: 2%; bottom: -20px; }
}
@media (max-width: 1023px) {
  .bear-mascot--cta { height: 380px; right: 1%; bottom: 0; opacity: 0.9; }
}
@media (max-width: 767px) {
  .bear-mascot--cta {
    position: relative;
    height: 280px;
    margin: 24px auto 0;
    display: block;
    right: auto;
    bottom: auto;
    opacity: 1;
  }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .bear-mascot {
    transition: none;
    transform: none;
    opacity: 1;
    filter: none;
  }
  .bear-mascot--problems.is-revealed,
  .bear-mascot--services.is-revealed {
    animation: none;
  }
  .bear-mascot--problems,
  .bear-mascot--services,
  .bear-mascot--workflow {
    opacity: 0.95;
  }
}
