/* css.slopped.site exhibit: The emote wheel. From css/exhibits/wheel.mjs. */
.x-wheel .emotes { display: grid; justify-items: center; gap: 10px; }
.x-wheel .wheel { margin: 0; padding: 0; border: 0; display: grid; justify-items: center; gap: 14px; min-width: 0; }
.x-wheel .mv { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.x-wheel .spoke, .x-wheel .still { display: inline-flex; align-items: center; justify-content: center; min-width: 76px; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--paper); font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.x-wheel .spoke:hover, .x-wheel .still:hover { background: var(--acid); color: var(--on-acid); }
.x-wheel .mv:checked + label { background: var(--ink); color: var(--paper); }
.x-wheel .mv:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (forced-colors: active) { .x-wheel .mv:checked + label { forced-color-adjust: none; background: Highlight; color: HighlightText; } }
.x-wheel .now { margin: 0; color: var(--muted); font-weight: 700; }
.x-wheel .emotes:has(#mv-wave:checked) .now::before { content: "Dancing: Wave"; }
.x-wheel .emotes:has(#mv-bob:checked) .now::before { content: "Dancing: Bob"; }
.x-wheel .emotes:has(#mv-spin:checked) .now::before { content: "Dancing: Spin"; }
.x-wheel .emotes:has(#mv-robot:checked) .now::before { content: "Dancing: The robot"; }
.x-wheel .emotes:has(#mv-step:checked) .now::before { content: "Dancing: Side step"; }
.x-wheel .emotes:has(#mv-jump:checked) .now::before { content: "Dancing: Jump"; }
.x-wheel .emotes:has(#mv-up:checked) .now::before { content: "Dancing: Arms up"; }
.x-wheel .emotes:has(#mv-shuffle:checked) .now::before { content: "Dancing: Shuffle"; }
.x-wheel .emotes:has(#mv-still:checked) .now::before { content: "Standing still"; }

/* the robot: a head, a torso, two arms and two legs, each turning about its own joint */
.x-wheel .dancer { position: relative; width: 120px; height: 200px; transform-style: preserve-3d; }
.x-wheel .part { position: absolute; display: block; background: var(--ink); }
.x-wheel .head { left: 35px; top: 0; width: 50px; height: 42px; border-radius: 10px; background: radial-gradient(circle at 32% 52%, var(--acid) 0 5px, transparent 6px), radial-gradient(circle at 68% 52%, var(--acid) 0 5px, transparent 6px), var(--ink); }
.x-wheel .head::before { content: ""; position: absolute; left: 23px; top: -14px; width: 4px; height: 14px; background: var(--ink); }
.x-wheel .torso { left: 30px; top: 48px; width: 60px; height: 70px; border-radius: 10px 10px 6px 6px; }
.x-wheel .arm { top: 52px; width: 14px; height: 64px; border-radius: 7px; transform-origin: 50% 7px; }
.x-wheel .arm.l { left: 14px; rotate: 12deg; }
.x-wheel .arm.r { right: 14px; rotate: -12deg; }
.x-wheel .leg { top: 116px; width: 16px; height: 78px; border-radius: 8px; transform-origin: 50% 8px; }
.x-wheel .leg.l { left: 38px; }
.x-wheel .leg.r { right: 38px; }

/* key */
/* the ring: each spoke's angle from its index, and its place from cos() and sin() of it */
@supports (width: calc(1px * sin(30deg))) {
  /* an ellipse on narrow screens: wide as it can be, and as tall as it needs to keep the spokes apart */
  .x-wheel .ring { --rx: min(150px, 50vw - 96px); --ry: 150px; position: relative; width: calc(2 * var(--rx) + 100px); height: calc(2 * var(--ry) + 56px); display: grid; place-items: center; }
  .x-wheel .spoke {
    --a: calc(var(--i) * 45deg - 90deg);   /* the first spoke at twelve o'clock, then every 45 degrees */
    position: absolute; left: 50%; top: 50%;
    translate: calc(cos(var(--a)) * var(--rx) - 50%) calc(sin(var(--a)) * var(--ry) - 50%);
  }
}
/* without trigonometry: the spokes sit in a plain grid above the robot */
@supports not (width: calc(1px * sin(30deg))) {
  .x-wheel .ring { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 420px; }
  .x-wheel .dancer { flex-basis: 100%; margin: 20px auto 0; }
}

/* the picked dance: :has() on the wheel starts the right keyframes on the right limbs */
.x-wheel .emotes:has(#mv-wave:checked) .arm.r { animation: wave .6s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-bob:checked) .dancer { animation: bob .5s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-spin:checked) .dancer { animation: spin 1.6s linear infinite; }
.x-wheel .emotes:has(#mv-robot:checked) .arm.l { animation: robot-l 1s steps(1) infinite; }
.x-wheel .emotes:has(#mv-robot:checked) .arm.r { animation: robot-r 1s steps(1) infinite; }
.x-wheel .emotes:has(#mv-robot:checked) .head { animation: robot-head 1s steps(1) infinite; }
.x-wheel .emotes:has(#mv-step:checked) .dancer { animation: step 1s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-step:checked) .leg.l { animation: kick .5s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-step:checked) .leg.r { animation: kick .5s ease-in-out infinite alternate-reverse; }
.x-wheel .emotes:has(#mv-jump:checked) .dancer { animation: jump .7s cubic-bezier(.3, 0, .3, 1) infinite alternate; }
.x-wheel .emotes:has(#mv-jump:checked) .arm.l { animation: flap-l .7s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-jump:checked) .arm.r { animation: flap-r .7s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-up:checked) .arm.l { animation: up-l .5s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-up:checked) .arm.r { animation: up-r .5s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-up:checked) .dancer { animation: bob .5s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-shuffle:checked) .leg.l { animation: kick .25s ease-in-out infinite alternate; }
.x-wheel .emotes:has(#mv-shuffle:checked) .leg.r { animation: kick .25s ease-in-out infinite alternate-reverse; }
.x-wheel .emotes:has(#mv-shuffle:checked) .dancer { animation: step .5s ease-in-out infinite alternate; }

/* reduced motion: every dance is a held pose (its keyframes, paused part way through) */
@media (prefers-reduced-motion: reduce) {
  .x-wheel .part, .x-wheel .dancer { animation-play-state: paused !important; animation-delay: -.3s !important; }
}
/* /key */
@keyframes wave { from { rotate: -150deg; } to { rotate: -110deg; } }
@keyframes bob { from { translate: 0 0; } to { translate: 0 10px; } }
@keyframes spin { to { transform: rotateY(360deg); } }
@keyframes robot-l { 0% { rotate: 12deg; } 25% { rotate: 90deg; } 50% { rotate: 12deg; } 75% { rotate: 170deg; } }
@keyframes robot-r { 0% { rotate: -90deg; } 25% { rotate: -12deg; } 50% { rotate: -170deg; } 75% { rotate: -12deg; } }
@keyframes robot-head { 0%, 50% { rotate: -8deg; } 25%, 75% { rotate: 8deg; } }
@keyframes step { from { translate: -22px 0; } to { translate: 22px 0; } }
@keyframes kick { from { rotate: -14deg; } to { rotate: 14deg; } }
@keyframes jump { from { translate: 0 0; } to { translate: 0 -34px; } }
@keyframes flap-l { from { rotate: 20deg; } to { rotate: 120deg; } }
@keyframes flap-r { from { rotate: -20deg; } to { rotate: -120deg; } }
@keyframes up-l { from { rotate: 150deg; } to { rotate: 175deg; } }
@keyframes up-r { from { rotate: -150deg; } to { rotate: -175deg; } }

/* live support notes (built from css/exhibits.js) */
.sup-trig .sup-no { display: none; }
@supports not (width: calc(1px * sin(30deg))) { .sup-trig .sup-yes { display: none; } .sup-trig .sup-no { display: inline; } .sup-trig { --sup: var(--no); } }
.sup-has .sup-no { display: none; }
@supports not selector(:has(*)) { .sup-has .sup-yes { display: none; } .sup-has .sup-no { display: inline; } .sup-has { --sup: var(--no); } }
.sup-checkbox-hack .sup-no { display: none; }
@supports not selector(:checked) { .sup-checkbox-hack .sup-yes { display: none; } .sup-checkbox-hack .sup-no { display: inline; } .sup-checkbox-hack { --sup: var(--no); } }
