/* Keep the isolated report readable without a remote font request. */
:root {
  --font-sans: ui-sans-serif, system-ui, sans-serif;
  --font-display: ui-sans-serif, system-ui, sans-serif;
  --font-mono: var(--font-sans);
  --color-page: oklch(0.985 0.006 250);
  --color-panel-muted: oklch(0.96 0.02 250);
  --color-panel-strong: #0a3d7b;
  --color-text-primary: oklch(0.21 0.03 258);
  --color-text-secondary: oklch(0.27 0.00377 264.591);
  --color-text-muted: oklch(0.30 0.00377 264.591);
  --color-text-inverse: oklch(0.99 0.005 250);
  --color-border: oklch(0.929 0.013 255.508);
  --color-focus: oklch(0.52 0.16 254);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

svg text {
  font-family: var(--font-sans);
}

/* The parent page owns scrolling; allow this document to shrink after filtering. */
body {
  min-width: 0;
  min-height: 0;
  overflow-x: visible;
}

/* Keep related charts closer together without crowding their captions. */
.report-story {
  gap: clamp(2.5rem, 5vw, 4rem);
}

.report-module {
  padding-block: clamp(1.75rem, 3vw, 2.5rem);
}

.report-more {
  margin-inline: var(--page-padding-inline);
  padding: clamp(1.5rem, 4vw, 3rem) 1rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-focus);
}

.report-more p {
  margin: 0;
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 700;
}

/* The website uses natural sentence case rather than uppercase report labels.
   Scope these overrides to the embed, including dynamically rendered charts. */
body * {
  text-transform: none !important;
  letter-spacing: normal !important;
}

body :is(h1, h2, h3, h4, .module-caption__title) {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em !important;
}

@media (max-width: 40rem) {
  :root {
    --page-padding-inline: 0.75rem;
  }

  /* Keep the dense rally timeline readable on narrow screens. */
  body:not(.report-preview) #rally-pulse {
    overflow-x: auto;
  }

  body:not(.report-preview) .rally-pulse-chart {
    min-width: 36rem;
  }
}

/* One type scale for every visualization section. The source report assigns
   sizes per chart; this embed applies a shared size to each text role. SVG
   labels keep viewBox units so they scale with the court and timeline art. */
:root {
  --viz-size-heading: 1.75rem;
  --viz-size-subheading: 1.125rem;
  --viz-size-subsubheading: 1rem;
  --viz-size-body: 0.875rem;
  --viz-size-caption: 0.8125rem;
  --viz-size-label: 0.75rem;
  --viz-size-metric: 2rem;
  --viz-size-data: 1.25rem;
}

body :where(*):not(svg):not(svg *) {
  font-size: var(--viz-size-body) !important;
}

body
  :is(
    h1,
    h2,
    .text-report-title,
    .text-section-title,
    .module-caption__title,
    .report-module--hero .module-caption__title,
    .report-module--supporting .module-caption__title,
    .chapter-interstitial__name
  ) {
  font-size: var(--viz-size-heading) !important;
}

body
  :is(
    h3,
    h4,
    .ui-section-header__title,
    .error-comparison__title > span,
    .loss-context__detail-heading h3,
    .score-game__title,
    .shot-outcomes__court-panel h4,
    .shot-outcomes__details h4
  ) {
  font-size: var(--viz-size-subheading) !important;
}

body
  :is(
    h5,
    h6,
    .viz-player-heading__name,
    .error-comparison__hero-player h3,
    .shot-efficiency__player-heading,
    .style-profile__player,
    .shot-direction__section-heading strong,
    .court-depth__header span,
    .shot-placement__court-shot
  ) {
  font-size: var(--viz-size-subsubheading) !important;
}

body
  :is(
    .text-body,
    .module-caption__subtitle,
    .ui-section-header__description,
    .ui-data-note__text,
    .shot-direction-selection__note,
    .shot-placement__coverage-note,
    .shot-outcomes__note,
    .report-more p
  ) {
  font-size: var(--viz-size-body) !important;
}

body
  :is(
    .text-caption,
    .viz-empty,
    .viz-source-note,
    .error-comparison__data-note,
    .shot-efficiency__data-note,
    .loss-context__evidence-note,
    .style-profile__note,
    .court-positioning__data-note,
    .shot-placement__evidence-note,
    .shot-direction__error-note,
    .shot-direction__legend
  ) {
  font-size: var(--viz-size-caption) !important;
}

body
  :is(
    .text-label,
    .module-caption__eyebrow,
    .viz-kicker,
    [class*="__label"],
    [class*="__eyebrow"],
    [class*="__hint"],
    [class*="__sample"],
    [class*="__provenance"],
    [class*="__axis-title"],
    [class*="__edge"]
  ):not(svg):not(svg *) {
  font-size: var(--viz-size-label) !important;
}

body
  :is(
    .text-metric,
    .broadcast-moment__value,
    .error-comparison__hero-player strong,
    .score-game__score,
    .rally-duel__wins
  ) {
  font-size: var(--viz-size-metric) !important;
}

body
  :is(
    .error-comparison__type-value,
    .loss-context__cell strong,
    .shot-efficiency__count,
    .style-profile__stat-pct,
    .shot-placement__cell strong
  ) {
  font-size: var(--viz-size-data) !important;
}
