/* Nova's teaching board (public/teaching-board.js): an SVG board below Nova's portrait. The SVG
   keeps a fixed viewBox and scales to its box (no redraw on resize). Okabe-Ito tones, each with
   its own line style as well as colour (never colour alone): demo solid blue, mistake dashed
   vermillion, ok thick bluish green, ask dotted orange. Logical properties for RTL pages. */
.tb {
  position: relative;
  inline-size: 100%;
  min-inline-size: 0;
  border-radius: var(--ws-radius-sm, 14px);
  background: #fbfcff;
  border: 2px solid var(--ws-line, #dfe3f3);
  box-shadow: var(--ws-shadow, 0 8px 24px rgba(18, 32, 79, 0.08));
  overflow: hidden;
}
.tb-svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 1000 / 625;
  max-block-size: 100%;
  color: var(--ws-navy, #12204f);
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Devanagari", "Noto Sans Malayalam", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  /* Faint ruled lines, like a classroom board. */
  background-image: linear-gradient(to bottom, transparent 96%, rgba(42, 79, 216, 0.06) 96%);
  background-size: 100% 8%;
}
.tb[data-state="empty"] .tb-svg { opacity: 0.85; }
.tb-svg text { fill: currentColor; stroke: none; }
.tb-text, .tb-cell, .tb-op, .tb-label { font-weight: 600; }
.tb-cell, .tb-op, .tb-carry, .tb-tick-label, .tb-ttext { font-variant-numeric: tabular-nums; }
.tb-cell.tb-blank { fill: var(--ws-grey, #6b6680); font-weight: 400; }
.tb-result { fill: var(--ws-violet-deep, #3b2391); }
.tb-carry { font-weight: 700; }
.tb-stroke, .tb-svg line, .tb-svg polyline, .tb-svg path { stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.tb-rule { stroke-width: 3.5; }
.tb-tick line { stroke-width: 2.5; }
.tb-tick-label { font-size: inherit; fill: var(--ws-ink-soft, #4a4d6e); }
.tb-ticks line { stroke-width: 2; }
.tb-axis { stroke-width: 3; }

.tb-tone-ink { color: var(--ws-navy, #12204f); }
.tb-tone-demo { color: var(--ws-blue, #0072b2); }
.tb-tone-mistake { color: var(--ws-vermillion, #d55e00); }
.tb-tone-ok { color: var(--ws-green-ink, #00624a); }
.tb-tone-ask { color: var(--ws-orange-ink, #7a4b00); }
.tb-tone-mistake .tb-stroke, .tb-stroke.tb-tone-mistake { stroke-dasharray: 14 9; }
.tb-tone-ok .tb-stroke, .tb-stroke.tb-tone-ok { stroke-width: 6; }
.tb-tone-ask .tb-stroke, .tb-stroke.tb-tone-ask { stroke-dasharray: 2 9; }

.tb-highlight { stroke: none; opacity: 0.5; }
.tb-highlight.tb-tone-demo { fill: #cfe6f5; }
.tb-highlight.tb-tone-mistake { fill: #f7d9c4; stroke: #d55e00; stroke-width: 2; stroke-dasharray: 8 6; opacity: 0.7; }
.tb-highlight.tb-tone-ok { fill: #c7ece0; }
.tb-highlight.tb-tone-ask { fill: #fbe8bf; stroke: #e69f00; stroke-width: 2; stroke-dasharray: 2 6; opacity: 0.7; }

.tb-tcell { fill: #ffffff; stroke: var(--ws-lavender-2, #d9defa); stroke-width: 2; }
.tb-thead { fill: var(--ws-lavender, #eef0ff); }
.tb-thead-text { font-weight: 700; }

/* Write animation: dash reveal over pathLength=1, then the tone's own dash style takes over. */
.tb-svg .tb-stroke.tb-drawing { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.tb-svg .tb-stroke.tb-drawing.tb-go { stroke-dashoffset: 0; transition: stroke-dashoffset 0.45s ease-out; }
.tb-svg .tb-hidden { opacity: 0; }
.tb-svg g, .tb-svg text, .tb-svg rect, .tb-svg ellipse { transition: opacity 0.18s ease-out; }

/* Screen-reader transcript of each revealed step (the SVG itself is one labelled image). */
.tb-sr {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .tb-svg .tb-stroke.tb-drawing, .tb-svg .tb-stroke.tb-drawing.tb-go { stroke-dasharray: none; stroke-dashoffset: 0; transition: none; }
  .tb-svg .tb-hidden { opacity: 1; }
  .tb-svg g, .tb-svg text, .tb-svg rect, .tb-svg ellipse { transition: none; }
}
@media (forced-colors: active) {
  .tb { border-color: CanvasText; }
  .tb-svg { color: CanvasText; background-image: none; }
  .tb-highlight { fill: Highlight; opacity: 0.4; }
}
