/* Synny motion language: calm at rest, expressive on interaction, contextual in workspaces. */
.landing-synny-welcome,
.landing-synny-profile,
.synny-companion-image {
  transform-origin: 50% 62%;
}

.landing-synny-welcome.synny-motion-visible {
  animation: synny-hero-drift-v2 5.8s ease-in-out infinite;
}

.landing-synny-welcome::before,
.landing-synny-portrait::after {
  content: "";
  position: absolute;
  z-index: 3;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(42, 205, 186, 0.7);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.landing-synny-welcome::before {
  top: 53%;
  left: 50%;
}

.landing-synny-portrait::after {
  top: 48%;
  left: 50%;
}

.landing-synny-welcome.synny-motion-visible::before,
.landing-synny-portrait.synny-motion-visible::after {
  animation: synny-heart-pulse 3.2s ease-out 0.8s infinite;
}

.landing-synny-portrait.synny-motion-ready {
  cursor: pointer;
  outline: none;
}

.landing-synny-portrait.synny-motion-ready:focus-visible {
  outline: 3px solid rgba(13, 148, 136, 0.24);
  outline-offset: 5px;
  border-radius: 8px;
}

.landing-synny-portrait.is-reacting .landing-synny-profile {
  animation: synny-cheer-hop 720ms cubic-bezier(0.2, 0.75, 0.25, 1.2) both;
}

.synny-greeting {
  position: absolute;
  top: 8px;
  right: -16px;
  z-index: 6;
  max-width: 210px;
  padding: 10px 12px;
  border: 1px solid #bdb6ee;
  border-radius: 8px;
  background: #ffffff;
  color: #2f3750;
  box-shadow: 0 12px 28px rgba(43, 50, 81, 0.14);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.96);
  transform-origin: bottom left;
  transition: opacity 180ms ease, transform 180ms ease;
}

.synny-greeting::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 22px;
  width: 10px;
  height: 10px;
  border-right: 1px solid #bdb6ee;
  border-bottom: 1px solid #bdb6ee;
  background: #ffffff;
  transform: rotate(45deg);
}

.synny-greeting.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.synny-companion-image {
  animation: synny-companion-bob 4.4s ease-in-out infinite;
}

.synny-companion.open .synny-companion-image {
  animation: synny-greet-pop 620ms cubic-bezier(0.2, 0.8, 0.25, 1.2) both;
}

.synny-companion-toggle:active .synny-companion-image {
  transform: scale(0.94);
}

.synny-presence-dot {
  animation: synny-presence-pulse 2.4s ease-out infinite;
}

.textbook-reference-head:hover .synny-reference-guide,
.textbook-reference-head:focus-within .synny-reference-guide,
.synny-practice-hero:hover .synny-practice-guide,
.synny-practice-hero:focus-within .synny-practice-guide {
  animation: synny-point-nudge 620ms ease both;
}

.synny-empty-image {
  animation: synny-calm-sway 5.2s ease-in-out infinite;
}

.synny-toast.good .synny-toast-image,
.synny-toast.success .synny-toast-image {
  animation: synny-celebrate 680ms cubic-bezier(0.2, 0.8, 0.25, 1.2) both;
}

.synny-toast.bad .synny-toast-image,
.synny-toast.error .synny-toast-image {
  animation: synny-encourage 520ms ease both;
}

.account-button:hover .synny-account-image,
.account-button:focus-visible .synny-account-image {
  animation: synny-avatar-hello 540ms ease both;
}

body.synny-motion-paused :is(
  .landing-synny-welcome,
  .landing-synny-welcome::before,
  .landing-synny-portrait::after,
  .landing-synny-profile,
  .synny-companion-image,
  .synny-presence-dot,
  .synny-empty-image
) {
  animation-play-state: paused !important;
}

@keyframes synny-hero-drift-v2 {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-0.8deg); }
  28% { transform: translate3d(3px, -7px, 0) rotate(0.1deg); }
  52% { transform: translate3d(0, -12px, 0) rotate(0.9deg); }
  76% { transform: translate3d(-3px, -5px, 0) rotate(-0.1deg); }
}

@keyframes synny-heart-pulse {
  0%, 42% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  56% { opacity: 0.72; transform: translate(-50%, -50%) scale(0.8); }
  82%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.75); }
}

@keyframes synny-cheer-hop {
  0% { transform: translate3d(0, 0, 0) rotate(0); }
  34% { transform: translate3d(0, -14px, 0) rotate(-3deg) scale(1.025); }
  62% { transform: translate3d(0, -5px, 0) rotate(2deg) scale(1.012); }
  100% { transform: translate3d(0, 0, 0) rotate(0); }
}

@keyframes synny-companion-bob {
  0%, 100% { transform: translateY(0) rotate(-0.5deg); }
  50% { transform: translateY(-5px) rotate(0.7deg); }
}

@keyframes synny-greet-pop {
  0% { transform: translateY(3px) rotate(-4deg) scale(0.9); }
  52% { transform: translateY(-7px) rotate(3deg) scale(1.06); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}

@keyframes synny-presence-pulse {
  0%, 45% { box-shadow: 0 0 0 0 rgba(19, 158, 132, 0.36); }
  80%, 100% { box-shadow: 0 0 0 7px rgba(19, 158, 132, 0); }
}

@keyframes synny-point-nudge {
  0%, 100% { transform: translateX(0) rotate(0); }
  45% { transform: translateX(5px) rotate(2deg); }
  72% { transform: translateX(2px) rotate(-1deg); }
}

@keyframes synny-calm-sway {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-5px) rotate(0.8deg); }
}

@keyframes synny-celebrate {
  0% { transform: scale(0.84) rotate(-5deg); }
  55% { transform: scale(1.1) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes synny-encourage {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-3px) rotate(-2deg); }
  55% { transform: translateX(3px) rotate(2deg); }
  78% { transform: translateX(-1px) rotate(-1deg); }
}

@keyframes synny-avatar-hello {
  0%, 100% { transform: translateY(0) rotate(0); }
  45% { transform: translateY(-3px) rotate(-4deg) scale(1.05); }
  72% { transform: translateY(-1px) rotate(2deg) scale(1.02); }
}

@media (max-width: 640px) {
  .landing-synny-welcome::before {
    width: 18px;
    height: 18px;
  }

  .synny-greeting {
    top: 2px;
    right: 0;
    max-width: 178px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-synny-welcome,
  .landing-synny-welcome::before,
  .landing-synny-portrait::after,
  .landing-synny-profile,
  .landing-synny-portrait.is-reacting .landing-synny-profile,
  .synny-companion-image,
  .synny-companion.open .synny-companion-image,
  .synny-presence-dot,
  .synny-reference-guide,
  .synny-practice-guide,
  .synny-empty-image,
  .synny-toast-image,
  .synny-account-image {
    animation: none !important;
  }

  .synny-greeting {
    transition: none;
  }
}
