/*
 * yr-motion.css — Yard Registry Interaction & Motion System
 * GPU-friendly. prefers-reduced-motion aware. No layout thrashing.
 * Load via: <link rel="stylesheet" href="/static/css/yr-motion.css">
 */

/* ── Reduced motion baseline ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Scroll reveal ────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  will-change: opacity, transform;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger siblings: .reveal-group > .reveal-item */
.reveal-group > .reveal-item { opacity: 0; transform: translateY(14px); transition: opacity 0.45s ease, transform 0.45s ease; will-change: opacity, transform; }
.reveal-group > .reveal-item.in-view { opacity: 1; transform: translateY(0); }
.reveal-group > .reveal-item:nth-child(1) { transition-delay: 0ms; }
.reveal-group > .reveal-item:nth-child(2) { transition-delay: 60ms; }
.reveal-group > .reveal-item:nth-child(3) { transition-delay: 120ms; }
.reveal-group > .reveal-item:nth-child(4) { transition-delay: 180ms; }
.reveal-group > .reveal-item:nth-child(5) { transition-delay: 240ms; }
.reveal-group > .reveal-item:nth-child(6) { transition-delay: 300ms; }

/* ── Fade in from neutral ─────────────────────────────────────────────────── */
@keyframes yr-fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fade-in { animation: yr-fadeIn 0.3s ease both; }

/* ── Fade up (content panels, cards) ─────────────────────────────────────── */
@keyframes yr-fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up          { animation: yr-fadeUp 0.35s ease both; }
.fade-up-sm       { animation: yr-fadeUp 0.25s ease both; }
.fade-up-fast     { animation: yr-fadeUp 0.18s ease both; }

/* ── Slide in from left (sidebar, panels) ────────────────────────────────── */
@keyframes yr-slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
.slide-in-left { animation: yr-slideInLeft 0.3s ease both; }

/* ── Scale pop (badges, tooltips, popovers) ──────────────────────────────── */
@keyframes yr-pop {
  0%   { opacity: 0; transform: scale(0.9); }
  60%  { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
.pop-in { animation: yr-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ── Pulse (live indicators, status dots) ────────────────────────────────── */
@keyframes yr-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.85); }
}
.pulse-live { animation: yr-pulse 2.2s ease-in-out infinite; }

@keyframes yr-pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.pulse-ring { animation: yr-pulseRing 2.5s ease-out infinite; }

/* ── Shimmer (skeleton loading) ──────────────────────────────────────────── */
@keyframes yr-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: yr-shimmer 1.6s ease infinite;
}

/* ── Hover lift (cards, panels) ──────────────────────────────────────────── */
.hover-lift {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  will-change: transform;
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hover-lift-sm {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  will-change: transform;
}
.hover-lift-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* ── Hover glow (accent elements) ────────────────────────────────────────── */
.hover-glow {
  transition: box-shadow 0.2s ease;
}
.hover-glow:hover {
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.25), 0 4px 16px rgba(52, 211, 153, 0.08);
}

/* ── Table row hover ─────────────────────────────────────────────────────── */
.yr-table-row {
  transition: background 0.12s ease;
}
.yr-table-row:hover {
  background: rgba(52, 211, 153, 0.04) !important;
  cursor: default;
}

/* ── Score bar animated fill ─────────────────────────────────────────────── */
.score-bar-animated {
  width: 0%;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Panel entrance (content loads) ─────────────────────────────────────── */
@keyframes yr-panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel-enter {
  animation: yr-panelIn 0.28s ease both;
}

/* ── Stagger helpers (apply to parent, adds delay to children) ───────────── */
.stagger > * { animation: yr-fadeUp 0.35s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 55ms; }
.stagger > *:nth-child(3) { animation-delay: 110ms; }
.stagger > *:nth-child(4) { animation-delay: 165ms; }
.stagger > *:nth-child(5) { animation-delay: 220ms; }
.stagger > *:nth-child(6) { animation-delay: 275ms; }
.stagger > *:nth-child(7) { animation-delay: 330ms; }
.stagger > *:nth-child(8) { animation-delay: 385ms; }

/* ── Spotlight focus (presentation mode) ────────────────────────────────── */
@keyframes yr-spotlight {
  0%   { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.12), 0 0 0 0 rgba(52, 211, 153, 0.25); }
  40%  { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0.08), 0 0 32px 0 rgba(52, 211, 153, 0.12); }
  100% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.08), 0 0 16px 0 rgba(52, 211, 153, 0.06); }
}
.spotlight-focus {
  outline: 1.5px solid rgba(52, 211, 153, 0.55) !important;
  outline-offset: 5px !important;
  border-radius: 12px !important;
  animation: yr-spotlight 0.5s ease forwards !important;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
[data-tip] {
  position: relative;
  cursor: default;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.94);
  background: #131F17;
  border: 1px solid #2D4636;
  color: #A8B8AD;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 999;
  letter-spacing: 0.02em;
}
[data-tip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ── Number ticker (freshness / counter) ─────────────────────────────────── */
@keyframes yr-tick {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
.yr-tick { display: inline-block; animation: yr-tick 0.2s ease both; }

/* ── Transition-quality button states ───────────────────────────────────── */
.btn-interactive {
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-interactive:active {
  transform: scale(0.97);
}

/* ── Live badge ──────────────────────────────────────────────────────────── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #34d399;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid rgba(52, 211, 153, 0.25);
  background: rgba(52, 211, 153, 0.06);
}
.live-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #34d399;
}
.live-badge-dot.pulsing {
  animation: yr-pulse 2s ease-in-out infinite;
}

/* ── Confidence ring ─────────────────────────────────────────────────────── */
.conf-ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.conf-ring-svg circle.track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
}
.conf-ring-svg circle.fill {
  fill: none;
  stroke: #34d399;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.conf-ring-label {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: #E8EDE9;
  pointer-events: none;
}

/* ── Skeleton rows ───────────────────────────────────────────────────────── */
.skel-row {
  height: 14px;
  border-radius: 4px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.skel-row.shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: yr-shimmer 1.6s ease infinite;
}
