/* Prumo chart inspector: structured exact point rows and the native range touch target.
 *
 * Loaded after prumo.css by the page shell. This file owns only the inspection controls, so
 * charts that keep the server SVG do not depend on it and no other page rule is redefined. */

.chart-shell .chart-controls {
  display: none;
}

/* The inspector exists only after the adapter has drawn a canvas successfully. A blocked
   bundle or disabled JavaScript therefore leaves the server SVG, legend and disclosure with no
   empty control gap between the plot and its key. */
.chart-shell.chart-enhanced .chart-controls {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* The same capability/viewport policy that owns the floating tooltip gives narrow and coarse
   readers the persistent readout directly below the plot. The readout comes first and spans
   the full controls width; the native range follows as the larger touch target. Reading type
   is inherited unchanged. */
.chart-shell.chart-inline-readout .chart-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: stretch;
  min-height: 0;
  margin-top: 2px;
}

.chart-shell.chart-inline-readout .chart-readout {
  order: -1;
  flex: 0 0 auto;
  width: 100%;
  gap: 8px;
}

/* Keep each key beside its own title even when the title wraps. The value and optional native
   period belong to that same text column, rather than wrapping independently around the key. */
.chart-shell.chart-inline-readout .chart-readout-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: .5em;
  row-gap: 2px;
  align-items: baseline;
}

.chart-shell.chart-inline-readout .chart-readout-row > .legend-swatch {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  margin-top: .6em;
}

.chart-shell.chart-inline-readout .chart-readout-title,
.chart-shell.chart-inline-readout .chart-readout-native,
.chart-shell.chart-inline-readout .chart-readout-value {
  grid-column: 2;
}

.chart-shell.chart-inline-readout .chart-readout-value {
  margin-left: 0;
  text-align: left;
  font-weight: 700;
}

.chart-shell.chart-inline-readout .chart-readout-value:only-child {
  grid-column: 1 / -1;
}

.chart-shell.chart-inline-readout .chart-range {
  width: 100%;
}

/* The axis cursor stays on the canvas, but its floating content box is not painted in this
   presentation. The server-prepared rows are visible in the persistent readout above. */
.chart-shell.chart-inline-readout .chart-tooltip {
  display: none !important;
}

/* Keep the native control's full hit area usable on touch without changing any reading type.
   The thumb and track paint inside this box; the slider still steps one exact period. */
.chart-shell .chart-range {
  min-height: 48px;
}

.chart-shell .chart-readout {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  font-size: .9rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.chart-readout-period {
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--paper);
}

.chart-readout-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .5em;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}

/* Prepared styles identify series; values already carry their unit, exactly once. */
.chart-readout-row > .legend-swatch {
  align-self: center;
  width: 18px;
}

.chart-readout .swatch-ink {
  background: var(--ink);
}

.chart-readout .swatch-red {
  background: repeating-linear-gradient(90deg, var(--red) 0 6px, transparent 6px 10px);
}

/* A calendar row's native observation is not the union calendar position. The label names
   that distinction without changing the exact textContent sentence. */
.chart-readout-native::before {
  content: "observação: ";
  color: var(--muted);
  font-weight: 400;
}

.chart-readout-title,
.chart-readout-native {
  min-width: 0;
  overflow-wrap: break-word;
}

.chart-readout-native {
  color: var(--muted);
}

/* The union period is already the row above; only a different native period needs its own
   visible label. The hidden copy stays in the DOM for exact text compatibility. */
.chart-readout-native-same {
  display: none;
}

.chart-readout-value {
  min-width: 0;
  margin-left: auto;
  text-align: right;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Compatibility separators: textContent keeps the reviewed one-line sentence, while the
   visible inspector is the period plus one row per series. Hidden from painting and the
   accessibility tree; the polite live region carries the full sentence on keyboard changes. */
.chart-readout-sep {
  display: none;
}

/* Secondary series/axis/source metadata. The native disclosure keeps the populated links and
   provenance in the document for no-JavaScript and print; print opens it even when closed. */
details.chart-meta {
  margin: 10px 0 0;
}

details.chart-meta > summary {
  cursor: pointer;
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  color: var(--ink); font-weight: 600;
  font-size: .85rem;
  padding: 8px 10px; list-style: none;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 7px;
}

details.chart-meta > summary::-webkit-details-marker { display: none; }
details.chart-meta > summary::after {
  content: ""; flex: none; width: .45em; height: .45em; margin-left: auto;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
details.chart-meta[open] > summary::after { transform: rotate(225deg); }

.chart-source-list {
  list-style: none;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  font-size: .8rem;
  line-height: 1.35;
  color: var(--muted);
}

.chart-source-list li {
  overflow-wrap: anywhere;
}

@media print {
  details.chart-meta {
    display: block;
  }
  details.chart-meta > summary {
    display: none;
  }
  details.chart-meta::details-content {
    content-visibility: visible !important;
    display: block !important;
  }
  details.chart-meta > *:not(summary) {
    display: block !important;
  }
  details.chart-meta > ul.notebook-chart-sources {
    display: grid !important;
  }
}

@media (max-width: 480px) {
  .chart-shell .chart-range,
  .chart-shell .chart-readout {
    flex: 1 1 100%;
  }
}
