/**
 * JaapCount – Interactive Mala Bead Physics & Kinetic Motion
 * Authentic physical prayer garland aesthetics with Emil Kowalski spring dynamics.
 */

:root {
  --accent-gold: var(--color-accent-brass, #E9C46A);
  --accent-sand: var(--color-accent-sandalwood, #D4A373);
  --bead-size: 26px;
  --bead-active-size: 34px;
  --bead-gap: 12px;
}

.mala-container {
  position: relative;
  width: 100%;
  max-width: 340px;
  height: 96px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 14%, black 86%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 14%, black 86%, transparent 100%);
}

.interactive-mala-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  outline: none;
}

.interactive-mala-wrapper:active {
  cursor: grabbing;
}

/* Background Golden Sacred Thread (Sutra) */
.mala-thread-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(212, 163, 115, 0.3) 15%, 
    rgba(233, 196, 106, 0.7) 50%, 
    rgba(212, 163, 115, 0.3) 85%, 
    transparent 100%
  );
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
}

/* Kinetic Mala Beads Track */
.mala-beads-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--bead-gap);
  z-index: 2;
  will-change: transform;
  pointer-events: none; /* Let pointer events register on wrapper */
}

/* Base Prayer Bead */
.interactive-bead {
  position: relative;
  width: var(--bead-size);
  height: var(--bead-size);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s cubic-bezier(0.23, 1, 0.32, 1),
              box-shadow 0.22s ease,
              width 0.22s cubic-bezier(0.23, 1, 0.32, 1),
              height 0.22s cubic-bezier(0.23, 1, 0.32, 1),
              border-color 0.22s ease;
  will-change: transform, box-shadow;
}

/* Center Active Bead – Golden Bloom & Sacred Scale */
.interactive-bead.bead--active {
  width: var(--bead-active-size);
  height: var(--bead-active-size);
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(233, 196, 106, 0.75), 
              0 4px 12px rgba(0, 0, 0, 0.65),
              inset 0 1px 3px rgba(255, 255, 255, 0.4);
  z-index: 4;
}

/* Sacred Quarter Marker Beads (27, 54, 81) */
.interactive-bead.bead--quarter {
  border: 1.5px solid var(--color-accent-sandalwood, #D4A373) !important;
  box-shadow: 0 0 14px rgba(233, 196, 106, 0.65), 0 3px 6px rgba(0, 0, 0, 0.55);
}

/* Micro Bead Number */
.bead-number {
  font-family: var(--font-counter, 'Cinzel', serif);
  font-size: 0.56rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  pointer-events: none;
  user-select: none;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.interactive-bead.bead--active .bead-number {
  font-size: 0.72rem;
  font-weight: 700;
  color: #FFFFFF;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

.interactive-bead.bead--sumeru .bead-number {
  font-size: 0.82rem;
  color: #5A2A00;
  text-shadow: none;
}

/* Incoming Bead Pre-activation Spring */
.interactive-bead.bead--arriving {
  transform: scale(1.08);
  box-shadow: 0 0 14px rgba(233, 196, 106, 0.4);
}

/* ─── SACRED BEAD TEXTURES & 3D LIGHTING ─── */

/* 1. Sacred Vrindavan Tulsi (Holy Basil Wood) */
.bead--tulsi {
  background: radial-gradient(circle at 35% 32%, #CDB380 0%, #8E5B28 50%, #422108 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.35);
  border: 0.5px solid rgba(255, 230, 180, 0.2);
}

/* 2. Himalayan 5-Mukhi Rudraksha */
.bead--rudraksha {
  background: radial-gradient(circle at 35% 32%, #8B4513 0%, #542509 55%, #240C03 100%);
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.65), inset 0 1px 2px rgba(233, 196, 106, 0.3);
  border: 1px dashed rgba(60, 24, 6, 0.85);
}

/* 3. Rakta Chandan (Red Sandalwood) */
.bead--chandan {
  background: radial-gradient(circle at 35% 32%, #E76F51 0%, #9E2A2B 55%, #4C0E0E 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.55), inset 0 1px 2px rgba(255, 200, 200, 0.35);
  border: 0.5px solid rgba(255, 180, 180, 0.2);
}

/* 4. Sphatik Crystal (Translucent Quartz) */
.bead--sphatik {
  background: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #E2E8F0 45%, #94A3B8 100%);
  box-shadow: 0 0 14px rgba(226, 232, 240, 0.6), inset 0 1px 4px rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

/* ─── SUMERU (GURU) BEAD ─── */
.interactive-bead.bead--sumeru {
  width: 38px;
  height: 38px;
  background: radial-gradient(circle at 35% 30%, #FFE8A3 0%, #E9C46A 45%, #993D00 100%);
  box-shadow: 0 0 28px rgba(233, 196, 106, 0.9), 0 5px 14px rgba(0, 0, 0, 0.7);
  border: 1.5px solid #FFF3C4;
  z-index: 5;
}

/* Sumeru Golden Cap & Saffron Tassel */
.sumeru-tassel {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 18px;
  background: linear-gradient(180deg, #E9C46A 0%, #E76F51 45%, #E63946 100%);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

/* Sumeru Sacred Turnaround Notice */
.sumeru-notice {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 10, 16, 0.96);
  border: 1px solid var(--accent-gold);
  border-radius: 9999px;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.8),
              0 0 16px rgba(233, 196, 106, 0.3);
  z-index: 10;
  animation: sumeruPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  pointer-events: none;
}

.sumeru-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.sumeru-text {
  font-size: 0.78rem;
  color: var(--accent-sand);
}

@keyframes sumeruPop {
  from {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}
