/*--------------------------------------Cart Icon Widget--------------------------------------------------------*/
/* Loaded as its own file (see index.html <link>) so the growing cart feature
   (icon -> popup -> checkout) stays out of shopstyle.css. */

.cart-widget {
  position: absolute;
  top: 380px;
  left: 20px;
  z-index: 500;
  width: 190px;               
  aspect-ratio: 783 / 620;

  /* hidden until first item is added to cart */
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.cart-widget.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cart-widget.is-visible .cart-click-overlay {
  pointer-events: auto; /* Activates the link only when cart has items */
}

.cart-toggle {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: url(/11-resources/02-images/Cursor_Cl.png), auto;
}

/* cart clickable area mask */
.cart-click-overlay,
.cart-button-container {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cart-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.cart-beam {
  z-index: 1;
}

.cart-moving-assembly {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  
  /* Continuous, gentle 3.1-second ambient float */
  animation: bobbin 3.1s ease-in-out infinite;
}

.cart-ship-group {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  
  transform-origin: 50% 30%;
  will-change: transform;
  
  /* --- REPAIRED TIMING PROFILE ---
     Plays a tight 4-second animation, pauses for 37 seconds, then repeats.
     This instantly clears up the browser's micro-stuttering bottleneck. */
  animation: SunshineSpillsHisSoda 43s linear infinite;
}

.cart-ship {
  z-index: 3;
}

@keyframes bobbin {
  0%, 100% { transform: translateY(0px)  rotate(0deg); }
  50%      { transform: translateY(3px)  rotate(-1deg); }
}

@keyframes SunshineSpillsHisSoda {

  0%, 90% { transform: translateY(0px) rotate(0deg); }
  
  93.8%   { transform: translateY(5px) rotate(-2deg); }
  94.1%   { transform: translateX(-6px) translateY(7px) rotate(-16.8deg); }
  94.8%   { transform: translateX(2px) translateY(9px) rotate(-5deg); }
  95.3%   { transform: translateY(-14px) rotate(31deg); }
  96.0%   { transform: translateX(-4px) translateY(-12px) rotate(-6deg); }
  96.7%   { transform: translateX(6px) translateY(-11px) rotate(7deg); }
  97.3%   { transform: translateX(2px) translateY(-6px) rotate(2deg); }
  100%    { transform: translateY(0px) rotate(0deg); }
}

/* Blinking knob lights, offset so left/right don't sync */
.cart-light {
  z-index: 4;
  pointer-events: none;

  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;

  animation-duration: 22.4s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.cart-light-l {
  
  animation-name: left-light-cycle;
  animation-delay: 0s;
}

.cart-light-r {
  
  animation-name: right-light-cycle;
  
}

/* Left Light animation */
@keyframes left-light-cycle {
  0%, 4.4% {
    background-image: none;
  }
  4.5%, 5.2% {
    background-image: url('/11-resources/02-images/LL-Mag.png');
  }
  5.3%, 8.3% {
    background-image: none; 
  }
  8.4%, 11.6% {
    background-image: url('/11-resources/02-images/LL-Purp.png');
  }
  11.7%, 24.9% {
    background-image: none; 
  }
  
  25%, 30.4% {
    background-image: url('/11-resources/02-images/LL-Mag.png');
  }

  30.5%, 49.9% {
    background-image: none;
  }

  50%, 55.4% {
    background-image: url('/11-resources/02-images/LL-Purp.png');
  }

  55.5%, 63.9% {
    background-image: none;
  }
  64%, 70.4% {
    background-image: url('/11-resources/02-images/LL-Purp.png');
  }

  70.5%, 100% {
    background-image: none;
  }
}

/* Right Light animation */
@keyframes right-light-cycle {
   0%, 4.4% {
    background-image: none;
  }
  4.5%, 5.2% {
    background-image: url('/11-resources/02-images/RL-Mag.png');
  }
  5.3%, 8.3% {
    background-image: none; 
  }
  8.4%, 11.6% {
    background-image: url('/11-resources/02-images/RL-Purp.png');
  }
  11.7%, 27.4% {
    background-image: none;
  }
 
  27.5%, 32.4% {
    background-image: url('/11-resources/02-images/RL-Mag.png');
  }

  32.5%, 49.9% {
    background-image: none;
  }

  52%, 57.4% {
    background-image: url('/11-resources/02-images/RL-Purp.png');
  }
 
  57.5%, 61.9% {
    background-image: none;
  }66%, 72.4% {
    background-image: url('/11-resources/02-images/RL-Purp.png');
  }
  72.5%, 100% {
    background-image: none;
  }
}

/* Item count badge, floating */
.cart-badge {
  position: absolute;
  left: 52%;
  bottom: 6%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;

  width: 32px;
  aspect-ratio: 1 / 1;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  background-color: var(--Shop_Accent);
  color: var(--Background_Light);
  font-family: var(--nav_font_fam);
  font-size: 16px;
  font-weight: normal;

  box-shadow: 0 2px 4px rgba(0,0,0,0.001);
  animation: cart-badge-pulse var(--badge-duration, 3.1s) ease-in-out infinite;
}

@keyframes cart-badge-pulse {
  0%, 100% { transform: translateX(-50%) translateY(0)    scale(1); }
  50%      { transform: translateX(-50%) translateY(-3px) scale(1.06); }
}


/* ======= HITBOX LAYERS ========== */

/* beam hitbox */
.hitbox-beam-stationary {
  position: absolute;
  top: 35%;
  left: 0;
  width: 100%;
  height: 65%;
  background:rgba(0, 0, 0, 0.001);
  pointer-events: auto;
  cursor: url(/11-resources/02-images/Cursor_Cl.png), auto;
  
  /* Creates a trapezoid that cuts out the clear canvas sides */
  clip-path: polygon(38% 0%, 62% 0%, 80% 100%, 20% 100%);
}

/* bobbing ship hitboxes */
.hitbox-ship-moving {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  background: transparent !important; 
  border: none !important;
  
  pointer-events: none;

  transform-origin: 50% 30%;
}

.hitbox-ship-moving::before,
.hitbox-ship-moving::after {
  content: '';
  position: absolute;
  background: rgba(0, 0, 0, 0.001);
  border: none;
  pointer-events: auto;
  cursor: url(/11-resources/02-images/Cursor_Cl.png), auto;
}

/* SHIP HULL hitbox*/
.hitbox-ship-moving::before {
  top: 10%;
  left: 9%;
  width: 82%;
  height: 28%;
  clip-path: ellipse(50% 50% at 50% 50%);
  transform: rotate(-6deg); /* Keeps the angled rotation alignment */
}

/*COCKPIT DOME hitbox*/
.hitbox-ship-moving::after {
  top: 3%;
  left: 35%;
  width: 30%;
  height: 20%;
  clip-path: ellipse(50% 50% at 50% 50%);
}


/* ======= Media Resizer ========== */

@media screen and (max-width: 800px) {
  .cart-widget {

    position: fixed;
    top: 30px;
    left: 220px;
    
    height: 110px;
    width: max-content;
  }

  .cart-widget a {
   
    background-image: none;
  }

  .cart-badge {
    width: 32px;
    aspect-ratio: 1 / 1;
    font-size: 11px;
    bottom: 7%;
    font-size: 16px;
    font-weight: normal;
  }

}