/* water_level_chart.css - chart chrome and color tokens for water_level_chart.js
 * (the Cernavodă water-level chart).
 *
 * Light tokens are the default (the page is light). The dark set is selected, not
 * auto-flipped: it applies when the document root carries data-theme="dark"
 * (<html data-theme="dark">), so a dark card never appears inside a light page.
 * Series colour: categorical slot 1 (blue, #2a78d6 light / #3987e5 dark), validated
 * with the dataviz palette checks against both surfaces.
 * Zoom chrome (selection band, navigator strip, header controls) reuses the same
 * tokens so it stays quieter than the data.
 */

.water-level-chart {
  --chart-surface: #fcfcfb;
  --chart-ink: #0b0b0b;
  --chart-ink-secondary: #52514e;
  --chart-ink-muted: #898781;
  --chart-grid: #e1e0d9;
  --chart-axis: #c3c2b7;
  --chart-border: rgba(11, 11, 11, 0.10);
  --chart-series: #2a78d6;
  --chart-tooltip-bg: #ffffff;
  --chart-tooltip-shadow: 0 4px 16px rgba(11, 11, 11, 0.12), 0 0 0 1px rgba(11, 11, 11, 0.06);

  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
  color: var(--chart-ink);
  background: var(--chart-surface);
  border: 1px solid var(--chart-border);
  border-radius: 10px;
  box-sizing: border-box;
  width: calc(100% - 90px);
  max-width: 1280px;
  margin: 28px auto 32px;
  padding: 16px 20px 10px;
}

:root[data-theme="dark"] .water-level-chart {
  --chart-surface: #1a1a19;
  --chart-ink: #ffffff;
  --chart-ink-secondary: #c3c2b7;
  --chart-ink-muted: #898781;
  --chart-grid: #2c2c2a;
  --chart-axis: #383835;
  --chart-border: rgba(255, 255, 255, 0.10);
  --chart-series: #3987e5;
  --chart-tooltip-bg: #262624;
  --chart-tooltip-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

@media (max-width: 720px) {
  .water-level-chart { width: calc(100% - 16px); padding: 12px 10px 6px; }
}

/* ---- header: title, period, stats ------------------------------------- */

.water-level-chart__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 20px;
  margin: 0 0 10px;
  padding: 0;
}

.water-level-chart__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--chart-ink);
}

.water-level-chart__unit {
  font-weight: 500;
  color: var(--chart-ink-muted);
}

.water-level-chart__period {
  color: var(--chart-ink-secondary);
}

.water-level-chart__stats {
  display: flex;
  gap: 24px;
  margin-left: auto;
}

.water-level-chart__stat {
  display: flex;
  flex-direction: column;
  min-width: 64px;
}

.water-level-chart__stat-label {
  font-size: 11px;
  color: var(--chart-ink-muted);
}

.water-level-chart__stat-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--chart-ink);
}

.water-level-chart__stat-time {
  font-size: 11px;
  color: var(--chart-ink-muted);
}

/* ---- body: plot, status, tooltip ------------------------------------- */

.water-level-chart__body {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.water-level-chart [hidden] {
  display: none !important;
}

.water-level-chart__plot {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  border-radius: 4px;
  touch-action: pan-y;
}

.water-level-chart__plot:focus { outline: none; }
.water-level-chart__plot:focus-visible { outline: 2px solid var(--chart-series); outline-offset: 2px; }

.water-level-chart__status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chart-ink-muted);
  pointer-events: none;
}

.water-level-chart__hit-area {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
}

.water-level-chart__grid line {
  stroke: var(--chart-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.water-level-chart__grid line.water-level-chart__zero-line,
.water-level-chart__axis-line {
  stroke: var(--chart-axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.water-level-chart__tick {
  fill: var(--chart-ink-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.water-level-chart__tick--major {
  fill: var(--chart-ink-secondary);
  font-weight: 600;
}

.water-level-chart__area {
  fill: var(--chart-series);
  fill-opacity: 0.1;
  stroke: none;
}

.water-level-chart__line {
  fill: none;
  stroke: var(--chart-series);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.water-level-chart__marker,
.water-level-chart__hover-marker {
  fill: var(--chart-series);
  stroke: var(--chart-surface);
  stroke-width: 2;
}

.water-level-chart__label {
  fill: var(--chart-ink);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  stroke: var(--chart-surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.water-level-chart__label-tag {
  fill: var(--chart-ink-muted);
  font-weight: 500;
}

.water-level-chart__crosshair {
  stroke: var(--chart-axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.water-level-chart__tooltip {
  position: absolute;
  z-index: 2;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  padding: 6px 10px 7px;
  border-radius: 6px;
  background: var(--chart-tooltip-bg);
  box-shadow: var(--chart-tooltip-shadow);
  font-size: 12px;
  color: var(--chart-ink-secondary);
}

.water-level-chart__tooltip-value {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--chart-ink);
}

.water-level-chart__tooltip-key {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 1px;
  background: var(--chart-series);
}

.water-level-chart__tooltip-date {
  margin-top: 1px;
}

/* ---- zoom: footer controls, selection band, navigator ------------------ */

/* one line under the navigator: the zoom controls (while zoomed) and the gesture
   hint; the hint swaps to a shorter text when the controls appear so the line
   stays single at ordinary widths and the plot never moves */
.water-level-chart__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  min-height: 24px;
  margin: 6px 0 0;
}

.water-level-chart__tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.water-level-chart__button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--chart-ink);
  background: transparent;
  border: 1px solid var(--chart-border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}

.water-level-chart__button:hover {
  background: var(--chart-grid);
}

.water-level-chart__button:focus-visible,
.water-level-chart__link:focus-visible {
  outline: 2px solid var(--chart-series);
  outline-offset: 2px;
}

.water-level-chart__link {
  font-size: 12px;
  color: var(--chart-ink-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--chart-axis);
}

.water-level-chart__link:hover {
  color: var(--chart-ink);
  text-decoration-color: currentColor;
}

.water-level-chart__hint {
  margin: 0;
  font-size: 11px;
  color: var(--chart-ink-muted);
}

.water-level-chart__brush {
  fill: var(--chart-series);
  fill-opacity: 0.12;
  stroke: var(--chart-series);
  stroke-opacity: 0.6;
  stroke-width: 1;
  shape-rendering: crispEdges;
  pointer-events: none;
}

.water-level-chart__nav-track {
  fill: transparent;
  stroke: var(--chart-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
  pointer-events: all;
  cursor: crosshair;
}

.water-level-chart__nav-series {
  pointer-events: none;
}

.water-level-chart__nav-area {
  fill: var(--chart-series);
  fill-opacity: 0.1;
}

.water-level-chart__nav-line {
  fill: none;
  stroke: var(--chart-series);
  stroke-opacity: 0.55;
  stroke-width: 1;
  stroke-linejoin: round;
}

.water-level-chart__nav-veil {
  fill: var(--chart-surface);
  fill-opacity: 0.65;
  pointer-events: none;
}

.water-level-chart__nav-window {
  fill: transparent;
  stroke: var(--chart-series);
  stroke-width: 1;
  shape-rendering: crispEdges;
  pointer-events: all;
  cursor: grab;
}

.water-level-chart__nav-window:active {
  cursor: grabbing;
}

.water-level-chart__nav-handle {
  fill: var(--chart-series);
  stroke: var(--chart-surface);
  stroke-width: 2;
  pointer-events: none;
}

.water-level-chart__nav-handle-hit {
  fill: transparent;
  pointer-events: all;
  cursor: ew-resize;
}

@media (forced-colors: active) {
  .water-level-chart__line, .water-level-chart__crosshair, .water-level-chart__axis-line,
  .water-level-chart__nav-line, .water-level-chart__nav-window, .water-level-chart__brush { stroke: CanvasText; }
  .water-level-chart__marker, .water-level-chart__hover-marker, .water-level-chart__area,
  .water-level-chart__nav-area, .water-level-chart__nav-handle { fill: CanvasText; }
  .water-level-chart__tick, .water-level-chart__label { fill: CanvasText; }
}

@media print {
  .water-level-chart { border: none; width: 100%; }
  .water-level-chart__tooltip, .water-level-chart__hover, .water-level-chart__footer { display: none; }
}
