/* Source chooser hand-off (owner 2026-11-11; js/run-source-handoff.js). A picked source: the
   tiles fade out where they are (the card keeps its size) and one loader sits in the middle.
   Arriving on the source's page: the Run Analysis card shows only that loader, at the same
   size and place, until the page knows what to show; then the content fades in. */
.run-source-chooser.is-picking { position: relative; }
.run-source-chooser.is-picking > * { opacity: 0; pointer-events: none; transition: opacity 180ms ease; }
.run-source-chooser.is-picking::after,
#runAnalysisSection > .mb-6:has(.run-source-chooser.is-picking)::after,
html[data-source-handoff] body :is(#runAnalysisSection, #strydRunAnalysisSection) > .mb-6::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  background: transparent url('/images/loaders/relay-build.webp?v=20261008-relay-smooth-v2') center / contain no-repeat;
  pointer-events: none;
  animation: riSourceHandoffIn 200ms ease 120ms both;
}
/* My Runs: the loader in the card body's middle, where the next page draws it too. */
#runAnalysisSection .run-source-chooser.is-picking::after { content: none; }
html[data-source-handoff] body :is(#runAnalysisSection, #strydRunAnalysisSection) > .mb-6::after { animation-delay: 0ms; }

html[data-source-handoff] body :is(#runAnalysisSection, #strydRunAnalysisSection) .frp-section-intro,
html[data-source-handoff] body :is(#runAnalysisSection, #strydRunAnalysisSection) > .mb-6 > * { display: none !important; }
html[data-source-handoff] body :is(#runAnalysisSection, #strydRunAnalysisSection) > .mb-6 { min-height: 340px; margin-bottom: 0; }
@media (min-width: 641px) {
  html[data-source-handoff] body :is(#runAnalysisSection, #strydRunAnalysisSection) {
    display: flex; flex-direction: column; box-sizing: border-box; min-height: 472px;
  }
  html[data-source-handoff] body :is(#runAnalysisSection, #strydRunAnalysisSection) > .mb-6 { flex: 1; min-height: 0; }
}

/* The source's own connect screen keeps the chooser card's size, so nothing jumps when it
   fades in: Apple Health / Garmin / Polar not connected, and the Stryd upload card. */
#runAnalysisSection:has(#bucketStatsNotConnected:not([style*="none"])) .frp-section-intro { display: none !important; }
@media (min-width: 641px) {
  #runAnalysisSection:has(#bucketStatsNotConnected:not([style*="none"])),
  #strydRunAnalysisSection:has(#strydUploadIntro:not([style*="none"])) {
    display: flex; flex-direction: column; box-sizing: border-box; min-height: 472px;
  }
  #runAnalysisSection:has(#bucketStatsNotConnected:not([style*="none"])) > .mb-6,
  #strydRunAnalysisSection:has(#strydUploadIntro:not([style*="none"])) > .mb-6 {
    flex: 1; display: flex; flex-direction: column; justify-content: center; margin-bottom: 0;
  }
}

.ri-handoff-reveal > * { animation: riSourceHandoffIn 320ms ease both; }
@keyframes riSourceHandoffIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .run-source-chooser.is-picking > * { transition: none; }
  .ri-handoff-reveal > * { animation: none; }
}
