/* ============================================================================
   HISOBCHI MOTION V2 — LOGIN SENTINELS (motion-login.css)
   Ikki abstrakt geometrik "data-sentinel" character. 6 holat:
   idle / email / password (privacy joke) / reveal / error / success.
   QOIDA: faqat transform + opacity + stroke-dashoffset animatsiya qilinadi.
   Stage pointer-events:none va aria-hidden — inputlar hech qachon bloklanmaydi.
   ========================================================================== */

.hl-stage {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  pointer-events: none;        /* login inputlari har doim bosiladi */
  user-select: none;
  -webkit-user-select: none;
}
.hl-stage svg { display: block; width: 100%; height: auto; overflow: visible; }

.hl-caption {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%) translateY(4px);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--his-mo-mute, #8aa79b);
  opacity: 0;
  transition: opacity var(--his-mo-normal, 220ms) var(--his-mo-ease, ease),
              transform var(--his-mo-normal, 220ms) var(--his-mo-ease, ease);
}
.hl-stage.hl-ph-password .hl-caption {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Character qismlari ---- */
.hl-char { transform-box: fill-box; transform-origin: 50% 100%; }
.hl-body { transform-box: fill-box; transform-origin: 50% 100%; }
.hl-face { transform-box: fill-box; transform-origin: 50% 50%; }
.hl-eye  { transform-box: fill-box; transform-origin: 50% 50%; }
.hl-pupil { transition: transform 120ms linear; }
.hl-shadow { opacity: 0.18; }
.hl-flow {
  stroke-dasharray: 6 7;
  stroke-dashoffset: 260;
  opacity: 0;
}
.hl-platform { transform-box: fill-box; transform-origin: center; }
.hl-data-arc { stroke-dasharray: 3 7; opacity: .18; animation: hlArcReveal 900ms var(--his-mo-ease, ease) 1 both; }
.hl-data-arc-b { animation-delay: 120ms; }
.hl-data-node { opacity: .4; transform-box: fill-box; transform-origin: center; animation: hlNodeReveal 520ms var(--his-mo-ease, ease) 1 both; }
.hl-data-node-1,.hl-data-node-4 { animation-delay: 120ms; }.hl-data-node-2,.hl-data-node-5 { animation-delay: 220ms; }
@keyframes hlArcReveal { from{stroke-dashoffset:80;opacity:0} to{stroke-dashoffset:0;opacity:.18} }
@keyframes hlNodeReveal { from{transform:scale(.2);opacity:0} to{transform:scale(1);opacity:.4} }

/* ============================================================================
   1) IDLE — nafas olish (2–3px), xira qarab qo'yish, jonli lekin sokin.
   Blink va glance JS tomonidan klass orqali qo'yiladi (takror mexanik emas).
   ========================================================================== */
.hl-stage.hl-ph-idle .hl-char-a .hl-body { animation: hlBreath 7s ease-in-out infinite; }
.hl-stage.hl-ph-idle .hl-char-b .hl-body { animation: hlBreath 8.4s ease-in-out -3.6s infinite; }
.hl-stage.hl-ph-idle .hl-char-a .hl-shadow { animation: hlShadow 7s ease-in-out infinite; }
.hl-stage.hl-ph-idle .hl-char-b .hl-shadow,
.hl-stage .hl-platform { animation: hlShadow 8.4s ease-in-out -3.6s infinite; }

@keyframes hlBreath {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2.5px); }
}
@keyframes hlShadow {
  0%, 100% { transform: scaleX(1); opacity: 0.18; }
  50%      { transform: scaleX(0.96); opacity: 0.14; }
}

/* Blink: JS .hl-blink klassini 130ms ga qo'yadi (mexanik interval emas) */
.hl-eye { transition: transform 140ms var(--his-mo-ease-io, ease); }
.hl-stage.hl-blink .hl-eye { transform: scaleY(0.12); }
/* Password holatida A ko'zi yopiq qoladi — blink uni ochib yubormasligi kerak */
.hl-stage.hl-ph-password.hl-blink .hl-char-a .hl-eye { transform: scaleY(0.06); }

/* Glance: qisqa o'zaro qaramaq (faqat idle'da, JS klassi) */
.hl-stage.hl-glance .hl-char-a .hl-pupil { transform: translateX(2.6px); }
.hl-stage.hl-glance .hl-char-b .hl-pupil { transform: translateX(-2.6px); }

/* ============================================================================
   2) EMAIL FOCUS — ko'zlar yozuvni kuzatadi (JS pupil transform orqali),
   tana inputga qarab eng ko'pi 4–6° egiladi.
   ========================================================================== */
.hl-stage.hl-ph-email .hl-char-a { transform: rotate(3.5deg); }
.hl-stage.hl-ph-email .hl-char-b { transform: rotate(-4.5deg); }
.hl-char { transition: transform var(--his-mo-major, 380ms) var(--his-mo-ease, ease); }

/* ============================================================================
   3) PASSWORD — privacy joke (bir martalik, 500–800ms):
   A ko'zini yumadi + chetga buriladi; B uqib qaraydi; A B'ni itaradi;
   ikkalasi chetga qarab qoladi. Yakuniy POSE klassda saqlanadi.
   ========================================================================== */
.hl-stage.hl-ph-password .hl-char-a .hl-eye { transform: scaleY(0.06); }
.hl-stage.hl-ph-password .hl-char-a { transform: rotate(-7deg) translateX(-5px); }
.hl-stage.hl-ph-password .hl-char-a .hl-pupil { transform: translateX(-2.6px); }
.hl-stage.hl-ph-password .hl-char-b .hl-pupil { transform: translateX(2.6px); }
.hl-stage.hl-ph-password .hl-char-b { transform: rotate(5deg) translateX(3px); }

/* Joke one-shot: B uqib qarash → A itarish → B silkinish (700ms ichida tugaydi) */
.hl-stage.hl-joke-play .hl-char-b .hl-eye { animation: hlPeek 700ms var(--his-mo-ease-io, ease) 1; }
.hl-stage.hl-joke-play .hl-char-a { animation: hlNudge 700ms var(--his-mo-ease-io, ease) 1; }
.hl-stage.hl-joke-play .hl-char-b { animation: hlWobble 700ms var(--his-mo-ease-io, ease) 1; }
@keyframes hlPeek {
  0%   { transform: scaleY(1); }
  18%  { transform: scaleY(1); }
  30%  { transform: scaleY(0.85); }
  46%  { transform: scaleY(1); }
  100% { transform: scaleY(1); }
}
@keyframes hlNudge {
  0%, 40% { transform: rotate(-7deg) translateX(-5px); }
  55%     { transform: rotate(-7deg) translateX(-1px); }
  70%, 100% { transform: rotate(-7deg) translateX(-5px); }
}
@keyframes hlWobble {
  0%, 54% { transform: rotate(5deg) translateX(3px); }
  64%     { transform: rotate(2deg) translateX(1px); }
  76%     { transform: rotate(7deg) translateX(4px); }
  88%, 100% { transform: rotate(5deg) translateX(3px); }
}

/* ============================================================================
   4) REVEAL (show password) — qisqa hayrat: ko'z kengayadi, yarim ochiq
   holatga o'tadi. Masxara YO'Q.
   ========================================================================== */
.hl-stage.hl-ph-reveal .hl-eye { animation: hlSurprise 560ms var(--his-mo-ease-io, ease) 1 forwards; }
@keyframes hlSurprise {
  0%   { transform: scaleY(1); }
  35%  { transform: scaleY(1.35); }
  100% { transform: scaleY(0.78); }
}

/* ============================================================================
   5) ERROR — 2–3px yumshoq lateral nudge + o'zaro qaramaq.
   Qizil chaqnash YO'Q (rang business UI'da qoladi).
   ========================================================================== */
.hl-stage.hl-err-play .hl-char-a { animation: hlErrNudgeA 300ms var(--his-mo-ease-io, ease) 1; }
.hl-stage.hl-err-play .hl-char-b { animation: hlErrNudgeB 300ms var(--his-mo-ease-io, ease) 1; }
.hl-stage.hl-err-play .hl-char-a .hl-pupil { transform: translateX(2.6px); }
.hl-stage.hl-err-play .hl-char-b .hl-pupil { transform: translateX(-2.6px); }
/* error holati saqlanib qolsa ham o'zaro qaramaq ko'rinib tursin (statik pose) */
.hl-stage.hl-ph-error .hl-char-a .hl-pupil { transform: translateX(2.6px); }
.hl-stage.hl-ph-error .hl-char-b .hl-pupil { transform: translateX(-2.6px); }
@keyframes hlErrNudgeA {
  0%, 100% { transform: translateX(0); }
  30%      { transform: translateX(-2.5px); }
  65%      { transform: translateX(1.5px); }
}
@keyframes hlErrNudgeB {
  0%, 100% { transform: translateX(0); }
  30%      { transform: translateX(2.5px); }
  65%      { transform: translateX(-1.5px); }
}

/* ============================================================================
   6) SUCCESS — ikkala sentinel orasida emerald data-flow chizig'i paydo
   bo'ladi va interfeys markaziga (pastga) oqadi. 350–500ms, dekorativ:
   auth jarayoni BUNGA bog'liq emas va kechiktirilmaydi.
   ========================================================================== */
.hl-stage.hl-ph-success .hl-flow {
  opacity: 1;
  animation: hlFlowDraw 460ms var(--his-mo-ease, ease) 1 forwards;
}
.hl-stage.hl-ph-success .hl-char-a { transform: rotate(2deg); }
.hl-stage.hl-ph-success .hl-char-b { transform: rotate(-2deg); }
.hl-stage.hl-ph-success .hl-caption { opacity: 0; }
@keyframes hlFlowDraw {
  from { stroke-dashoffset: 260; opacity: 0; }
  25%  { opacity: 1; }
  to   { stroke-dashoffset: 0; opacity: 1; }
}

/* ============================================================================
   MOBILE (≤430px): stage kichrayadi, siljishlar kamlashadi.
   ========================================================================== */
@media (max-width: 430px) {
  .hl-stage { max-width: 250px; }
  .hl-caption { font-size: 11px; }
}

/* ============================================================================
   REDUCED MOTION — MAJBURIY: loop'lar o'chadi, lekin holat POZASI saqlanadi
   (privacy hali ham tushunarli: A ko'zi yopiq, ikkalasi chetga qaragan).
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .hl-stage .hl-body,
  .hl-stage .hl-shadow,
  .hl-stage .hl-eye,
  .hl-stage .hl-char,
  .hl-stage .hl-flow { animation: none !important; transition-duration: 1ms !important; }
  .hl-stage .hl-platform,
  .hl-stage .hl-data-arc,
  .hl-stage .hl-data-node { animation: none !important; }
  .hl-stage.hl-ph-reveal .hl-eye { transform: scaleY(0.78); }
  .hl-stage.hl-ph-success .hl-flow { opacity: 1; stroke-dashoffset: 0; }
  .hl-stage.hl-ph-password .hl-caption { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Tab yashirin / section ekrandan tashqarida — ambient PAUSE (observer klassi) */
html.his-mo-hidden-tab .hl-stage .hl-body,
html.his-mo-hidden-tab .hl-stage .hl-shadow { animation-play-state: paused !important; }
html.his-mo-hidden-tab .hl-stage .hl-platform,
html.his-mo-hidden-tab .hl-stage .hl-data-arc,
html.his-mo-hidden-tab .hl-stage .hl-data-node { animation-play-state: paused !important; }
.his-mo-offscreen .hl-stage .hl-body,
.his-mo-offscreen .hl-stage .hl-shadow { animation-play-state: paused !important; }
.his-mo-offscreen .hl-stage .hl-platform,
.his-mo-offscreen .hl-stage .hl-data-arc,
.his-mo-offscreen .hl-stage .hl-data-node { animation-play-state: paused !important; }
