/* The talking mascot (guide.js): bottom-right on every page, a speech bubble above it, a small
   help card when clicked. The site's own materials: card surface, border, primary for focus. */

.guide {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  transform: translateY(140%);
  opacity: 0;
  transition:
    transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease;
}
.guide[data-on] {
  transform: none;
  opacity: 1;
}
.guide > * {
  pointer-events: auto;
}

.guide-me {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.guide-me:hover {
  transform: translateY(-4px) rotate(-3deg);
}
.guide-me:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 4px;
}
.guide-img {
  display: block;
  width: 76px;
  height: 80px;
  filter: drop-shadow(0 12px 14px rgb(0 0 0 / 0.3));
}
.guide.chomp .guide-me {
  animation: guide-chomp 0.9s ease-in-out;
}
@keyframes guide-chomp {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: scale(1.15, 0.9);
  }
  40% {
    transform: scale(0.95, 1.08) translateY(-8px);
  }
  60% {
    transform: scale(1.1, 0.92);
  }
  80% {
    transform: scale(0.98, 1.03);
  }
}

/* Speech bubble: a card with a tail pointing at the mascot. */
.guide-bubble,
.guide-card {
  position: relative;
  max-width: min(320px, calc(100vw - 36px));
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  color: var(--foreground);
  box-shadow:
    0 18px 40px -18px rgb(0 0 0 / 0.45),
    0 0 0 4px color-mix(in oklab, var(--primary) 10%, transparent);
}
.guide-bubble {
  padding: 12px 38px 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  transform-origin: calc(100% - 38px) 100%;
}
.guide-bubble::after {
  content: "";
  position: absolute;
  right: 30px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: var(--card);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}
.guide-bubble.pop {
  animation: guide-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes guide-pop {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(8px);
  }
}
.guide-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.guide-actions a,
.guide-answer-link a {
  color: var(--link);
  font-weight: 800;
  font-size: 13px;
}
.guide-x {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted-foreground);
}
.guide-x:hover {
  background: var(--muted);
  color: var(--foreground);
}
.guide-x svg {
  width: 14px;
  height: 14px;
}

/* Help card */
.guide-card {
  width: 320px;
  padding: 16px;
  transform-origin: calc(100% - 38px) 100%;
  animation: guide-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.guide-card-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.guide-qs {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.guide-q {
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in oklab, var(--card) 60%, var(--background));
  font-size: 13.5px;
  font-weight: 700;
  transition:
    border-color 0.15s,
    background-color 0.15s;
}
.guide-q:hover,
.guide-q:focus-visible {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 10%, var(--card));
  outline: none;
}
.guide-answer {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
}
.guide-answer-link {
  margin-top: 8px;
}
.guide-back,
.guide-hide {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted-foreground);
}
.guide-back:hover,
.guide-hide:hover {
  color: var(--foreground);
}
.guide-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.guide-foot .guide-hide {
  margin-top: 0;
}

/* Dragging a file over the page: the whole window becomes the mouth. */
html.guide-feeding body::after {
  content: "";
  position: fixed;
  inset: 10px;
  z-index: 39;
  border: 3px dashed var(--primary);
  border-radius: 24px;
  background: color-mix(in oklab, var(--primary) 6%, transparent);
  pointer-events: none;
}

/* Every mascot leans towards the pointer (guide.js sets the variables) and wiggles when clicked. */
.hero-mascot > svg,
.section-mascot,
.head-mascot,
.band-mascot,
.guide-img {
  transform: translate(var(--look, 0px), var(--tilt, 0px)) rotate(var(--lean, 0deg));
  transform-origin: 50% 90%;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.section-mascot,
.head-mascot,
.band-mascot,
.hero-mascot > svg {
  cursor: pointer;
}
.wiggle {
  animation: mascot-poke 0.6s ease-in-out;
}
@keyframes mascot-poke {
  0%,
  100% {
    rotate: 0deg;
    scale: 1;
  }
  20% {
    rotate: -12deg;
    scale: 1.08 0.94;
  }
  45% {
    rotate: 10deg;
    scale: 0.96 1.06;
  }
  70% {
    rotate: -5deg;
  }
}

@media (max-width: 640px) {
  .guide {
    right: 10px;
    bottom: 8px;
  }
  .guide-img {
    width: 58px;
    height: 61px;
  }
  .guide-bubble {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .guide,
  .guide-me,
  .guide-bubble.pop,
  .guide-card,
  .guide.chomp .guide-me,
  .wiggle {
    transition: none;
    animation: none;
  }
  .hero-mascot > svg,
  .section-mascot,
  .head-mascot,
  .band-mascot,
  .guide-img {
    transform: none;
    transition: none;
  }
}
@media print {
  .guide {
    display: none;
  }
}
/* The head mascot also has an entrance animation; the click wiggle must win over it. */
.page-head.enter .head-mascot.wiggle {
  animation: mascot-poke 0.6s ease-in-out;
}
