/* =========================
   PUTUJÍCÍ DUCH BOO
   (jen na počítači; na mobilu a s vypnutými animacemi
    zůstávají původní statičtí duchové)
========================= */

.roam-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 900;

  width: 116px;

  pointer-events: none;
  will-change: transform;

  filter: drop-shadow(0 12px 18px rgba(59, 47, 42, .16));
}

.roam-ghost svg {
  display: block;
  width: 116px;
  height: auto;
  overflow: visible;
}

/* mrkání */
.rg-eyes {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .09s ease-in-out;
}

.rg-eyes.is-blinking {
  transform: scaleY(.08);
}

/* =========================
   VÝRAZY (oči)
========================= */

.rg-face {
  display: none;
}

.roam-ghost[data-mood="open"]  .rg-face-open,
.roam-ghost[data-mood="happy"] .rg-face-happy,
.roam-ghost[data-mood="sleep"] .rg-face-sleep,
.roam-ghost[data-mood="wow"]   .rg-face-wow,
.roam-ghost[data-mood="love"]  .rg-face-love,
.roam-ghost[data-mood="wink"]  .rg-face-wink {
  display: inline;
}

/* tvářičky se přibarví, když je myš blízko nebo má radost */
.rg-cheeks {
  opacity: calc(var(--near, 0) * .55);
  transition: opacity .3s ease;
}

.roam-ghost[data-mood="happy"] .rg-cheeks,
.roam-ghost[data-mood="love"] .rg-cheeks {
  opacity: .6;
}

/* =========================
   OTOČENÍ NA DRUHOU STRANU
========================= */

.roam-ghost-flip {
  transition: transform .5s cubic-bezier(.5, 0, .25, 1.35);
}

.roam-ghost.is-flipped .roam-ghost-flip {
  transform: scaleX(-1);
}

/* =========================
   PÓZY
========================= */

.roam-ghost-stretch {
  transform-origin: 50% 40%;
}

.roam-ghost-body {
  transform-origin: 50% 85%;
  pointer-events: auto;
  cursor: pointer;
}

.roam-ghost.is-near .roam-ghost-body:not([class*="pose-"]) {
  animation: rg-sway 1.6s ease-in-out infinite;
}

.roam-ghost-body.pose-wave { animation: rg-wave 1s ease-in-out; }
.roam-ghost-body.pose-hop  { animation: rg-hop .7s cubic-bezier(.3, 1.4, .5, 1); }
.roam-ghost-body.pose-jump { animation: rg-jump .8s cubic-bezier(.3, 1.4, .5, 1); }
.roam-ghost-body.pose-spin { animation: rg-spin .9s cubic-bezier(.45, 0, .2, 1); }
.roam-ghost-body.pose-peek { animation: rg-peek 1.1s ease-in-out; }
.roam-ghost-body.pose-tilt { animation: rg-tilt 1.1s ease-in-out; }

@keyframes rg-sway {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25%      { transform: rotate(-4deg) scale(1.03); }
  75%      { transform: rotate(4deg) scale(1.03); }
}

@keyframes rg-wave {
  0%, 100% { transform: rotate(0deg); }
  20%      { transform: rotate(-10deg); }
  40%      { transform: rotate(9deg); }
  60%      { transform: rotate(-7deg); }
  80%      { transform: rotate(4deg); }
}

@keyframes rg-hop {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  20%      { transform: translateY(2px) scale(1.08, .9); }
  50%      { transform: translateY(-16px) scale(.95, 1.06); }
  80%      { transform: translateY(0) scale(1.04, .96); }
}

@keyframes rg-jump {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  15%      { transform: translateY(4px) scale(1.12, .85); }
  45%      { transform: translateY(-34px) scale(.92, 1.1); }
  75%      { transform: translateY(0) scale(1.08, .92); }
}

@keyframes rg-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(.9); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes rg-peek {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  30%, 55% { transform: translateY(26px) scale(1.05, .8); }
  70%      { transform: translateY(-8px) scale(.97, 1.04); }
}

@keyframes rg-tilt {
  0%, 100% { transform: rotate(0deg); }
  30%, 70% { transform: rotate(-14deg); }
}

/* spánek – pomalé dýchání a „zzz“ */
.roam-ghost.is-sleeping .roam-ghost-body {
  animation: rg-breathe 3s ease-in-out infinite;
}

@keyframes rg-breathe {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.03, .96); }
}

.roam-ghost-zzz {
  position: absolute;
  top: -6px;
  right: -4px;

  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  color: #8C7563;

  pointer-events: none;
}

.roam-ghost-zzz span {
  position: absolute;
  opacity: 0;
}

.roam-ghost.is-sleeping .roam-ghost-zzz span {
  animation: rg-zzz 2.4s ease-in-out infinite;
}

.roam-ghost-zzz span:nth-child(1) { font-size: 12px; }
.roam-ghost-zzz span:nth-child(2) { font-size: 15px; animation-delay: .8s !important; }
.roam-ghost-zzz span:nth-child(3) { font-size: 19px; animation-delay: 1.6s !important; }

@keyframes rg-zzz {
  0%   { opacity: 0; transform: translate(0, 0); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(18px, -34px); }
}

/* čárky rychlosti při bleskovém letu nahoru */
.roam-ghost-whoosh {
  position: absolute;
  left: 50%;
  top: 92%;

  width: 60px;
  height: 70px;

  transform: translateX(-50%);
  pointer-events: none;
}

.roam-ghost-whoosh i {
  position: absolute;
  top: 0;

  width: 4px;
  height: 46px;
  border-radius: 4px;

  background: linear-gradient(to bottom, rgba(140, 117, 99, .55), rgba(140, 117, 99, 0));

  opacity: 0;
}

.roam-ghost-whoosh i:nth-child(1) { left: 8px; }
.roam-ghost-whoosh i:nth-child(2) { left: 28px; height: 60px; }
.roam-ghost-whoosh i:nth-child(3) { left: 48px; }

.roam-ghost.is-express .roam-ghost-whoosh i {
  animation: rg-whoosh .35s linear infinite;
}

.roam-ghost.is-express .roam-ghost-whoosh i:nth-child(2) { animation-delay: .12s; }
.roam-ghost.is-express .roam-ghost-whoosh i:nth-child(3) { animation-delay: .22s; }

@keyframes rg-whoosh {
  0%   { opacity: 0; transform: translateY(-10px); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(24px); }
}

/* srdíčka po kliknutí */
.roam-ghost-heart {
  position: absolute;
  left: 50%;
  top: 30%;

  width: var(--size, 14px);
  height: var(--size, 14px);

  pointer-events: none;

  background: #E98D99;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 9C2 3 9 1 12 6c3-5 10-3 10 3 0 7-10 13-10 13S2 16 2 9z'/%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 24 24'%3E%3Cpath d='M2 9C2 3 9 1 12 6c3-5 10-3 10 3 0 7-10 13-10 13S2 16 2 9z'/%3E%3C/svg%3E") center / contain no-repeat;

  opacity: 0;
  animation: rg-heart 1.3s ease-out var(--delay, 0ms) forwards;
}

@keyframes rg-heart {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -90px) scale(1.1); }
}

/* bublina */
.roam-ghost-bubble {
  position: absolute;
  bottom: calc(100% - 6px);
  right: 62%;

  padding: 9px 14px;

  white-space: nowrap;

  background: #F7F3EE;
  color: #3B2F2A;
  border: 1px solid #E6DDD2;
  border-radius: 16px 16px 4px 16px;

  box-shadow: 0 8px 20px rgba(59, 47, 42, .12);

  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;

  opacity: 0;
  transform: translateY(8px) scale(.85);
  transform-origin: bottom right;
  transition:
    opacity .35s ease,
    transform .45s cubic-bezier(.34, 1.56, .64, 1);
}

.roam-ghost.bubble-right .roam-ghost-bubble {
  right: auto;
  left: 62%;
  border-radius: 16px 16px 16px 4px;
  transform-origin: bottom left;
}

.roam-ghost.is-talking .roam-ghost-bubble {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* když duch putuje, statické duchy v hero a nad patičkou schováme */
@media (min-width: 900px) {
  html.ghost-roaming .hero-ghost,
  html.ghost-roaming .footer-ghost {
    display: none;
  }
}

@media (max-width: 899px) {
  .roam-ghost {
    display: none;
  }
}


/* =========================
   BOO NA MOBILU A TABLETU
   (ovládá mobileBoo() v ghost.js)
========================= */

.boo-tappable {
  pointer-events: auto !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.boo-tappable:focus-visible {
  outline: 2px solid #7A6352;
  outline-offset: 4px;
  border-radius: 50%;
}

/* zamávání, protočení, poskok */
.hero-ghost.boo-wave,
.footer-ghost img.boo-wave {
  animation: boo-wave 1.3s ease-in-out;
}

.hero-ghost.boo-spin,
.footer-ghost img.boo-spin {
  animation: boo-spin .9s cubic-bezier(.45, 0, .2, 1);
}

.hero-ghost.boo-hop,
.footer-ghost img.boo-hop {
  animation: boo-hop .7s cubic-bezier(.3, 1.4, .5, 1);
}

@keyframes boo-wave {
  0%, 100% { transform: rotate(-8deg); }
  15%      { transform: rotate(-20deg) translateY(-4px); }
  35%      { transform: rotate(6deg)  translateY(-6px); }
  55%      { transform: rotate(-16deg) translateY(-4px); }
  75%      { transform: rotate(2deg); }
}

@keyframes boo-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(.88) translateY(8px); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes boo-hop {
  0%, 100% { transform: translateY(0) scale(1, 1) rotate(-8deg); }
  20%      { transform: translateY(3px) scale(1.1, .88) rotate(-8deg); }
  50%      { transform: translateY(-18px) scale(.94, 1.08) rotate(-4deg); }
  80%      { transform: translateY(0) scale(1.05, .95) rotate(-8deg); }
}

/* bublina */
.boo-bubble {
  position: absolute;
  z-index: 6;

  padding: 8px 13px;

  background: #F7F3EE;
  color: #3B2F2A;
  border: 1px solid #E6DDD2;
  border-radius: 16px 16px 16px 4px;

  box-shadow: 0 8px 20px rgba(59, 47, 42, .14);

  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;

  pointer-events: none;

  opacity: 0;
  transform: translateY(8px) scale(.85);
  transform-origin: bottom left;
  transition:
    opacity .3s ease,
    transform .45s cubic-bezier(.34, 1.56, .64, 1);
}

.boo-bubble.is-on {
  opacity: 1;
  transform: none;
}

/* v hero – vpravo od ducha */
.boo-bubble--hero {
  top: -40px;
  left: 82px;
}

/* v patičce – vlevo od ducha */
.boo-bubble--footer {
  top: -96px;
  right: calc(12% + 70px);

  border-radius: 16px 16px 4px 16px;
  transform-origin: bottom right;
}

/* duch v patičce po doscrolování vyskočí celý */
.footer-ghost {
  transition: top .5s cubic-bezier(.34, 1.56, .64, 1), height .5s cubic-bezier(.34, 1.56, .64, 1);
}

.footer-ghost.is-up {
  top: -79px;
  height: 79px;
}

.footer-ghost.is-up {
  overflow: visible;
}

.footer-ghost.is-up img {
  animation: boo-float 3.4s ease-in-out infinite;
}

.footer-ghost.is-up img.boo-wave { animation: boo-wave 1.3s ease-in-out; }
.footer-ghost.is-up img.boo-spin { animation: boo-spin .9s cubic-bezier(.45, 0, .2, 1); }
.footer-ghost.is-up img.boo-hop  { animation: boo-hop .7s cubic-bezier(.3, 1.4, .5, 1); }

@keyframes boo-float {
  0%, 100% { transform: translateY(2px) rotate(-4deg); }
  50%      { transform: translateY(-4px) rotate(3deg); }
}

@media (max-width: 650px) {
  .footer-ghost.is-up {
    top: -64px;
    height: 64px;
  }

  .boo-bubble--footer {
    top: -84px;
    right: calc(8% + 56px);
  }
}

@media (max-width: 600px) {
  .boo-bubble--hero {
    top: -44px;
    left: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-ghost.boo-wave,
  .hero-ghost.boo-spin,
  .hero-ghost.boo-hop,
  .footer-ghost img.boo-wave,
  .footer-ghost img.boo-spin,
  .footer-ghost img.boo-hop,
  .footer-ghost.is-up img,
  .footer-ghost.is-up img.boo-wave,
  .footer-ghost.is-up img.boo-spin,
  .footer-ghost.is-up img.boo-hop {
    animation: none;
  }

  .footer-ghost {
    transition: none;
  }
}