/* Chart styles for the D3 figures (figures/*.ts). Ported from the Astro
   site's Tailwind classes; the tokens below are read by figure-kit.ts. */
:root {
  --background: #fdfdfd;
  --foreground: #282728;
  --muted-foreground: #6b7280;
  --border: #ece9e9;
  --accent: #006cac;
}

.fig {
  margin: 2rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}
.fig svg {
  display: block;
  width: 100%;
  height: auto;
}
.fig figcaption {
  margin-top: 0.75rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.6;
}
.fig .fig-axis {
  fill: var(--muted-foreground);
  font-size: 10px;
}
.fig .fig-label {
  fill: var(--foreground);
  font-size: 11px;
}
.fig .fig-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}
.fig .fig-controls input[type="range"] {
  flex: 1;
  max-width: 16rem;
  accent-color: var(--accent);
}
.fig .fig-value {
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.fig-tip {
  position: absolute;
  z-index: 50;
  pointer-events: none;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.75rem;
  line-height: 1.35;
  opacity: 0;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  transition: opacity 150ms;
}
.fig-tip-muted {
  color: var(--muted-foreground);
}
.fig-head {
  margin-bottom: 0.75rem;
}
.fig-title {
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.35;
}
.fig-subtitle {
  margin-top: 0.125rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  line-height: 1.35;
}
.fig-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.fig-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.fig-swatch {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border: 1px solid transparent;
  border-radius: 2px;
}
.fig-source {
  margin: 0.375rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  line-height: 1.6;
}
.fig-source::before {
  content: "Source: ";
}

/* KaTeX display math scrolls instead of overflowing on narrow screens. */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

/* Hover focus (figure-kit.ts): the hovered mark stays solid, its siblings fade. */
.fig svg {
  cursor: crosshair;
}
.fig svg .fig-dim {
  opacity: 0.28;
}
.fig svg .fig-hot,
.fig svg .fig-dim {
  transition: opacity 120ms ease;
}
.fig-hint {
  margin: 0.5rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  opacity: 0.8;
}
@media (prefers-reduced-motion: reduce) {
  .fig svg .fig-hot,
  .fig svg .fig-dim {
    transition: none;
  }
}

/* Interaction and motion (figures/interact.ts, figures/motion.ts). */
.fig {
  position: relative;
}
.fig:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.fig-replay {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--muted-foreground);
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease, transform 300ms ease;
}
.fig:hover .fig-replay,
.fig:focus-within .fig-replay,
.fig-replay:focus-visible {
  opacity: 1;
}
.fig-replay:hover {
  color: var(--accent);
  transform: rotate(-60deg);
}
@media (hover: none) {
  .fig-replay {
    opacity: 1;
  }
}
.fig-guide {
  position: absolute;
  width: 0;
  border-left: 1px dashed var(--muted-foreground);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease, left 80ms ease-out;
}
.fig svg .fig-series-dim {
  opacity: 0.15;
  transition: opacity 180ms ease;
}
.fig svg .fig-series-on {
  transition: opacity 180ms ease;
}
.fig-legend-item {
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: opacity 150ms ease, background-color 150ms ease;
}
.fig-legend-item:hover,
.fig-legend-item[aria-pressed="true"] {
  background: rgb(0 108 172 / 0.08);
}
.fig-legend-item.is-muted {
  opacity: 0.45;
}
.fig-legend-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.fig-tip.is-pinned {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgb(0 0 0 / 0.08);
}
.fig-tip.is-pinned::after {
  content: "pinned · click to release";
  display: block;
  margin-top: 0.25rem;
  color: var(--muted-foreground);
  font-size: 0.6875rem;
}

/* Excalidraw architecture diagrams (tools/embed-diagrams.py). Click opens the
   theme lightbox, which can zoom and pan. */
.post-content figure.excal {
  margin: 1.8rem 0;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.post-content figure.excal a {
  display: block;
  border: 0;
  text-decoration: none;
}
.post-content figure.excal img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  cursor: zoom-in;
}
