/* AusSci · How does particle theory explain the properties of substances? (Year 7): the particle drawings, the
   simulations' controls and the charts. The particle drawings sit on a light plate with fixed colours in light and dark
   mode alike. Charts follow the page's colours. Each state has one chart colour on every chart: solid in the first
   categorical colour (blue), liquid in the second (orange) and gas in the third (aqua), checked with the dataviz palette
   validator against both page surfaces for all pairs. The spacing chart also gives each state its own marker shape, the
   heating chart labels its shading, the diffusion chart has a key, and the spacing records are in a table. */

/* ---------- 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-small { font-size: 11.5px; fill: #34423c; }
.dia .d-strong { font-weight: 800; fill: #15231d; }
.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-s1: #2a78d6; --viz-s2: #eb6834; --viz-s3: #1baf7a;
  --viz-b1: rgba(42, 120, 214, 0.13); --viz-b2: rgba(235, 104, 52, 0.13); --viz-b3: rgba(27, 175, 122, 0.13);
}
@media (prefers-color-scheme: dark) {
  .lab {
    --viz-grid: #26332d; --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70;
    --viz-b1: rgba(57, 135, 229, 0.2); --viz-b2: rgba(217, 89, 38, 0.2); --viz-b3: rgba(25, 158, 112, 0.2);
  }
}
.chart text.ch-axis { fill: var(--viz-ink-2); font-size: 11.5px; }
.chart text.ch-axis-t { fill: var(--viz-ink-2); font-size: 11.5px; 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-line-t { fill: none; stroke: var(--viz-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-line-l { fill: none; stroke: var(--viz-s2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-line-g { fill: none; stroke: var(--viz-s3); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-dash { stroke-dasharray: 6 4; }
.chart .ch-band-1 { fill: var(--viz-b1); }
.chart .ch-band-2 { fill: var(--viz-b2); }
.chart .ch-band-3 { fill: var(--viz-b3); }
.chart .ch-key { stroke: var(--viz-muted); stroke-width: 0.8; }
.chart .ch-pt-1 { fill: var(--viz-s1); stroke: var(--paper); stroke-width: 1.5; }
.chart .ch-pt-2 { fill: var(--viz-s2); stroke: var(--paper); stroke-width: 1.5; }
.chart .ch-pt-3 { fill: var(--viz-s3); stroke: var(--paper); stroke-width: 1.5; }

/* ---------- 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; }
.pt-opt { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.889rem; font-weight: 700; cursor: pointer; min-height: 2rem; }
.pt-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); }
.lab-run .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; }
.ctl-row .ctl-range { flex: 1 1 14rem; }

/* ---------- 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); }
.pt-table td { font-variant-numeric: tabular-nums; }

/* ---------- the three rules (screen 1) ---------- */
.pt-rules { border: 1px solid var(--rule); border-left: 4px solid var(--y-stripe); border-radius: 4px; padding: 0.7rem 1rem; max-width: 46rem; }
.pt-rules .label { margin: 0 0 0.35rem; }
.pt-rules ol { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.3rem; }

/* ---------- a simulation: the drawing, with readings and a chart beside it ---------- */
.pt-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.pt-wrap:has(.pt-side) { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.pt-box { padding: 0.25rem; }
.pt-side { display: grid; gap: 0.7rem; align-content: start; }
.pt-side .chart { max-width: 22rem; }
.pt-read, .pt-badge { margin: 0; font-size: 0.944rem; }
.pt-read b, .pt-badge b { color: var(--y-deep); }
.pt-todo { margin: 0; color: var(--ink-3); }
.pt-status { min-height: 2.6em; }
.pt-tasks { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.4rem; font-size: 0.944rem; }
.pt-tasks li.is-done { color: var(--ink-3); }
.pt-tasks li.is-done b { color: var(--accent); }
.pt-size p { margin: 0 0 0.2rem; }
.pt-size .pt-dot { max-width: 9rem; }
.pt-hal { max-width: 22rem; }

/* energy bars on the heating screen */
.pt-bars { display: grid; gap: 0.5rem; max-width: 22rem; }
.pt-bar { position: relative; margin: 0; padding-bottom: 0.95rem; font-size: 0.889rem; font-weight: 700; }
.pt-bar::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 0.6rem; border-radius: 3px; background: var(--rule); }
.pt-bar i { position: absolute; left: 0; bottom: 0; height: 0.6rem; max-width: 100%; border-radius: 3px; background: #d4483d; z-index: 1; }
.pt-bar-2 i { background: #6b7bd8; }
@media (prefers-color-scheme: dark) { .pt-bar i { background: #e0574c; } .pt-bar-2 i { background: #8f9be6; } }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .pt-wrap:has(.pt-side) { grid-template-columns: minmax(0, 1fr); }
  .pt-side .chart, .pt-bars { max-width: 26rem; }
  .chart text.ch-axis, .chart text.ch-axis-t { font-size: 12.5px; }
}

/* the drawing on its own: not wider than the text column */
.pt-wrap:not(:has(.pt-side)) .pt-box { max-width: 48rem; }
.pt-key { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.833rem; color: var(--ink-2); max-width: 22rem; }
.pt-key li { display: inline-flex; align-items: center; }
.pt-key svg { width: 1.7rem; height: 0.6rem; margin-right: 0.35rem; flex: none; }
.pt-rules .small { margin: 0.4rem 0 0; color: var(--ink-2); }
