/* Paint: the sheet, its mirror guides and the checkbox tool palette. Everything is scoped to .toy.paint. */

.toy.paint .pt-canvas {
  position: relative;
  cursor: crosshair;
  -webkit-touch-callout: none;
}

/* mirror axes: dashed guides through the middle of the sheet */
.toy.paint .pt-canvas.pt-mx::before,
.toy.paint .pt-canvas.pt-my::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0.55;
}

.toy.paint .pt-canvas.pt-mx::before {
  top: 3px;
  bottom: 3px;
  left: 50%;
  border-left: 2px dashed var(--blue);
  transform: translateX(-1px);
}

.toy.paint .pt-canvas.pt-my::after {
  left: 3px;
  right: 3px;
  top: 50%;
  border-top: 2px dashed var(--blue);
  transform: translateY(-1px);
}

/* 50 boxes painted */
.toy.paint .pt-canvas.pt-yay {
  animation: pt-yay 0.9s ease-out;
}

@keyframes pt-yay {
  0% {
    box-shadow: 0 0 0 0 var(--green);
  }
  30% {
    box-shadow: 0 0 0 6px var(--green);
  }
  100% {
    box-shadow: 0 0 0 16px transparent;
  }
}

/* ---------- palette ---------- */
/* one row spread to the sheet's width (--pt-sheet, set from paint.js); two even rows on narrow screens */
.toy.paint .pt-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 22px;
  width: var(--pt-sheet, auto);
  max-width: 100%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.toy.paint .pt-group {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  transition: opacity 0.15s ease;
}

/* the two-word mirror labels need more air than one-word tools, or they read as one line */
.toy.paint .pt-group.pt-mirror {
  gap: 12px;
}

.toy.paint .pt-bar.pt-erasing .pt-paintish {
  opacity: 0.45;
}

.toy.paint .pt-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 34px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
}

.toy.paint .pt-chip.on {
  color: var(--ink);
}

.toy.paint .pt-chip input {
  width: 26px;
  height: 26px;
  margin: 0;
  cursor: pointer;
}

.toy.paint .pt-chip.on input {
  animation: pt-pop 0.22s ease-out;
}

.toy.paint .pt-swatch {
  min-width: 0;
}

.toy.paint .pt-swatch input {
  width: 28px;
  height: 28px;
}

@keyframes pt-pop {
  0% {
    transform: scale(0.75);
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 700px) {
  .toy.paint .pt-bar {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: space-between;
  }
  .toy.paint .pt-bar > :nth-child(even) {
    justify-self: end;
  }
}

@media (max-width: 520px) {
  .toy.paint .pt-bar {
    gap: 10px 14px;
  }
  .toy.paint .pt-group {
    gap: 4px;
  }
  .toy.paint .pt-chip {
    min-width: 30px;
  }
  .toy.paint .pt-chip input {
    width: 24px;
    height: 24px;
  }
  .toy.paint .pt-swatch {
    min-width: 0;
  }
  .toy.paint .pt-swatch input {
    width: 26px;
    height: 26px;
  }
  .toy.paint .toy-button {
    padding: 8px 4px;
    font-size: 13px;
  }
}

/* seven buttons as two full rows the width of the sheet: four, then the three ways to share */
@media (max-width: 760px) {
  .toy.paint .toy-actions {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px 8px;
    width: var(--pt-sheet, 100%);
    max-width: 100%;
  }
  .toy.paint .toy-button {
    grid-column: span 3;
    white-space: nowrap;
  }
  .toy.paint .toy-button:nth-child(n + 5) {
    grid-column: span 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toy.paint .pt-chip.on input,
  .toy.paint .pt-canvas.pt-yay {
    animation: none;
  }
  .toy.paint .pt-group {
    transition: none;
  }
}
