/* winemarkets — viz.css (WWW-29)
   Styles for assets/icons.svg (.ic) and the 4 assets/viz.js components (.viz-*).
   Zero hardcoded colors — everything through the CONTRACT.md §3 tokens (--ink/--muted/
   --wine/--green/--paper/--paper-alt/--border), so dark mode (prefers-color-scheme) and
   any future palette change apply here automatically, same as site.css. */

.ic {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  vertical-align: -0.2em;
  flex-shrink: 0;
  color: currentColor;
}

.viz {
  width: 100%;
  min-width: 280px;
  box-sizing: border-box;
  color: var(--ink);
}

.viz-fallback {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- bars-countries ---------- */

.viz-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.viz-bars-row {
  display: grid;
  grid-template-columns: 44px 1fr 72px;
  align-items: center;
  gap: 10px;
}

.viz-bars-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}

.viz-bars-track {
  height: 10px;
  border-radius: 999px;
  background: var(--paper-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}

.viz-bars-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--wine);
  transition: width 0.6s ease;
}

.viz-bars-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--ink);
  text-align: right;
}

/* ---------- donut-contact ---------- */

.viz-donut {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.viz-donut-svg {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.viz-donut-center-value {
  font-size: 1.15rem;
  font-weight: 700;
  fill: var(--ink);
}

.viz-donut-center-label {
  font-size: 0.5rem;
  fill: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.viz-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.viz-donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.viz-donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Single-hue palette by design (CONTRACT.md §3: --green is reserved for "AI" in
   "SilvanosAI" only, never reused in charts) — segments differ by opacity, not hue. */
.viz-donut-swatch--a { background: var(--wine); }
.viz-donut-swatch--b { background: var(--wine); opacity: 0.55; }
.viz-donut-swatch--c { background: var(--border); }

.viz-donut-legend-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  padding-left: 12px;
}

/* ---------- coverage ---------- */

.viz-coverage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.viz-coverage-value {
  font-weight: 700;
  color: var(--wine);
  font-variant-numeric: tabular-nums;
}

.viz-coverage-track {
  height: 14px;
  border-radius: 999px;
  background: var(--paper-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}

.viz-coverage-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--wine);
  transition: width 0.6s ease;
}

.viz-coverage-caption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- stat-grid ---------- */

.viz-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.viz-stat-tile {
  background: var(--paper-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viz-stat-tile .ic {
  width: 1.5em;
  height: 1.5em;
  color: var(--wine);
}

.viz-stat-number {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.viz-stat-label {
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 480px) {
  .viz-bars-row { grid-template-columns: 36px 1fr 60px; }
  .viz-donut { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .viz-bars-fill,
  .viz-coverage-fill {
    transition: none;
  }
}
