/* bagging_performance — the rules the section's two forms declare identically.
 *
 * The bagging performance screen and its per-bagger drill-down panel share
 * these nineteen rules through this head link.
 *
 * SCOPE. The private `.bp-*` rules are scoped `:where(.bp-root, .bd-overlay)`,
 * which adds no specificity, so each keeps the (0,1,0) it had as a bare class
 * and cannot change which declaration wins. Nothing outside this section
 * declares a `.bp-*` class, in `theme/assets/theme.css` or in the dependency's
 * runtime theme injection, so there is no tie to lose.
 *
 * THE THREE `.px-*` RULES ARE WRITTEN WITH A REAL ANCESTOR CLASS, not
 * `:where()`. `theme.css` declares `.px-page-title`, `.px-page-title::before`
 * and `.px-subtitle` itself, and this asset is a head <link>, which loads
 * BEFORE `theme.css`.
 * Scoped at zero specificity these rules would tie the theme's and lose on
 * document order, and `.px-page-title::before` would then paint its accent bar
 * from the theme's `--accent` instead of this section's `--bp-accent`. A real
 * ancestor puts them at (0,2,0) and (0,2,1), one class heavier than the
 * theme's, so they keep winning wherever the link lands.
 *
 * Each form's own asset keeps the rules the two forms differ on (`.bp-page`,
 * `.bp-stat`, `.bp-stat-value .unit`, the two delta colours, the token bands
 * and the two pulse keyframes) and the panel's own `.bp-reveal:nth-child(5)`.
 *
 * `@keyframes bpReveal` is unscoped, because a keyframes name is global. It is
 * already section-prefixed, so nothing else in the app can reach it.
 */

/* === Page heading === */
.bp-root .px-page-title,
.bd-overlay .px-page-title {
  font-family: var(--px-font);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--px-text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  letter-spacing: -0.01em;
}
.bp-root .px-page-title::before,
.bd-overlay .px-page-title::before {
  content: '';
  width: 4px;
  height: 32px;
  background: var(--bp-accent);
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--bp-accent-glow);
}
.bp-root .px-subtitle,
.bd-overlay .px-subtitle {
  font-family: var(--px-mono);
  font-size: 0.75rem;
  color: var(--px-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin: 4px 0 0 0;
}

/* === Stat tile internals. The tile itself differs between the two
   forms and stays in each form's own asset. === */
:where(.bp-root, .bd-overlay) .bp-stat::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--bp-accent) 0%, transparent 100%);
  opacity: 0.6;
}
:where(.bp-root, .bd-overlay) .bp-stat-label {
  font-family: var(--px-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--px-text-muted);
  margin-bottom: 8px;
}
:where(.bp-root, .bd-overlay) .bp-stat-value {
  font-family: var(--px-mono);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--px-text-primary);
  line-height: 1.1;
}
:where(.bp-root, .bd-overlay) .bp-stat-sub {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--px-text-secondary);
}

/* === Section card === */
:where(.bp-root, .bd-overlay) .bp-section-card {
  background: var(--px-bg-card);
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius);
  overflow: hidden;
  box-shadow: var(--px-shadow), var(--px-shadow-md);
  margin-bottom: 1.5rem;
}
:where(.bp-root, .bd-overlay) .bp-section-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--px-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
:where(.bp-root, .bd-overlay) .bp-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--px-text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
:where(.bp-root, .bd-overlay) .bp-section-title-bar {
  width: 3px;
  height: 18px;
  background: var(--bp-accent);
  border-radius: 2px;
}
:where(.bp-root, .bd-overlay) .bp-section-hint {
  font-family: var(--px-mono);
  font-size: 0.7rem;
  color: var(--px-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
:where(.bp-root, .bd-overlay) .bp-section-body { padding: 1.2rem 1.5rem 1.5rem; }

/* === Fade-in. Step 5 is the panel's alone and stays in its asset. === */
:where(.bp-root, .bd-overlay) .bp-reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: bpReveal 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
:where(.bp-root, .bd-overlay) .bp-reveal:nth-child(1) { animation-delay: 0.05s; }
:where(.bp-root, .bd-overlay) .bp-reveal:nth-child(2) { animation-delay: 0.12s; }
:where(.bp-root, .bd-overlay) .bp-reveal:nth-child(3) { animation-delay: 0.2s; }
:where(.bp-root, .bd-overlay) .bp-reveal:nth-child(4) { animation-delay: 0.28s; }
@keyframes bpReveal {
  to { opacity: 1; transform: translateY(0); }
}
