/**
 * Klic2Help Logo Motion System
 * Extends klic2help-3d.css — language from the 3D logo (targets, cursors, heart, hand, arc, halo).
 * Prefer transform/opacity. Honors prefers-reduced-motion.
 */
:root {
  --k2lm-blue: #1a8fd4;
  --k2lm-blue-deep: #0b4f8a;
  --k2lm-cyan: #3ec8ff;
  --k2lm-chrome-1: #f5f7fa;
  --k2lm-chrome-2: #9aa3ad;
  --k2lm-chrome-3: #e8edf2;
  --k2lm-ink: #061525;
  --k2lm-halo: 0 0 28px rgba(62, 200, 255, 0.45);
  --k2lm-halo-soft: 0 0 18px rgba(26, 143, 212, 0.28);
  --k2lm-fast: 160ms;
  --k2lm-med: 280ms;
  --k2lm-slow: 480ms;
  --k2lm-hero: 2.2s;
  --k2lm-impact: 600ms;
  --k2lm-idle: 5.2s;
  --k2lm-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --k2lm-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========== Hero: logo cinematic ========== */
.k2h-hero.k2lm-hero {
  background:
    radial-gradient(900px 520px at 78% 42%, rgba(26, 143, 212, 0.28), transparent 62%),
    radial-gradient(700px 420px at 20% 80%, rgba(11, 79, 138, 0.35), transparent 55%),
    #061525;
}

.k2lm-hero .k2h-hero__veil {
  background:
    linear-gradient(105deg, rgba(6, 21, 37, 0.94) 0%, rgba(6, 21, 37, 0.62) 48%, rgba(6, 21, 37, 0.22) 100%),
    linear-gradient(0deg, rgba(6, 21, 37, 0.78) 0%, transparent 44%);
}

.k2lm-logo-scene {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  contain: layout style paint;
}

.k2lm-logo-scene__svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.4));
}

.k2lm-logo-static {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.35));
}

.k2lm-hero__halo {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(62, 200, 255, 0.22), transparent 68%);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.85);
}

/* Cinematic play states (driven by .is-playing / .is-settled) */
.k2lm-logo-scene .k2lm-target,
.k2lm-logo-scene .k2lm-cursor,
.k2lm-logo-scene .k2lm-arc,
.k2lm-logo-scene .k2lm-heart,
.k2lm-logo-scene .k2lm-hand {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.k2lm-logo-scene.is-playing .k2lm-target--l {
  animation: k2lm-fade-in 360ms var(--k2lm-ease) 80ms both;
}
.k2lm-logo-scene.is-playing .k2lm-target--r {
  animation: k2lm-fade-in 360ms var(--k2lm-ease) 220ms both;
}
.k2lm-logo-scene.is-playing .k2lm-cursor--l {
  animation: k2lm-cursor-in 480ms var(--k2lm-ease) 420ms both;
}
.k2lm-logo-scene.is-playing .k2lm-cursor--r {
  animation: k2lm-cursor-in 480ms var(--k2lm-ease) 780ms both;
}
.k2lm-logo-scene.is-playing .k2lm-ring-pulse--l {
  animation: k2lm-ring-ripple 700ms var(--k2lm-ease-out) 560ms both;
}
.k2lm-logo-scene.is-playing .k2lm-ring-pulse--r {
  animation: k2lm-ring-ripple 700ms var(--k2lm-ease-out) 920ms both;
}
.k2lm-logo-scene.is-playing .k2lm-arc {
  animation: k2lm-arc-draw 700ms var(--k2lm-ease) 1100ms both;
}
.k2lm-logo-scene.is-playing .k2lm-heart {
  animation: k2lm-heart-rise 700ms var(--k2lm-ease) 1400ms both;
}
.k2lm-logo-scene.is-playing .k2lm-hand {
  animation: k2lm-hand-in 640ms var(--k2lm-ease) 1680ms both;
}
.k2h-scene.is-playing .k2lm-hero__halo {
  animation: k2lm-halo-in 700ms var(--k2lm-ease) 1900ms both;
}

.k2lm-logo-scene.is-settled .k2lm-target,
.k2lm-logo-scene.is-settled .k2lm-cursor,
.k2lm-logo-scene.is-settled .k2lm-arc,
.k2lm-logo-scene.is-settled .k2lm-heart,
.k2lm-logo-scene.is-settled .k2lm-hand {
  opacity: 1;
  animation: none;
}

.k2lm-logo-scene.is-settled .k2lm-heart {
  animation: k2lm-heart-float var(--k2lm-idle) ease-in-out infinite;
}

.k2lm-logo-scene.is-settled .k2lm-ring-idle--l,
.k2lm-logo-scene.is-settled .k2lm-ring-idle--r {
  animation: k2lm-target-idle 3.6s ease-in-out infinite;
}
.k2lm-logo-scene.is-settled .k2lm-ring-idle--r {
  animation-delay: 0.45s;
}

.k2h-scene .k2lm-hero__halo.is-on {
  opacity: 1;
  transform: scale(1);
}

/* ========== Named motions (utilities) ========== */
.k2lm-target-pulse {
  position: relative;
  isolation: isolate;
}
.k2lm-target-pulse::before,
.k2lm-target-pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid rgba(62, 200, 255, 0.55);
  pointer-events: none;
  opacity: 0;
  z-index: 0;
}
.k2lm-target-pulse.is-pulsing::before {
  animation: k2lm-target-ring 720ms var(--k2lm-ease-out) both;
}
.k2lm-target-pulse.is-pulsing::after {
  animation: k2lm-target-ring 720ms var(--k2lm-ease-out) 140ms both;
}

.k2lm-double-ripple {
  position: relative;
  overflow: hidden;
}
.k2lm-double-ripple.is-ripping::before,
.k2lm-double-ripple.is-ripping::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 2px solid rgba(62, 200, 255, 0.7);
  pointer-events: none;
  z-index: 2;
}
.k2lm-double-ripple.is-ripping::before {
  animation: k2lm-ripple-burst 620ms var(--k2lm-ease-out) both;
}
.k2lm-double-ripple.is-ripping::after {
  animation: k2lm-ripple-burst 620ms var(--k2lm-ease-out) 180ms both;
  border-color: rgba(26, 143, 212, 0.55);
}

.k2lm-heart-float {
  animation: k2lm-heart-float var(--k2lm-idle) ease-in-out infinite;
}

.k2lm-heart-impact.is-impacting {
  animation: k2lm-heart-impact var(--k2lm-impact) var(--k2lm-ease) both;
}

.k2lm-hand-glow.is-protecting {
  box-shadow: var(--k2lm-halo-soft), inset 0 0 0 1px rgba(245, 247, 250, 0.35) !important;
  animation: k2lm-hand-sweep 900ms var(--k2lm-ease) both;
}

.k2lm-cursor-strike.is-striking {
  animation: k2lm-strike 340ms var(--k2lm-ease) both;
}

.k2lm-arc-connect {
  stroke-dasharray: 180;
  stroke-dashoffset: 180;
}
.k2lm-arc-connect.is-connected {
  animation: k2lm-arc-draw 700ms var(--k2lm-ease) both;
}

/* ========== Quick Donation signature ========== */
#klic2help-quick-donation.k2lm-qd {
  --k2lm-qd-glow: rgba(26, 143, 212, 0.22);
}

#klic2help-quick-donation.k2lm-qd .quick-donation-card__badge {
  background: linear-gradient(135deg, rgba(26, 143, 212, 0.12), rgba(62, 200, 255, 0.1));
  color: var(--k2lm-blue-deep);
  border: 1px solid rgba(26, 143, 212, 0.2);
  box-shadow: var(--k2lm-halo-soft);
}

.k2lm-qd-motif {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 0.35rem 0 0.85rem;
  min-height: 2.25rem;
  pointer-events: none;
}

.k2lm-qd-motif__target {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  border: 2px solid rgba(26, 143, 212, 0.35);
  box-shadow: inset 0 0 0 3px rgba(62, 200, 255, 0.15);
  position: relative;
  opacity: 0.55;
  transition: opacity var(--k2lm-fast) ease, box-shadow var(--k2lm-med) var(--k2lm-ease), transform var(--k2lm-med) var(--k2lm-ease);
}

.k2lm-qd-motif__target::after {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: var(--k2lm-cyan);
  opacity: 0.35;
}

.k2lm-qd-motif__arc {
  width: 2.5rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--k2lm-cyan), transparent);
  opacity: 0.35;
  transform: scaleX(0.4);
  transition: opacity var(--k2lm-med) ease, transform var(--k2lm-slow) var(--k2lm-ease);
}

.k2lm-qd-motif__heart {
  width: 1.35rem;
  height: 1.35rem;
  color: var(--k2lm-blue);
  opacity: 0.4;
  transition: opacity var(--k2lm-med) ease, transform var(--k2lm-med) var(--k2lm-ease), filter var(--k2lm-med) ease;
}

#klic2help-quick-donation.k2lm-qd[data-k2lm-step="1"] .k2lm-qd-motif__target--1,
#klic2help-quick-donation.k2lm-qd.is-amount-ready .k2lm-qd-motif__target--1 {
  opacity: 1;
  box-shadow: var(--k2lm-halo), inset 0 0 0 3px rgba(62, 200, 255, 0.28);
  transform: scale(1.08);
}

#klic2help-quick-donation.k2lm-qd.is-amount-ready .k2lm-qd-motif__arc {
  opacity: 0.85;
  transform: scaleX(1);
}

#klic2help-quick-donation.k2lm-qd.is-paying .k2lm-qd-motif__target--2,
#klic2help-quick-donation.k2lm-qd[data-k2lm-step="2"] .k2lm-qd-motif__target--2 {
  opacity: 1;
  box-shadow: var(--k2lm-halo);
  transform: scale(1.08);
}

#klic2help-quick-donation.k2lm-qd.is-success .k2lm-qd-motif__heart {
  opacity: 1;
  transform: scale(1.2);
  filter: drop-shadow(0 0 10px rgba(62, 200, 255, 0.85));
  animation: k2lm-heart-impact var(--k2lm-impact) var(--k2lm-ease) both;
}

#klic2help-quick-donation.k2lm-qd .quick-donation-amount-btn.is-selected,
#klic2help-quick-donation.k2lm-qd .quick-donation-amount-btn[aria-pressed="true"] {
  border-color: var(--k2lm-blue) !important;
  color: var(--k2lm-blue-deep) !important;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(62, 200, 255, 0.18), transparent 55%),
    linear-gradient(160deg, #fff 0%, #eaf6fc 100%) !important;
  box-shadow: var(--k2lm-halo-soft), var(--k2h-depth-2, 0 12px 32px rgba(14, 36, 56, 0.1)) !important;
}

#klic2help-quick-donation.k2lm-qd .quick-donation-payment.is-visible {
  animation: k2lm-surface-rise var(--k2lm-slow) var(--k2lm-ease) both;
}

#klic2help-quick-donation.k2lm-qd.is-loading {
  box-shadow: var(--k2h-depth-2, 0 12px 32px rgba(14, 36, 56, 0.1)), var(--k2lm-halo-soft) !important;
}

#klic2help-quick-donation.k2lm-qd.is-loading .k2lm-qd-motif__target {
  animation: k2lm-target-idle 1.4s ease-in-out infinite;
}

#klic2help-quick-donation.k2lm-qd.is-error {
  animation: k2lm-error-shake 320ms var(--k2lm-ease) both;
  box-shadow: 0 0 0 1px rgba(200, 60, 60, 0.25), 0 12px 28px rgba(14, 36, 56, 0.1) !important;
}

#klic2help-quick-donation.k2lm-qd.is-success {
  box-shadow: var(--k2lm-halo), var(--k2h-depth-2, 0 12px 32px rgba(14, 36, 56, 0.1)) !important;
}

#klic2help-quick-donation.k2lm-qd .quick-donation-status--success {
  position: relative;
}
#klic2help-quick-donation.k2lm-qd .quick-donation-status--success::before {
  content: "";
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 0.4rem;
  vertical-align: -0.15rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231a8fd4'%3E%3Cpath d='M12 21s-6.7-4.35-9.33-7.3C.7 11.45.5 8.2 2.4 6.35A5.1 5.1 0 0 1 12 6.1a5.1 5.1 0 0 1 9.6.25c1.9 1.85 1.7 5.1-.27 7.35C18.7 16.65 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ========== Components (logo codes) ========== */
.btn--base.k2lm-cta,
.btn--accent.k2lm-cta,
.k2h-cta-glow {
  position: relative;
  overflow: hidden;
}
.btn--base.k2lm-cta:hover,
.btn--accent.k2lm-cta:hover,
.k2h-cta-glow:hover {
  box-shadow: var(--k2lm-halo-soft), 0 10px 24px rgba(14, 36, 56, 0.12) !important;
}

.k2lm-focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--k2lm-cyan), var(--k2lm-halo-soft) !important;
}

.campaign-item.k2-card.k2lm-card {
  transition: transform var(--k2lm-med) var(--k2lm-ease), box-shadow var(--k2lm-med) var(--k2lm-ease);
}
.campaign-item.k2-card.k2lm-card:hover {
  box-shadow: var(--k2lm-halo-soft), 0 18px 40px rgba(14, 36, 56, 0.12);
}

.k2lm-toast-success {
  box-shadow: var(--k2lm-halo-soft);
}

.k2lm-loader {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid rgba(26, 143, 212, 0.2);
  border-top-color: var(--k2lm-cyan);
  animation: k2lm-spin 0.85s linear infinite;
}

.k2lm-progress {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(26, 143, 212, 0.12);
}
.k2lm-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--k2lm-blue-deep), var(--k2lm-cyan));
  box-shadow: var(--k2lm-halo-soft);
  transition: width var(--k2lm-slow) var(--k2lm-ease);
}

.k2lm-empty-heart {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 0.75rem;
  color: var(--k2lm-blue);
  filter: drop-shadow(0 0 12px rgba(62, 200, 255, 0.35));
  animation: k2lm-heart-float var(--k2lm-idle) ease-in-out infinite;
}

/* Dashboard / admin restrained */
.dashboard-item.k2-card.k2lm-widget:hover,
.user-count-wrapper.k2lm-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(14, 36, 56, 0.1) !important;
}

.k2lm-tab-active {
  box-shadow: inset 0 -2px 0 var(--k2lm-cyan);
}

/* ========== Keyframes ========== */
@keyframes k2lm-fade-in {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes k2lm-cursor-in {
  0% { opacity: 0; transform: translate(10px, -10px) scale(0.8); }
  70% { opacity: 1; transform: translate(-2px, 2px) scale(1.05); }
  100% { opacity: 1; transform: translate(0, 0) scale(1); }
}
@keyframes k2lm-ring-ripple {
  0% { opacity: 0.9; transform: scale(0.7); }
  100% { opacity: 0; transform: scale(1.55); }
}
@keyframes k2lm-arc-draw {
  from { opacity: 0; stroke-dashoffset: 180; }
  to { opacity: 1; stroke-dashoffset: 0; }
}
@keyframes k2lm-heart-rise {
  0% { opacity: 0; transform: translateY(12px) scale(0.85); filter: brightness(0.8); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.06); filter: brightness(1.15); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}
@keyframes k2lm-hand-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes k2lm-halo-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes k2lm-heart-float {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 8px rgba(62, 200, 255, 0.35)); }
  50% { transform: translateY(-5px) scale(1.035); filter: drop-shadow(0 0 16px rgba(62, 200, 255, 0.55)); }
}
@keyframes k2lm-heart-impact {
  0% { transform: scale(1); filter: brightness(1); }
  25% { transform: scale(0.94); }
  45% { transform: scale(1.12); filter: brightness(1.35) drop-shadow(0 0 18px rgba(62, 200, 255, 0.9)); }
  70% { transform: scale(1.04); }
  100% { transform: scale(1); filter: brightness(1.1); }
}
@keyframes k2lm-target-ring {
  0% { opacity: 0.7; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(1.18); }
}
@keyframes k2lm-ripple-burst {
  0% { opacity: 0.85; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(9); }
}
@keyframes k2lm-strike {
  0% { transform: translate(0, 0) scale(1); }
  40% { transform: translate(3px, 4px) scale(0.94); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes k2lm-hand-sweep {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.18); }
  100% { filter: brightness(1.05); }
}
@keyframes k2lm-surface-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes k2lm-target-idle {
  0%, 100% { box-shadow: inset 0 0 0 3px rgba(62, 200, 255, 0.12); }
  50% { box-shadow: inset 0 0 0 3px rgba(62, 200, 255, 0.35), 0 0 12px rgba(62, 200, 255, 0.35); }
}
@keyframes k2lm-error-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}
@keyframes k2lm-spin {
  to { transform: rotate(360deg); }
}

/* ========== Responsive ========== */
@media (max-width: 991px) {
  .k2lm-hero .k2h-hero__scene {
    width: min(52vw, 280px);
    height: min(52vw, 280px);
    right: 2%;
    top: 30%;
    opacity: 0.92;
  }
}

@media (max-width: 575px) {
  .k2lm-hero .k2h-hero__scene {
    display: block !important;
    position: absolute;
    right: 4%;
    top: 12%;
    width: 42vw;
    height: 42vw;
    max-width: 160px;
    max-height: 160px;
    opacity: 0.9;
  }
  .k2lm-hero .k2lm-logo-scene__svg {
    display: none;
  }
  .k2lm-hero .k2lm-logo-static {
    display: block;
  }
  .k2lm-hero .k2lm-hero__halo {
    display: none;
  }
}

/* ========== Reduced motion ========== */
@media (prefers-reduced-motion: reduce) {
  .k2lm-logo-scene .k2lm-target,
  .k2lm-logo-scene .k2lm-cursor,
  .k2lm-logo-scene .k2lm-arc,
  .k2lm-logo-scene .k2lm-heart,
  .k2lm-logo-scene .k2lm-hand,
  .k2lm-hero__halo {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
  }

  .k2lm-heart-float,
  .k2lm-heart-impact.is-impacting,
  .k2lm-target-pulse.is-pulsing::before,
  .k2lm-target-pulse.is-pulsing::after,
  .k2lm-double-ripple.is-ripping::before,
  .k2lm-double-ripple.is-ripping::after,
  .k2lm-cursor-strike.is-striking,
  .k2lm-hand-glow.is-protecting,
  .k2lm-loader,
  .k2lm-empty-heart,
  #klic2help-quick-donation.k2lm-qd.is-error,
  #klic2help-quick-donation.k2lm-qd.is-success .k2lm-qd-motif__heart,
  #klic2help-quick-donation.k2lm-qd.is-loading .k2lm-qd-motif__target {
    animation: none !important;
  }

  .k2lm-logo-scene__svg {
    display: none;
  }
  .k2lm-logo-static {
    display: block !important;
  }
}

html.k2lm-reduced .k2lm-logo-scene__svg {
  display: none;
}
html.k2lm-reduced .k2lm-logo-static {
  display: block !important;
}
