/* Year 9 Science, Unit 1: the lesson text of a lab page and the Labs list.
 *
 * The lesson text is the owner's Markdown (science/content/labs/), drawn by
 * science/lab_content.py into the lab page's own look (science-alkali.css):
 * one step per section in the section's accent colour, the key words as a
 * table, each equation set large with its picture under it. Loaded after
 * science-alkali.css, tokens only. Colour is never the only cue. */

/* The accent of a lab is the colour its section has on the unit page. */
.alk {
    --alk-accent: var(--gold);
}
.alk--matter {
    --alk-accent: var(--teal);
}
.alk--atom {
    --alk-accent: var(--cyan);
}
.alk--table {
    --alk-accent: var(--gold);
}
.alk--change {
    --alk-accent: var(--tangerine);
}
.alk-step--lesson {
    --alk-step: var(--alk-accent);
}
.alk-step { scroll-margin-top: 5rem; }

/* The title block is a <div>, not a <header>: the site's print sheet hides
   every <header>, and a printed handout needs its title. */
.alk-head { padding-left: 0.9rem; border-left: 6px solid var(--alk-accent); margin-bottom: 1rem; }
.alk-labs .alk-head { border-left-color: var(--ink); }
.alk-aim { font-size: 1.125rem; line-height: 1.55; }
.alk-aim p { margin: 0 0 0.4rem; }
.alk-ref { margin: 0.25rem 0 0; }
.alk-ref i { margin-right: 0.25rem; }
.alk-back--labs { padding-left: 1rem; border-left: 1px solid var(--line); }
.alk-preview--lang { border-style: solid; border-color: var(--line); font-weight: 500; }

/* ------------------------------------------------------- on this page */

.alk-jump { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.75rem; margin: 0 0 1.25rem; }
.alk-jump-h { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.alk-jump-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.alk-jump-list a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.2rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.alk-jump-list a:hover { border-color: var(--ink); background: var(--cream); }

/* ---------------------------------------------------- the Markdown text */

.alk-md > :last-child { margin-bottom: 0; }
.alk-md p { margin: 0 0 0.85rem; }
.alk-md ul, .alk-md ol { margin: 0 0 0.85rem; padding-left: 1.4rem; }
.alk-md li { margin-bottom: 0.4rem; }
.alk-md li > ul, .alk-md li > ol { margin: 0.4rem 0 0; }
.alk-md a { color: var(--teal-deep); overflow-wrap: anywhere; }
.alk-md code { font-family: inherit; }

/* Key words (and any other table): word, then meaning. */
.alk-tablewrap { margin: 0 0 0.85rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.alk-table { width: 100%; border-collapse: collapse; font-size: 1rem; line-height: 1.5; }
.alk-table th, .alk-table td { padding: 0.6rem 0.85rem; text-align: left; vertical-align: top; }
.alk-table th {
    background: color-mix(in srgb, var(--alk-step) 16%, var(--paper));
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.alk-table tbody tr + tr td { border-top: 1px solid var(--line); }
.alk-table td:first-child { width: 32%; min-width: 9rem; font-weight: 700; }

/* An equation: the words, then the balanced equation set large, then its
   picture. A long equation breaks at a space; it never widens the page. */
.alk-eq {
    margin: 0 0 0.85rem;
    padding: 0.7rem 1rem;
    border-left: 6px solid var(--alk-step);
    border-radius: 0 12px 12px 0;
    background: color-mix(in srgb, var(--alk-step) 12%, var(--paper));
    font-size: clamp(1.125rem, 4.6vw, 1.5rem);
    line-height: 1.35;
    overflow-wrap: break-word;
}
.alk-eq strong { font-weight: 800; }
.alk-md .alk-eq--word {
    margin-bottom: 0.4rem;
    padding: 0;
    border: 0;
    background: none;
    font-size: 1.0625rem;
    line-height: 1.5;
    color: var(--ink);
}
.alk-eq--word strong { font-weight: 700; }
.alk-eqfig {
    margin: 0 0 1rem;
    padding: 0.6rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
}
.alk-eqfig-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.alk-eqimg { display: block; width: 100%; max-width: 46rem; height: auto; margin: 0 auto; }

/* The safety box of a "Stay safe" section. */
.alk-step--safety {
    --alk-step: var(--ink);
    background: var(--cream);
}
.alk-step--safety h2::after {
    content: "";
    flex: 1 1 auto;
    height: 2px;
    margin-left: 0.25rem;
    background: var(--ink);
    opacity: 0.15;
}
.alk-step--safety .alk-num { color: var(--paper); }
.alk-md.alk-safety { background: var(--paper); }

/* ------------------------------------------------------------ answers */

.alk-sheetgrid + .alk-sheetgrid { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.alk-sheetgrid ~ .alk-predict, .alk-watch { margin-bottom: 1rem; }
.alk-col--written { margin-top: 1rem; }
.alk-written-h { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 800; }
.alk-written {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--paper);
    font-size: 1rem;
    line-height: 1.55;
}
.alk-col--written .alk-answers-show, .alk-col--written .alk-answers-hide,
.alk-step--sheet > .alk-answers .alk-answers-show, .alk-step--sheet > .alk-answers .alk-answers-hide { position: static; }
.alk-col--written .alk-answers[open] .alk-answers-show,
.alk-step--sheet > .alk-answers[open] .alk-answers-show { display: none; }

/* Words only a teacher's page holds (teacher-running in the Markdown). */
div.alk-run {
    margin: 0 0 0.85rem;
    padding: 0.6rem 0.85rem 0.1rem;
    border: 1px dashed var(--ink);
    border-radius: 10px;
    background: var(--cream);
}
.alk-run-tag {
    margin: 0 0 0.35rem;
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}
span.alk-run { padding: 0 0.2rem; border-bottom: 1px dashed var(--ink); background: var(--cream); }

/* --------------------------------------------------------------- videos */

.alk-vlead {
    display: inline-block;
    margin-bottom: 0.25rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.alk-vnote { display: block; margin-top: 0.2rem; font-weight: 400; }
.alk-vids-more { margin-top: 1rem; }

/* ------------------------------------------------- previous / next lab */

.alk-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-top: 2rem; }
.alk-pager-link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
}
.alk-pager-link small { font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.alk-pager-link:hover { border-color: var(--ink); background: var(--cream); }
.alk-pager-link--next { grid-column: 2; align-items: flex-end; text-align: right; }

/* ---------------------------------------------------------- Labs list */

.alk-lablist { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; }
.alk-labrow {
    display: flex;
    gap: 1rem;
    padding: 1.1rem 1.1rem 1rem;
    border: 1px solid color-mix(in srgb, var(--alk-accent) 40%, var(--line));
    border-left: 8px solid var(--alk-accent);
    border-radius: 16px;
    background: var(--paper);
}
.alk-labrow-num { background: var(--alk-accent); }
.alk-labrow-text { min-width: 0; }
.alk-labrow-meta {
    margin: 0 0 0.15rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.alk-labrow-title { margin: 0 0 0.35rem; font-size: 1.3125rem; font-weight: 800; line-height: 1.25; }
.alk-labrow-title a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--alk-accent); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.alk-labrow-title a:hover { text-decoration-color: var(--ink); }
.alk-labrow-aim { margin: 0 0 0.5rem; }
.alk-labrow-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0.4rem 0 0;
    padding: 0.15rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--cream);
    font-size: 0.875rem;
    font-weight: 600;
}
.alk-labrow-status.is-open { border-color: var(--teal-deep); background: var(--mint); }
.alk-labrow-status.is-open i { color: var(--teal-deep); }
.alk-labrow.is-locked { background: var(--cream); }
.sci-labunit .sci-plain-labs.is-on { box-shadow: inset 0 0 0 2px var(--tangerine); }

/* ---------------------------------------------------------------- phone */

@media (max-width: 575.98px) {
    .alk-head { padding-left: 0.7rem; }
    .alk-aim { font-size: 1.0625rem; }
    .alk-jump-list { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; padding-bottom: 0.3rem; -webkit-overflow-scrolling: touch; }
    .alk-jump { flex-direction: column; align-items: stretch; }
    /* The key words table stacks: the word, then its meaning under it. */
    .alk-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .alk-table, .alk-table tbody, .alk-table tr, .alk-table td { display: block; width: auto; }
    .alk-table td { padding: 0 0.75rem 0.6rem; }
    .alk-table td:first-child { width: auto; min-width: 0; padding: 0.6rem 0.75rem 0.1rem; }
    .alk-table tbody tr + tr td { border-top: 0; }
    .alk-table tbody tr + tr { border-top: 1px solid var(--line); }
    /* The picture keeps a readable size and scrolls inside its own box. */
    .alk-eqimg { min-width: 30rem; }
    .alk-eq { padding: 0.6rem 0.75rem; }
    .alk-pager { grid-template-columns: minmax(0, 1fr); }
    .alk-pager-link--next { grid-column: 1; }
    /* The Labs list: each lab a compact card, the number in the corner,
       the aim at body size and the status on one line. */
    .alk-lablist { gap: 0.6rem; }
    .alk-labrow { padding: 0.7rem 0.75rem 0.65rem; gap: 0.6rem; border-left-width: 6px; border-radius: 12px; }
    .alk-labrow-num { width: 1.9rem; height: 1.9rem; font-size: 1rem; }
    .alk-labrow-meta { margin-bottom: 0.1rem; font-size: 0.75rem; }
    .alk-labrow-title { margin-bottom: 0.25rem; font-size: 1.0625rem; }
    .alk-labrow-aim { margin-bottom: 0.35rem; font-size: 0.9375rem; line-height: 1.45; }
    .alk-labrow-status { padding: 0.1rem 0.6rem; font-size: 0.8125rem; }
    .alk-labs .alk-head { margin-bottom: 0.75rem; }
    .alk-labs .alk-aim { font-size: 0.9375rem; }
    .alk-labs .alk-tools { margin-bottom: 0.9rem; padding-bottom: 0.7rem; }
    .alk-back--labs { padding-left: 0; border-left: 0; }
}

/* ---------------------------------------------------------------- print
 * The lab page prints as a handout of the lesson text: the title, the aim
 * and every lesson section with its equation pictures. Navigation, the
 * galleries, the answers, the videos, the interactive pieces and everything
 * for teachers are left out (most by .d-print-none in the template). */

@media print {
    /* The site's own print sheet sets the page margin to nothing (posters). */
    @page { margin: 14mm 12mm; }
    .alk { max-width: none; padding: 0; font-size: 11pt; }
    /* A step may run over a page: holding each one whole wastes paper. */
    .alk-step { margin-bottom: 10pt; padding: 8pt 10pt; border-top-width: 3pt; break-inside: auto; }
    .alk-step h2 { font-size: 14pt; break-after: avoid; }
    .alk-md li, .alk-eq { break-inside: avoid; }
    .alk-eq { break-after: avoid; }
    .alk-actions, .alk-pages-hint, .alk-col--answers, .alk-written, .alk-run,
    .alk-jump, .alk-pager, .alk-step--videos, .alk-step--try, .alk-step--fake { display: none !important; }
    .alk-col--sheet, .alk-preview { display: none !important; }
    .alk-eqfig { break-inside: avoid; }
    .alk-eqimg { min-width: 0; max-width: 100%; }
    .alk-tablewrap { overflow: visible; }
    .alk-table tr { break-inside: avoid; }
    .alk-eq, .alk-table th, .alk-num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
