/* bow: slice 5 owns this file. The page is pine (body[data-screen=bow]); text is white. */

.bow { text-align: center; color: #fff; padding: 12px 0 40px; }
.bow__title { font-size: 32px; color: #fff; margin: 0 0 40px; }

.bow__stage {
  position: relative;
  width: 230px;
  height: 250px;
  margin: 0 auto 28px;
  transform-origin: 50% 100%;
}

.bow__box.kraft-box {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: auto;
  height: 150px;
  box-shadow: 0 16px 18px -12px oklch(0.15 0.04 155 / 0.8);
}
.bow__box .ribbon { z-index: 1; width: 32px; margin-left: -16px; }
.bow__tartan { /* the horizontal ribbon band */
  position: absolute;
  left: 0; right: 0; top: 56px;
  height: 30px;
  opacity: 0.95;
  background-size: 60px 60px;
  box-shadow: inset 0 3px 0 oklch(0.3 0.05 40 / 0.5), inset 0 -3px 0 oklch(0.3 0.05 40 / 0.5);
}

/* the bow: a button made of shapes */
.bow__bow {
  position: absolute;
  left: 50%; bottom: 128px;
  width: 150px; height: 96px;
  margin-left: -75px;
  padding: 0; border: 0; background: none;
  cursor: pointer;
  z-index: 2;
  transform-origin: 50% 80%;
  -webkit-tap-highlight-color: transparent;
}
.bow__bow:active { transform: scale(0.96); }
.bow__bow i { position: absolute; display: block; }
.bow__loop {
  top: 8px; width: 70px; height: 62px;
  background: var(--red);
  box-shadow: inset 0 -8px 0 var(--red-dark), inset 0 0 0 7px oklch(0.55 0.18 27), 0 4px 6px -3px oklch(0.15 0.04 155 / 0.7);
}
.bow__loop--l { left: 2px; border-radius: 70% 20% 60% 50% / 80% 30% 70% 40%; transform: rotate(-14deg); }
.bow__loop--r { right: 2px; border-radius: 20% 70% 50% 60% / 30% 80% 40% 70%; transform: rotate(14deg); }
.bow__tail {
  top: 52px; width: 30px; height: 44px;
  background: var(--red-dark);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}
.bow__tail--l { left: 38px; transform: rotate(14deg); }
.bow__tail--r { right: 38px; transform: rotate(-14deg); }
.bow__knot {
  left: 50%; top: 26px;
  width: 34px; height: 34px; margin-left: -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, oklch(0.92 0.12 90), var(--gold) 55%, oklch(0.68 0.13 80));
  box-shadow: 0 2px 4px oklch(0.2 0.05 60 / 0.5);
}

.bow__status {
  min-height: 3em;
  margin: 0 0 20px;
  font-size: 17px;
  line-height: 1.4;
  color: oklch(0.95 0.02 140);
}
.bow__pill { max-width: 260px; margin: 0 auto; }
.bow__pill:disabled { opacity: 0.8; }
.bow__error { margin: 14px 0 0; color: var(--gold); font-weight: 600; }

/* an invitation: the bow wiggles every few seconds until you tap it */
.bow__stage:not(.is-shaking):not(.is-fading) .bow__bow { animation: bow-wiggle 4s ease-in-out infinite; }
@keyframes bow-wiggle {
  0%, 78%, 100% { transform: rotate(0); }
  82% { transform: rotate(-6deg); }
  86% { transform: rotate(5deg); }
  90% { transform: rotate(-4deg); }
  94% { transform: rotate(2deg); }
}

/* the draw: the box shakes hard */
.bow__stage.is-shaking { animation: bow-shake 1.5s linear both; }
.bow__stage.is-shaking .bow__bow { animation: none; }
@keyframes bow-shake {
  0%   { transform: translate(0, 0) rotate(0); }
  8%   { transform: translate(-9px, 0) rotate(-5deg); }
  16%  { transform: translate(9px, -4px) rotate(5deg); }
  24%  { transform: translate(-11px, 0) rotate(-6deg); }
  32%  { transform: translate(11px, -5px) rotate(6deg); }
  40%  { transform: translate(-12px, 0) rotate(-6deg); }
  48%  { transform: translate(12px, -4px) rotate(6deg); }
  56%  { transform: translate(-10px, 0) rotate(-5deg); }
  64%  { transform: translate(10px, -3px) rotate(5deg); }
  72%  { transform: translate(-7px, 0) rotate(-4deg); }
  80%  { transform: translate(7px, -2px) rotate(3deg); }
  90%  { transform: translate(-3px, 0) rotate(-2deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

/* reduced motion: global.css removes animations, so the fade is a plain state change */
.bow__stage.is-fading { opacity: 0.35; }

@media (prefers-reduced-motion: reduce) {
  .bow__bow:active { transform: none; }
}
