/* ============================================================
   Spike & Splat paint cannon.
   Identical on all five Laughs & Locks concepts, tape frame included.
   Consumes from the host page: --ink, --paper, --accent, --font.
   ============================================================ */

.pc {
  --pc-tape: #ddc79b;
  --pc-board: var(--paper, #fffdf9);
  position: relative;
  max-width: 470px;
}

/* ---- the masking-tape frame ---------------------------------- */

.pc-frame {
  position: relative;
  padding: 18px;
  filter: drop-shadow(0 10px 22px rgba(36, 31, 29, 0.13));
}

.pc-board {
  position: relative;
  overflow: hidden;
  background: var(--pc-board);
  aspect-ratio: 4 / 3;
  touch-action: manipulation;
  cursor: crosshair;
  box-shadow: inset 0 0 22px rgba(36, 31, 29, 0.07);
}

.pc-board:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Four strips overhanging the corners, each at its own sub-degree rotation.
   Only the SHORT ends are torn. Tearing the long edges as well is what makes
   a strip read as corrugated card instead of tape, which is the mistake the
   first build shipped. */
.pc-tape {
  position: absolute;
  opacity: 0.93;
  pointer-events: none;
  z-index: 3;
}

.pc-tape::before,
.pc-tape::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Body: a barely-there fibre, plus the roll's own cross-curvature. The first
   build had the fibre at 6px and 0.14 alpha, which read as woven straw. */
.pc-tape::before {
  background:
    repeating-linear-gradient(
      var(--pc-fibre, 90deg),
      rgba(255, 255, 255, 0.05) 0 1px,
      rgba(122, 98, 44, 0.035) 1px 3px
    ),
    linear-gradient(
      var(--pc-curve, 180deg),
      rgba(122, 98, 44, 0.16) 0%,
      rgba(255, 255, 255, 0.2) 30%,
      rgba(255, 255, 255, 0.06) 62%,
      rgba(122, 98, 44, 0.2) 100%
    ),
    var(--pc-tape);
}

/* one soft sheen band down the roll */
.pc-tape::after {
  background: linear-gradient(
    var(--pc-sheen, 178deg),
    rgba(255, 255, 255, 0.3) 0 18%,
    rgba(255, 255, 255, 0) 52%
  );
}

/* Torn short ends. Uneven depths at uneven intervals: an evenly stepped
   sawtooth reads as pinking shears, which is what the first build shipped. */
.pc-tape-t,
.pc-tape-b { --pc-fibre: 90deg; --pc-curve: 180deg; --pc-sheen: 178deg; }

.pc-tape-l,
.pc-tape-r { --pc-fibre: 0deg; --pc-curve: 90deg; --pc-sheen: 92deg; }

.pc-tape-t {
  clip-path: polygon(
    0% 0%, 100% 0%,
    96.4% 22%, 99.4% 48%, 95.8% 74%, 99.1% 100%,
    3.4% 100%, 0.6% 71%, 4.1% 44%, 1.0% 18%
  );
}
.pc-tape-b {
  clip-path: polygon(
    0% 0%, 100% 0%,
    98.8% 19%, 95.4% 46%, 99.3% 72%, 96.2% 100%,
    1.2% 100%, 4.3% 68%, 0.7% 41%, 3.6% 15%
  );
}
.pc-tape-l {
  clip-path: polygon(
    0% 1.0%, 24% 3.4%, 52% 0.4%, 78% 3.1%, 100% 0.6%,
    100% 99.2%, 76% 96.8%, 49% 99.7%, 23% 96.9%, 0% 99.4%
  );
}
.pc-tape-r {
  clip-path: polygon(
    0% 3.2%, 26% 0.5%, 50% 3.5%, 75% 0.7%, 100% 2.8%,
    100% 97.0%, 74% 99.6%, 51% 96.6%, 25% 99.5%, 0% 97.4%
  );
}

.pc-tape-t { top: 5px;   left: -22px; right: -28px; height: 26px; transform: rotate(-0.7deg); }
.pc-tape-b { bottom: 6px; left: -28px; right: -20px; height: 24px; transform: rotate(0.9deg); }
.pc-tape-l { left: 6px;   top: -26px; bottom: -20px; width: 24px; transform: rotate(0.5deg); }
.pc-tape-r { right: 7px;  top: -20px; bottom: -28px; width: 22px; transform: rotate(-1.1deg); }

/* ---- the marks ------------------------------------------------ */

.pc-mark {
  position: absolute;
  mix-blend-mode: multiply;
  pointer-events: none;
  transform-origin: 50% 50%;
  animation: pc-land 0.26s cubic-bezier(0.15, 1.5, 0.4, 1) both;
}

@keyframes pc-land {
  from { transform: translate(-50%, -50%) scale(0.42); opacity: 0.6; }
  to   { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
}

/* seeds skip the landing animation but must keep the centring transform the
   keyframe was carrying, or they sit half their own width down and right */
.pc-mark.is-seed {
  animation: none;
  transform: translate(-50%, -50%);
}

.pc-mark.is-going {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.86);
  transition: opacity 0.42s ease, transform 0.42s ease;
}

.pc-blob {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  z-index: 2;
}

/* ---- the spout ------------------------------------------------ */

.pc-spout {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 20px;
  height: 74px;
  transform-origin: 50% 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 2;
}

.pc-board.is-live .pc-spout { opacity: 1; }

.pc-barrel {
  position: absolute;
  inset: 0;
  border-radius: 9px 9px 3px 3px;
  background: linear-gradient(
    90deg,
    #4b4340 0%, #7d7370 30%, #5d5451 62%, #383331 100%
  );
  box-shadow: 0 2px 6px rgba(36, 31, 29, 0.3);
}

.pc-muzzle {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 15px;
  height: 15px;
  margin-left: -7.5px;
  border-radius: 50%;
  background: var(--pc-loaded, #1b22e0);
  box-shadow: 0 0 0 2.5px #383331;
}

.pc-spout.is-recoil { animation: pc-recoil 0.3s ease-out; }

@keyframes pc-recoil {
  0%   { translate: 0 0; }
  22%  { translate: 0 14px; }
  100% { translate: 0 0; }
}

/* ---- the controls --------------------------------------------- */

.pc-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.pc-swatch {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px rgba(36, 31, 29, 0.22);
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.2, 1.3, 0.4, 1), box-shadow 0.22s ease;
}

.pc-swatch:hover { transform: translateY(-3px); }

/* state is ring + lift + aria-pressed, never colour alone */
.pc-swatch[aria-pressed="true"] {
  transform: translateY(-5px);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink);
}

.pc-swatch:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.pc-clear {
  margin-left: auto;
  padding: 9px 16px;
  min-height: 44px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease;
}

.pc-clear:hover { background: var(--ink); color: var(--paper); }
.pc-clear:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.pc-clear[disabled] { opacity: 0.45; cursor: default; }
.pc-clear[disabled]:hover { background: transparent; color: var(--ink); }

/* touch has no hover, so the spout rests visible */
@media (hover: none) {
  .pc-spout { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-mark { animation: none; }
  .pc-spout.is-recoil { animation: none; }
  .pc-swatch { transition: none; }
}
