/* THE CREW (components/Crew.tsx), shared by the app (imported by Crew.tsx) and the public
   site's exam pages (landing/student/build.mjs copies it). Each product sets the five
   `--crew-*` values from its own tokens and draws the bubble in its own hand; this file is
   only the characters. Ink line on the page's white, the state's colour on the
   hat's trim and each member's own touch of it. At rest they roll with the water and
   blink; when they start saying something they tip the hat, talk and wave; on hover of
   what they are saying they wink and tip again. Reduced motion leaves each part on its
   declared value: hand hidden, wings folded, mouth shut, eyes open. */
.crew { display: block; flex: none; overflow: visible; }
/* The hand and the tails face the bubble in either direction. */
[dir="rtl"] .crew { scale: -1 1; }
.crew-body { transform-origin: 50% 100%; transform-box: fill-box; animation: crew-bob 5.5s ease-in-out infinite; }
.crew-line, .crew-stache { fill: none; stroke: var(--crew-ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.crew-stache { stroke-width: 1.9; }
.crew-face { fill: var(--crew-paper); stroke: var(--crew-ink); stroke-width: 1.5; }
.crew-tone { fill: currentColor; stroke: var(--crew-ink); stroke-width: 1.1; stroke-linejoin: round; }
.crew-dark { fill: var(--crew-ink); stroke: var(--crew-ink); stroke-width: 1.2; stroke-linejoin: round; }
.crew-cockade { fill: var(--crew-paper); stroke: var(--crew-ink); stroke-width: .8; }
.crew-trim { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.crew-hoop { fill: none; stroke: currentColor; stroke-width: 1.3; }
/* The captain's skull and crossbones, in paper on the dark hat. */
.crew-bones { stroke: var(--crew-paper); }
.crew-hand {
  fill: var(--crew-paper); stroke: var(--crew-ink); stroke-width: 1.3; stroke-linejoin: round;
  transform-box: fill-box; transform-origin: 30% 100%; opacity: 0;
  animation: crew-wave 1.3s .1s ease-in-out;
}
/* The parrot's two wings are part of the bird: always there. They flap three times as it
   starts speaking, flutter once every few seconds after, and give a quick greeting on hover. Its warm
   crest and beak, pale belly, blush and eye glints are what make it read as a cheerful bird rather
   than a dark owl. */
.crew-wing {
  fill: currentColor; stroke: var(--crew-ink); stroke-width: 1.1; stroke-linejoin: round;
  transform-box: fill-box; animation: crew-flap 1.2s .1s ease-in-out, crew-flutter 7s 2.4s ease-in-out infinite;
}
.crew-wing-l { transform-origin: 100% 8%; }
.crew-wing-r { transform-origin: 0 8%; --flap: -1; }
/* Its own name, so hover starts it: a finished `crew-flap` named again does not replay. */
:is(.vy-say, .crew-say, .crew-peek):hover .crew-wing { animation: crew-greet .7s ease-in-out; }
/* Inky's raised tentacle and Pinch's raised claw are always there, like the parrot's wings:
   each waves as they start speaking and again on hover, pivoting where it leaves the body. */
.crew-arm {
  fill: currentColor; stroke: var(--crew-ink); stroke-width: 1.1; stroke-linejoin: round;
  transform-box: fill-box; transform-origin: 0 100%; --flap: -.7;
  animation: crew-flap 1.2s .1s ease-in-out, crew-flutter 6s 2.8s ease-in-out infinite;
}
:is(.vy-say, .crew-say, .crew-peek):hover .crew-arm { animation: crew-greet .7s ease-in-out; }
.crew-spot { fill: var(--crew-paper); opacity: .35; }
/* Pinch's claw is drawn as the left one mirrored, so its joint is its box's right foot. */
.crew-pinch .crew-arm { transform-origin: 100% 100%; }
.crew-crest, .crew-beak { fill: var(--crew-warm); stroke: var(--crew-ink); stroke-width: 1.1; stroke-linejoin: round; }
.crew-belly { fill: var(--crew-pale); stroke: var(--crew-ink); stroke-width: 1.1; }
.crew-blush { fill: var(--crew-warm); opacity: .5; }
.crew-glint { fill: var(--crew-paper); }
.crew-eye, .crew-mouth { fill: var(--crew-ink); transform-box: fill-box; transform-origin: center; }
.crew-eye { animation: crew-blink 4.8s infinite; }
.crew-mouth { transform: scaleY(0); animation: crew-talk 1.1s .15s ease-in-out; }
.crew-brow { transform-box: fill-box; transform-origin: center; animation: crew-brow 1.1s .15s ease-in-out; }
.crew-hat { transform-box: fill-box; transform-origin: 20% 100%; animation: crew-tip .9s .25s var(--crew-ease); }
:is(.vy-say, .crew-say, .crew-peek):hover .crew-hat { animation: crew-tip .9s var(--crew-ease); }
:is(.vy-say, .crew-say, .crew-peek):hover .crew-eye-l { animation: crew-wink .6s; }
@keyframes crew-blink { 0%, 95%, 100% { transform: none; } 97.5% { transform: scaleY(.12); } }
@keyframes crew-wink { 0%, 100% { transform: none; } 25%, 70% { transform: scaleY(.12); } }
@keyframes crew-talk {
  0%, 100% { transform: scaleY(0); } 15%, 45%, 75% { transform: scaleY(1); }
  30%, 60% { transform: scaleY(.25); }
}
@keyframes crew-wave {
  0% { opacity: 0; transform: translateY(4px); } 12%, 88% { opacity: 1; }
  12%, 44%, 76% { transform: rotate(-14deg); } 28%, 60% { transform: rotate(10deg); }
  100% { opacity: 0; transform: translateY(4px); }
}
@keyframes crew-flap {
  0%, 100% { transform: none; }
  16%, 50%, 84% { transform: rotate(calc(var(--flap, 1) * 34deg)); }
  33%, 67% { transform: rotate(calc(var(--flap, 1) * 6deg)); }
}
@keyframes crew-greet {
  0%, 100% { transform: none; } 25%, 75% { transform: rotate(calc(var(--flap, 1) * 28deg)); }
  50% { transform: rotate(calc(var(--flap, 1) * 8deg)); }
}
@keyframes crew-flutter {
  0%, 88%, 100% { transform: none; }
  91%, 97% { transform: rotate(calc(var(--flap, 1) * 24deg)); }
  94% { transform: rotate(calc(var(--flap, 1) * 4deg)); }
}
@keyframes crew-brow { 0%, 100% { transform: none; } 20%, 70% { transform: translateY(-1.2px); } }
@keyframes crew-tip {
  0%, 100% { transform: none; } 35%, 65% { transform: translateY(-2px) rotate(-8deg); }
}
@keyframes crew-bob {
  0%, 100% { transform: translateY(0) rotate(-1.4deg); }
  50% { transform: translateY(-1.6px) rotate(1.4deg); }
}
@media (prefers-reduced-motion: reduce) {
  .crew * { animation: none !important; }
}
