/* ==========================================================================
   Motion & Animation Vault - Category 1: Hover & Click Micro-Interactions
   Demos 1 to 8:
   1. Magnetic Pull
   2. 3D Tilt & Glare
   3. Spotlight Border
   4. Shimmer / Shine Sweep
   5. Material Ripple
   6. Tactile Squish / Press
   7. Liquid / Gooey Fill
   8. Draw Underline / Split Link
   ========================================================================== */

/* --------------------------------------------------------------------------
   Shared Container & Playground Centering
   -------------------------------------------------------------------------- */
.cat1-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  box-sizing: border-box;
  user-select: none;
  overflow: hidden;
}

.cat1-meta-readout {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* --------------------------------------------------------------------------
   Demo 1: Magnetic Pull
   -------------------------------------------------------------------------- */
.cat1-magnetic-stage {
  position: relative;
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  cursor: crosshair;
}

.cat1-magnetic-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
  background: #181d2a;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 9999px;
  cursor: pointer;
  outline: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(99, 102, 241, 0.2);
  will-change: transform;
  transform: translate3d(0, 0, 0);
  transition: transform calc(var(--duration, 0.5s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.175, 0.885, 0.32, 1.275)) var(--delay, 0ms),
              box-shadow calc(var(--duration, 0.3s) / var(--speed-mult, 1)) ease var(--delay, 0ms);
}

.cat1-magnetic-btn.is-active {
  transition: none; /* Instant tracking on cursor drag/proximity */
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4), 0 0 25px rgba(99, 102, 241, 0.5);
  border-color: rgba(99, 102, 241, 0.8);
}

.cat1-magnetic-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #818cf8;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  transition: transform calc(var(--duration, 0.5s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.175, 0.885, 0.32, 1.275)) var(--delay, 0ms);
}

.cat1-magnetic-btn.is-active .cat1-magnetic-icon {
  transition: none;
}

.cat1-magnetic-glow {
  position: absolute;
  inset: -2px;
  border-radius: 9999px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.6) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity calc(var(--duration, 0.3s) / var(--speed-mult, 1)) ease var(--delay, 0ms);
}

.cat1-magnetic-btn:hover .cat1-magnetic-glow {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Demo 2: 3D Tilt & Glare
   -------------------------------------------------------------------------- */
.cat1-tilt-stage {
  perspective: 1000px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.cat1-tilt-card {
  position: relative;
  width: 220px;
  height: 130px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e2436 0%, #111420 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform-style: preserve-3d;
  cursor: pointer;
  will-change: transform;
  transform: rotateX(0deg) rotateY(0deg) translateZ(0);
  transition: transform calc(var(--duration, 0.6s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.23, 1, 0.32, 1)) var(--delay, 0ms),
              box-shadow calc(var(--duration, 0.4s) / var(--speed-mult, 1)) ease var(--delay, 0ms);
  overflow: hidden;
  padding: 16px;
  box-sizing: border-box;
}

.cat1-tilt-card.is-tilting {
  transition: box-shadow calc(var(--duration, 0.2s) / var(--speed-mult, 1)) ease;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(99, 102, 241, 0.25);
}

.cat1-tilt-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 12px;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.22) 0%, transparent 60%);
  opacity: 0;
  transition: opacity calc(var(--duration, 0.3s) / var(--speed-mult, 1)) ease var(--delay, 0ms);
  mix-blend-mode: overlay;
}

.cat1-tilt-card.is-tilting .cat1-tilt-glare {
  opacity: 1;
}

.cat1-tilt-layer {
  transform: translateZ(24px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  pointer-events: none;
}

.cat1-tilt-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.15);
  padding: 3px 6px;
  border-radius: 4px;
  width: fit-content;
}

.cat1-tilt-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  margin: 4px 0 0 0;
}

.cat1-tilt-sub {
  font-size: 11px;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   Demo 3: Spotlight Border
   -------------------------------------------------------------------------- */
.cat1-spotlight-cluster {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  justify-content: center;
}

.cat1-spotlight-card {
  position: relative;
  flex: 1;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px; /* Emulates 1px border revealed by spotlight */
  overflow: hidden;
  cursor: pointer;
}

.cat1-spotlight-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 10px;
  background: radial-gradient(
    140px circle at var(--mx, -200px) var(--my, -200px),
    rgba(99, 102, 241, 0.9) 0%,
    rgba(14, 165, 233, 0.4) 40%,
    transparent 80%
  );
  opacity: 0;
  transition: opacity calc(var(--duration, 0.3s) / var(--speed-mult, 1)) ease var(--delay, 0ms);
  pointer-events: none;
}

.cat1-spotlight-card:hover::before,
.cat1-spotlight-cluster:hover .cat1-spotlight-card::before {
  opacity: 1;
}

.cat1-spotlight-inner {
  position: relative;
  background: #111420;
  border-radius: 9px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  box-sizing: border-box;
}

.cat1-spotlight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cat1-spotlight-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.cat1-spotlight-name {
  font-size: 12px;
  font-weight: 600;
  color: #f8fafc;
}

.cat1-spotlight-metric {
  font-size: 18px;
  font-weight: 700;
  color: #818cf8;
  font-family: ui-monospace, monospace;
}

.cat1-spotlight-hint {
  font-size: 10px;
  color: #64748b;
}

/* --------------------------------------------------------------------------
   Demo 4: Shimmer / Shine Sweep
   -------------------------------------------------------------------------- */
.cat1-shimmer-card {
  position: relative;
  width: 240px;
  padding: 16px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #161b2b 0%, #0d101a 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.cat1-shimmer-sheen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    110deg,
    transparent 15%,
    rgba(255, 255, 255, 0.05) 30%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0.05) 70%,
    transparent 85%
  );
  transform: translateX(-150%) skewX(-25deg);
  pointer-events: none;
  will-change: transform;
}

.cat1-shimmer-card:hover .cat1-shimmer-sheen,
.cat1-shimmer-card.is-shining .cat1-shimmer-sheen {
  animation: cat1ShineAnim calc(var(--duration, 0.8s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.4, 0, 0.2, 1)) var(--delay, 0ms);
}

@keyframes cat1ShineAnim {
  0% {
    transform: translateX(-150%) skewX(-25deg);
  }
  100% {
    transform: translateX(250%) skewX(-25deg);
  }
}

.cat1-shimmer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat1-shimmer-title {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
}

.cat1-shimmer-tier {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 500;
}

.cat1-shimmer-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* --------------------------------------------------------------------------
   Demo 5: Material Ripple
   -------------------------------------------------------------------------- */
.cat1-ripple-card {
  position: relative;
  width: 250px;
  height: 110px;
  border-radius: 12px;
  background: #181d2a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: border-color calc(var(--duration, 0.2s) / var(--speed-mult, 1)) ease;
}

.cat1-ripple-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
}

.cat1-ripple-span {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.55) 0%, rgba(129, 140, 248, 0.2) 60%, transparent 80%);
  pointer-events: none;
  transform: scale(0);
  opacity: 1;
  animation: cat1RippleAnim calc(var(--duration, 0.65s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.2, 0.8, 0.2, 1)) var(--delay, 0ms) forwards;
}

@keyframes cat1RippleAnim {
  0% {
    transform: scale(0);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.cat1-ripple-prompt {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  pointer-events: none;
}

.cat1-ripple-sub {
  font-size: 11px;
  color: #94a3b8;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Demo 6: Tactile Squish / Press
   -------------------------------------------------------------------------- */
.cat1-tactile-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cat1-tactile-btn {
  position: relative;
  outline: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cat1-tactile-shadow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: #1e1b4b;
  transform: translateY(6px);
  transition: transform calc(var(--duration, 0.15s) / var(--speed-mult, 1)) ease var(--delay, 0ms);
}

.cat1-tactile-face {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: 12px;
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  transform: translateY(0) scale(1);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  transition: transform calc(var(--duration, 0.2s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.34, 1.56, 0.64, 1)) var(--delay, 0ms),
              box-shadow calc(var(--duration, 0.2s) / var(--speed-mult, 1)) ease var(--delay, 0ms);
  will-change: transform;
}

.cat1-tactile-btn:hover .cat1-tactile-face {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.5);
}

.cat1-tactile-btn:hover .cat1-tactile-shadow {
  transform: translateY(8px);
}

.cat1-tactile-btn:active .cat1-tactile-face,
.cat1-tactile-btn.is-pressed .cat1-tactile-face {
  transform: translateY(5px) scale(0.96, 0.94);
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
  transition: transform calc(var(--duration, 0.06s) / var(--speed-mult, 1)) ease-in;
}

.cat1-tactile-btn:active .cat1-tactile-shadow,
.cat1-tactile-btn.is-pressed .cat1-tactile-shadow {
  transform: translateY(1px);
}

.cat1-tactile-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   Demo 7: Liquid / Gooey Fill
   -------------------------------------------------------------------------- */
.cat1-liquid-btn {
  position: relative;
  padding: 14px 32px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 9999px;
  border: 2px solid #6366f1;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  outline: none;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
  transition: border-color calc(var(--duration, 0.3s) / var(--speed-mult, 1)) ease;
}

.cat1-liquid-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  border-radius: 9999px 9999px 0 0;
  transition: height calc(var(--duration, 0.5s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.4, 0, 0.2, 1)) var(--delay, 0ms);
  will-change: height;
  pointer-events: none;
}

.cat1-liquid-btn:hover .cat1-liquid-fill,
.cat1-liquid-btn.is-filled .cat1-liquid-fill {
  height: 100%;
  border-radius: 0;
}

.cat1-liquid-wave {
  position: absolute;
  top: -12px;
  left: -50%;
  width: 200%;
  height: 24px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,0 C150,90 350,-40 500,50 C650,140 900,10 1200,60 L1200,120 L0,120 Z' fill='%236366f1'/%3E%3C/svg%3E");
  background-size: 50% 100%;
  opacity: 0.6;
  animation: cat1WaveLoop calc(2s / var(--speed-mult, 1)) linear infinite;
  pointer-events: none;
}

@keyframes cat1WaveLoop {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Crisp text contrast without muddy difference mode */
.cat1-liquid-text {
  position: relative;
  z-index: 2;
  color: #a5b4fc;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  transition: color calc(var(--duration, 0.3s) / var(--speed-mult, 1)) ease,
              transform calc(var(--duration, 0.3s) / var(--speed-mult, 1)) ease var(--delay, 0ms);
}

.cat1-liquid-btn:hover .cat1-liquid-text,
.cat1-liquid-btn.is-filled .cat1-liquid-text {
  color: #ffffff;
  transform: scale(1.05);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* --------------------------------------------------------------------------
   Demo 8: Draw Underline / Split Link
   -------------------------------------------------------------------------- */
.cat1-split-nav {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: center;
}

.cat1-split-link {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f8fafc;
  padding: 8px 4px;
  cursor: pointer;
  overflow: hidden;
}

.cat1-split-row {
  display: flex;
  overflow: hidden;
}

.cat1-split-char {
  display: inline-block;
  transform: translateY(0);
  transition: transform calc(var(--duration, 0.35s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.76, 0, 0.24, 1)) var(--delay, 0ms);
  will-change: transform;
}

.cat1-split-row-clone {
  position: absolute;
  top: 8px;
  left: 4px;
  display: flex;
  overflow: hidden;
}

.cat1-split-row-clone .cat1-split-char {
  transform: translateY(120%);
  color: #818cf8;
}

.cat1-split-link:hover .cat1-split-row-primary .cat1-split-char,
.cat1-split-link.is-hovered .cat1-split-row-primary .cat1-split-char {
  transform: translateY(-120%);
}

.cat1-split-link:hover .cat1-split-row-clone .cat1-split-char,
.cat1-split-link.is-hovered .cat1-split-row-clone .cat1-split-char {
  transform: translateY(0);
}

/* Directional underline */
.cat1-split-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #38bdf8);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform calc(var(--duration, 0.4s) / var(--speed-mult, 1)) var(--easing, cubic-bezier(0.65, 0, 0.35, 1)) var(--delay, 0ms);
}

.cat1-split-link:hover .cat1-split-line,
.cat1-split-link.is-hovered .cat1-split-line {
  transform: scaleX(1);
  transform-origin: left center;
}

/* --------------------------------------------------------------------------
   Reduced Motion Simulator Support
   -------------------------------------------------------------------------- */
.reduced-motion .cat1-magnetic-btn,
.reduced-motion .cat1-tilt-card,
.reduced-motion .cat1-shimmer-sheen,
.reduced-motion .cat1-tactile-face,
.reduced-motion .cat1-liquid-fill,
.reduced-motion .cat1-split-char,
.reduced-motion .cat1-split-line {
  transition: none !important;
  animation: none !important;
  transform: none !important;
}
