/* AusSci · Physical or chemical change? (Year 8, AC9S8U07): the simulations' drawings and controls, the
   results tables, the questions under the drawings, and the boxes (the problem, the task cards and the practical work).
   Drawings have fixed colours in light and dark mode alike. Every particle and substance in a drawing is also named in
   words, and each kind of particle has its own shape, so colour is never the only key. */

/* ---------- 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 text.d-lab, .dia text.d-lab-s, .dia text.d-lab-b, .dia text.d-big, .dia text.d-lab-w { paint-order: stroke; stroke: #fbfbf6; stroke-width: 3.4px; stroke-linejoin: round; }
.dia text.d-lab { font-size: 14px; font-weight: 700; }
.dia text.d-lab-s { font-size: 12.5px; font-weight: 700; fill: #2c3a34; }
.dia text.d-lab-b { font-size: 15px; font-weight: 800; }
.dia text.d-big { font-size: 20px; font-weight: 800; }
.dia text.d-lab-w { font-size: 13.5px; font-weight: 800; fill: #ffffff; stroke: rgba(10, 18, 40, 0.8); stroke-width: 3px; }
.dia text.d-lab-ws { font-size: 11.5px; font-weight: 700; fill: #e8ecf4; paint-order: stroke; stroke: rgba(10, 18, 40, 0.8); stroke-width: 3px; stroke-linejoin: round; }
.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; touch-action: manipulation; }

/* ---------- controls ---------- */
.ctl .label { margin-bottom: 0.3rem; }
.ctl + .ctl, .lab-run + .ctl { margin-top: 0.6rem; }
.lab-run { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; margin-top: 0.6rem; }
.lab-run .btn[hidden], .ctl[hidden] { display: none; }
.seg { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.seg .btn { padding: 0.3rem 0.65rem; }
.seg .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg .btn:disabled, .lab-run .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- a simulation: the drawing, with its readings ---------- */
.ec-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; margin-top: 0.8rem; }
.ec-main { max-width: 52rem; }
.ec-box { padding: 0.25rem; }
.ec-read { margin: 0.6rem 0 0.2rem; padding: 0.6rem 0.8rem; border-left: 4px solid var(--rule); background: var(--soft); font-size: 1.056rem; line-height: 1.5; color: var(--ink); }
.ec-status { min-height: 2.6em; font-size: 1.056rem; }
.ec-todo { margin: 0; color: var(--ink-3); }
.ec-todo:empty { display: none; }

/* ---------- the questions under a drawing ---------- */
.ec-ask { margin-top: 0.9rem; border-top: 1px dashed var(--rule); padding-top: 0.7rem; max-width: 46rem; }
.ec-q { font-weight: 800; margin: 0 0 0.4rem; }
.ec-fb { min-height: 1.4em; font-weight: 700; margin: 0.4rem 0 0; color: var(--ink-2); }
.ec-fb:empty { min-height: 0; margin: 0; }

/* ---------- the results tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.944rem; }
table.data th, table.data td { vertical-align: top; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--rule); }
table.data thead th { font-size: 0.833rem; color: var(--ink-3); vertical-align: bottom; }
table.data tbody th { font-weight: 800; text-align: left; }
.ec-res-wrap { margin-top: 0.8rem; max-width: 46rem; }
table.ec-res caption { text-align: left; font-weight: 800; margin-bottom: 0.3rem; }
table.ec-res td { text-align: center; font-weight: 800; min-width: 2.6rem; }
table.ec-res td.is-now, table.ec-res tr.is-now th, table.ec-res tr.is-now td { background: var(--box); }
table.ec-res-text td { text-align: left; font-weight: 400; }
table.ec-res .ec-where { display: block; font-size: 0.722rem; font-weight: 400; color: var(--ink-2); }
table.ec-res .ec-where:empty { display: none; }
table.ec-sort .seg .btn { padding: 0.2rem 0.5rem; font-size: 0.833rem; }
table.ec-sort .ec-fb { font-size: 0.833rem; margin-top: 0.25rem; }
@media (max-width: 640px) {
  table.ec-res th, table.ec-res td { padding: 0.3rem 0.12rem; font-size: 0.722rem; min-width: 0; }
  table.ec-res thead th { font-size: 0.611rem; }
  table.ec-res th:first-child { width: 4rem; }
  table.ec-res .ec-where { font-size: 0.611rem; }
  table.ec-res-text th:first-child { width: 5rem; }
  /* a table with Solid and Liquid buttons stacks its rows on a phone: the thing, its results, then the buttons */
  table.ec-sort, table.ec-sort tbody, table.ec-sort tr, table.ec-sort th, table.ec-sort td { display: block; width: auto; }
  table.ec-sort caption { display: block; }
  table.ec-sort thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.ec-sort tbody tr { border-bottom: 1px solid var(--rule); padding: 0.45rem 0; }
  table.ec-sort tbody th, table.ec-sort tbody td { border-bottom: 0; padding: 0.1rem 0; font-size: 0.833rem; }
  table.ec-sort tbody th:first-child { width: auto; }
}

/* ---------- the boxes: the test on the screen, the task cards and the real test ---------- */
.look, .tasks, .real { border: 2px solid var(--y-stripe); border-radius: 6px; padding: 0.9rem 1.1rem 1rem; max-width: 46rem; background: var(--box); }
.play-tag { display: inline-block; font-size: 0.722rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--paper); background: var(--ink); border-radius: 3px; padding: 0.1rem 0.45rem; margin: 0 0 0.45rem !important; }
.look p, .tasks p, .real p { margin: 0 0 0.5rem; }
.look-text { font-size: 1.111rem; font-weight: 700; }
.ch-list { margin: 0.4rem 0 0.6rem; padding: 0; list-style: none; display: grid; gap: 0.5rem; counter-reset: ch; }
.ch { border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; padding: 0.55rem 0.75rem 0.5rem 2.6rem; position: relative; counter-increment: ch; }
.ch::before { content: counter(ch); position: absolute; left: 0.6rem; top: 0.5rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-items: center; font-weight: 800; font-size: 0.833rem; }
.ch.is-done { border-color: var(--ok); box-shadow: inset 0.3rem 0 0 var(--ok); }
.ch.is-done::before { content: '\2713'; border-color: var(--ok); background: var(--ok); color: var(--paper); }
.ch-t { font-weight: 800; margin: 0 0 0.25rem !important; }
.ch-hint summary { cursor: pointer; font-weight: 700; color: var(--ink-2); font-size: 0.944rem; }
.ch-hint p { margin: 0.3rem 0 0.2rem !important; }
.ch-done { margin: 0.2rem 0 0 !important; font-weight: 700; color: var(--ok); }
.ch-done:empty { display: none; }
.ch-count { font-weight: 800; }
.ch-talk { border-top: 1px dashed var(--rule); padding-top: 0.55rem; }


/* ---------- the results tables: extras ---------- */
table.ec-res .ec-sub { display: block; font-size: 0.778rem; font-weight: 400; color: var(--ink-2); }
table.ec-res-text td:empty::after, table.ec-res td:empty::after { content: '\00a0'; }
table.ec-mat td, table.ec-res-text td { vertical-align: top; }
@media (max-width: 640px) {
  table.ec-sort td:empty { display: none; }
  table.ec-sort td { text-align: left; }
}

/* ---------- the real test ---------- */
.real { margin-top: 1rem; }
.real + .look { margin-top: 1rem; }
.real h3 { margin: 0 0 0.3rem; font-size: 1.222rem; }
.real-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 0.4rem 1.4rem; }
.real-cols ul, .real-cols ol { margin: 0.2rem 0 0.5rem; padding-left: 1.3rem; }
.real-cols li { margin-bottom: 0.25rem; }
.real-care { border-left: 0.3rem solid var(--y-stripe); padding-left: 0.6rem; }
.real .ec-ask { border-top: 1px dashed var(--rule); }
@media (max-width: 640px) { .real-cols { grid-template-columns: minmax(0, 1fr); } }

/* ---------- this lesson: tables that stack on a phone ---------- */
.look .play-tag { background: var(--y-deep); }
.key-idea + .real { margin-top: 1.2rem; }
[data-for][hidden] { display: none; }
@media (max-width: 640px) {
  table.ec-stack, table.ec-stack tbody, table.ec-stack tr, table.ec-stack th, table.ec-stack td { display: block; width: auto; }
  table.ec-stack caption { display: block; }
  table.ec-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.ec-stack tbody tr { border-bottom: 1px solid var(--rule); padding: 0.45rem 0.2rem; }
  table.ec-stack tbody th, table.ec-stack tbody td { border-bottom: 0; padding: 0.1rem 0; font-size: 0.833rem; text-align: left; }
  table.ec-stack tbody th:first-child { width: auto; font-size: 0.889rem; }
  table.ec-stack td[data-h]:not(:empty)::before { content: attr(data-h) ': '; font-weight: 800; }
  table.ec-stack td:empty { display: none; }
  table.ec-sort td[data-h]:not(:empty)::before { content: attr(data-h) ': '; font-weight: 800; }
}

/* ---------- this lesson: the plan builder, the products and the problem box ---------- */
.ec-plan { margin-top: 0.8rem; max-width: 46rem; }
.ec-plan ol { margin: 0.3rem 0 0; padding-left: 1.4rem; }
.ec-plan li { margin-bottom: 0.2rem; }
.ec-plan:empty { display: none; }
.look-text b { font-weight: 800; }

/* sliders: a label above a full-width range; the four element sliders on screen 3 go in a grid */
.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; }
.ctl-range + .ctl-range { margin-top: 0.4rem; }
.ec-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.3rem 1.5rem; margin: 0.6rem 0; }
.ec-sliders .ctl-range + .ctl-range { margin-top: 0; }
.ec-choice { margin-top: 0.6rem; }
