/* One screen for the simulators built from the original STEM Lab site: the picture and every control visible at
   once, with no scrolling to find a button (_lab/fit.js adds the "fit" class; tool/stem_lab/trim_pages.py links both
   files into each page).

   Each page's tool is a grid of two columns: controls, then the simulation (picture first, then readings and graphs).
   Here the tool is one window tall. On a phone the simulation sits on top and the controls under it; on a computer
   they stay side by side. Each part scrolls on its own, so the picture never leaves the screen while a slider moves.
   Below the tool the guide reads as before. */

html.fit #simulator { padding-top: 12px; padding-bottom: 24px; }
html.fit #simulator > div > .mb-6 { display: none; } /* "... interactive experiment" and its sentence: the hero says it */
html.fit #hero { padding-top: 16px; }
html.fit #hero p, html.fit #hero a { display: none; }
html.fit #hero h1 { font-size: 1.375rem; }
html.fit.in-app #hero { display: none; }
html.fit.in-app #simulator { padding-top: 8px; }

html.fit [data-labels] { padding: 8px; }
html.fit [data-labels] > .grid {
  height: calc(100vh - 32px);
  height: calc(100svh - 32px);
  min-height: 480px;
  max-height: 1100px;
  gap: 12px;
}
html.fit [data-labels] > .grid > * {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: auto; /* at either end the page scrolls on, to the guide */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* Compact controls: less padding, the cards' explanatory sentence left out (the guide has it) */
html.fit [data-labels] .card-body { padding: 12px 14px; gap: 6px; }
html.fit [data-labels] .card-title + p { display: none; }
html.fit [data-labels] .card-body .grid.gap-4 { gap: 10px; }
html.fit [data-labels] .card-body .mt-4 { margin-top: 10px; }
html.fit [data-labels] .btn { min-height: 2.5rem; height: auto; }

@media (max-width: 1023.98px) {
  html.fit [data-labels] > .grid {
    display: flex;
    flex-direction: column;
  }
  /* the simulation first and a little more than half the height; the controls under it, in reach of a thumb */
  html.fit [data-labels] > .grid > :last-child { order: -1; flex: 1 1 56%; }
  html.fit [data-labels] > .grid > :first-child { flex: 1 1 44%; }
  html.fit [data-labels] .card-body .grid.gap-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* Notes above a tool (thermocouple: "runs locally in your browser") go under it, so the tool starts the screen */
html.fit [data-labels] { display: flex; flex-direction: column; }
html.fit [data-labels] > :not(.grid) { order: 1; margin: 12px 0 0; }

/* Where the readings come before the picture (dice, eclipse, spaceflight), the picture goes first */
html.fit :is(.dice-tool, .solar-eclipse-tool, .spaceflight-tool) > .grid > :last-child {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
html.fit :is(.dice-tool, .solar-eclipse-tool, .spaceflight-tool) > .grid > :last-child > * { margin-top: 0; }
html.fit :is(.dice-tool, .solar-eclipse-tool, .spaceflight-tool) > .grid > :last-child > :has(canvas) { order: -1; }

/* Phones: the long "how to use this" sentences under the controls' heading and under the picture go; the guide below
   the tool says the same, and on a small screen they push the sliders out of sight. Result sentences stay. */
@media (max-width: 1023.98px) {
  html.fit [data-labels] > .grid > :first-child p.leading-6[class*="content/65"],
  html.fit [data-labels] > .grid > :last-child p.mt-3.text-xs.leading-5[class*="content/55"]:not([class*="note"]) {
    display: none;
  }
}
