/* Year 9 Science lab pages: the "Class results" step (science/lab_data.py,
 * _lab_class_data.html). Loaded after science-alkali.css, only on a lab that
 * collects class results. Tokens only.
 *
 * Three parts: the class table (what each group measured), the form that
 * adds a row, and the steps for the spreadsheet, each beside a drawing of the
 * sheet. Colour is never the only cue: the chosen cell of a drawing is named
 * in the box above the grid, and a teacher-only column says so under the
 * table. */

.alk-step--data { --alk-step: var(--tangerine); }

.labd-msg {
    margin: 0 0 0.85rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--tangerine);
    border-left-width: 6px;
    border-radius: 10px;
    background: var(--cream);
    font-weight: 600;
}
.labd-msg--ok { border-color: var(--teal-deep); background: var(--mint); }

.labd-class { margin: 0 0 0.6rem; }
.labd-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 0.85rem; }

/* ----------------------------------------------------------- the table */

.labd-wrap { margin: 0 0 0.6rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.labd-table { width: 100%; border-collapse: collapse; font-size: 1rem; line-height: 1.4; }
.labd-table th, .labd-table td { padding: 0.55rem 0.75rem; text-align: left; vertical-align: middle; white-space: nowrap; }
.labd-table thead th {
    background: var(--alk-step-soft);
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 800;
    white-space: normal;
    vertical-align: bottom;
}
.labd-table tbody tr + tr > *, .labd-table tfoot tr > * { border-top: 1px solid var(--line); }
.labd-table .labd-num { text-align: right; font-variant-numeric: tabular-nums; }
.labd-table tbody th { font-weight: 700; }
.labd-table tfoot th, .labd-table tfoot td { font-weight: 800; background: var(--cream); }
.labd-mine > * { background: color-mix(in srgb, var(--gold) 14%, var(--paper)); }
.labd-yours { margin-left: 0.25rem; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.labd-worked { background: color-mix(in srgb, var(--cyan) 9%, var(--paper)); }
.labd-table form { margin: 0; }
.labd-x {
    min-height: 44px;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 600;
}
.labd-x:hover { border-color: var(--ink); background: var(--cream); }

/* ------------------------------------------------------------ the form */

.labd-form, .labd-copy, .labd-guide { margin-top: 1.25rem; padding-top: 0.25rem; border-top: 1px solid var(--line); }
.labd-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem 1rem; }
.alk-step .labd-field { margin: 0; }
.labd-label { display: block; margin: 0 0 0.25rem; font-size: 0.9063rem; font-weight: 700; }
.labd-pick .labd-label { margin: 0; }
.labd-input {
    width: 100%;
    min-height: 44px;
    padding: 0.4rem 0.65rem;
    border: 2px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-variant-numeric: tabular-nums;
}
.labd-pick .labd-input { width: auto; min-width: 12rem; }
.labd-input:focus-visible, .labd-x:focus-visible, .labd-textarea:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-color: var(--ink); }

.labd-text { margin: 0.25rem 0 0; }
.labd-text summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--teal-deep); cursor: pointer; }
.labd-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--cream);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre;
    overflow: auto;
}

/* ----------------------------------------------- the spreadsheet steps */

.alk-step .labd-steps { margin: 0; padding: 0; list-style: none; counter-reset: labd; }
.alk-step .labd-step {
    counter-increment: labd;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    margin: 0;
    padding: 1.1rem 0;
    border-top: 1px solid var(--line);
}
.labd-step h4 { display: flex; align-items: baseline; gap: 0.6rem; margin: 0 0 0.4rem; font-size: 1.125rem; font-weight: 800; line-height: 1.3; }
.labd-step h4::before {
    content: counter(labd);
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.9375rem;
}
.labd-step code {
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    background: var(--cream);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1rem;
    font-weight: 700;
}
.alk-step .labd-formulae { padding-left: 1.2rem; }
.labd-why { display: block; margin: 0.2rem 0 0; font-size: 0.9375rem; color: var(--muted); }
p.labd-why { margin-bottom: 0; }

.labd-pic { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); overflow: hidden; }
.labd-bar { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--cream); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9375rem; }
.labd-bar-cell { flex: 0 0 auto; min-width: 4.5rem; padding: 0.4rem 0.7rem; border-right: 1px solid var(--line); font-weight: 700; text-align: center; }
.labd-bar-text { flex: 1 1 auto; min-height: 2.2rem; padding: 0.4rem 0.7rem; background: var(--paper); font-weight: 700; overflow-wrap: anywhere; }
.labd-gridwrap { overflow-x: auto; }
.labd-grid { width: 100%; border-collapse: collapse; font-size: 0.875rem; line-height: 1.25; }
.labd-grid th, .labd-grid td { height: 2rem; padding: 0.25rem 0.45rem; border: 1px solid var(--line); text-align: left; white-space: nowrap; }
.labd-grid thead th, .labd-grid thead td, .labd-grid tbody th {
    background: color-mix(in srgb, var(--line) 45%, var(--paper));
    color: var(--muted);
    font-weight: 600;
    text-align: center;
}
.labd-grid tbody th { width: 2.25rem; }
.labd-grid .labd-c--head { font-weight: 800; white-space: normal; }
.labd-grid .labd-c--num { text-align: right; font-variant-numeric: tabular-nums; }
.labd-grid .labd-c--new { background: var(--mint); }
.labd-grid .labd-c--on {
    background: color-mix(in srgb, var(--gold) 22%, var(--paper));
    outline: 3px solid var(--teal-deep);
    outline-offset: -3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
}

/* A phone: seven columns have to fit the width of the screen, so the drawing
 * is set smaller (it is a picture's labels, with the words beside it). */
@media (max-width: 40rem) {
    .labd-grid { font-size: 0.625rem; }
    .labd-grid th, .labd-grid td { height: 1.6rem; padding: 0.15rem 0.2rem; }
    .labd-grid tbody th { width: 1.1rem; }
    .labd-grid .labd-c--head { hyphens: auto; overflow-wrap: anywhere; }
    .labd-grid tbody td:first-of-type { white-space: nowrap; overflow-wrap: normal; }
    .labd-bar { font-size: 0.8125rem; }
    .labd-bar-cell { min-width: 3.25rem; padding: 0.35rem 0.4rem; }
}
/* The drawing of a chart: two axes, a dot a row. */
.labd-chart { max-width: 26rem; padding: 0.5rem; }
.labd-chart-svg { display: block; width: 100%; height: auto; }
.labd-chart-axis { stroke: var(--ink); stroke-width: 2; }
.labd-chart-dot { fill: var(--teal-deep); }
.labd-chart-title { fill: var(--ink); font-size: 11px; font-weight: 700; }

@media print {
    .alk-step .labd-step { break-inside: avoid; }
}
