/*
 * Self-contained "jackmarshall" Easter egg.
 * Remove this file and its two includes in includes/layout.php to remove the feature.
 */

.jack-marshall-stage {
    position: fixed;
    inset: 0;
    z-index: 2147483635;
    overflow: hidden;
    pointer-events: none;
}

.jack-marshall-stage.is-leaving {
    opacity: 0;
    transition: opacity 260ms ease;
}

.jack-marshall-mascot {
    position: fixed;
    left: 0;
    top: 0;
    width: 54px;
    height: 54px;
    pointer-events: none;
    will-change: transform;
}

.jack-marshall-creature {
    --jack-facing: 1;
    position: absolute;
    inset: 2px 3px 4px;
    transform-origin: center bottom;
    transition: transform 120ms ease;
}

.jack-marshall-mascot.faces-left .jack-marshall-creature {
    --jack-facing: -1;
    transform: scaleX(-1);
}

.jack-marshall-mascot.is-running .jack-marshall-creature {
    animation: jack-marshall-run 260ms ease-in-out infinite alternate;
}

.jack-marshall-mascot.is-fleeing .jack-marshall-creature {
    animation-duration: 145ms;
}

.jack-marshall-mascot.is-sitting .jack-marshall-creature {
    transform: translateY(3px) scale(var(--jack-facing), .94);
}

.jack-marshall-body {
    position: absolute;
    left: 9px;
    top: 17px;
    width: 35px;
    height: 29px;
    border: 2px solid #1f163d;
    border-radius: 48% 48% 44% 44%;
    background: linear-gradient(145deg, #8f46ff, #4d248f);
    box-shadow: 0 5px 9px rgba(44, 25, 88, .24);
}

.jack-marshall-face {
    position: absolute;
    left: 12px;
    top: 8px;
    width: 31px;
    height: 28px;
    border: 2px solid #1f163d;
    border-radius: 48% 48% 52% 52%;
    background:
        radial-gradient(ellipse at 29% 45%, #322452 0 20%, transparent 22%),
        radial-gradient(ellipse at 71% 45%, #322452 0 20%, transparent 22%),
        #f8e7c8;
}

.jack-marshall-ear {
    position: absolute;
    top: 4px;
    z-index: -1;
    width: 15px;
    height: 16px;
    border: 2px solid #1f163d;
    background: #7140b7;
    transform: rotate(45deg);
}

.jack-marshall-ear::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #ff91c9;
}

.jack-marshall-ear-left {
    left: 9px;
    border-radius: 60% 12% 54% 30%;
}

.jack-marshall-ear-right {
    right: 7px;
    border-radius: 12% 60% 30% 54%;
}

.jack-marshall-eye {
    position: absolute;
    top: 11px;
    width: 5px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 -2px 0 #1f163d;
    transition: height 140ms ease, top 140ms ease;
}

.jack-marshall-eye-left {
    left: 7px;
}

.jack-marshall-eye-right {
    right: 7px;
}

.jack-marshall-nose {
    position: absolute;
    left: 50%;
    top: 18px;
    width: 7px;
    height: 5px;
    border-radius: 60% 60% 70% 70%;
    background: #1f163d;
    transform: translateX(-50%);
}

.jack-marshall-tail {
    position: absolute;
    right: -5px;
    top: 26px;
    z-index: -2;
    width: 23px;
    height: 11px;
    border: 2px solid #1f163d;
    border-radius: 80% 60% 70% 50%;
    background: repeating-linear-gradient(90deg, #4d248f 0 6px, #c799ff 6px 10px);
    transform: rotate(24deg);
    transform-origin: left center;
    animation: jack-marshall-tail 620ms ease-in-out infinite alternate;
}

.jack-marshall-foot {
    position: absolute;
    top: 42px;
    width: 13px;
    height: 7px;
    border: 2px solid #1f163d;
    border-radius: 50%;
    background: #f8e7c8;
}

.jack-marshall-foot-left {
    left: 10px;
}

.jack-marshall-foot-right {
    right: 7px;
}

.jack-marshall-mascot.is-sleeping .jack-marshall-eye {
    top: 15px;
    height: 2px;
    background: #1f163d;
}

.jack-marshall-sleep {
    position: absolute;
    right: -3px;
    top: -1px;
    color: #4d248f;
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 900;
    opacity: 0;
}

.jack-marshall-mascot.is-sleeping .jack-marshall-sleep {
    opacity: 1;
    animation: jack-marshall-sleep 1300ms ease-in-out infinite;
}

.jack-marshall-bubble {
    position: absolute;
    left: 34px;
    bottom: 44px;
    width: max-content;
    max-width: 190px;
    padding: 6px 9px;
    border: 1px solid rgba(44, 25, 88, .22);
    border-radius: 10px 10px 10px 2px;
    background: #fff;
    color: #2c1958;
    box-shadow: 0 8px 20px rgba(44, 25, 88, .18);
    font: 800 11px/1.25 Arial, sans-serif;
    opacity: 0;
    transform: translateY(5px) scale(.94);
    transition: opacity 150ms ease, transform 150ms ease;
}

.jack-marshall-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.jack-marshall-footprint {
    position: fixed;
    width: 7px;
    height: 10px;
    border-radius: 50% 50% 44% 44%;
    background: rgba(77, 36, 143, .36);
    transform: rotate(var(--jack-footprint-rotation, 0deg));
    animation: jack-marshall-footprint-fade 4200ms linear forwards;
}

.jack-marshall-footprint::before,
.jack-marshall-footprint::after {
    content: "";
    position: absolute;
    top: -3px;
    width: 3px;
    height: 4px;
    border-radius: 50%;
    background: inherit;
}

.jack-marshall-footprint::before {
    left: 0;
}

.jack-marshall-footprint::after {
    right: 0;
}

.jack-marshall-fake-cursor {
    position: absolute;
    left: 38px;
    top: 14px;
    width: 0;
    height: 0;
    border-top: 15px solid #111827;
    border-right: 9px solid transparent;
    filter: drop-shadow(1px 1px 0 #fff);
    opacity: 0;
    transform: rotate(-26deg);
    transition: opacity 100ms ease;
}

.jack-marshall-mascot.has-cursor .jack-marshall-fake-cursor {
    opacity: 1;
}

.jack-marshall-controls {
    position: fixed;
    right: 14px;
    bottom: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: min(420px, calc(100vw - 28px));
    padding: 8px 9px 8px 12px;
    border: 1px solid rgba(44, 25, 88, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: #2c1958;
    box-shadow: 0 12px 32px rgba(44, 25, 88, .18);
    font: 800 11px/1.25 Arial, sans-serif;
    pointer-events: auto;
}

.jack-marshall-close {
    min-height: 30px;
    padding: 5px 10px;
    border: 0;
    border-radius: 999px;
    background: #4d248f;
    color: #fff;
    font: 900 11px/1 Arial, sans-serif;
    cursor: pointer;
}

.jack-marshall-close:hover,
.jack-marshall-close:focus-visible {
    background: #2c1958;
}

.jack-marshall-shifted {
    position: relative;
    z-index: 7;
    transform:
        translate3d(var(--jack-shift-x, 0), var(--jack-shift-y, 0), 0)
        rotate(var(--jack-shift-rotation, 0deg)) !important;
    transition: transform 520ms cubic-bezier(.18, .89, .32, 1.28), opacity 220ms ease !important;
}

.jack-marshall-dragged-error {
    z-index: 20;
    opacity: .78 !important;
}

.jack-marshall-reordered {
    animation: jack-marshall-reordered 560ms ease;
}

body.jack-marshall-cursor-stolen,
body.jack-marshall-cursor-stolen * {
    cursor: none !important;
}

body.jack-marshall-cursor-stolen .jack-marshall-close {
    cursor: none !important;
}

@keyframes jack-marshall-run {
    from {
        transform: translateY(0) scaleX(var(--jack-facing)) rotate(-2deg);
    }
    to {
        transform: translateY(-4px) scaleX(var(--jack-facing)) rotate(2deg);
    }
}

@keyframes jack-marshall-tail {
    from {
        transform: rotate(12deg);
    }
    to {
        transform: rotate(34deg);
    }
}

@keyframes jack-marshall-sleep {
    0% {
        opacity: 0;
        transform: translate(0, 4px) scale(.8);
    }
    45% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(10px, -11px) scale(1.2);
    }
}

@keyframes jack-marshall-footprint-fade {
    0% {
        opacity: 0;
        transform: rotate(var(--jack-footprint-rotation, 0deg)) scale(.6);
    }
    12% {
        opacity: 1;
        transform: rotate(var(--jack-footprint-rotation, 0deg)) scale(1);
    }
    100% {
        opacity: 0;
    }
}

@keyframes jack-marshall-reordered {
    0%,
    100% {
        filter: none;
    }
    45% {
        filter: saturate(1.8) drop-shadow(0 0 8px rgba(143, 70, 255, .52));
    }
}

@media (max-width: 620px) {
    .jack-marshall-controls span {
        display: none;
    }
}
