/* Gráficos de Josia Brew. Paleta anual diferenciada en ambos temas. */
.viz-root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #1d6ac4; /* azul     */
  --series-2: #eb6834; /* naranja  */
  --series-3: #1baf7a; /* aguamarina */
  --series-4: #eda100; /* amarillo */
  --series-5: #8e5bd0; /* violeta  */
  --context-1: #898781; /* gris de contexto: año anterior */
  --context-2: #b8b6ad; /* gris más claro: dos años atrás */
  --year-prev: #a85d00;  /* año anterior: ámbar */
  --year-older: #7b2cbf; /* dos años atrás: violeta */
  --year-next: #087d70;  /* año siguiente: verde azulado */
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #a77fe0;
  --context-1: #898781;
  --context-2: #5f5e59;
  --year-prev: #ffb45c;
  --year-older: #c690ff;
  --year-next: #62d6c4;
}

.viz {
  margin: 0;
  padding: 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.viz-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.viz-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.viz-sub { margin-top: 2px; font-size: 12px; color: var(--text-secondary); }
.viz-toggle {
  flex: none; padding: 2px 8px; font-size: 12px; color: var(--text-secondary);
  background: transparent; border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.viz-toggle:hover { background: var(--grid); }
.viz-toggle:focus-visible, .viz-hit:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; font-size: 12px; color: var(--text-secondary); }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.viz-key { display: inline-block; width: 16px; height: 2px; border-radius: 1px; }
.viz-key-bar { height: 8px; width: 8px; border-radius: 2px; }
.viz-key-band { height: 10px; width: 16px; border-radius: 2px; background: var(--text-muted); opacity: 0.35; }

.viz-plot { position: relative; margin-top: 8px; }
.viz-plot svg { display: block; overflow: visible; }
.viz-plot text { font-family: inherit; font-size: 11px; fill: var(--text-muted); }
.viz-plot .viz-label { fill: var(--text-secondary); font-weight: 600; }
.viz-grid { stroke: var(--grid); stroke-width: 1; }
.viz-axis { stroke: var(--axis); stroke-width: 1; }
.viz-ref { stroke: var(--axis); stroke-width: 1; }
.viz-cross { stroke: var(--text-muted); stroke-width: 1; }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-dot { stroke: var(--surface-1); stroke-width: 2; }
.viz-bar { transition: filter 80ms; }
.viz-bar.is-hover { filter: brightness(1.12); }
.viz-dot-hollow { fill: var(--surface-1); stroke-width: 2; }
.viz-band { fill: var(--text-muted); fill-opacity: 0.14; stroke: none; }
.viz-hit { fill: transparent; outline: none; }

.viz-tip {
  position: absolute; z-index: 5; min-width: 120px; max-width: 240px; padding: 8px 10px; pointer-events: none;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); font-size: 12px; color: var(--text-secondary);
}
.viz-tip[hidden] { display: none; }
.viz-tip-head { margin-bottom: 4px; color: var(--text-secondary); }
.viz-tip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; line-height: 1.5; }
.viz-tip-val { font-weight: 600; color: var(--text-primary); }
.viz-tip-note { flex-basis: 100%; padding-left: 22px; color: var(--text-muted); }

.viz-empty { padding: 32px 0; text-align: center; font-size: 13px; color: var(--text-muted); }
.viz-table { margin-top: 8px; overflow-x: auto; }
.viz-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.viz-table th { text-align: left; padding: 4px 8px; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--axis); }
.viz-table td { padding: 4px 8px; color: var(--text-primary); border-bottom: 1px solid var(--grid); }
