/* The Animal Maker (MAKERS-PLAN.md). Shared layout comes from potions.css and
   kitchen.css, the big button from zaplab.css, the bin from studio.css and the
   machines' look from machineshop.css; this file is only the glasshouse's own. */

#animallab { --am-wall: #4f4686; }

/* ---------------------------------------------------------------- the room */

.am-vine { fill: none; stroke: #2f6b4a; stroke-width: 6; stroke-linecap: round; }
.am-leaf { fill: #4fa86e; }
.am-firefly { fill: #fff3a8; animation: zap-blink 2.6s ease-in-out infinite; filter: drop-shadow(0 0 6px #fff3a8); }
.am-moss { fill: #3f7a52; opacity: 0.85; }
.am-moss-rim { fill: none; stroke: #b7f0c4; stroke-width: 3; stroke-dasharray: 6 8; }

#animallab .creature-slot { width: 28%; }

/* --------------------------------------------------------------- the benches */

.bench-am-songs {
  --bench-edge: #ffc46b;
  background: linear-gradient(180deg, #5a4630, #33261c);
  box-shadow: 0 12px 30px rgba(7, 4, 15, 0.55), inset 0 0 0 3px var(--bench-edge);
}
.bench-am-machines {
  --bench-edge: #e28ccf;
  background: linear-gradient(180deg, #6a3c5e, #3a2040);
  box-shadow: 0 12px 30px rgba(7, 4, 15, 0.55), inset 0 0 0 3px var(--bench-edge);
}
.bench-am-songs, .bench-am-machines { position: relative; }
/* Her songs run to sixty: the bench scrolls, and keeps clear of the back button and
   the room's name above it. */
.bench-am-songs { max-height: calc(100% - 168px); }
.am-song { background: linear-gradient(180deg, #3b2a66, #241847); border-color: rgba(255, 196, 107, 0.5); }
.am-song img { width: 78%; height: 78%; }
.am-machine { background: linear-gradient(180deg, #8a5a86, #5a3460); border-color: rgba(255, 196, 234, 0.5); }
.am-machine svg { width: 92%; height: 92%; pointer-events: none; }
.am-song[aria-pressed="true"], .am-machine[aria-pressed="true"] {
  border-color: #ffffff; box-shadow: 0 0 0 3px #ffffff, 0 0 16px rgba(255, 226, 168, 0.8);
}

/* ---------------------------------------------------------------- the jar */

.am-jar {
  position: absolute; aspect-ratio: 300 / 340; transform: translate(-50%, -100%);
  pointer-events: auto;
}
.am-jar > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible;
  filter: drop-shadow(0 10px 12px rgba(7, 4, 15, 0.55)); }
.am-jar.bump > svg { animation: bowl-bump 0.35s cubic-bezier(.3, 1.5, .5, 1); }
.am-jar.over > svg, .am-jar.can-drop > svg { filter: drop-shadow(0 0 18px rgba(201, 182, 255, 0.95)); }

.am-stand { fill: #8a5a3c; stroke: #4a2e1f; stroke-width: 4; }
.am-stand-top { fill: #a8714c; stroke: #4a2e1f; stroke-width: 4; }
.am-glass { fill: rgba(220, 230, 255, 0.14); stroke: rgba(240, 245, 255, 0.75); stroke-width: 5; }
.am-knob-neck { fill: #c9c2e8; }
.am-knob { fill: #e9e4ff; stroke: rgba(42, 29, 72, 0.6); stroke-width: 3; }
.am-shine { fill: none; stroke: rgba(255, 255, 255, 0.5); stroke-width: 7; stroke-linecap: round; }

/* what is in the jar, floating: the song on the left, the machine on the right */
.in-jar { position: absolute; top: 40%; aspect-ratio: 1; pointer-events: none;
  filter: drop-shadow(0 4px 4px rgba(7, 4, 15, 0.4)); animation: dome-float 2.4s ease-in-out infinite; }
.in-jar[hidden] { display: none; }
.jar-song { left: 22%; width: 26%; }
.jar-machine { left: 50%; width: 32%; top: 36%; animation-delay: -1.2s; }
.jar-machine svg { width: 100%; height: 100%; }

.am-button { top: 87%; width: max(22%, 48px); }

/* Brewing: the jar glows and sways, and the two inside spin into one. */
.am-jar.brewing > svg { animation: am-sway 0.55s ease-in-out infinite; filter: drop-shadow(0 0 24px rgba(201, 182, 255, 0.95)); }
.am-jar.brewing .am-glass { fill: rgba(201, 182, 255, 0.35); }
.am-jar.brewing .in-jar { animation: am-swirl 2s ease-in forwards; }
@keyframes am-sway { 25% { rotate: -1.2deg; } 75% { rotate: 1.2deg; } }
@keyframes am-swirl { to { left: 37%; top: 40%; rotate: 540deg; scale: 0.2; opacity: 0; } }

/* -------------------------------------------------------------- the animal */

.result-box-am {
  background: radial-gradient(ellipse at 50% 45%, #4f4686, #241c4a 72%);
  box-shadow: inset 0 0 0 3px rgba(201, 182, 255, 0.55), 0 10px 24px rgba(7, 4, 15, 0.45);
}
.dish.made-animal { width: 15%; filter: drop-shadow(0 10px 10px rgba(7, 4, 15, 0.5)) drop-shadow(0 0 18px rgba(201, 182, 255, 0.55)); }
.am-pic { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* dancing: a hop on every beat of the song, leaning one way and then the other */
.dish.made-animal.dancing .am-pic { animation: am-dance calc(var(--beat, 0.545s) * 2) ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes am-dance {
  0%, 50%, 100% { translate: 0 0; scale: 1.06 0.94; }
  25% { translate: 0 -14%; rotate: -8deg; scale: 0.96 1.06; }
  75% { translate: 0 -14%; rotate: 8deg; scale: 0.96 1.06; }
}

/* Tall and narrow: the room keeps the scene's own height and the benches share what is
   left beneath it, scrolling, as in the Beat Lab; left to size themselves, sixty songs
   squeezed the room to a strip. */
@media (max-aspect-ratio: 5/6) {
  #animallab { grid-template-rows: min(66.667vw, 62%) minmax(0, 1fr); }
  .bench-am-songs { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  .am-firefly, .in-jar, .am-jar.brewing > svg, .dish.made-animal.dancing .am-pic { animation: none; }
}
