/* ═══════════════════════════════════════════════════════════════
   5ELABS — Global Animation System
   Scroll-reveal, micro-interactions, floating orbs, counters
   ═══════════════════════════════════════════════════════════════ */

/* ─── Page Load Curtain ─── */
.page-curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #f8f9fa;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.page-curtain.done {
  opacity: 0;
}

/* ─── Scroll Reveal Base ─── */
[data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Directional variants */
[data-reveal="left"] {
  transform: translateX(-40px);
}
[data-reveal="left"].revealed {
  transform: translateX(0);
}

[data-reveal="right"] {
  transform: translateX(40px);
}
[data-reveal="right"].revealed {
  transform: translateX(0);
}

[data-reveal="scale"] {
  transform: scale(0.92);
}
[data-reveal="scale"].revealed {
  transform: scale(1);
}

[data-reveal="fade"] {
  transform: none;
}
[data-reveal="fade"].revealed {
  transform: none;
}

/* Stagger delays for grid children */
[data-stagger] > *:nth-child(1) { transition-delay: 0ms; }
[data-stagger] > *:nth-child(2) { transition-delay: 80ms; }
[data-stagger] > *:nth-child(3) { transition-delay: 160ms; }
[data-stagger] > *:nth-child(4) { transition-delay: 240ms; }
[data-stagger] > *:nth-child(5) { transition-delay: 320ms; }
[data-stagger] > *:nth-child(6) { transition-delay: 400ms; }
[data-stagger] > *:nth-child(7) { transition-delay: 480ms; }
[data-stagger] > *:nth-child(8) { transition-delay: 560ms; }

/* ─── Floating Orbs (pulsing background blurs) ─── */
@keyframes float-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(12px, -18px) scale(1.05); }
  50%      { transform: translate(-8px, -10px) scale(0.97); }
  75%      { transform: translate(6px, 14px) scale(1.03); }
}
.orb-float {
  animation: float-drift 8s ease-in-out infinite;
}
.orb-float-slow {
  animation: float-drift 14s ease-in-out infinite;
  animation-delay: -4s;
}

/* ─── Animated Progress Bars ─── */
[data-progress] .progress-fill {
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-progress].revealed .progress-fill {
  transform: scaleX(1);
}

/* ─── Counter Glow Pulse ─── */
@keyframes counter-glow {
  0%   { text-shadow: 0 0 0 transparent; }
  50%  { text-shadow: 0 0 20px rgba(36, 96, 157, 0.25); }
  100% { text-shadow: 0 0 0 transparent; }
}
.counter-done {
  animation: counter-glow 1s ease-out;
}

/* ─── Card Hover Lift ─── */
.hover-lift {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease;
}
.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.12),
              0 8px 16px -8px rgba(0, 0, 0, 0.08);
}

/* ─── Glowing Border on Hover ─── */
.hover-glow {
  position: relative;
  overflow: hidden;
}
.hover-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s ease;
  box-shadow: inset 0 0 0 1px rgba(36, 96, 157, 0.3);
  pointer-events: none;
}
.hover-glow:hover::after {
  opacity: 1;
}

/* ─── Icon Spin on Hover ─── */
.hover-icon-spin:hover .material-symbols-outlined {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: rotate(12deg) scale(1.15);
}

/* ─── Shimmer Sweep Effect ─── */
@keyframes shimmer-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.shimmer-on-hover {
  position: relative;
  overflow: hidden;
}
.shimmer-on-hover::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.15) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  pointer-events: none;
  z-index: 1;
}
.shimmer-on-hover:hover::before {
  animation: shimmer-sweep 0.7s ease-out;
}

/* ─── Sidebar Link Indicator ─── */
aside nav a {
  position: relative;
}
aside nav a::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 3px; height: 0;
  background: #24609d;
  border-radius: 0 4px 4px 0;
  transform: translateY(-50%);
  transition: height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
aside nav a:hover::before,
aside nav a.bg-blue-50::before,
aside nav a[class*="bg-blue"]::before {
  height: 60%;
}

/* ─── Hero Text Gradient Shift ─── */
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.animated-gradient-text {
  background: linear-gradient(135deg, #24609d, #016b5f, #24609d);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 6s ease-in-out infinite;
}

/* ─── Particle Dots Background ─── */
@keyframes particle-float-1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(30px,-20px); } }
@keyframes particle-float-2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-25px,15px); } }
@keyframes particle-float-3 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(15px,25px); } }

.particle-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.particle-field .dot {
  position: absolute;
  background: radial-gradient(circle at 30% 30%, rgba(36, 96, 157, 0.4), rgba(36, 96, 157, 0.1));
  border-radius: 50%;
  pointer-events: none;
}
.particle-field .dot:nth-child(odd)  { animation: particle-float-1 12s ease-in-out infinite; }
.particle-field .dot:nth-child(even) { animation: particle-float-2 10s ease-in-out infinite; }
.particle-field .dot:nth-child(3n)   { animation: particle-float-3 14s ease-in-out infinite; }

/* ─── Table Row Slide-In ─── */
@keyframes row-slide {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.animate-rows tbody tr {
  animation: row-slide 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.animate-rows tbody tr:nth-child(1) { animation-delay: 0.1s; }
.animate-rows tbody tr:nth-child(2) { animation-delay: 0.2s; }
.animate-rows tbody tr:nth-child(3) { animation-delay: 0.3s; }
.animate-rows tbody tr:nth-child(4) { animation-delay: 0.4s; }
.animate-rows tbody tr:nth-child(5) { animation-delay: 0.5s; }

/* ─── ECG Heartbeat Line (Cardium) ─── */
@keyframes ecg-pulse {
  0%   { transform: scaleY(1); }
  10%  { transform: scaleY(2.5); }
  20%  { transform: scaleY(0.6); }
  30%  { transform: scaleY(1.8); }
  40%  { transform: scaleY(1); }
  100% { transform: scaleY(1); }
}
.ecg-bar {
  animation: ecg-pulse 2s ease-in-out infinite;
  transform-origin: bottom;
}
.ecg-bar:nth-child(2)  { animation-delay: 0.1s; }
.ecg-bar:nth-child(3)  { animation-delay: 0.2s; }
.ecg-bar:nth-child(4)  { animation-delay: 0.3s; }
.ecg-bar:nth-child(5)  { animation-delay: 0.4s; }
.ecg-bar:nth-child(6)  { animation-delay: 0.5s; }
.ecg-bar:nth-child(7)  { animation-delay: 0.6s; }
.ecg-bar:nth-child(8)  { animation-delay: 0.7s; }
.ecg-bar:nth-child(9)  { animation-delay: 0.8s; }
.ecg-bar:nth-child(10) { animation-delay: 0.9s; }
.ecg-bar:nth-child(11) { animation-delay: 1.0s; }
.ecg-bar:nth-child(12) { animation-delay: 1.1s; }
.ecg-bar:nth-child(13) { animation-delay: 1.2s; }
.ecg-bar:nth-child(14) { animation-delay: 1.3s; }

/* ─── Smooth scroll ─── */
html {
  scroll-behavior: smooth;
}

/* Shared responsive platform navigation */
.site-desktop-nav {
  display: none;
}

.site-mobile-header {
  display: block;
}

.site-mobile-page-links {
  display: flex;
}

.mobile-platform-menu summary {
  list-style: none;
}

.mobile-platform-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-platform-chevron {
  flex: 0 0 auto;
  transition: transform 0.22s ease;
}

.mobile-platform-menu[open] .mobile-platform-chevron {
  transform: rotate(180deg);
}

@media (min-width: 1024px) {
  .site-desktop-nav {
    display: flex;
  }

  .site-mobile-header,
  .site-mobile-page-links {
    display: none;
  }
}

/* ─── Status Badge Pulse ─── */
.site-search-trigger {
  position: relative;
  z-index: 120;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.25rem;
  color: #5f6b72;
  background: transparent;
  box-shadow: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.site-search-trigger:hover {
  color: #24609d;
  background: transparent;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.site-search-trigger.is-search-active {
  color: #24609d !important;
  background: transparent;
  opacity: 1;
  box-shadow: none;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.site-search-trigger:focus-visible {
  outline: 2px solid rgba(36, 96, 157, 0.55);
  outline-offset: 3px;
}

.site-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: none;
  width: min(21.25rem, calc(100vw - 2rem));
  background: transparent;
}

.site-search-overlay.is-open,
.site-search-overlay.is-closing {
  display: block;
}

.site-search-panel {
  width: 100%;
  overflow: visible;
  background: transparent;
}

.site-search-overlay.is-open .site-search-panel {
  animation: site-search-enter 0.22s ease both;
}

.site-search-overlay.is-closing .site-search-panel {
  pointer-events: none;
  animation: site-search-exit 0.18s ease both;
}

.site-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.site-search-form {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 2.55rem;
  border: 1px solid rgba(115, 124, 127, 0.32);
  border-radius: 999px;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.9) 0,
    rgba(255, 255, 255, 0.9) calc(100% - 3.35rem),
    rgba(255, 255, 255, 0) calc(100% - 3.35rem),
    rgba(255, 255, 255, 0) 100%
  );
  box-shadow: 0 16px 40px -24px rgba(12, 15, 16, 0.65);
}

.site-search-input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  border: 0 !important;
  border-radius: 999px;
  padding: 0.58rem 3.05rem 0.58rem 0.95rem;
  color: #2b3437;
  background: transparent !important;
  box-shadow: none !important;
  font: 500 0.88rem/1.3 "Public Sans", sans-serif;
}

.site-search-input::placeholder {
  color: #66737b;
  font-size: 0.76rem;
}

.site-search-input:focus {
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
}

.site-search-form:focus-within {
  border-color: rgba(36, 96, 157, 0.6);
  box-shadow: 0 0 0 3px rgba(36, 96, 157, 0.16), 0 16px 40px -24px rgba(12, 15, 16, 0.65);
}

.site-search-results {
  display: none;
  max-height: min(17rem, calc(100dvh - 5rem));
  overflow-y: auto;
  scrollbar-gutter: stable;
  margin-top: 0.45rem;
  padding: 0.25rem 0;
  border: 1px solid rgba(171, 179, 183, 0.26);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 56px -28px rgba(12, 15, 16, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.site-search-panel.has-results .site-search-results {
  display: grid;
}

.site-search-dropdown-title {
  padding: 0.75rem 1rem;
  color: #2b3437;
  background: #eef3f7;
  font: 800 0.92rem/1.25 "Manrope", sans-serif;
}

.site-search-result {
  display: block;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 0;
  text-decoration: none;
  background: transparent;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.site-search-result:hover,
.site-search-result:focus-visible {
  background: #f1f4f6;
  outline: none;
}

.site-search-result-title {
  color: #2b3437;
  font: 800 0.98rem/1.2 "Manrope", sans-serif;
}

.site-search-result-snippets {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.site-search-result-snippet {
  color: #586064;
  font: 500 0.78rem/1.4 "Public Sans", sans-serif;
}

.site-search-result mark {
  padding: 0 0.08rem;
  border-radius: 0.2rem;
  color: #0f4d86;
  background: rgba(181, 219, 255, 0.72);
  font-weight: 800;
}

.site-search-empty {
  margin: 0;
  padding: 1rem;
  color: #586064;
  text-align: left;
  font: 500 0.95rem/1.4 "Public Sans", sans-serif;
}

@keyframes site-search-enter {
  from {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes site-search-exit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-0.45rem);
  }
}

@media (max-width: 640px) {
  .site-search-overlay {
    max-width: calc(100vw - 1.5rem);
  }

  .site-search-panel {
    width: 100%;
  }

  .site-search-results {
    max-height: min(17rem, calc(100dvh - 5rem));
  }
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(1, 107, 95, 0.3); }
  50%      { box-shadow: 0 0 0 6px rgba(1, 107, 95, 0); }
}
.badge-pulse {
  animation: badge-pulse 2.5s ease-in-out infinite;
}

/* ─── Typing cursor blink ─── */
@keyframes blink-caret {
  0%, 100% { border-color: transparent; }
  50%      { border-color: #24609d; }
}
.typing-cursor {
  border-right: 2px solid #24609d;
  animation: blink-caret 1s step-end infinite;
  padding-right: 2px;
}

/* Research focus accordions */
.research-focus-card {
  transition: border-color 0.25s ease,
              background-color 0.25s ease,
              box-shadow 0.25s ease,
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: height;
}

.research-focus-card[open] {
  border-color: rgba(36, 96, 157, 0.18);
  box-shadow: 0 18px 32px -24px rgba(36, 96, 157, 0.5);
}

.research-focus-summary {
  list-style: none;
}

.research-focus-summary::-webkit-details-marker {
  display: none;
}

.research-focus-summary h3 {
  overflow-wrap: anywhere;
}

.research-focus-summary:focus-visible {
  outline: 2px solid rgba(36, 96, 157, 0.55);
  outline-offset: -6px;
  border-radius: 0.5rem;
}

.research-card-chevron {
  flex: 0 0 auto;
  transition: transform 0.25s ease;
}

.research-focus-card[open] .research-card-chevron {
  transform: rotate(180deg);
}

.research-focus-card.is-collapsing .research-card-chevron {
  transform: rotate(0deg);
}

.research-focus-description {
  margin: 0;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.research-focus-card.is-expanding .research-focus-description,
.research-focus-card.is-collapsing .research-focus-description {
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .site-search-panel,
  .research-focus-description,
  .research-focus-card,
  .research-card-chevron {
    transition: none;
    animation: none;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }
}
