/* Phase 4 — Accessibility, mobile, performance, final polish */

/* Skip link */
.skip-link {
  position: absolute;
  top: -120px;
  left: 16px;
  z-index: 10001;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ax-ink, #1e1b3a);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: top 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.skip-link:focus {
  top: 16px;
  outline: 2px solid var(--ax-cyan, #a5f3fc);
  outline-offset: 2px;
}

/* Focus visible — keyboard navigation */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--ax-primary, #4f46e5);
  outline-offset: 3px;
}

.btn:focus-visible,
.site-nav-links a:focus-visible,
.emr-tile:focus-visible,
.safety-card:focus-visible,
.impact-tab:focus-visible {
  outline-color: var(--ax-primary, #4f46e5);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
}

/* Performance — content visibility for below-fold sections */
.section,
.showcase-section,
.cta-band {
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

.hero-premium {
  content-visibility: visible;
}

/* Section polish — remaining sections */
.showcase-section.scroll-story .showcase-phone {
  will-change: transform;
}

.safety-card {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.35s ease, box-shadow 0.35s ease;
}

.safety-card.is-highlight,
.safety-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.showcase-badge {
  transition: transform 0.35s ease, background 0.35s ease;
}

.showcase-badge:hover {
  transform: translateY(-2px);
}

/* Impact tab panel crossfade */
.impact-panel {
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.impact-panel.is-entering {
  animation: impactFadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes impactFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Integrations EMR wave reveal */
.emr-tile {
  opacity: 0;
  transform: translateY(16px) scale(0.96);
}

.emr-tile.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* CTA final premium */
.cta-final.scroll-story .container {
  position: relative;
}

.cta-final .btn-white {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}

.cta-final .btn-white:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.cta-final::before {
  display: none;
}

/* Footer polish */
.footer-premium a {
  transition: color 0.25s ease, opacity 0.25s ease;
}

.footer-premium a:hover {
  color: var(--ax-cyan, #a5f3fc);
}

.footer-col a {
  display: inline-block;
  padding: 2px 0;
}

.footer-bottom a:focus-visible {
  outline-offset: 2px;
}

/* Mobile — hero and dashboard */
@media (max-width: 1024px) {
  .hero-premium {
    min-height: auto;
    padding-top: 100px;
    padding-bottom: 48px;
  }

  .hero-stage {
    margin-top: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .hero-stage .heroDash-frame {
    min-width: min(100%, 520px);
    scroll-snap-align: center;
  }

  .cursor-glow,
  .ambient-particles {
    display: none !important;
  }

  .experience-card[data-tilt]:hover {
    transform: none;
  }
}

@media (max-width: 768px) {
  .hero-premium h1 {
    font-size: clamp(2rem, 9vw, 2.75rem);
  }

  .hero-trust {
    justify-content: center;
  }

  .showcase-split {
    gap: 32px;
  }

  .impact-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .live-demo-scenarios {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .sticky-demo {
    bottom: 16px;
    right: 16px;
  }

  .sticky-demo .btn {
    min-height: 44px;
    padding: 12px 18px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }

  .section,
  .showcase-section,
  .cta-band {
    content-visibility: visible;
  }

  .safety-card,
  .emr-tile,
  .showcase-badge,
  .cta-final .btn-white,
  .impact-panel {
    transition: none !important;
    animation: none !important;
  }

  .emr-tile {
    opacity: 1;
    transform: none;
  }

  .gsap-reveal {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
}
