/* Balík C2 (parity/ux/motion_v3_design.md) -- styling for src/lib/motion-charts.tsx.
   Own file per the "new CSS/JS go in their own files, not style.css" rule
   (parallel-agent hygiene). Reuses the same design tokens style.css already
   defines on :root (--good, --bad, --live, --instrument-accent, --text-dim,
   --motion-draw, --motion-hover, --border, --bg-raised) -- this file must be
   loaded on the same page as style.css (see layout.tsx's hasMotionCharts
   prop), never standalone. */

.mc-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mc-empty {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 12px 0;
}

.mc-svg-wrap {
  width: 100%;
}

.mc-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.mc-gridline {
  stroke: var(--instrument-border, var(--border));
  stroke-width: 1;
}

.mc-axis-text {
  fill: var(--text-dim);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
}

.mc-year-label {
  font-size: 8px;
}

.mc-caption {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0;
}

/* --- YearByYearBars ------------------------------------------------- */

.mc-bar {
  transform-box: fill-box;
  transform-origin: bottom;
  transform: scaleY(1);
}

.mc-bar-stated {
  fill: var(--text-dim);
  opacity: 0.55;
}

.mc-bar-actual {
  fill: var(--instrument-accent, var(--accent));
}

.mc-bar-unreportable {
  fill: url(#mc-hatch);
  opacity: 0.6;
}

.mc-hatch-line {
  stroke: var(--text-dim);
  stroke-width: 1.5;
}

/* Set by motion-charts.js only, before the chart scrolls into view -- the
   no-JS / prefers-reduced-motion state is the plain rule above (final,
   grown bars). */
.mc-bar.mc-pre-anim {
  transition: none;
  transform: scaleY(0);
}

.mc-bar.mc-grow {
  transition: transform var(--motion-draw, 1000ms) cubic-bezier(0.22, 1, 0.36, 1);
  transform: scaleY(1);
}

/* --- CalibrationDrawLine --------------------------------------------- */

.mc-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mc-line-predicted {
  stroke: var(--text-dim);
}

.mc-line-realized {
  stroke: var(--instrument-accent, var(--live));
}

.mc-band {
  fill: var(--instrument-accent, var(--accent));
  opacity: 0.12;
  stroke: none;
}

.mc-line.mc-pre-anim {
  transition: none;
}

.mc-line.mc-js-draw {
  transition: stroke-dashoffset var(--motion-draw, 1000ms) ease;
}

.mc-band.mc-pre-anim {
  opacity: 0;
  transition: none;
}

.mc-band.mc-js-reveal {
  transition: opacity var(--motion-draw, 1000ms) ease;
  opacity: 0.12;
}

.mc-legend {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.mc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mc-legend-item::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2.5px;
  border-radius: 2px;
}

.mc-legend-predicted::before {
  background: var(--text-dim);
}

.mc-legend-realized::before {
  background: var(--instrument-accent, var(--live));
}

/* --- CountUp ----------------------------------------------------------- */

.mc-countup {
  font-variant-numeric: tabular-nums;
}

/* --- ResultStrip --------------------------------------------------------- */

.mc-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mc-chip-item {
  opacity: 1;
  transform: none;
}

.mc-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text);
  transition: transform var(--motion-hover, 180ms) ease, border-color var(--motion-hover, 180ms) ease;
}

a.mc-chip:hover,
a.mc-chip:focus-visible {
  transform: translateY(-1px);
  border-color: currentColor;
  text-decoration: none;
}

.mc-chip-mark {
  font-weight: 700;
  font-size: 13px;
}

.mc-chip-label {
  color: var(--text);
}

.mc-chip-status {
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.mc-chip-item.mc-pre-anim {
  transition: none;
  opacity: 0;
  transform: translateY(4px);
}

.mc-chip-item.mc-reveal {
  transition: opacity var(--motion-hover, 180ms) ease, transform var(--motion-hover, 180ms) ease;
  opacity: 1;
  transform: none;
}

.mc-chip-hit {
  background: color-mix(in srgb, var(--good) 14%, transparent);
  color: var(--good);
}

.mc-chip-miss {
  background: color-mix(in srgb, var(--bad) 14%, transparent);
  color: var(--bad);
}

.mc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- RaceBar --------------------------------------------------------------- */

.mc-race {
  width: 100%;
}

.mc-race-track {
  position: relative;
  height: 40px;
  border-radius: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--instrument-border, var(--border));
}

.mc-race-inv,
.mc-race-target {
  position: absolute;
  top: 2px;
  font-size: 10px;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-dim);
  white-space: nowrap;
}

.mc-race-inv {
  left: 0;
  padding-left: 4px;
}

.mc-race-target {
  right: 0;
  transform: translateX(-100%);
  padding-right: 4px;
}

.mc-race-entry {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mc-race-entry-mark {
  width: 2px;
  flex: 1;
  background: var(--text-dim);
}

.mc-race-entry-label {
  position: absolute;
  bottom: -16px;
  font-size: 10px;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-dim);
  white-space: nowrap;
}

.mc-race-pointer {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  left: 0;
  transition: left var(--motion-hover, 180ms) ease;
}

.mc-race-pointer-dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 30%, transparent);
}

.mc-race-pointer.mc-pulse .mc-race-pointer-dot {
  animation: mc-pulse-anim 1.6s ease-in-out infinite;
}

@keyframes mc-pulse-anim {
  0%,
  100% {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 30%, transparent);
  }
  50% {
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--live) 12%, transparent);
  }
}

/* --- Global reduced-motion override -------------------------------------
   Belt and braces on top of motion-charts.js checking matchMedia before it
   ever adds a *.mc-pre-anim class: even if that check were ever bypassed,
   nothing here can visually collapse/hide the server-rendered final state. */
@media (prefers-reduced-motion: reduce) {
  .mc-bar,
  .mc-line,
  .mc-band,
  .mc-chip-item,
  .mc-race-pointer,
  .mc-race-pointer-dot {
    transition: none !important;
    animation: none !important;
  }
  .mc-bar.mc-pre-anim {
    transform: scaleY(1);
  }
  .mc-line.mc-pre-anim {
    stroke-dashoffset: 0 !important;
  }
  .mc-band.mc-pre-anim {
    opacity: 0.12 !important;
  }
  .mc-chip-item.mc-pre-anim {
    opacity: 1 !important;
    transform: none !important;
  }
}
