/* ============================================================
   Cow Mood Mascot — Production
   Homepage-only fixed helper that points visitors to the cut map.
   ============================================================ */

.cow-mascot {
  --cow-peek: 30%;

  position: fixed;
  right: var(--space-lg);
  bottom: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 220px;
  pointer-events: none;
  transform: translateY(110%);
  transition: transform 0.65s var(--ease-out);
}

.cow-mascot.is-visible {
  transform: translateY(0);
}

.cow-mascot.is-dismissing {
  transform: translateY(110%);
}

/* Bubble */
.cow-mascot__bubble {
  position: relative;
  width: 100%;
  max-width: 260px;
  margin-bottom: var(--space-xs);
  padding: var(--space-md) 42px var(--space-md) var(--space-md);
  background: #f7f0e4;
  border: 1px solid rgba(90, 60, 40, 0.10);
  border-top: 2px solid var(--amber);
  border-radius: 20px 20px 6px 20px;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.05),
    0 18px 38px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s var(--ease-out) 0.1s, transform 0.45s var(--ease-out) 0.1s;
  pointer-events: auto;
}

.cow-mascot.is-visible .cow-mascot__bubble {
  opacity: 1;
  transform: translateY(0);
}

.cow-mascot__bubble::after {
  content: '';
  position: absolute;
  right: 38px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background: #f7f0e4;
  border-right: 1px solid rgba(90, 60, 40, 0.10);
  border-bottom: 1px solid rgba(90, 60, 40, 0.10);
  border-radius: 0 0 5px 0;
  transform: rotate(45deg);
  box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.04);
  pointer-events: none;
}

.cow-mascot__text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1512;
  line-height: 1.35;
  margin: 0 0 var(--space-sm);
}

.cow-mascot__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--bone);
  background: var(--ember);
  padding: 0.55rem 0.95rem;
  border-radius: 50px;
  min-height: 34px;
  transition: background 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.cow-mascot__cta:hover,
.cow-mascot__cta:focus-visible {
  background: var(--ember-dark);
  transform: translateY(-1px);
  outline: none;
}

.cow-mascot__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  color: rgba(26, 21, 18, 0.45);
  cursor: pointer;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.cow-mascot__close:hover,
.cow-mascot__close:focus-visible {
  background: rgba(90, 60, 40, 0.08);
  color: #1a1512;
  outline: none;
}

/* Cow wrapper */
.cow-mascot__cow {
  width: 200px;
  height: 170px;
  pointer-events: auto;
  transform: translateY(var(--cow-peek));
  transform-origin: bottom center;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.18));
}

.cow-mascot.is-visible .cow-mascot__cow {
  animation: cow-mascot-bob 3.2s ease-in-out infinite;
}

@keyframes cow-mascot-bob {
  0%, 100% { transform: translateY(var(--cow-peek)); }
  50% { transform: translateY(calc(var(--cow-peek) - 5px)); }
}

/* Expression states */
.cow-mascot__mouth--sad,
.cow-mascot__eyebrow--sad,
.cow-mascot__sweat,
.cow-mascot__mouth--panic,
.cow-mascot__eyebrow--panic,
.cow-mascot__tail {
  display: none;
}

.cow-mascot.is-sad .cow-mascot__mouth--happy,
.cow-mascot.is-sad .cow-mascot__eyebrow--happy,
.cow-mascot.is-panicked .cow-mascot__mouth--happy,
.cow-mascot.is-panicked .cow-mascot__eyebrow--happy,
.cow-mascot.is-exiting .cow-mascot__mouth--happy,
.cow-mascot.is-exiting .cow-mascot__eyebrow--happy {
  display: none;
}

.cow-mascot.is-sad .cow-mascot__mouth--sad,
.cow-mascot.is-sad .cow-mascot__eyebrow--sad,
.cow-mascot.is-sad .cow-mascot__sweat,
.cow-mascot.is-panicked .cow-mascot__mouth--panic,
.cow-mascot.is-panicked .cow-mascot__eyebrow--panic,
.cow-mascot.is-panicked .cow-mascot__sweat {
  display: block;
}

.cow-mascot.is-panicked .cow-mascot__mouth--sad,
.cow-mascot.is-panicked .cow-mascot__eyebrow--sad {
  display: none;
}

/* Hide CTA during the joke */
.cow-mascot.is-sad .cow-mascot__cta,
.cow-mascot.is-panicked .cow-mascot__cta,
.cow-mascot.is-exiting .cow-mascot__cta {
  display: none;
}

/* Panic lean (just before zip) */
.cow-mascot.is-panicked .cow-mascot__cow {
  animation: none;
  transform: translateY(var(--cow-peek)) rotate(-5deg);
  transition: transform 0.25s var(--ease-out);
}

/* Exit / zip-out */
.cow-mascot.is-exiting .cow-mascot__bubble {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cow-mascot.is-exiting .cow-mascot__cow {
  animation: none;
  transform: translateX(135%) translateY(var(--cow-peek)) rotate(-9deg);
  transition: transform 0.7s cubic-bezier(0.55, 0, 0.85, 0.25);
}

@keyframes cow-mascot-tail-fade {
  0% {
    opacity: 0;
    transform: scaleX(0.8) translateX(0);
  }
  20% {
    opacity: 1;
    transform: scaleX(1.35) translateX(-8px);
  }
  80% {
    opacity: 1;
    transform: scaleX(1.35) translateX(-14px);
  }
  100% {
    opacity: 0;
    transform: scaleX(1.1) translateX(-22px);
  }
}

.cow-mascot.is-exiting .cow-mascot__tail {
  display: block;
  animation: cow-mascot-tail-fade 0.75s ease-in forwards;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cow-mascot,
  .cow-mascot__bubble {
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .cow-mascot {
    transform: translateY(0);
    opacity: 0;
    visibility: hidden;
  }

  .cow-mascot.is-visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .cow-mascot.is-dismissing {
    transform: translateY(0);
    opacity: 0;
    visibility: hidden;
  }

  .cow-mascot.is-visible .cow-mascot__cow,
  .cow-mascot.is-panicked .cow-mascot__cow,
  .cow-mascot.is-exiting .cow-mascot__cow {
    animation: none;
    transform: translateY(var(--cow-peek));
  }

  .cow-mascot.is-exiting .cow-mascot__tail {
    display: none;
    animation: none;
  }

  .cow-mascot.is-exiting .cow-mascot__bubble {
    opacity: 0;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .cow-mascot {
    --cow-peek: 34%;

    right: var(--space-sm);
    width: 150px;
  }

  .cow-mascot__bubble {
    max-width: calc(100vw - var(--space-sm) * 2 - 24px);
    padding: 12px 34px 12px 12px;
    border-radius: 16px 16px 4px 16px;
  }

  .cow-mascot__bubble::after {
    right: 24px;
    bottom: -6px;
    width: 12px;
    height: 12px;
  }

  .cow-mascot__cow {
    width: 120px;
    height: 102px;
  }

  .cow-mascot__text {
    font-size: 0.82rem;
  }

  .cow-mascot__cta {
    font-size: 0.6rem;
    padding: 0.4rem 0.55rem;
    min-height: 30px;
    white-space: nowrap;
  }

  .cow-mascot__close {
    width: 28px;
    height: 28px;
    top: 4px;
    right: 4px;
    font-size: 1.1rem;
  }

  /* Sit above the real site's fixed mobile Call/Directions bar */
  .mobile-actions ~ .cow-mascot {
    bottom: 86px;
  }
}
