/* The Works' yard (js/works/works-yard*.js): the baked pieces laid on the plan's base, each in its own layer by depth;
   the brass signs with a potion-green tab for a crew's boost; the delivery trucks (painted by masks in the company's
   colours); the Move crews mode's outlines (cyan, the machine), channelled supply beams (potion green, magic and boosts)
   and riveted iron plates in the workshop style. Every button at least 40px; the stage scales with its width. */
.wkyard { border: 3px solid var(--wk-ink, #0a0612); border-radius: 12px; overflow: hidden; background: #05070e; min-height: 120px; }
.ystage { position: relative; width: 100%; aspect-ratio: var(--ya); container-type: inline-size; overflow: hidden; isolation: isolate; z-index: 0; }
.ystage > *, .ystage .ylay > * { position: absolute; display: block; }
.ystage .ylay, .ystage .yover { inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ystage .ybase { inset: 0; width: 100%; height: 100%; }
.ystage img { max-width: none; }
.ystage style { display: none !important; }
.ystage [hidden] { display: none; }
.ystage .ya, .ystage .yw { overflow: hidden; }
.ystage .ya img, .ystage .yw i { position: absolute; left: 0; top: 0; height: 100%; animation: wkrun 1s infinite; will-change: transform; }
.ystage .yw i { background-size: 100% 100%; }
@keyframes wkrun { to { transform: translateX(-100%); } }

/* the trucks: a stage-sized box moved along its run, the sprite at its anchor, the strip of headings stepped inside */
.ystage .ytrucks > .yt { inset: 0; width: 100%; height: 100%; will-change: transform; }
.ystage .ytb { position: absolute; overflow: hidden; animation: ytbob 0.45s ease-in-out infinite alternate; }
.ystage .yts { position: absolute; left: 0; top: 0; width: 1600%; height: 100%; isolation: isolate; }
.ystage .yts > img, .ystage .yts > i { position: absolute; inset: 0; width: 100%; height: 100%; }
.ystage .yts > i { -webkit-mask-size: 100% 100%; mask-size: 100% 100%; mix-blend-mode: multiply; }
@keyframes ytbob { to { translate: 0 -3%; } }

/* a crew's brass sign: its headcount, a lamp per milestone, and what its neighbours add */
.ysign { position: absolute; width: 0; height: 0; z-index: 300; font-size: calc(clamp(6.5px, 1.15cqw, 12px) * var(--yk, 1)); }
@container (max-width: 520px) { .ysign { font-size: calc(5.4px * var(--yk, 1)); } .ysign .pips { display: none; } .ysign .plate { min-width: 0; padding: 0.34em 0.55em 0.4em; } }
.ysign::before { content: ""; position: absolute; left: -0.35em; top: -0.55em; width: 0.8em; height: 1.1em; background: #1e1e24; border-radius: 0.2em; box-shadow: 0 0 0 0.14em #0a0612; }
.ysign .arm { position: absolute; left: 0; top: -0.2em; width: 3.4em; height: 0.36em; background: #2a2a32; border-radius: 0.2em; box-shadow: 0 0 0 0.14em #0a0612; }
.ysign .arm::after { content: ""; position: absolute; right: -0.3em; top: -0.22em; width: 0.62em; height: 0.62em; border-radius: 50%; background: #c8902a; box-shadow: 0 0 0 0.14em #0a0612; }
.ysign .plate { position: absolute; left: 3.25em; top: 1.1em; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 0.28em; padding: 0.38em 0.7em 0.42em; min-width: 3.6em;
  background: linear-gradient(#f6cf6a, #c8902a 58%, #94600f); border: 0.16em solid #0a0612; border-radius: 0.55em; box-shadow: inset 0 0.14em 0 rgba(255, 255, 255, 0.55), 0 0.26em 0 #0a0612, 0 0.4em 0.9em rgba(0, 0, 0, 0.5); color: #2a1606; }
.ysign b { font: 400 1.55em/1 Rye, Georgia, serif; }
.ysign .pips { display: flex; gap: 0.22em; }
.ysign .pips i { width: 0.5em; height: 0.5em; border-radius: 50%; background: #4a3010; box-shadow: inset 0 0.08em 0.1em rgba(0, 0, 0, 0.6), 0 0 0 0.1em #0a0612; }
.ysign .pips i.on { background: radial-gradient(circle at 40% 35%, #fff4c0, #ffb02a 60%, #c86a0a); box-shadow: 0 0 0 0.1em #0a0612, 0 0 0.5em 0.1em rgba(255, 154, 42, 0.85); }
.ysign .boost { margin-top: 0.1em; padding: 0.22em 0.55em 0.24em; font: 800 1.15em/1 var(--f-ui); white-space: nowrap; color: var(--wk-potion, #7aff2a); background: var(--wk-deep, #15181e);
  border: 0.16em solid #0a0612; border-radius: 0.4em; text-shadow: 0 0 0.5em rgba(122, 255, 42, 0.65); box-shadow: 0 0 0.6em rgba(122, 255, 42, 0.4); }

/* the header: the Move crews switch and what to do */
.wkmovebtn { margin-right: auto; min-height: 40px; padding: 0 14px; border: 3px solid var(--wk-ink, #0a0612); border-radius: 10px; cursor: pointer; touch-action: manipulation;
  font: 800 12.5px/1 var(--f-ui); letter-spacing: 0.06em; text-transform: uppercase; color: #3a2206; background: linear-gradient(#ffd56a, #c8902a); box-shadow: var(--wk-drop-sm); }
.wkmovebtn.on { color: #06222a; background: linear-gradient(#7af0ff, #2ab0d0); }
.wkyardhint { margin: 0; font: 600 12.5px var(--f-ui); color: #bfe9f4; }

/* the plots' buttons: the pad and the hall above it, nearer plots on top; a focused one gets the cyan frame (drawn in the svg) */
.ystage .yhits { z-index: 360; pointer-events: none; }
.ystage .yhit { pointer-events: auto; padding: 0; border: 0; background: transparent; cursor: pointer; touch-action: manipulation; }
.ystage .yhit:focus { outline: none; }
.ystage .yhit:focus-visible { background: rgba(42, 224, 255, 0.16); }
.ystage .yover { z-index: 340; }
.ystage .yplates { z-index: 350; }
.yo-pick { fill: rgba(42, 224, 255, 0.15); stroke: var(--wk-cyan, #2ae0ff); stroke-width: 6; stroke-linejoin: round; filter: drop-shadow(0 0 8px #2ae0ff); }
.yo-drop, .yo-can { fill: rgba(42, 224, 255, 0.05); stroke: rgba(42, 224, 255, 0.7); stroke-width: 3; stroke-dasharray: 14 9; stroke-linejoin: round; }
.yo-can { stroke: rgba(42, 224, 255, 0.45); }
.yo-look { fill: rgba(42, 224, 255, 0.1); stroke: var(--wk-cyan, #2ae0ff); stroke-width: 4; stroke-linejoin: round; }

/* a supply link: a glowing beam, two strands braided round it, motes running down it, an orb pulsing over the supplier */
.yb-glow { fill: none; stroke: #7aff2a; stroke-width: 26; stroke-opacity: 0.35; stroke-linecap: round; }
.yb-strand { fill: none; stroke: #b8ff7a; stroke-width: 3; stroke-opacity: 0.9; stroke-linecap: round; stroke-dasharray: 22 10; animation: ybflow 1.2s linear infinite; }
.yb-core { fill: none; stroke: #f4ffe0; stroke-width: 4; stroke-linecap: round; }
.yb-motes { fill: none; stroke: #f4ffe0; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 0 46; animation: ybmotes 1.1s linear infinite; }
.yb-orb { transform-box: fill-box; transform-origin: center; animation: ybpulse 1.4s ease-in-out infinite alternate; }
.yb-aura { fill: #7aff2a; fill-opacity: 0.16; stroke: #7aff2a; stroke-opacity: 0.8; stroke-width: 3; animation: ybaura 1.6s ease-in-out infinite alternate; }
.yb-spark { fill: #e8ffc8; animation: ybspark 1.6s linear infinite; }
@keyframes ybflow { to { stroke-dashoffset: -32; } }
@keyframes ybmotes { to { stroke-dashoffset: -46; } }
@keyframes ybpulse { from { transform: scale(0.85); } to { transform: scale(1.15); } }
@keyframes ybaura { from { fill-opacity: 0.1; } to { fill-opacity: 0.24; } }
@keyframes ybspark { from { transform: translateY(0); opacity: 0.9; } to { transform: translateY(-90px); opacity: 0; } }

/* the plates: riveted iron in the workshop style, Rye numbers, brass labels (a 0-size spot holds each one) */
.yplate { position: absolute; width: 0; height: 0; font-size: clamp(7px, 1.2cqw, 13px); }
.yplate .plt { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); padding: 0.55em 1em 0.6em; border: 3px solid var(--wk-ink, #0a0612); border-radius: 10px;
  background: var(--wk-plate, #2a2e36); box-shadow: var(--wk-drop); color: var(--wk-paper, #f0ece0); text-align: center; white-space: nowrap; }
.yplate .plt.ytag { transform: translate(-50%, 0.9em); }
.yplate .plt.ychip { padding: 0.35em 0.7em 0.3em; border-width: 2px; border-radius: 8px; box-shadow: var(--wk-drop-sm); }
.yplate .plt.ychip b { font-size: 1.35em; }
.yplate .plt.ychip::before, .yplate .plt.ychip::after { content: none; }
.yplate.on { z-index: 2; } .yplate.on .plt.ychip { padding: 0.55em 1em 0.6em; border-width: 3px; box-shadow: var(--wk-drop), 0 0 0 3px var(--wk-cyan, #2ae0ff); }
.yplate.on .plt.ychip b { font-size: 1.9em; }
.yplate .plt::before, .yplate .plt::after { content: ""; position: absolute; top: 0.35em; width: 0.42em; height: 0.42em; border-radius: 50%; background: #c8902a; box-shadow: 0 0 0 2px #0a0612; }
.yplate .plt::before { left: 0.45em; } .yplate .plt::after { right: 0.45em; }
.yplate small, .yplate b, .yplate span { display: block; }
.yplate small { font: 800 0.8em/1.2 var(--f-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--wk-brass, #f2b632); }
.yplate b { font: 400 1.9em/1.05 Rye, Georgia, serif; color: var(--wk-potion, #7aff2a); text-shadow: 0 0 10px rgba(122, 255, 42, 0.55), 2px 2px 0 #0a0612; }
.yplate span { font: 500 0.95em/1.25 var(--f-ui); }
.yplate .down b, .yplate .no b { color: #8a8e94; text-shadow: 2px 2px 0 #0a0612; }
.ymoving .yhit { cursor: grab; }

/* the halls with no room on the plan, waiting while crews are moved */
.ywait { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.ywait[hidden] { display: none; }
.ywaitb { min-height: 44px; padding: 0 12px; border: 3px solid var(--wk-ink, #0a0612); border-radius: 10px; cursor: pointer; font: 800 12px var(--f-ui); color: var(--wk-paper, #f0ece0); background: var(--wk-plate, #2a2e36); box-shadow: var(--wk-drop-sm); }
.ywaitb.held { color: #06222a; background: linear-gradient(#7af0ff, #2ab0d0); }

@media (prefers-reduced-motion: reduce) { .ystage .ya img, .ystage .yw i, .ystage .yt, .ystage .ytb, .ystage .yts, .yb-strand, .yb-motes, .yb-orb, .yb-aura, .yb-spark { animation: none !important; } }
/* moving crews: the yard dims under the outlines and plates, and the signs make way for them */
.ystage.ymoving::after { content: ""; position: absolute; inset: 0; z-index: 330; background: rgba(5, 7, 14, 0.32); pointer-events: none; }
.ystage.ymoving .ysigns { display: none; }
