/**
 * @file
 * VA OIG accessible column chart.
 *
 * Colour values here mirror the TOKENS object in va_column_chart.js. If one
 * changes, change both.
 */

.va-cc {
  /* Never allow the component to widen its container. */
  max-width: 100%;
  overflow: hidden;
}

.va-cc__figure {
  margin: 0;
  padding: 0 0 8px;
}

.va-cc__caption {
  display: block;
  text-align: center;
  font-family: "Roboto Condensed", "Source Sans Pro", Helvetica, Arial, sans-serif;
  font-weight: 700;
  color: #112E51;
  padding: 10px 12px 6px;
}

.va-cc__title {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.va-cc__subtitle {
  display: block;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 400;
}

.va-cc__viewport {
  position: relative;
  max-width: 100%;
}

.va-cc__svg {
  display: block;
  max-width: 100%;
  height: auto;
  font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
}

/* ---------------------------------------------------------------------------
   Bars
   --------------------------------------------------------------------------- */

.va-cc__bar-link {
  cursor: pointer;
  /* The drawn focus ring is the indicator; suppress the UA outline so the two
     do not stack. A replacement is always rendered -- see .va-cc__focus. */
  outline: none;
}

.va-cc__hit {
  fill: transparent;
}

.va-cc__bar-link:hover .va-cc__hit,
.va-cc__bar-link:focus-visible .va-cc__hit {
  fill: #ECEEF0;
}

.va-cc__value {
  font-weight: 600;
}

.va-cc__label {
  font-weight: 400;
}

/* Focus ring is always in the DOM and revealed on focus, so its geometry is
   never recalculated at focus time. */
.va-cc__focus {
  opacity: 0;
  pointer-events: none;
}

.va-cc__bar-link:focus-visible .va-cc__focus {
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   Tooltip
   --------------------------------------------------------------------------- */

.va-cc__tooltip {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  max-width: 90%;
  padding: 5px 9px;
  border-radius: 3px;
  background: #1B1F23;
  color: #FFFFFF;          /* 16.4:1 on #1B1F23 */
  font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.va-cc__tooltip[hidden] {
  display: none;
}

/* ---------------------------------------------------------------------------
   Status region (present for future dynamic updates; silent on resize)
   --------------------------------------------------------------------------- */

.va-cc__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------------
   Data table -- the accessibility twin, not a hidden afterthought
   --------------------------------------------------------------------------- */

.va-cc__details {
  margin: 4px 12px 0;
  font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
  font-size: 14px;
}

.va-cc__summary {
  cursor: pointer;
  padding: 6px 2px;
  color: #112E51;
  font-weight: 600;
}

.va-cc__summary:focus-visible {
  outline: 2px solid #1B1F23;
  outline-offset: 2px;
}

.va-cc__table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0 10px;
}

.va-cc__table caption {
  text-align: left;
  padding: 4px 0 8px;
  color: #1B1F23;
  font-weight: 600;
}

.va-cc__table th,
.va-cc__table td {
  border: 1px solid #A9AEB1;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  color: #1B1F23;
}

.va-cc__table thead th {
  background: #F0F0F0;
}

.va-cc__table tbody th {
  font-weight: 400;
}

.va-cc__table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.va-cc__table a {
  color: #112E51;
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Motion
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .va-cc__hit {
    transition: fill 120ms ease-out;
  }
}

/* ---------------------------------------------------------------------------
   Forced colours / Windows High Contrast
   Author colours are replaced, so the bar fill stops carrying meaning. Keep
   the geometry readable via system colours instead of opting out.
   --------------------------------------------------------------------------- */

@media (forced-colors: active) {
  .va-cc__bar {
    fill: Canvas;
    stroke: CanvasText;
    stroke-width: 2;
  }

  .va-cc__bar-link:hover .va-cc__hit,
  .va-cc__bar-link:focus-visible .va-cc__hit {
    fill: Highlight;
    fill-opacity: 0.25;
  }

  .va-cc__focus rect {
    stroke: Highlight !important;
  }

  .va-cc__tooltip {
    background: Canvas;
    color: CanvasText;
    border: 1px solid CanvasText;
  }
}
