/* Math plot shortcodes: loaded only on pages that use functionplot/jsxgraph. */
.math-plot {
  margin: 1.5rem auto;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.math-plot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, rgba(139, 94, 52, 0.10), rgba(212, 160, 23, 0.08));
}

.math-plot-head strong {
  color: var(--text-heading);
  font-size: 0.98rem;
}

.math-plot-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.12rem 0.48rem;
  background: var(--accent);
  color: var(--hero-text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.functionplot-target,
.jsxgraph-target {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--bg-body) 76%, var(--bg-card));
}

.functionplot-target svg {
  max-width: 100%;
  height: auto;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.functionplot-target .function-plot .axis path,
.functionplot-target .function-plot .axis line {
  stroke: var(--text-muted);
}

.functionplot-target .function-plot .tick text,
.functionplot-target .function-plot text {
  fill: var(--text-muted);
}

.functionplot-target .function-plot .graph path {
  stroke-width: 2.2px;
}

/* impulse inline SVG */
.impulse-svg-wrap {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem 0.25rem;
  background: color-mix(in srgb, var(--bg-body) 76%, var(--bg-card));
}

.impulse-svg {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.imp-axis { stroke: var(--text-muted); stroke-width: 1.2; }
.imp-axis-head { fill: var(--text-muted); }
.imp-shaft { stroke: var(--accent); stroke-width: 2.2; }
.imp-arrow { fill: var(--accent); }
.imp-base-dot { fill: var(--bg-card); stroke: var(--accent); stroke-width: 1.6; }
.imp-label { fill: var(--accent); font-size: 15px; font-weight: 700; font-family: "Latin Modern Math", "STIX Two Math", "Cambria Math", serif; }
.imp-tick { stroke: var(--text-muted); stroke-width: 1; }
.imp-tick-label { fill: var(--text-muted); font-size: 13px; font-family: system-ui, -apple-system, sans-serif; }
.imp-axis-label { fill: var(--text-muted); font-size: 14px; font-style: italic; font-family: "Latin Modern Math", "STIX Two Math", "Cambria Math", serif; }

.jsxgraph-target.jxgbox {
  width: 100%;
  border: none;
  background: color-mix(in srgb, var(--bg-body) 76%, var(--bg-card));
}

.math-plot figcaption {
  padding: 0.65rem 1rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.math-plot-error {
  margin: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--accent-red, #d66);
  border-radius: 10px;
  color: var(--text-color);
  background: color-mix(in srgb, var(--accent-red, #d66) 12%, var(--bg-card));
}
