/* ============================================
   MDx OS Animations & Polish
   Session 31: Shared animation utilities,
   iPad polish, and accessibility enhancements.
   All animations GPU-accelerated (transform/opacity).
   All respect prefers-reduced-motion.
   ============================================ */

/* ============================================
   SKIP TO CONTENT
   ============================================ */

.skip-to-content {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  font-weight: 500;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-to-content:focus {
  top: var(--space-4);
}

/* ============================================
   TOUCH TARGET ENFORCEMENT
   Minimum 44x44px for all interactive elements
   ============================================ */

/* Small icon buttons that need larger touch targets */
.touch-target-44 {
  min-width: 44px;
  min-height: 44px;
}

/* ============================================
   SECTION TRANSITIONS
   Fade-in for console section switching
   ============================================ */

.console-section {
  animation: section-fade-in var(--duration-normal) var(--ease-out);
}

@keyframes section-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tab panel content fade */
.tabs__panel {
  animation: none;
}

.tabs__panel:not([hidden]) {
  animation: tab-content-fade var(--duration-normal) var(--ease-out);
}

@keyframes tab-content-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================
   CARD HOVER POLISH
   Subtle elevation on hover
   ============================================ */

.registry-card:hover,
.dash-subsystem:hover,
.dash-quicklink:hover {
  transform: translateY(-1px);
}

/* ============================================
   BUTTON ACTIVE STATES
   Subtle press feedback
   ============================================ */

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

/* ============================================
   FOCUS RING — GLOBAL FALLBACK
   Catch any interactive element that missed
   :focus-visible in component styles
   ============================================ */

a:focus-visible,
button:focus-visible,
[role="tab"]:focus-visible,
[role="radio"]:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-primary, #4285F4);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--color-primary, #4285F4);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15);
}

/* ============================================
   STATUS DOT PULSE
   Gentle pulse for "checking" health dots
   ============================================ */

.status-dot--checking {
  animation: status-pulse 2s var(--ease-in-out) infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ============================================
   TOAST ENHANCEMENTS
   Already defined in components.css but ensure
   toasts have proper ARIA role styling
   ============================================ */

.toast[role="alert"] {
  /* Ensure screen readers announce immediately */
}

/* ============================================
   LINK HOVER TRANSITION
   Consistent color transition on all links
   ============================================ */

a {
  transition: color var(--duration-fast, 100ms) ease;
}

/* ============================================
   REDUCED MOTION — COMPREHENSIVE OVERRIDE
   ============================================ */

@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;
  }

  .console-section,
  .tabs__panel:not([hidden]),
  .registry-card:hover,
  .dash-subsystem:hover,
  .dash-quicklink:hover {
    animation: none;
    transform: none;
  }

  .skip-to-content:focus {
    transition: none;
  }
}
