/* ============================================================
   MOTION.CSS — Animasi mikro + jaringan (aman, responsif)
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html {
  transition: background-color 0.22s ease, color 0.22s ease;
}
html.theme-animating,
html.theme-animating body,
html.theme-animating .dash-card,
html.theme-animating .panel,
html.theme-animating .stat-card,
html.theme-animating .mhs-stat-card,
html.theme-animating .card,
html.theme-animating .student-card,
html.theme-animating .navbar,
html.theme-animating .topbar,
html.theme-animating .hub-panel,
html.theme-animating .portal-hl-card {
  transition:
    background-color 0.26s ease,
    color 0.26s ease,
    border-color 0.26s ease,
    box-shadow 0.26s ease !important;
}

.page-view.active,
.mhs-section.active,
.admin-section.active {
  animation: motionIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes motionIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .page-view.active,
  .mhs-section.active,
  .admin-section.active {
    animation-duration: 0.2s;
  }
}

@media (hover: hover) and (pointer: fine) {
  .hero-cta,
  .mhs-quick-btn,
  .btn-submit,
  .btn-primary,
  .am-quick-chip,
  .nav-portal-cta,
  .btn-hub,
  .btn-mahasiswa-cta,
  .portal-btn-primary {
    transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 0.16s ease, filter 0.16s ease;
  }
  .hero-cta:hover,
  .mhs-quick-btn:hover,
  .btn-submit:hover,
  .btn-primary:hover,
  .am-quick-chip:hover,
  .nav-portal-cta:hover,
  .btn-hub:hover,
  .btn-mahasiswa-cta:hover,
  .portal-btn-primary:hover {
    transform: translateY(-2px);
  }
  .hero-cta:active,
  .mhs-quick-btn:active,
  .btn-submit:active,
  .btn-primary:active {
    transform: translateY(0);
  }
  .card,
  .student-card,
  .portal-hl-card,
  .mhs-stat-card,
  .stat-card,
  .mhs-teman-card,
  .mhs-link-card {
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 0.18s ease;
  }
  .card:hover,
  .student-card:hover,
  .portal-hl-card:hover,
  .mhs-teman-card:hover {
    transform: translateY(-3px);
  }
}

.mhs-nav-item,
.mhs-bnav-item,
.sidebar nav a,
.nav-link {
  transition: background-color 0.14s ease, color 0.14s ease;
}

.mhs-bnav-item.active .bnav-ic {
  animation: motionPop 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes motionPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.mhs-progress-ring { transition: background 0.35s ease; }
.mhs-completeness-bar > i {
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.mhs-toast {
  animation: motionToast 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes motionToast {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.theme-toggle-btn,
[data-theme-toggle] {
  transition: transform 0.12s ease, background-color 0.2s ease;
}
.theme-toggle-btn:active,
[data-theme-toggle]:active {
  transform: scale(0.96);
}

.hub-identity-card {
  animation: motionIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
  overflow: hidden;
}

.mhs-stat-grid .mhs-stat-card:nth-child(1) { animation: motionIn 0.3s 0.03s both; }
.mhs-stat-grid .mhs-stat-card:nth-child(2) { animation: motionIn 0.3s 0.06s both; }
.mhs-stat-grid .mhs-stat-card:nth-child(3) { animation: motionIn 0.3s 0.09s both; }
.mhs-stat-grid .mhs-stat-card:nth-child(4) { animation: motionIn 0.3s 0.12s both; }

.stat-cards .stat-card:nth-child(1) { animation: motionIn 0.3s 0.03s both; }
.stat-cards .stat-card:nth-child(2) { animation: motionIn 0.3s 0.06s both; }
.stat-cards .stat-card:nth-child(3) { animation: motionIn 0.3s 0.09s both; }
.stat-cards .stat-card:nth-child(4) { animation: motionIn 0.3s 0.12s both; }
.stat-cards .stat-card:nth-child(5) { animation: motionIn 0.3s 0.15s both; }
.stat-cards .stat-card:nth-child(6) { animation: motionIn 0.3s 0.18s both; }

a:focus-visible,
button:focus-visible,
.nav-link:focus-visible,
.mhs-nav-item:focus-visible,
.mhs-bnav-item:focus-visible,
.form-control:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
[data-theme="dark"] a:focus-visible,
[data-theme="dark"] button:focus-visible {
  outline-color: #60a5fa;
}

/* ---- Jaringan / network micro ---- */
.site-announce-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: netPulse 2s ease-out infinite;
  flex-shrink: 0;
}

@keyframes netPulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hub-identity-card::after {
  content: "";
  position: absolute;
  right: -20%;
  top: -30%;
  width: 60%;
  height: 80%;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.12) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.1) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 50% 70%, rgba(255, 255, 255, 0.08) 0 2px, transparent 3px);
  pointer-events: none;
  animation: netDrift 12s linear infinite;
  opacity: 0.7;
}

@keyframes netDrift {
  0% { transform: translate(0, 0); opacity: 0.55; }
  50% { transform: translate(-6px, 4px); opacity: 0.75; }
  100% { transform: translate(0, 0); opacity: 0.55; }
}

.dash-welcome {
  position: relative;
  overflow: hidden;
}
.dash-welcome::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 30%, rgba(255, 255, 255, 0.15) 0 1.5px, transparent 2px),
    radial-gradient(circle at 45% 70%, rgba(255, 255, 255, 0.1) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 25%, rgba(255, 255, 255, 0.12) 0 1.5px, transparent 2px),
    radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.08) 0 1px, transparent 2px);
  pointer-events: none;
  opacity: 0.8;
  animation: netDrift 14s ease-in-out infinite;
}

@media (hover: hover) and (pointer: fine) {
  .mhs-link-card:hover {
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2), 0 8px 24px -8px rgba(37, 99, 235, 0.25);
  }
}

.mhs-skeleton,
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.12) 25%,
    rgba(148, 163, 184, 0.22) 50%,
    rgba(148, 163, 184, 0.12) 75%
  );
  background-size: 200% 100%;
  animation: netShimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes netShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.site-loader-bar::after {
  animation: netShimmer 1.1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .site-announce-dot,
  .hub-identity-card::after,
  .dash-welcome::after,
  .mhs-skeleton,
  .skeleton {
    animation: none !important;
  }
}
