/* Karekod mark — SVG + CSS animation (Phase 2B). No infinite intro loop. */

.brand-mark {
  display: block;
  flex-shrink: 0;
}

.brand-mark--static .kk-finder-frame,
.brand-mark--static .kk-finder-module,
.brand-mark--static .kk-k-stroke,
.brand-mark--static .kk-node {
  opacity: 1;
  stroke-dashoffset: 0;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark--animate .kk-finder-frame,
  .brand-mark--animate .kk-finder-module,
  .brand-mark--animate .kk-k-stroke,
  .brand-mark--animate .kk-node {
    animation: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
    transform: none !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .brand-mark--animate .kk-finder-frame {
    opacity: 0;
    animation: kkFinderIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .brand-mark--animate .kk-finder-module {
    opacity: 0;
    animation: kkModuleIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(0.08s + var(--kk-mod-i, 0) * 0.07s);
  }

  .brand-mark--animate .kk-k-stroke {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: kkKDraw 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(0.28s + var(--kk-k-i, 0) * 0.06s);
  }

  .brand-mark--animate .kk-k-stroke[data-kk-part="stem"] {
    --kk-k-i: 0;
  }

  .brand-mark--animate .kk-k-stroke[data-kk-part="upper"] {
    --kk-k-i: 1;
  }

  .brand-mark--animate .kk-k-stroke[data-kk-part="lower"] {
    --kk-k-i: 2;
  }

  .brand-mark--animate .kk-node {
    opacity: 0;
    transform-origin: 36px 14px;
    animation: kkNodePulse 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.62s;
  }

  .brand-lockup:hover .brand-mark--static .kk-finder-frame,
  .brand-lockup:focus-visible .brand-mark--static .kk-finder-frame {
    stroke: #1a75ff;
    transition: stroke 0.2s ease;
  }

  .brand-lockup:hover .brand-mark--static .kk-node,
  .brand-lockup:focus-visible .brand-mark--static .kk-node {
    opacity: 1;
    transition: opacity 0.2s ease;
  }

  .brand-mark.is-loading .kk-finder-module {
    animation: kkFinderLoad 1.1s ease-in-out infinite;
  }

  .brand-mark.is-loading .kk-k-stroke,
  .brand-mark.is-loading .kk-node {
    animation: none;
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

@keyframes kkFinderIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes kkModuleIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes kkKDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes kkNodePulse {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  60% {
    opacity: 1;
    transform: scale(1.15);
  }
  100% {
    opacity: 0.85;
    transform: scale(1);
  }
}

@keyframes kkFinderLoad {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}
