/* Pit Stop print bay: printer reward animation + ship customiser. Orange is reserved for the Done button. */

.ps-print {
  --t0: .15s;
  --row: .12s;
  --pop: calc(var(--t0) + var(--row) * 8 + .02s);
  --gy0: 110px;
  --gy1: 240px;
  --cx0: 98px;
  --cx1: 202px;
  position: relative;
  display: block;
  width: min(100%, 360px);
  margin: 0 auto;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Patrick Hand', 'Segoe Print', cursive;
}
.ps-print.ps-print-paint { --gy0: 104px; --gy1: 208px; --cx0: 68px; --cx1: 116px; }
.ps-print:focus-visible { outline: 3px dashed #4a8fe0; outline-offset: 4px; border-radius: 22px; }
.ps-print-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ps-print-title { font: 15px 'Patrick Hand', 'Segoe Print', cursive; letter-spacing: .12em; fill: #fffdf8; }
.ps-print-swatch-name { font: 15px 'Patrick Hand', 'Segoe Print', cursive; fill: #2b2b2b; }
.ps-print-label-text { font: 22px 'Patrick Hand', 'Segoe Print', cursive; letter-spacing: .06em; fill: #2b2b2b; }

.ps-print-gantry { animation: ps-print-gy calc(var(--row) * 8) steps(8, end) var(--t0) both; }
.ps-print-carriage { animation: ps-print-cx var(--row) ease-in-out var(--t0) 8 alternate both; }
.ps-print-park { animation: ps-print-park .22s ease-in calc(var(--t0) + var(--row) * 8 + .01s) both; }
.ps-print-spark { transform-box: fill-box; transform-origin: 50% 0; animation: ps-print-flick .09s steps(2) var(--t0) 12 both; }
.ps-print-cover { transform-box: fill-box; transform-origin: 50% 100%; animation: ps-print-cover calc(var(--row) * 8) steps(8, end) var(--t0) both; }
.ps-print-fill { transform-box: fill-box; transform-origin: 50% 0; animation: ps-print-fill calc(var(--row) * 8) steps(8, end) var(--t0) both; }
.ps-print-foot { animation: ps-print-fade-out .15s linear calc(var(--t0) + var(--row) * 8) both; }
.ps-print-art { transform-box: fill-box; transform-origin: 50% 100%; animation: ps-print-pop .5s cubic-bezier(.3, 1.3, .5, 1) var(--pop) both; }
.ps-print-hop { transform-box: fill-box; transform-origin: 50% 100%; animation: ps-print-pop .5s cubic-bezier(.3, 1.3, .5, 1) var(--pop) both; }
.ps-print-shipcol { animation: ps-print-col 1.8s linear both; }
.ps-print-puff { transform-box: fill-box; transform-origin: 50% 50%; animation: ps-print-puff .5s ease-out var(--pop) both; }
.ps-print-sp { transform-box: fill-box; transform-origin: 50% 50%; animation: ps-print-sp .55s ease-out calc(var(--pop) + .03s) both; }
.ps-print-label { transform-box: fill-box; transform-origin: 50% 50%; animation: ps-print-label .38s cubic-bezier(.3, 1.6, .5, 1) calc(var(--pop) + .14s) both; }
.ps-print-led { animation: ps-print-blink .24s steps(2) var(--t0) 5 both; }
.ps-print-led-ok { animation: ps-print-ok .01s linear var(--pop) both; }

@keyframes ps-print-gy { from { transform: translateY(var(--gy0)); } to { transform: translateY(var(--gy1)); } }
@keyframes ps-print-cx { from { transform: translateX(var(--cx0)); } to { transform: translateX(var(--cx1)); } }
@keyframes ps-print-park { to { transform: translateY(-26px); opacity: 0; } }
@keyframes ps-print-flick { from { opacity: 1; transform: scale(.7); } to { opacity: .35; transform: scale(1.15); } }
@keyframes ps-print-cover { from { transform: scaleY(1); } to { transform: scaleY(0); } }
@keyframes ps-print-fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes ps-print-fade-out { to { opacity: 0; } }
@keyframes ps-print-pop {
  0% { transform: translateY(0) scale(1, 1); }
  35% { transform: translateY(-14px) scale(.94, 1.1); }
  65% { transform: translateY(0) scale(1.08, .92); }
  82% { transform: translateY(-4px) scale(1, 1); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes ps-print-col {
  0%, 57% { --paint: var(--old); }
  58%, 100% { --paint: var(--new); }
}
@keyframes ps-print-puff {
  0% { transform: scale(.3); opacity: 0; }
  12% { opacity: .95; }
  70% { opacity: .8; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes ps-print-sp {
  0% { transform: translate(0, 0) scale(0); opacity: 0; }
  30% { opacity: 1; transform: translate(calc(var(--dx) * .4), calc(var(--dy) * .4)) scale(1.1); }
  100% { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; }
}
@keyframes ps-print-label {
  0% { transform: scale(0) rotate(-12deg); opacity: 0; }
  100% { transform: scale(1) rotate(-3deg); opacity: 1; }
}
@keyframes ps-print-blink { from { fill: #8a8780; } to { fill: #f5b82e; } }
@keyframes ps-print-ok { to { fill: #3aa56b; } }
@keyframes ps-print-fade { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* Skipped or reduced-motion: jump every animation straight to its finished state. */
.ps-print-skip .ps-print-svg *,
.ps-print-rm .ps-print-svg * {
  animation-delay: -9s !important;
  animation-duration: .01s !important;
  animation-iteration-count: 1 !important;
  animation-direction: normal !important;
}
.ps-print-rm .ps-print-svg { animation: ps-print-fade .3s ease-out both; }

/* ---------- customiser ---------- */
.ps-cust {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 6px 14px 4px;
  box-sizing: border-box;
  font-family: 'Patrick Hand', 'Segoe Print', cursive;
  color: #2b2b2b;
}
.ps-cust button { font-family: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.ps-cust button:focus-visible { outline: 3px solid #4a8fe0; outline-offset: 2px; }
.ps-cust-ship {
  position: relative;
  flex: 0 0 auto;
  height: min(42vh, 340px);
  aspect-ratio: 300 / 420;
  max-width: 100%;
}
.ps-cust-art, .ps-cust-art svg { display: block; width: 100%; height: 100%; }
.ps-cust-art svg { overflow: visible; }
.ps-cust-slots { position: absolute; inset: 0; }
.ps-cust-slot {
  position: absolute;
  width: max(44px, calc(var(--sw) * 1%));
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 2.5px dashed #8a8780;
  border-radius: 50%;
  background: rgba(255, 253, 248, .45);
  cursor: pointer;
}
.ps-cust-slot.is-filled { border-color: transparent; background: transparent; }
.ps-cust-slot.is-filled:hover, .ps-cust-slot.is-filled:focus-visible { border: 2.5px solid #4a8fe0; }
.ps-cust-slot.is-picked, .ps-cust-slots.is-armed .ps-cust-slot:not(.is-filled) {
  border: 3px solid #4a8fe0;
  background: rgba(211, 230, 251, .75);
  box-shadow: 0 0 0 4px rgba(74, 143, 224, .25);
}
.ps-cust-mark { transform-box: fill-box; transform-origin: 50% 50%; }
.ps-cust-mark-new { animation: ps-cust-place .35s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes ps-cust-place { from { transform: scale(.3) rotate(-20deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }

.ps-cust-hint { margin: 0; min-height: 1.3em; font-size: 18px; text-align: center; color: #5b5953; }
.ps-cust-heading { align-self: flex-start; font-size: 17px; color: #8a8780; letter-spacing: .06em; text-transform: uppercase; }
.ps-cust-paints { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.ps-cust-swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid #2b2b2b;
  border-radius: 50%;
  background: var(--c, #d9d6cf);
  cursor: pointer;
}
.ps-cust-swatch.is-on { box-shadow: 0 0 0 3px #fffdf8, 0 0 0 6px #2b2b2b; }
.ps-cust-swatch.is-locked { background: #e8e5de; border-color: #8a8780; border-style: dashed; cursor: default; }
.ps-cust-stickers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px;
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
  border: 2.5px dashed #d9d6cf;
  border-radius: 16px;
  background: #fffdf8;
}
.ps-cust-stk {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 48px;
  padding: 2px;
  border: 2.5px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.ps-cust-stk.is-on { border-color: #4a8fe0; background: #d3e6fb; }
.ps-cust-stk.is-locked { cursor: default; }
.ps-cust-stk.is-locked .ps-stk-svg { filter: brightness(0); opacity: .14; }
.ps-cust-stk .ps-cust-lock { position: absolute; right: 2px; bottom: 2px; }
.ps-cust-swatch .ps-cust-lock { opacity: .9; }
.ps-cust-foot {
  position: sticky;
  bottom: 0;
  width: 100%;
  padding: 10px 6px 12px;
  box-sizing: border-box;
  background: linear-gradient(rgba(255, 253, 248, 0), #fffdf8 34%);
}
.ps-cust .ps-cust-done {
  display: block;
  width: 100%;
  min-height: 58px;
  padding: 10px 18px;
  border: 3px solid #2b2b2b;
  border-radius: 18px;
  background: #ff6a28;
  box-shadow: 0 4px 0 #2b2b2b;
  color: #2b2b2b;
  font-size: 28px;
  letter-spacing: .08em;
  text-transform: uppercase;
  outline: 3px dashed #ffd9c4;
  outline-offset: 5px;
  cursor: pointer;
}
.ps-cust-done:active { transform: translateY(3px); box-shadow: 0 1px 0 #2b2b2b; }
.ps-cust button.ps-cust-done:focus-visible { outline: 3px solid #2b2b2b; outline-offset: 5px; }

@media (prefers-reduced-motion: reduce) {
  .ps-cust-mark-new { animation: none; }
}

/* ---------- schematics: Print test bar, cargo list, locked-item hints ---------- */
.ps-printbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px;
  margin: 6px 12px; padding: 8px 12px; box-sizing: border-box;
  background: var(--ps-paper); color: var(--ps-ink); border: 3px solid var(--ps-ink); border-radius: 16px;
}
.ps-printbar-cargo { display: inline-flex; align-items: center; gap: 8px; font-size: 20px; }
.ps-printbar-cargo svg { width: 24px; height: 24px; }
.ps-printbar-cargo b { font-weight: normal; }
.ps-printbar-btn { min-height: 44px; background: var(--ps-gold); border: 3px solid var(--ps-ink); border-radius: 14px; font-size: 19px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; }
.ps-printbar-btn svg { width: 22px; height: 22px; }
.ps-printbar-btn[disabled] { background: var(--ps-grey); color: #5b5953; cursor: not-allowed; }
.ps-printbar-why { flex-basis: 100%; font-size: 17px; color: #4a4a4a; }
.ps-printbar.is-idle .ps-printbar-cargo { color: #4a4a4a; }
.ps-chip--print { background: var(--ps-gold); color: var(--ps-ink); }
.ps-chip--print svg { display: inline-block; }
.ps-chip-count { margin-left: 4px; padding: 0 7px; min-width: 20px; box-sizing: border-box; font-weight: normal; text-align: center; background: var(--ps-ink); color: var(--ps-paper); border-radius: 10px; }
.ps-map .ps-head-tools:has(.ps-chip--print) { flex-wrap: wrap; }
.ps-map .ps-head-tools .ps-chip--print { flex: 1 1 100%; order: 9; }
.ps-map .ps-head-tools .ps-chip--print svg { display: none; }
.ps-printlist { list-style: none; margin: 8px auto; padding: 0; display: grid; gap: 6px; max-width: 460px; }
.ps-printlist .ps-gain { margin: 0; }
.ps-print-test .ps-primary[disabled], .ps-primary[disabled] { animation: none; background: var(--ps-grey); color: #5b5953; text-shadow: none; box-shadow: none; cursor: not-allowed; }
.ps-gear.is-locked .ps-gear-how { color: #2b2b2b; font-size: 17px; }
.ps-gear.is-locked.is-cargo { background: #fde9a8; color: var(--ps-ink); border-style: solid; }
.ps-gear.is-locked.is-cargo .ps-gear-icon { opacity: 1; }
.ps-cust-swatch.is-locked.is-cargo, .ps-cust-stk.is-locked.is-cargo { outline: 3px solid var(--ps-gold); outline-offset: 1px; }
.ps-cust-swatch.is-locked.is-cargo, .ps-look .ps-cust-swatch.is-locked.is-cargo { background: #fde9a8; border-color: var(--ps-ink); }
.ps-look .ps-cust-stk.is-locked.is-cargo .ps-stk-svg { opacity: .8; }
.ps-look .ps-printbar, .ps-gears .ps-printbar { max-width: 460px; margin-inline: auto; }

@media (prefers-reduced-motion: reduce) {
  .ps-primary[disabled] { animation: none; }
}
