/* Mingle, the FestFriends flamingo. Pairs with public/js/mingle.js and <x-mingle>. */
@font-face { font-family: 'Caveat'; font-style: normal; font-weight: 600 700; font-display: swap; src: url('../fonts/caveat/caveat-latin-variable.woff2') format('woff2'); }
/* Base layout has zero specificity so the page placing Mingle can position and size it freely. */
:where(.ff-mingle) { position: relative; display: inline-block; line-height: 0; }
.ff-mingle > svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ff-mingle[data-mingle-mode="hero"] > svg { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* A Mingle that walks on waits off stage until the script is ready; if the script never runs it still appears. */
.ff-mingle[data-mingle-entrance="walk"]:not(.is-ready) { opacity: 0; animation: ff-mingle-show 0s 2.5s forwards; }
@keyframes ff-mingle-show { to { opacity: 1; } }

/* Every moving part turns around its own joint, in artwork units. */
.ff-mingle :is(.facing, .whole, .ff-bob, .head-track, .ff-head, .side-head, .front-head, .front-eyes, .eye-mood, .ff-eye, .ff-pupil, .ff-wing, .cheek, .jaw, .lid, .shades, .tear, .sweat) { transform-box: view-box; }
.ff-mingle .facing { transform-origin: 46px 50px; transition: transform .28s cubic-bezier(.5, -.4, .5, 1.4); }
.ff-mingle .whole { transform-origin: 46px 98px; }
.ff-mingle .ff-bob { transform-origin: 46px 69px; animation: ff-mingle-bob 3.6s ease-in-out infinite; }
.ff-mingle .ff-glow { animation: ff-mingle-glow 2.4s ease-in-out infinite; }
.ff-mingle :is(.head-track, .ff-head) { transform-origin: 57px 25px; }
.ff-mingle .head-track { transition: transform .35s ease-out; }
.ff-mingle :is(.side-head, .front-head) { transform-origin: 58px 16px; }
.ff-mingle .front-head { transform: scaleX(0); }
.ff-mingle .front-eyes { transform-origin: 58px 13.4px; }
.ff-mingle :is(.eye-mood, .ff-eye) { transform-origin: 58.5px 14.2px; }
.ff-mingle .eye-mood { transition: transform .18s ease; }
.ff-mingle .ff-pupil { transform-origin: 59.5px 14.6px; transition: transform .2s ease; }
.ff-mingle .pupil-track { transition: transform .12s ease-out, opacity .15s; }
.ff-mingle .ff-wing { transform-origin: 56px 56px; }
.ff-mingle .cheek { transform-origin: 55.5px 20.5px; transition: fill-opacity .3s, transform .3s; }
.ff-mingle .jaw { transform-origin: 61.5px 15.5px; transition: transform .18s ease; }
.ff-mingle .lid { transform-origin: 58.5px 13.4px; transform: translateY(-8px); transition: transform .3s ease; }
.ff-mingle .eye-white { transition: fill .15s; }
.ff-mingle :is(.p-heart, .p-star, .p-spiral, .eye-arc, .eye-squeeze, .tear, .sweat) { opacity: 0; transition: opacity .15s; }
.ff-mingle .p-dot { transition: opacity .15s; }
.ff-mingle .shades { transform: translateY(-16px); opacity: 0; transition: transform .45s cubic-bezier(.3, 1.5, .5, 1), opacity .2s; }
@keyframes ff-mingle-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(.9px); } }
@keyframes ff-mingle-glow { 0%, 100% { opacity: .78; } 50% { opacity: 1; } }
@keyframes ff-mingle-hue { to { filter: hue-rotate(360deg); } }

/* Everyday moods */
.ff-mingle.is-pleased .eye-mood { transform: scaleY(.45) translateY(1.2px); }
.ff-mingle:is(.is-pleased, .is-happy, .is-love, .is-bliss, .is-party) .cheek { fill-opacity: 1; transform: scale(1.5); }
.ff-mingle.is-sleepy .eye-mood { transform: scaleY(.08); }
.ff-mingle.is-dancing .ff-glow { animation: ff-mingle-glow .5s ease-in-out infinite, ff-mingle-hue 3s linear infinite; }

/* Feelings */
.ff-mingle:is(.is-love, .is-excited) .p-dot, .ff-mingle.is-dizzy .ff-pupil { opacity: 0; }
.ff-mingle.is-love .p-heart, .ff-mingle.is-excited .p-star, .ff-mingle.is-dizzy .p-spiral { opacity: 1; }
.ff-mingle:is(.is-love, .is-excited) .ff-pupil { transform: scale(1.12); }
.ff-mingle:is(.is-happy, .is-wink, .is-cringe) .pupil-track { opacity: 0; }
.ff-mingle:is(.is-happy, .is-wink, .is-cringe) .eye-white { fill: #FF86B0; }
.ff-mingle:is(.is-happy, .is-wink) .eye-arc, .ff-mingle.is-cringe .eye-squeeze { opacity: 1; }
.ff-mingle.is-happy .jaw { transform: rotate(13deg); }
.ff-mingle.is-surprised .eye-mood { transform: scale(1.22); }
.ff-mingle.is-surprised .ff-pupil { transform: scale(.62); }
.ff-mingle.is-surprised .jaw { transform: rotate(16deg); }
.ff-mingle.is-grumpy .lid { transform: rotate(22deg) translateY(.2px); }
.ff-mingle.is-sad .lid { transform: rotate(-24deg) translateY(.6px); }
.ff-mingle.is-confused .lid { transform: rotate(-10deg) translateY(-.6px); }
.ff-mingle.is-eyeroll .lid { transform: translateY(-1.1px); transition-delay: .35s; }
.ff-mingle.is-bliss .lid { transform: translateY(.5px); }
.ff-mingle.is-party .lid { transform: rotate(-9deg) translateY(.9px); }
.ff-mingle.is-cool .shades { transform: none; opacity: 1; }

/* Speech bubble (used when Mingle has no note to speak through) */
.ff-mingle-bubble { position: absolute; left: 50%; bottom: calc(100% + 6px); z-index: 2; width: max-content; max-width: 220px; padding: 8px 14px 10px; border-radius: 18px; background: #ffffff; color: #2A1238; font: 700 22px/1.05 'Caveat', cursive; white-space: pre-line; text-align: center; box-shadow: 0 10px 26px #00000052; opacity: 0; transform: translateX(-50%) scale(.6); transform-origin: 50% 100%; transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1); pointer-events: none; }
.ff-mingle-bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; margin-left: -6px; border: 6px solid transparent; border-top: 10px solid #ffffff; }
.ff-mingle-bubble.is-shown { opacity: 1; transform: translateX(-50%) scale(1); }
[data-mingle-line] { white-space: pre-line; }
.ff-mingle[data-mingle-mode="tip"] > svg { cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* A tip's bubble is in the page already, so it reads even before the script runs. */
.ff-mingle-bubble[data-mingle-tip] { opacity: 1; transform: translateX(-50%); font-size: 20px; max-width: 210px; border: 2px solid #2A1238; box-shadow: 0 6px 0 #2A123826, 0 12px 22px #2A12381f; }
.ff-mingle-bubble[data-mingle-tip]::before { content: ""; position: absolute; left: 50%; bottom: -14px; margin-left: -8px; border: 8px solid transparent; border-top: 13px solid #2A1238; }
/* The bubble sits left of Mingle (facing left) with its pointer touching the beak tip. */
.ff-mingle[data-mingle-bubble="left"] .ff-mingle-bubble { left: auto; right: calc(83% + 9px); bottom: calc(76% - 18px); transform: none; transform-origin: 100% 100%; }
.ff-mingle[data-mingle-bubble="left"] .ff-mingle-bubble::after { left: auto; right: -11px; bottom: 8px; margin: 0; border: 7px solid transparent; border-left: 12px solid #ffffff; border-right: 0; }
.ff-mingle[data-mingle-bubble="left"] .ff-mingle-bubble[data-mingle-tip]::before { left: auto; right: -15px; bottom: 6px; margin: 0; border: 9px solid transparent; border-left: 14px solid #2A1238; border-right: 0; }
.ff-mingle-tip-art .ff-flamingo { filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(0 8px 12px #2A123833); }
.is-mingle-speaking { animation: ff-mingle-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ff-mingle-pop { from { opacity: .3; scale: .92; } }

/* Floating hearts, notes, sparkles, z's and confetti */
.ff-mingle-float { position: absolute; z-index: 2; pointer-events: none; font: 700 22px/1 'Caveat', cursive; color: #FF5C93; animation: ff-mingle-rise 1.4s ease-out forwards; }
.ff-mingle-float.z { color: #cfc2ff; font-size: 26px; animation-duration: 2.6s; }
.ff-mingle-float.spark { color: #F5B82E; }
.ff-mingle-float.bang { color: #F5B82E; font: 900 36px/1 system-ui, sans-serif; }
.ff-mingle-float.q { color: #4FE3F0; font: 900 30px/1 system-ui, sans-serif; }
.ff-mingle-float.note { color: #4FE3F0; font: 700 24px/1 system-ui, sans-serif; }
.ff-mingle-float.hic { color: #ffd6e6; font-size: 20px; }
.ff-mingle-float.puff { width: 10px; height: 10px; border-radius: 50%; background: #d9cfe3; animation-duration: 1.6s; }
@keyframes ff-mingle-rise { from { opacity: 0; transform: translate(0, 0) scale(.6); } 15% { opacity: 1; } to { opacity: 0; transform: translate(var(--dx, 10px), -80px) scale(1.15); } }
.ff-mingle-confetti { position: absolute; top: -12px; z-index: 3; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: ff-mingle-fall linear forwards; }
@keyframes ff-mingle-fall { to { transform: translate(var(--dx), 560px) rotate(var(--rot)); opacity: .9; } }

/* Mingle around the site: a row with copy on the left and Mingle explaining on the right. */
.ff-mingle-host { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; }
.ff-mingle-host-copy { min-width: 0; flex: 1 1 auto; }
.ff-mingle-spot { flex: 0 0 auto; width: 112px; height: 151px; margin: 2.75rem 1rem 0 0; }
.ff-festival-plan.has-mingle { position: relative; }
.ff-festival-plan.has-mingle .ff-festival-plan-title { min-height: 3.4rem; }
.ff-festival-plan-mingle { position: absolute; right: 1.5rem; top: -2.6rem; width: 92px; height: 124px; }
@media (max-width: 640px) {
    .ff-mingle-host { flex-direction: column; align-items: flex-end; }
    .ff-mingle-host-copy { align-self: stretch; }
    .ff-mingle-spot { width: 88px; height: 119px; margin: 3rem 0.5rem 0 0; }
    .ff-festival-plan.has-mingle .ff-festival-plan-title { min-height: 0; padding-top: 5.8rem; }
    .ff-festival-plan-mingle { right: .75rem; top: 2.4rem; width: 80px; height: 108px; }
    .ff-mingle-bubble[data-mingle-tip] { font-size: 17px; max-width: 200px; }
}

/* A celebration: Mingle walks into the bottom corner of the screen, parties, and walks off. */
.ff-mingle-party { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; transition: opacity .35s; }
.ff-mingle-party.is-leaving { opacity: 0; }
.ff-mingle-party .ff-mingle { position: absolute; right: max(28px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); width: 132px; height: 178px; pointer-events: auto; }
.ff-mingle-party .ff-mingle:not(.is-ready) { visibility: hidden; }
.ff-mingle-party .ff-mingle-bubble[data-mingle-tip] { opacity: 0; transition: opacity .25s; }
.ff-mingle-party .ff-mingle.has-arrived .ff-mingle-bubble[data-mingle-tip] { opacity: 1; }
@media (max-width: 640px) { .ff-mingle-party .ff-mingle { right: 12px; width: 100px; height: 135px; } }

@media (prefers-reduced-motion: reduce) {
    .ff-mingle *, .is-mingle-speaking { animation: none !important; }
}

/* Seasonal looks: hats ride on the head, so they tilt, bob and dance with it. */
.ff-mingle .outfit-drop { transform-box: fill-box; transform-origin: 50% 0; animation: ff-mingle-drip 2.8s ease-in infinite; }
@keyframes ff-mingle-drip { 0%, 55% { opacity: 0; translate: 0 -2px; } 65% { opacity: 1; } 100% { opacity: 0; translate: 0 9px; } }
.ff-weather-mingle { align-self: flex-end; }
@media (prefers-reduced-motion: reduce) { .ff-mingle .outfit-drop { animation: none; opacity: 0; } }
.ff-packing-mingle { align-items: center; }
.ff-packing-mingle .ff-mingle-spot { width: 96px; height: 130px; margin-top: 2.25rem; }
/* On phones the host stacks; Mingle must stay at the right edge so its left-hand bubble has room (centered, the bubble ran off the card). */
@media (max-width: 640px) {
    .ff-packing-mingle { align-items: flex-end; }
    /* Too narrow for a side bubble: speak from above the head, tail pointing down at Mingle. */
    .ff-packing-mingle .ff-mingle-spot { margin-top: 5.5rem; }
    .ff-packing-mingle .ff-mingle[data-mingle-bubble="left"] .ff-mingle-bubble { right: 28%; bottom: calc(100% + 2px); transform-origin: 85% 100%; }
    .ff-packing-mingle .ff-mingle[data-mingle-bubble="left"] .ff-mingle-bubble::after { right: 16px; bottom: -10px; border: 6px solid transparent; border-top: 10px solid #ffffff; border-bottom: 0; }
    .ff-packing-mingle .ff-mingle[data-mingle-bubble="left"] .ff-mingle-bubble[data-mingle-tip]::before { right: 14px; bottom: -14px; border: 8px solid transparent; border-top: 13px solid #2A1238; border-bottom: 0; }
}
