/* DeepInfer Explained - shared styles for interactive visuals (<x-viz>) and images (<x-img>).
   Loaded only by pages that use these tags (build.py adds the <link>).
   Colours come from the site.css custom properties, so dark mode works with no extra rules.
   Each visual's own styles live in its script (prefixed classes, scoped under its mount). */

:root {
  /* categorical series, instructions-svg.md section 2.3 */
  --viz-c1: #2563eb; --viz-c2: #db2777; --viz-c3: #16a34a; --viz-c4: #ea580c;
  --viz-c5: #7c3aed; --viz-c6: #0891b2; --viz-c7: #ca8a04; --viz-c8: #dc2626;
}
/* dark values only when the reader picks dark mode with the toggle (not from the system setting) */
:root[data-theme="dark"] {
  --viz-c1: #60a5fa; --viz-c2: #f472b6; --viz-c3: #4ade80; --viz-c4: #fb923c;
  --viz-c5: #a78bfa; --viz-c6: #22d3ee; --viz-c7: #facc15; --viz-c8: #f87171;
}

/* ---------- <x-viz>: a quiet panel with a one-line header ---------- */
.viz { margin: 14px 0 34px; }
.viz-head {
  display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap;
  padding: 0 2px 10px;
}
.viz-badge {
  font: 600 11.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--blue);
}
.viz-title { font-weight: 700; font-size: 18px; color: var(--ink-strong, var(--ink)); }
.viz-mount {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  min-width: 0;
  font-size: 16px; line-height: 1.55;
}
.viz-fallback { color: var(--mute); font-size: 15px; }
.viz-fallback > :last-child { margin-bottom: 0; }
.viz-caption { max-width: var(--measure, 720px); margin: 10px auto 0; text-align: center; font-size: 15px; line-height: 1.55; font-style: italic; color: var(--mute); }
.viz-caption code { font-style: normal; }

/* shared controls a visual may use */
.viz-btn {
  min-height: 40px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: 500 14.5px/1.2 var(--sans); cursor: pointer;
  touch-action: manipulation;
}
.viz-btn:hover { border-color: var(--gray-mid); background: var(--panel-bg); }
.viz-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.viz-btn-primary { border-color: var(--blue); color: var(--blue); background: var(--surface); font-weight: 600; }
.viz-btn-primary:hover { border-color: var(--blue); background: var(--blue-tint); }

@media (max-width: 560px) {
  .viz-mount { padding: 12px; }
  .viz-caption { font-size: 14px; }
}

/* ---------- <x-img>: full width, hairline frame, italic caption below ---------- */
.figure-img { margin: 14px 0 34px; text-align: center; }
.figure-img-card {
  display: inline-block; max-width: 100%; background: #ffffff;
  border: 1px solid var(--border); border-radius: 6px; padding: 0; overflow: hidden;
  cursor: zoom-in; vertical-align: top;
}
.figure-img-card img { display: block; width: 100%; height: auto; }
.figure-img figcaption { max-width: var(--measure, 720px); margin: 10px auto 0; text-align: center; font-size: 15px; line-height: 1.55; font-style: italic; color: var(--mute); }
.figure-img figcaption code { font-style: normal; }
.img-source { white-space: nowrap; }

@media print {
  .viz-mount button { display: none; }
}
