/* The PointMaze trainer (lab.html): the map to pick a start and a goal, then the site's three-panel figure, live, as
   wide as the main page's figures. */
.lab-page { max-width: var(--wide); margin: 0 auto; padding: 36px var(--gut, 24px) 80px; }
.lab-back { margin: 0 0 28px; font: 600 15px/1.2 var(--mono); }
.lab-back a { color: var(--ink); }
.lab-page h1 { margin: 0 0 14px; font: 700 clamp(34px, 5vw, 52px)/1.05 var(--logo); letter-spacing: -0.03em; }
.lab-lede { max-width: var(--col); margin: 0 0 8px; }
.lab-pick { display: grid; gap: 10px; }
.lab-pick[hidden], .lab .why-panels[hidden], .lab .why-key[hidden] { display: none; }
.lab-map { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.lab-map .start, .lab-map .goal { cursor: grab; }
.lab-map .goal.off { fill: #cfcfcb; stroke: #8b8b85; }
.lab-map .lab-ok circle { fill: var(--veto); opacity: .2; }
.lab-map .lab-link { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 3 5; opacity: .35; }
.lab-map :focus { outline: none; }
.lab-map :focus-visible { stroke: var(--ink); stroke-width: 3; }
.lab-hint { margin: 0; min-height: 1.4em; font: 500 15px/1.4 var(--mono); color: var(--ink-2); }
.lab figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; max-width: none; margin: 16px 0 0; }
.lab figcaption button { font-size: 15px; padding: 6px 14px; }
.lab figcaption button.lab-train { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lab figcaption button.lab-train:disabled { opacity: .35; }
/* the bar above the panels: episodes trained so far (grey), the one training now (pulsing), the one being drawn (ink) */
.lab-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 22px; }
.lab-progress[hidden] { display: none; }
.lab-bar { position: relative; flex: 0 1 360px; min-width: 160px; height: 8px; border-radius: 4px; background: var(--maze); overflow: hidden; }
.lab-bar span { position: absolute; top: 0; bottom: 0; left: 0; width: 0; }
.lab-trained, .lab-next { background: #b5b4ac; transition: width .3s ease-out, left .3s ease-out; }
.lab-shown { background: var(--ink); }
.lab-next { display: none; }
.lab-bar.busy .lab-next { display: block; animation: lab-pulse .9s ease-in-out infinite alternate; }
@keyframes lab-pulse { from { opacity: .2; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .lab-trained, .lab-next { transition: none; }
  .lab-bar.busy .lab-next { animation: none; opacity: .6; }
}
.lab-status { font: 500 15px/1.3 var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lab-note { max-width: var(--col); margin: 36px 0 0; font-size: 15px; color: var(--ink-2); }

/* On a computer the whole page fits in the window, with no scrolling: the figure takes the height left between the
   title and the note, and the map or the three panels are sized to that height (container units). While picking, the
   hint and the Train button sit beside the map; while training, the progress bar and the key share one line above the
   panels. On a phone the page scrolls as before. */
@media (min-width: 900px) {
  .lab-page { display: flex; flex-direction: column; min-height: 100svh; box-sizing: border-box; padding-top: 24px; padding-bottom: 20px; }
  .lab-back { margin-bottom: 12px; }
  .lab-page h1 { margin-bottom: 8px; }
  .lab-lede { margin-bottom: 0; }
  .lab.why { flex: 1 1 0; min-height: 320px; margin: 20px 0 0; container-type: size; display: grid;
    grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto 1fr; align-content: start; column-gap: 32px; }
  .lab-pick:not([hidden]) { display: contents; }
  /* the map is 10 by 7 maze units; it leaves 320px beside it for the hint and the button */
  .lab-map { grid-column: 1; grid-row: 1 / -1; width: min(calc(100cqw - 352px), calc(100cqh * 10 / 7)); }
  .lab-hint { grid-column: 2; grid-row: 1; }
  .lab.why > figcaption { grid-column: 2; grid-row: 2; align-self: start; }
  .lab-progress { grid-column: 1; grid-row: 1; margin: 0 0 18px; }
  .lab .why-key { grid-column: 2; grid-row: 1; justify-content: flex-end; margin: 0 0 18px; }
  /* a panel is about 67px of title, marks and count plus 0.806 of its width; the line above and the buttons below
     take about 93px more */
  .lab .why-panels { grid-column: 1 / -1; grid-row: 2; max-width: min(100%, calc((100cqh - 160px) / 0.806 * 3 + 56px)); }
  .lab.why:has(> .lab-pick[hidden]) > figcaption { grid-column: 1 / -1; grid-row: 3; }
  .lab-note { margin-top: 16px; }
}
