/*
 * Small site-wide fixes in plain CSS, loaded after style.css (see functions/wordpress/site-enqueue.php).
 * Kept outside SCSS so they don't depend on the WP-SCSS plugin recompiling style.css.
 */

/* Contact Form 7 wraps its hidden inputs in this fieldset. The plugin's own CSS (dequeued in
   site-dequeue.php) normally hides it; without that it shows as an empty bordered box.
   Hidden inputs are still submitted when their container is display: none. */
.hidden-fields-container {
  display: none;
}

/* ------------------------------------------------------------------
 * Waving dog peeking over the footer's top edge (footer.php)
 * Only his head and paw show above the edge; the rest is clipped as if he's behind the footer "wall".
 * clip-path only cuts below the edge, so the hover pop-up and speech bubble can extend upwards.
 * ------------------------------------------------------------------ */

.footer {
  position: relative;
  margin-top: 40px; /* room above the footer so his head never covers page content */
}

.footer-dog {
  position: absolute;
  bottom: 100%;
  left: 50%;
  z-index: 5;
  display: block;
  width: 190px;
  height: 86px; /* how much of him shows above the edge */
  transform: translateX(-50%);
  clip-path: inset(-300px -300px 0 -300px);
  text-decoration: none;
}

.footer-dog img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Pops up a little further on hover */
.footer-dog:hover img,
.footer-dog:focus-visible img {
  transform: translateY(-14px);
}

/* Hidden below the edge until the footer scrolls into view (js/site.js swaps is-waiting for is-arriving).
   Listed after the hover rule, and with :hover included, so hovering the empty spot can't reveal him early. */
.footer-dog.is-waiting img,
.footer-dog.is-waiting:hover img {
  transform: translateY(100%);
}

.footer-dog.is-waiting .footer-dog__bubble {
  visibility: hidden;
}

/* A slower, bouncier rise than the hover pop */
.footer-dog.is-arriving img {
  transition: transform 0.9s cubic-bezier(0.34, 1.45, 0.64, 1) 0.15s;
}

.footer-dog:focus-visible {
  outline: none;
}

.footer-dog:focus-visible img {
  outline: 3px solid #a1bf60;
  outline-offset: 4px;
  border-radius: 12px;
}

/* "Fancy a run?" speech bubble, shown on hover / keyboard focus.
   `.footer` prefix out-ranks the theme's `.footer span { color: #fff }`. */
.footer .footer-dog__bubble {
  position: absolute;
  bottom: 100%;
  left: 78%;
  z-index: 1;
  margin-bottom: 4px;
  padding: 8px 14px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(20, 15, 54, 0.18);
  font-family: 'Lato', sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  color: #201b4e;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.footer .footer-dog:hover .footer-dog__bubble,
.footer .footer-dog:focus-visible .footer-dog__bubble {
  opacity: 1;
  transform: translateY(0);
}

/* Phones: smaller, at the right, clear of the centred footer text */
@media (max-width: 800px) {
  .footer-dog {
    left: auto;
    right: 16px;
    width: 130px;
    height: 60px;
    transform: none;
  }

  .footer .footer-dog__bubble {
    left: auto;
    right: 70%;
    border-radius: 14px 14px 4px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .footer-dog img,
  .footer-dog.is-arriving img,
  .footer-dog__bubble {
    transition: none;
  }

  .footer-dog.is-waiting img {
    transform: none;
  }
}
