/* Accessibility refinements; loaded after the report's editorial styles. */

/* A white separator and black outline stay visible on white, blue and ink. */
:is(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid #000 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 3px #fff;
}
.map-container [data-country]:focus-visible {
  stroke: #fff;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}
.chart svg[tabindex]:focus-visible {
  outline-offset: -3px !important;
  box-shadow: inset 0 0 0 6px #fff;
}
.country-ranking {
  padding-top: 6px;
  padding-bottom: 6px;
  padding-left: 6px;
  scroll-padding-block: 8px;
}

/* Preserve the blue/neutral chart language with legible data boundaries. */
.rank-row .rank-fill,
.growth-row > i > b,
.growth-row:hover > i > b {
  background: #2c67c5;
}
.region-row:not(:first-child):not(.eu) .region-bar i {
  background: #5d5d5d;
}

/* Tooltips remain available while the pointer moves onto or across them. */
.chart-tooltip {
  pointer-events: auto;
  max-width: min(240px, calc(100vw - 24px));
  overflow-wrap: anywhere;
}
.chart-tooltip::before {
  content: "";
  position: absolute;
  inset: -12px;
}
.chart-tooltip[hidden] { display: none; }

/* Data stays in the report; its optional table is collapsed until requested. */
.chart-data {
  margin-top: 20px;
  max-width: 100%;
  min-width: 0;
  color: #000;
  font-size: 1rem;
  line-height: 1.6;
}
.chart-data > summary {
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 2px;
  cursor: pointer;
  color: #2c67c5;
  font-size: .875rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.chart-data > summary::marker { color: currentColor; }
.chart-data-context {
  margin: 6px 0 12px;
  color: #5d5d5d;
  font-size: .875rem;
  line-height: 1.6;
}
.chart-data-scroll {
  max-width: 100%;
  max-height: 28rem;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding: 8px;
  border: 1px solid #cdcdcd;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.chart-data-scroll:focus-visible {
  outline-offset: 3px !important;
}
.chart-data table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: .875rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.chart-data caption {
  padding: 14px 16px;
  text-align: left;
  font-weight: 500;
  color: #000;
}
.chart-data :is(th, td) {
  min-width: 7rem;
  padding: 12px 16px;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  border-bottom: 1px solid #e8e8e8;
  line-height: 1.6;
}
.chart-data th {
  position: static;
  background: #e8f3fe;
  color: #000;
  font-weight: 600;
}
.chart-data tbody th { background: #fff; }
.chart-data tbody tr:last-child :is(th, td) { border-bottom: 0; }

/* Keep Close outside the scrolling report, including at large text sizes. */
:is(#reader-dialog, #definitions-dialog)[open] {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}
:is(#reader-dialog, #definitions-dialog) .reader-toolbar {
  position: relative;
  flex: 0 0 auto;
  flex-wrap: wrap;
  min-width: 0;
}
:is(#reader-dialog, #definitions-dialog) .reader-toolbar > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
:is(#reader-dialog, #definitions-dialog) .reader-toolbar button {
  flex-shrink: 0;
  min-height: 44px;
}
:is(#reader-dialog, #definitions-dialog) .reader-intro {
  flex: 0 0 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
:is(#reader-dialog, #definitions-dialog) .reader-body {
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding: 12px;
  overflow-wrap: anywhere;
}

/* Flexible content survives 320px viewports and user text-spacing settings. */
.hero h1 { overflow-wrap: anywhere; }
.atlas-grid > *, .task-explorer > *, .task-story > *, .scrubber > *,
.signal-grid > *, .closing-resources > *, .resource-card > div {
  min-width: 0;
}
.segmented { max-width: 100%; flex-wrap: wrap; }
.segmented button, .masthead .header-menu nav a { white-space: normal; }
.timeline-moment { flex-wrap: wrap; }
.rank-row .flag-country-name { overflow-wrap: anywhere; }
.scrubber output { overflow-wrap: anywhere; }
@media (max-width: 380px) {
  .stat-label { overflow-wrap: anywhere; }
  .country-heading { column-gap: 10px; }
  .region-row { grid-template-columns: minmax(0, 110px) minmax(20px, 1fr) max-content; gap: 10px; }
  .rank-row { grid-template-columns: minmax(0, 1fr) minmax(24px, .5fr) max-content; }
  .rank-label { flex-wrap: wrap; gap: 4px 12px; }
  .product-phrase { white-space: normal; }
}
@media (forced-colors: active) {
  :is(a, button, input, select, summary, [tabindex]):focus-visible {
    outline-color: Highlight !important;
  }
  .map-container [data-country]:focus-visible { stroke: Highlight; }
  .chart-data-scroll { border-color: CanvasText; }
}
