/* ══════════════════════════════════════════════════════════════
   CMMava — Animations & Scroll Effects
   ══════════════════════════════════════════════════════════════ */

/* ── KEYFRAMES ──────────────────────────────────────────────── */

@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.6; }
  50%       { transform: translateX(-50%) translateY(8px); opacity: 1; }
}

@keyframes scrollWheel {
  0%   { transform: translateY(0); opacity: 1; }
  60%  { transform: translateY(10px); opacity: 0; }
  61%  { transform: translateY(0); opacity: 0; }
  100% { opacity: 1; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes orbitSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Counter-rotate orbit dots to stay upright */
.orbit-ring-1 { animation: orbitSpin 16s linear infinite; }
.orbit-ring-1 .orbit-dot { animation: orbitSpin 16s linear infinite reverse; }
.orbit-ring-2 { animation: orbitSpin 28s linear infinite reverse; }
.orbit-ring-2 .orbit-dot { animation: orbitSpin 28s linear infinite; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0,113,227,0.2), 0 0 40px rgba(0,113,227,0.05); }
  50%       { box-shadow: 0 0 30px rgba(0,113,227,0.4), 0 0 60px rgba(0,113,227,0.15); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes borderRotate {
  from { --border-angle: 0turn; }
  to   { --border-angle: 1turn; }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40%           { transform: scale(1.2); opacity: 1; }
}

/* ── REVEAL ANIMATIONS (Intersection Observer) ──────────────── */

.reveal-up {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--delay, 0s),
    transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--delay, 0s);
}

.reveal-fade {
  opacity: 0;
  transform: scale(0.97) translateY(16px);
  transition:
    opacity 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--delay, 0s),
    transform 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--delay, 0s);
}

.reveal-up.is-visible,
.reveal-fade.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── HERO ENTRANCE (no JS needed, pure CSS) ──────────────────── */

.hero-eyebrow  { animation: slideUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s both; }
.hero-title    { animation: slideUp 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.32s both; }
.hero-subtitle { animation: slideUp 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.46s both; }
.hero-actions  { animation: slideUp 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.58s both; }

/* Remove JS-based reveal-up from hero elements */
.hero-content .reveal-up {
  opacity: 1;
  transform: none;
  transition: none;
  animation-delay: var(--delay, 0s);
}

/* ── BENTO CARD HOVER GLOW ───────────────────────────────────── */

.bento-card {
  --mouse-x: 50%;
  --mouse-y: 50%;
}

/* Auth card subtle pulse when visible */
.auth-card {
  animation: glowPulse 4s ease-in-out infinite;
}

/* ── GRADIENT TEXT ANIMATION ─────────────────────────────────── */

.gradient-text {
  background-size: 200% 200%;
  animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%;   }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%;   }
}

/* ── SECTION SEPARATOR GRADIENT LINE ────────────────────────── */

section::before {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-border), transparent);
  margin-bottom: var(--section-py);
  opacity: 0.5;
}

#hero::before { display: none; }

/* ── NAV ACTIVE INDICATOR ────────────────────────────────────── */

.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px; left: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--c-accent);
  transform: translateX(-50%) scale(0);
  transition: transform 0.2s ease;
}
.nav-link.active::after { transform: translateX(-50%) scale(1); }

/* ── APP LINK CARD SHIMMER ON HOVER ─────────────────────────── */

.app-link-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 60%
  );
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.app-link-card:hover::after {
  opacity: 1;
  animation: shimmer 1.5s ease infinite;
}

/* ── SECURITY BADGE PULSE ────────────────────────────────────── */

.security-badge:first-child svg {
  animation: glowPulseIcon 3s ease-in-out infinite;
}

@keyframes glowPulseIcon {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1; filter: drop-shadow(0 0 4px var(--c-success)); }
}

/* ── ORBIT FLOAT ─────────────────────────────────────────────── */

.orbit-center {
  animation: floatY 4s ease-in-out infinite;
}

/* ── SCROLL HINT: SCROLL INDICATOR ──────────────────────────── */

#scroll-indicator {
  animation: scrollBounce 2s ease-in-out 1.5s infinite;
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes fadeInScroll {
  from { opacity: 0; }
  to   { opacity: 0.7; }
}

/* Show scroll indicator after hero animations finish */
#scroll-indicator {
  animation:
    fadeInScroll 0.8s ease 1.2s forwards,
    scrollBounce 2.2s ease-in-out 2s infinite;
}

/* ── SPINNER DOTS (auth loading alternative) ─────────────────── */

.loading-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.loading-dots span {
  display: block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-accent);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

/* ── SECTION TRANSITIONS ─────────────────────────────────────── */

section { opacity: 1; }

/* ── BUTTON PRESS FEEDBACK ───────────────────────────────────── */

.btn-primary:active,
.btn-ghost:active,
.btn-microsoft:active {
  transform: scale(0.98) translateY(0) !important;
  transition-duration: 80ms !important;
}

/* ── IFRAME FULLSCREEN STYLES ────────────────────────────────── */

.sharepoint-embed-wrap:fullscreen {
  background: var(--c-bg);
  padding: 0;
  border-radius: 0;
}
.sharepoint-embed-wrap:fullscreen #sharepoint-iframe {
  height: calc(100vh - 56px);
}

/* ── FORM INPUT FOCUS EFFECT ─────────────────────────────────── */

.form-input {
  position: relative;
}
.form-group {
  position: relative;
}
.form-group::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0;
  height: 2px;
  background: var(--grad-accent);
  transition: width 0.3s ease;
  border-radius: var(--r-full);
  pointer-events: none;
}
.form-group:focus-within::after {
  width: 100%;
}

/* ── REDUCED MOTION OVERRIDE ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow, .hero-title, .hero-subtitle, .hero-actions,
  .reveal-up, .reveal-fade {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  #scroll-indicator { opacity: 0.7; animation: none !important; }
  .gradient-text { animation: none !important; }
  .orbit-ring-1, .orbit-ring-2 { animation: none !important; }
  .orbit-dot { animation: none !important; }
  .auth-card { animation: none !important; }
}
