/* AusSci · How does your body respond to change? (Year 9): the concept maps, the simulations' controls, the drawings
   and the charts. Concept maps and body diagrams are drawn on a light plate with fixed colours in light and dark mode
   alike. Charts on the page follow the page's colours (the --viz-* tokens below, the same pair as the atoms and big bang
   lessons, checked with the dataviz palette validator). Insulin is drawn in the first chart colour and glucagon in the
   second, so dots and lines match. */

/* ---------- drawings ---------- */
.dia { display: block; width: 100%; height: auto; font-family: 'Atkinson Next', system-ui, sans-serif; touch-action: manipulation; }
.plate { background: #fbfbf6; border: 1px solid #d8ded9; border-radius: 4px; color: #15231d; }
.dia text { fill: #15231d; pointer-events: none; }
.d-lab { font-size: 13px; fill: #34423c; }
.d-small { font-size: 11.5px; fill: #34423c; }
.dia .d-strong { font-weight: 800; fill: #15231d; }
.dia .d-muted { fill: #5f6b66; }
.dia .d-num { font-variant-numeric: tabular-nums; font-weight: 700; }
.dia .d-halo { paint-order: stroke; stroke: rgba(251, 251, 246, 0.92); stroke-width: 3.5px; stroke-linejoin: round; }
.dia .d-on-dark { fill: #eef2f7; }
.art { position: relative; width: 100%; }
.art-cv { display: block; width: 100%; height: auto; border-radius: 4px; background: #fbfbf6; }
.art .art-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; overflow: visible; }
.arrow line { stroke: #15231d; stroke-width: 1.6; }
.arrow .arrow-head { fill: #15231d; }

/* ---------- chart tokens ---------- */
.lab { --viz-ink: var(--ink); --viz-ink-2: var(--ink-2); --viz-muted: var(--ink-3); --viz-grid: #e3e8e4; --viz-band: rgba(42, 120, 214, 0.1); --viz-s1: #2a78d6; --viz-s2: #eb6834; }
@media (prefers-color-scheme: dark) { .lab { --viz-grid: #26332d; --viz-band: rgba(57, 135, 229, 0.16); --viz-s1: #3987e5; --viz-s2: #d95926; } }
.chart text.ch-axis { fill: var(--viz-ink-2); }
.chart text.ch-axis-t { fill: var(--viz-ink-2); font-weight: 700; }
.chart .ch-grid { stroke: var(--viz-grid); stroke-width: 1; }
.chart .ch-base { stroke: var(--viz-muted); stroke-width: 1.2; }
.chart .ch-band { fill: var(--viz-band); }
.chart .ch-band-t { fill: var(--viz-ink-2); }
.chart .ch-line { fill: none; stroke: var(--viz-s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-line-2 { fill: none; stroke: var(--viz-s2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-ref { stroke: var(--viz-muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.chart .ch-dot { fill: var(--viz-s1); stroke: var(--paper); stroke-width: 2; }
.chart .ch-dot-2 { fill: var(--viz-s2); stroke: var(--paper); stroke-width: 2; }
.chart text.ch-val { fill: var(--viz-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart .ch-cross { stroke: var(--viz-muted); stroke-width: 1; }
.chart .ch-tip rect { fill: var(--paper); stroke: var(--rule); }

/* ---------- controls ---------- */
.ctl .label { margin-bottom: 0.3rem; }
.ctl-range label { display: block; font-size: 0.889rem; font-weight: 700; margin-bottom: 0.2rem; }
.ctl-range output { font-weight: 800; color: var(--y-deep); margin-left: 0.25rem; }
.ctl-range input[type="range"] { width: 100%; max-width: 36rem; accent-color: var(--accent); min-height: 2rem; }
.lab-run { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; }
.bs-opt { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.889rem; font-weight: 700; cursor: pointer; min-height: 2rem; }
.bs-opt input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.seg .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.model-note { font-size: 0.833rem; color: var(--ink-3); margin: 0; max-width: 46rem; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 0.8rem 1.6rem; }

/* ---------- concept maps ---------- */
.map-focus { margin: 0; font-weight: 700; max-width: 46rem; }
.map-focus .label { display: block; margin-bottom: 0.15rem; }
.map-slot { max-width: 44rem; padding: 0.3rem; }
.dia .map-line { fill: none; stroke: #6b7872; stroke-width: 1.6; }
.dia .map-head { fill: #6b7872; }
.dia .map-node rect { fill: #e8f5f9; stroke: #00465d; stroke-width: 1.4; }
.dia .map-node.is-key rect { fill: #cdebf3; stroke-width: 1.8; }
.dia .map-node-t { font-size: 13px; font-weight: 700; fill: #10303b; }
.dia .map-node.is-blank rect { fill: #fff6ea; stroke: #b0560f; stroke-width: 2; stroke-dasharray: 5 4; }
.dia .map-node-q { font-size: 18px; font-weight: 800; fill: #b0560f; }
.dia .map-pill rect { fill: #fbfbf6; stroke: none; }
.dia .map-pill-t { font-size: 11.5px; fill: #34423c; font-style: italic; }
.dia .map-pill.is-blank rect { fill: #fff6ea; stroke: #b0560f; stroke-width: 2; stroke-dasharray: 4 3; }
.dia .map-pill-q { font-size: 15px; font-weight: 800; fill: #b0560f; }
.dia .map-pill.is-new rect, .dia .map-node.is-new rect { fill: #e2f4e6; stroke: #2a7d46; stroke-width: 2; stroke-dasharray: none; }
.dia .map-pill.is-on rect, .dia .map-node.is-on rect { stroke: #007aa4; stroke-width: 3; stroke-dasharray: none; }
.map-svg [role="button"] { cursor: pointer; }
.map-svg [role="button"]:focus { outline: none; }
.map-svg [role="button"]:focus-visible rect { stroke: #15231d; stroke-width: 3; stroke-dasharray: none; }
.map-svg .map-pill[role="button"]:not(.is-blank):hover rect { fill: #eef3f0; }
.map-chooser { border-left: 4px solid var(--y-stripe); padding: 0.5rem 0 0.5rem 0.8rem; }
.map-q { margin: 0 0 0.45rem; font-weight: 700; }
.map-gap-s { font-weight: 400; }
.map-gap { display: inline-block; min-width: 2.2rem; text-align: center; border-bottom: 2px dashed #b0560f; color: #b0560f; font-weight: 800; }
@media (prefers-color-scheme: dark) { .map-gap { color: #f0a35e; border-color: #f0a35e; } }
.map-opts { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.map-opts .btn.is-wrong { text-decoration: line-through; opacity: 0.6; }
.map-fb { margin: 0.45rem 0 0; font-size: 0.944rem; }
.map-sentences summary { cursor: pointer; font-weight: 700; font-size: 0.889rem; }
.map-props { margin: 0.4rem 0 0; padding-left: 1.4rem; font-size: 0.944rem; }
.map-props li.is-blank { color: var(--ink-3); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; max-width: 40rem; }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.944rem; }
.data-table caption { text-align: left; font-weight: 700; font-size: 0.889rem; color: var(--ink-2); padding-bottom: 0.35rem; }
.data-table th, .data-table td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data-table thead th { font-size: 0.833rem; color: var(--ink-3); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .d-small { font-size: 12.5px; }
  .d-lab { font-size: 14px; }
  .dia .map-node-t { font-size: 13.5px; }
  .dia .map-pill-t { font-size: 12px; }
}

/* ---------- screen 1: the stimulus and response explorer ---------- */
.ex-wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.ex-art { padding: 0.2rem; }
.ex-chain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.ex-chain li { position: relative; border: 1px solid var(--rule); border-radius: 6px; padding: 0.4rem 0.65rem; background: var(--paper); }
.ex-chain li + li::before { content: ''; position: absolute; left: 1.4rem; top: -0.6rem; height: 0.55rem; border-left: 2px solid var(--ink-3); }
.ex-chain li.is-on { border-color: var(--y-stripe); box-shadow: inset 4px 0 0 var(--y-stripe); }
.ex-k { display: block; font-size: 0.778rem; font-weight: 800; letter-spacing: 0.03em; color: var(--ink-3); }
.ex-v { display: block; font-size: 0.944rem; }
.ex-picks .btn.is-tried .ex-tick::before { content: '✓'; margin-right: 0.3rem; }
@media (max-width: 640px) { .ex-wrap { grid-template-columns: minmax(0, 1fr); } }
.dia .ex-tag { font-size: 12px; fill: #15231d; }
.dia .ex-in { font-size: 12px; fill: #15231d; }
.dia .ex-in.d-on-dark { fill: #fdf3ee; }
.dia .ex-cap { font-size: 14px; fill: #15231d; }
.ex-key { margin: 0.35rem 0 0; font-size: 0.833rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; align-items: center; }
.sw { display: inline-block; width: 1.4rem; height: 0.3rem; border-radius: 2px; vertical-align: middle; margin-right: 0.3rem; }
.sw-nerve { background: #f2b33d; }
.sw-hormone { background: #e0528f; }
@media (max-width: 640px) {
  .dia .ex-tag { font-size: 17px; }
  .dia .ex-in { font-size: 15px; }
  .dia .ex-cap { font-size: 19px; }
}

/* ---------- screen 2: the reflex arc and the ruler ---------- */
.rf-wrap { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.rf-art { padding: 0.2rem; }
.rf-steps { margin: 0; padding-left: 1.5rem; display: grid; gap: 0.4rem; font-size: 0.944rem; }
.rf-steps li { color: var(--ink-3); }
.rf-steps li.is-on { color: var(--ink); font-weight: 700; }
.dia .rf-num { font-size: 13px; font-weight: 800; }
.dia .rf-tag { font-size: 12px; fill: #15231d; }
.ru-wrap { display: grid; grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.ru-art { padding: 0.2rem; touch-action: none; }
.ru-side { display: grid; gap: 0.6rem; align-content: start; }
.ru-side .lab-run .btn[data-catch] { min-width: 7rem; }
.dia .ru-mark { font-size: 12px; font-weight: 700; fill: #4d3c08; }
.dia .ru-tag { font-size: 12px; fill: #34423c; }
.dia .ru-read { font-size: 14px; fill: #a5281b; }
.ru-calc { margin: 0; font-size: 0.944rem; }
.ru-table .ru-avg th, .ru-table .ru-avg td { font-weight: 800; }
@media (max-width: 640px) {
  .rf-wrap, .ru-wrap { grid-template-columns: minmax(0, 1fr); }
  .ru-art { max-width: 15rem; }
  .dia .rf-num { font-size: 17px; }
  .dia .rf-tag { font-size: 16px; }
}
.dia .rf-n circle { fill: #ffffff; stroke: #15231d; stroke-width: 1.5; }
.dia .rf-n text { fill: #15231d; }
.dia .rf-n { opacity: 0.35; }
.dia .rf-n.is-on { opacity: 1; }
.dia .rf-n.is-on circle { fill: #15231d; }
.dia .rf-n.is-on text { fill: #ffffff; }

/* ---------- screen 3: danger, nerves and a hormone ---------- */
.lab { --viz-h: #c2185b; }
@media (prefers-color-scheme: dark) { .lab { --viz-h: #d94f9c; } }
.hm-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.hm-art { padding: 0.2rem; }
.dia .hm-tag { font-size: 12px; fill: #15231d; }
.chart .ch-hormone { fill: none; stroke: var(--viz-h); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-dot-h { fill: var(--viz-h); stroke: var(--paper); stroke-width: 2; }
.chart .ch-tick { stroke: var(--viz-ink-2); stroke-width: 1.2; }
.chart text { font-size: 12px; }
@media (max-width: 640px) {
  .hm-wrap { grid-template-columns: minmax(0, 1fr); }
  .dia .hm-tag { font-size: 13px; }
  .chart text { font-size: 13px; }
}

/* ---------- screens 4 and 6: body temperature ---------- */
.tp-wrap { display: grid; grid-template-columns: minmax(12rem, 0.9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.tp-art { padding: 0.2rem; }
.dia .tp-tag { font-size: 13px; fill: #15231d; }
.dia .tp-zt { font-size: 10.5px; font-weight: 700; fill: #15231d; }
.chart .ch-band-1, .chart .ch-band-2, .chart .ch-band-3 { fill: var(--viz-s1); }
.chart .ch-band-1 { fill-opacity: 0.08; }
.chart .ch-band-2 { fill-opacity: 0.15; }
.chart .ch-band-3 { fill-opacity: 0.24; }
.tp-loop { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.tp-loop li { border: 1px solid var(--rule); border-radius: 6px; padding: 0.4rem 0.6rem; background: var(--paper); }
@media (max-width: 900px) { .tp-loop { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .tp-wrap { grid-template-columns: minmax(0, 1fr); }
  .tp-art { max-width: 22rem; }
  .dia .tp-zt { font-size: 12px; }
  .tp-loop { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- screens 5, 6 and 7: blood glucose ---------- */
.gl-art { padding: 0.2rem; }
.dia .gl-box { fill: #ffffff; stroke: #9aa5a0; stroke-width: 1.2; }
.dia .gl-box.is-busy { stroke: #d35400; stroke-width: 3; }
.dia .gl-tag { font-size: 12.5px; fill: #15231d; }
.dia .gl-screen { font-size: 13px; font-weight: 700; fill: #8ef0ae; font-variant-numeric: tabular-nums; }
.gl-read { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0.4rem 0 0; font-size: 0.944rem; }
.gl-charts { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.chart .ch-glucose { fill: none; stroke: var(--viz-ink); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-reading { fill: var(--viz-ink-2); }
.chart .ch-dot-g { fill: var(--viz-ink); stroke: var(--paper); stroke-width: 2; }
@media (max-width: 640px) {
  .gl-charts { grid-template-columns: minmax(0, 1fr); }
  .dia .gl-tag { font-size: 12px; }
  .dia .gl-screen { font-size: 12px; }
}
.chart text.ch-band-t { paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
