/* Pip, golden stars, easter eggs and clipart (static/js/fun.js, templates/_clipart.html).
 * Everything here sits off to the side and never covers a button for long. */

/* ---------- Pip ---------- */
.pip-dock { position: fixed; left: 14px; bottom: 0; z-index: 45; width: 96px; height: 96px; pointer-events: none; }
.pip-dock .pip-btn { pointer-events: auto; position: absolute; left: 0; bottom: 0; width: 96px; height: 88px; padding: 0; border: 0; background: none; cursor: pointer;
  transform: translateY(100%); transition: transform .55s cubic-bezier(.34, 1.56, .64, 1); }
.pip-dock.is-lurking .pip-btn { transform: translateY(70%); }
.pip-dock.is-up .pip-btn { transform: translateY(6%); }
.pip-dock .pip-btn:focus-visible { outline: 3px solid rgb(var(--c-sun)); outline-offset: 2px; border-radius: 16px; }
.pip-svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.pip-svg .pip-lid { transform-origin: 50% 0; transform: scaleY(0); animation: pip-blink 5s infinite; }
.pip-svg .pip-tongue { transform-origin: 0 50%; animation: pip-tongue 3.2s infinite; }
.pip-dock.is-up .pip-svg { animation: pip-bob 2.4s ease-in-out infinite; }
.pip-dock.is-wiggle .pip-svg { animation: pip-wiggle .5s ease-in-out; }
.pip-dock.is-dance .pip-svg { animation: pip-dance .45s ease-in-out 6; }
@keyframes pip-blink { 0%, 92%, 100% { transform: scaleY(0); } 95% { transform: scaleY(1); } }
@keyframes pip-tongue { 0%, 80%, 100% { transform: scaleX(0); } 85%, 92% { transform: scaleX(1); } }
@keyframes pip-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-2deg); } }
@keyframes pip-wiggle { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes pip-dance { 0%, 100% { transform: translateY(0) rotate(0) scale(1); } 25% { transform: translateY(-14px) rotate(-12deg) scale(1.06); } 75% { transform: translateY(-14px) rotate(12deg) scale(1.06); } }

.pip-bubble { pointer-events: auto; position: absolute; left: 70px; bottom: 74px; width: max-content; max-width: min(280px, calc(100vw - 100px));
  padding: 10px 30px 10px 14px; border-radius: 18px 18px 18px 4px; background: rgb(var(--c-card)); color: rgb(var(--c-ink));
  border: 2px solid rgb(var(--c-ink) / .12); box-shadow: 0 12px 30px -10px rgba(0,0,0,.3);
  font: 700 14px/1.4 Inter, system-ui, sans-serif; opacity: 0; transform: translateY(8px) scale(.9); transform-origin: 0 100%;
  transition: opacity .25s, transform .3s cubic-bezier(.34, 1.56, .64, 1); visibility: hidden; }
.pip-dock.is-talking .pip-bubble { opacity: 1; transform: none; visibility: visible; }
.pip-bubble-x { position: absolute; top: 4px; right: 6px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent;
  color: rgb(var(--c-ink) / .5); font-size: 16px; line-height: 1; cursor: pointer; }
.pip-bubble-x:hover { background: rgb(var(--c-ink) / .08); color: rgb(var(--c-ink)); }

/* ---------- toast ---------- */
.fun-toast { position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; background: #17303a; color: #fff; font: 800 14px/1.3 Inter, system-ui, sans-serif;
  box-shadow: 0 14px 30px -10px rgba(0,0,0,.45); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), opacity .25s; max-width: calc(100vw - 32px); text-align: center; }
.fun-toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* ---------- confetti and sparkles ---------- */
.fun-bit { position: fixed; z-index: 61; pointer-events: none; width: 9px; height: 13px; border-radius: 2px; top: 0; left: 0;
  animation: fun-fly var(--d, 1.4s) cubic-bezier(.2, .7, .4, 1) forwards; }
.fun-bit.is-round { border-radius: 50%; width: 9px; height: 9px; }
@keyframes fun-fly {
  0% { transform: translate(var(--x0), var(--y0)) rotate(0); opacity: 1; }
  100% { transform: translate(var(--x1), var(--y1)) rotate(var(--r)); opacity: 0; } }

/* ---------- golden star ---------- */
.fun-star { position: absolute; z-index: 44; width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer;
  animation: fun-twinkle 1.8s ease-in-out infinite; filter: drop-shadow(0 0 6px rgba(255, 200, 61, .8)); }
.fun-star svg { width: 100%; height: 100%; }
.fun-star.is-caught { animation: fun-caught .6s ease-in forwards; pointer-events: none; }
@keyframes fun-twinkle { 0%, 100% { transform: scale(.85) rotate(-8deg); opacity: .75; } 50% { transform: scale(1.1) rotate(8deg); opacity: 1; } }
@keyframes fun-caught { to { transform: scale(2.4) rotate(180deg); opacity: 0; } }

/* ---------- easter eggs ---------- */
.fun-walker { position: fixed; z-index: 46; bottom: 6px; left: -220px; pointer-events: none; animation: fun-walk var(--d, 9s) linear forwards; }
.fun-walker svg { display: block; }
@keyframes fun-walk { to { transform: translateX(calc(100vw + 440px)); } }
.fun-bug { position: fixed; z-index: 46; width: 38px; height: 38px; padding: 0; border: 0; background: none; cursor: crosshair;
  transition: left 1.1s linear, top 1.1s linear; }
.fun-bug svg { width: 100%; height: 100%; animation: fun-scuttle .18s steps(2) infinite; }
.fun-bug.is-squashed { pointer-events: none; transition: none; }
.fun-bug.is-squashed svg { animation: none; transform: scaleY(.25); opacity: .6; }
@keyframes fun-scuttle { 50% { transform: rotate(6deg); } }
.fun-rainbow { position: fixed; inset: 0 0 auto; z-index: 62; height: 6px; pointer-events: none;
  background: linear-gradient(90deg, #ff5f6d, #ffc83d, #4cbb76, #56acf0, #8d6ce6, #ff5f6d); background-size: 200% 100%; animation: pl-slide 1s linear infinite; }

/* ---------- clipart (templates/_clipart.html) ---------- */
/* isolation keeps the clipart above the section's background but behind its content */
.has-clipart { position: relative; isolation: isolate; }
.clipart { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; border-radius: inherit; }
.clip { position: absolute; width: var(--s, 56px); height: var(--s, 56px); pointer-events: auto; cursor: pointer; padding: 0; border: 0; background: none;
  animation: clip-float var(--t, 7s) ease-in-out infinite; animation-delay: var(--dl, 0s); opacity: .95; }
.clip svg { width: 100%; height: 100%; overflow: visible; }
.clip:hover { filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
@keyframes clip-float { 0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); } 50% { transform: translateY(-12px) rotate(calc(var(--rot, 0deg) * -1)); } }
.clip.is-boing { animation: clip-boing .7s cubic-bezier(.34, 1.56, .64, 1); }
.clip-rocket.is-boing { animation: clip-launch 1.6s ease-in; }
.clip-gear svg, .clip-atom svg { animation: clip-spin 14s linear infinite; }
@keyframes clip-boing { 0% { transform: scale(1); } 30% { transform: scale(1.35, .75); } 60% { transform: scale(.85, 1.2) rotate(12deg); } 100% { transform: scale(1); } }
@keyframes clip-launch { 0% { transform: translateY(0); } 15% { transform: translateY(6px) rotate(-3deg); } 60% { transform: translateY(-120vh); opacity: 1; }
  61% { transform: translateY(40px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes clip-spin { to { transform: rotate(360deg); } }

/* positions: top/left as custom properties set inline; on phones keep only the first two */
.clip { top: var(--y, 10%); left: var(--x, 4%); }
@media (max-width: 640px) { .clip:nth-of-type(n+3) { display: none; } .clip { --s: 40px; } }
/* edge: in the padding above and below the content (clear of the band's wavy edges) */
.clipart.is-edge .clip { width: 44px; height: 44px; }
.clipart.is-edge .clip:nth-of-type(odd) { top: 50px; }
.clipart.is-edge .clip:nth-of-type(even) { top: auto; bottom: 50px; }

.no-motion .clip, .no-motion .clip svg, .no-motion .fun-star { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .clip, .clip svg, .fun-star, .pip-svg, .pip-svg * { animation: none !important; }
  .pip-dock .pip-btn, .pip-bubble { transition: none; }
}

/* ---------- 404 bug hunt ---------- */
.oops { max-width: 760px; margin: 0 auto; text-align: center; }
.oops-big { display: flex; align-items: center; justify-content: center; gap: 6px; font: 700 clamp(84px, 18vw, 150px)/1 Manrope, system-ui, sans-serif; color: rgb(var(--c-glow)); }
.oops-big .pip-svg { width: clamp(90px, 18vw, 150px); height: auto; animation: pip-bob 2.4s ease-in-out infinite; }
.oops-game { position: relative; height: 260px; margin-top: 26px; border-radius: var(--radius-xl); overflow: hidden;
  background: radial-gradient(circle at 20% 20%, rgb(var(--c-sun) / .18), transparent 40%), radial-gradient(circle at 80% 70%, rgb(var(--c-sky) / .18), transparent 45%), rgb(var(--c-card));
  border: 2px dashed rgb(var(--c-line)); }
.oops-game .fun-bug { position: absolute; }
.oops-score { position: absolute; top: 10px; left: 14px; z-index: 2; font: 800 14px/1 Inter, system-ui, sans-serif; color: rgb(var(--c-ink) / .7); }
.oops-win { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px; font: 700 26px/1.2 Manrope, system-ui, sans-serif; color: rgb(var(--c-ink)); }
.oops-game.is-won .oops-win { display: flex; }
.oops-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
