/* Capacitors and RC Circuits: its colours, circuit diagrams (with capacitors and switches), graphs
   against time, answer fields and tutor marks; the general look is in ui.css (shared by the apps). */
:root {
  --cur: #1f5fd6;
  --vol: #c8322b;
  --curve: #1f5fd6;
  --ghost: #9a958b;
  --grid: #ebe8e1;
  --grid-major: #d9d5cb;
  --zone-light: rgba(43, 89, 195, 0.06);
  --zone-light-line: rgba(43, 89, 195, 0.45);
  --zone-strong: rgba(43, 89, 195, 0.16);
  --zone-strong-line: rgba(43, 89, 195, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root {
    --cur: #74a7ff;
    --vol: #ff8a80;
    --curve: #74a7ff;
    --ghost: #7d828a;
    --grid: #2a2e33;
    --grid-major: #3a3f45;
    --zone-light: rgba(122, 162, 255, 0.07);
    --zone-light-line: rgba(122, 162, 255, 0.45);
    --zone-strong: rgba(122, 162, 255, 0.2);
    --zone-strong-line: rgba(122, 162, 255, 0.65);
  }
}

#prompt p { margin: 6px 0; }

/* circuit drawing */
svg text { font-family: var(--serif); font-size: 14px; }
svg .w { stroke: var(--ink); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg .w.thick { stroke-width: 4.5; stroke-linecap: butt; }
svg .w.plate { stroke-width: 3; stroke-linecap: butt; }
svg .w.plate.hl { stroke: var(--accent); }
svg .c { stroke: var(--ink); stroke-width: 1.8; fill: var(--card); }
svg .dot { fill: var(--ink); }
svg .lbl { fill: var(--ink); }
svg .small { font-size: 12px; }
svg .cur { stroke: var(--cur); stroke-width: 1.8; fill: none; }
svg .cur-h, svg .cur-t { fill: var(--cur); }
svg .contact { fill: var(--card); stroke: var(--ink); stroke-width: 1.4; }
svg .lever.hl { stroke: var(--accent); stroke-width: 2.6; }
svg .note { fill: var(--accent); font-size: 13px; font-weight: 600; font-family: system-ui, sans-serif; }
svg .dim { opacity: 0.3; }

/* tutor: the block a step is about, the capacitor just found */
svg .zone { stroke-width: 1.2; }
svg .zone.light { fill: var(--zone-light); stroke: var(--zone-light-line); stroke-dasharray: 4 3; }
svg .zone.strong { fill: var(--zone-strong); stroke: var(--zone-strong-line); }
svg .cap { fill: var(--ink); font-size: 13px; }
svg .new { font-weight: 700; }
svg .mark { fill: var(--mark); }
.k-strong { background: var(--zone-strong); border: 1px solid var(--zone-strong-line); border-radius: 3px; padding: 0 3px; }
.k-new { background: var(--mark); border-radius: 3px; padding: 0 3px; font-weight: 600; }

/* graphs against time */
svg.tgraph { display: block; width: 440px; max-width: 100%; height: auto; aspect-ratio: 340 / 210; }
svg.tgraph .grid { stroke: var(--grid); stroke-width: 1; }
svg.tgraph .grid.major { stroke: var(--grid-major); }
svg.tgraph .ax { stroke: var(--ink); stroke-width: 1.4; fill: none; }
svg.tgraph .axhead { fill: var(--ink); }
svg.tgraph .tick { fill: var(--muted); font-size: 12px; font-family: system-ui, sans-serif; }
svg.tgraph .axl { fill: var(--ink); font-size: 15px; }
svg.tgraph .axl .sub { font-size: 11px; }
svg.tgraph .it { font-style: italic; }
svg.tgraph .lvl { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
svg.tgraph .lvlt { fill: var(--ink); font-size: 15px; }
svg.tgraph .curve { stroke: var(--curve); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg.tgraph .curve.ghost { stroke: var(--ghost); stroke-width: 2; stroke-dasharray: 6 4; }
svg.tgraph .tan { stroke: var(--vol); stroke-width: 1.6; stroke-dasharray: 6 4; }
svg.tgraph .tdot { fill: var(--vol); stroke: var(--card); stroke-width: 1.5; }

/* the tutor's four graphs, numbered */
.four { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 560px; }
.four .fig, .choices.pics .fig { position: relative; }
.four .num, .choices.pics .num { position: absolute; right: 10px; top: 6px; font-weight: 700; color: var(--accent); font-family: system-ui, sans-serif; }

/* answers that are no numbers: a choice of words, statements (one below the other) or graphs */
.field.choice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.field.choice .what { margin-right: 4px; }
.field.choice.wide { flex-direction: column; align-items: stretch; }
/* every answer part on its own row of the grid of fields (ui.css) */
.fields > .field.choice { grid-column: 1 / -1; }
.field.choice .choices.levels { flex-wrap: wrap; flex-shrink: 1; }
.choices { flex-wrap: wrap; }
.choices.stack { flex-direction: column; align-items: stretch; }
.choices.stack > label > span { border-left: 0; border-top: 1px solid var(--line); text-align: left; padding: 6px 12px; white-space: normal; }
.choices.stack > label:first-child > span { border-top: 0; }
.choices.pics { display: flex; flex-wrap: wrap; gap: 8px; border: 0; background: none; overflow: visible; max-width: 640px; }
.choices.pics > label { flex: 0 0 calc(50% - 4px); min-width: 0; }
.choices.pics > label > span { position: relative; display: block; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.choices.pics > label:first-child > span { border-left: 1px solid var(--line); }
.choices.pics input:checked + span { background: var(--card); color: var(--ink); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.choices.pics svg.tgraph, .four svg.tgraph { width: 100%; }
.field.choice.ok .choices.pics input:checked + span { border-color: var(--ok); box-shadow: inset 0 0 0 2px var(--ok); background: var(--ok-bg); }
.field.choice.bad .choices.pics input:checked + span { border-color: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); background: var(--bad-bg); }
@media (max-width: 560px) { .four { grid-template-columns: minmax(0, 1fr); } .choices.pics > label { flex-basis: 100%; } }

/* a result in the text of a step (in formulas, KaTeX marks it: see ui.css) */
span.result { background: var(--ok-bg); border-radius: 3px; padding: 0.05em 0.25em; }

#hint-list ul { margin: 4px 0; padding-left: 1.2em; }

/* check: graphs as options */
#ck .ck-opt .val svg.tgraph { width: 260px; max-width: 100%; }

/* graphs without numbers shown small (as options, or four of them): larger labels; shown at
   full size they keep the labels of the other graphs */
:is(.four, .choices.pics, #ck) svg.tgraph.bare :is(.axl, .lvlt) { font-size: 20px; }
:is(.four, .choices.pics, #ck) svg.tgraph.bare .axl .sub { font-size: 14px; }
:is(.four, .choices.pics, #ck) svg.tgraph.bare .tick { font-size: 15px; }
#ck .ck-answers svg.tgraph { width: 260px; max-width: 100%; }
/* reading a graph (reader.js, see figures.js): the point pointed at, or the tangent there; a
   horizontal drag reads at once, a vertical one scrolls the page until the graph is tapped */
svg.tgraph[data-read]:not(.rd-reading) { touch-action: pan-y; }
svg.tgraph g.rd .rd-guide { stroke-width: 1.2; stroke-dasharray: 4 3; }
svg.tgraph g.rd .rd-pt:not(.rd-on) { r: 3.5px; }
svg.tgraph g.rd .rd-tan { stroke: var(--vol); }

/* predict, then watch (play.js): the circuit with the switch S and, once unlocked, the graph of
   the voltages and the current, drawn up to the time of the slider, with the values read off
   beside it; rings mark the moments that mean something in the exercise (named below the graph),
   and the student's answers are listed there (✓ on the curve, ✗ off it) */
:root { --s0: #2a78d6; --s1: #eb6834; --s2: #1baf7a; }
@media (prefers-color-scheme: dark) { :root { --s0: #3987e5; --s1: #d95926; --s2: #199e70; } }
.capw-host { flex: 1 1 100%; min-width: 0; }
.capw { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 24px; }
.capw-circ { max-width: 100%; }
.capw-side { width: min(100%, 340px); }
.capw-wait { max-width: 30em; margin: 0; }
svg.capw-plot { display: block; width: 100%; height: auto; }
.capw-plot .grid { stroke: var(--grid-major); stroke-width: 1; }
.capw-plot .grid.zero { stroke: var(--muted); }
.capw-plot .axis { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.capw-plot .now { stroke: var(--ink); stroke-width: 1; opacity: 0.45; }
.capw-plot .tick, .capw-plot .pname { fill: var(--muted); font: 11px system-ui, sans-serif; }
.capw-plot .pname { fill: var(--ink); font-size: 12px; }
.capw-plot .it { font-style: italic; }
.capw-plot .sub { font-size: 9px; }
.capw-plot .curve { fill: none; stroke-width: 2; stroke-linejoin: round; }
.capw-plot .other { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-dasharray: 0.1 4; stroke-linecap: round; stroke-linejoin: round; }
.capw-plot .odot { fill: var(--ink); stroke: var(--card); stroke-width: 1.5; }
.capw-read .key.other { height: 0; border-top: 3px dotted var(--ink); border-radius: 0; background: none; }
.capw-read .otherrow { font-size: 0.85rem; }
.capw-plot .ghost { fill: none; stroke: var(--ghost); stroke-width: 1.6; stroke-dasharray: 5 4; }
.capw-plot .dot { stroke: var(--card); stroke-width: 2; }
.capw-plot .kpt { fill: var(--card); stroke-width: 2; }
.capw-plot .kline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.capw-plot text.klab { font: 600 11px system-ui, sans-serif; stroke: var(--card); stroke-width: 3; paint-order: stroke; }
.capw-plot .klab.s0 { fill: var(--s0); } .capw-plot .klab.s1 { fill: var(--s1); } .capw-plot .klab.s2 { fill: var(--s2); }
.capw-plot .s0 { stroke: var(--s0); } .capw-plot .dot.s0 { fill: var(--s0); stroke: var(--card); }
.capw-plot .s1 { stroke: var(--s1); } .capw-plot .dot.s1 { fill: var(--s1); stroke: var(--card); }
.capw-plot .s2 { stroke: var(--s2); } .capw-plot .dot.s2 { fill: var(--s2); stroke: var(--card); }
.capw-read { list-style: none; margin: 4px 0 0; padding: 0; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.capw-read li { margin: 2px 0; }
.capw-read .key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.capw-read .key.s0 { background: var(--s0); } .capw-read .key.s1 { background: var(--s1); } .capw-read .key.s2 { background: var(--s2); }
.capw-read .key.ghost { height: 0; border-top: 2px dashed var(--ghost); border-radius: 0; }
.capw-read .ghost-note { color: var(--muted); font-size: 0.85rem; }
.capw-read .keyrow { font-size: 0.85rem; color: var(--muted); }
.capw-read .kmark { display: inline-block; width: 7px; height: 7px; border: 2px solid var(--muted); border-radius: 50%; vertical-align: -1px; margin-right: 6px; }
.capw-read .pred { font-size: 0.85rem; }
.capw-read .pred.ok { color: var(--ok); } .capw-read .pred.bad { color: var(--bad); }
