/* Design and Technologies lab activities (building): wheels and bridge (site/js/science/design-build.js).
   They share the lab look of lab-motion.css (.mo-in, .mo-kit, .mo-table, .mo-row, .mo-note):
   on the iPad each fills the space under the instruction, on a phone the step scrolls. */

.lab-wheels .mo-in, .lab-bridge .mo-in { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); grid-template-areas: "world" "kit" "note" "side"; }
.wh-world, .bd-world {
  grid-area: world;
  justify-self: center;
  position: relative;
  width: min(100%, (100dvh - 750px) * 2);
  aspect-ratio: 2;
  overflow: hidden;
  container-type: inline-size;
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.wh-world { width: min(100%, (100dvh - 750px) * 2.5); aspect-ratio: 5 / 2; }
.wh-world .mo-fair, .bd-world .mo-fair { top: 4%; right: 2%; font-size: max(11px, 1.8cqw); }
.lab-wheels .wh-go, .lab-bridge .bd-add { min-width: 150px; }

/* The drawings that stand in for an emoji on the cards and in the results. */
.wh-icon { display: block; width: 44px; height: 44px; }
.bd-icon { display: block; width: 70px; height: 30px; }
.mo-row .wh-icon { width: 34px; height: 34px; }
.mo-row .bd-icon { width: 60px; height: 26px; }
.mo-kit .wh-set .card-emoji, .mo-kit .bd-design .card-emoji { display: grid; place-items: center; min-height: 44px; }

/* ---- Wheels ---- */

.wh-wall { position: absolute; inset: 0 0 40% 0; background: linear-gradient(#e2f1ff, #fbf8f1); }
.wh-floor { position: absolute; inset: 60% 0 0 0; background: repeating-linear-gradient(90deg, #d7a76c 0 9cqw, #c08f55 9cqw 9.3cqw), #d7a76c; box-shadow: inset 0 0.3cqw 0 rgb(0 0 0 / 0.12); }
.wh-start { position: absolute; top: 56%; height: 9%; width: 0.6cqw; margin-left: -0.3cqw; background: repeating-linear-gradient(#1d2433 0 0.7cqw, #fff 0.7cqw 1.4cqw); border-radius: 2px; }
/* The ruler along the floor: 200 cm across 80 % of the view, from the start line. */
.wh-ruler { position: absolute; left: 12%; width: 80%; top: 67%; height: 13%; border: 1px solid #c49b00; border-radius: 3px; background: #ffd84d; }
.wh-ruler-ticks {
  position: absolute;
  inset: 0;
  border-right: 2px solid #4d3d10;
  background:
    repeating-linear-gradient(90deg, #4d3d10 0 2px, transparent 2px 100%) 0 0 / 25% 58% repeat-x,
    repeating-linear-gradient(90deg, #4d3d10 0 1px, transparent 1px 100%) 0 0 / 5% 30% repeat-x;
}
.wh-ruler-n { position: absolute; bottom: 6%; transform: translateX(-50%); color: #3b2f0c; font: 700 max(10px, 1.7cqw)/1 var(--ui); white-space: nowrap; }
.wh-ruler-n:first-of-type { transform: translateX(-10%); }
.wh-ruler-n:last-child { transform: translateX(-85%); }
.wh-pins { position: absolute; left: 0; right: 0; top: 82%; height: 18%; }
.wh-pin { position: absolute; top: 4%; }
.wh-pin .wh-icon { width: 4cqw; height: 4cqw; }
/* The reading: a dashed line from the cart down to the ruler, with the number. */
.wh-read { position: absolute; top: 36%; height: 31%; width: 0; z-index: 4; pointer-events: none; }
.wh-read-line { position: absolute; left: -1px; top: 0; bottom: 0; border-left: 2px dashed var(--wrong); }
.wh-read-n { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); padding: 0.15em 0.6em; border-radius: 999px; background: var(--wrong); color: #fff; font: 800 max(14px, 2.6cqw)/1.2 var(--ui); white-space: nowrap; }

/* The pusher at the start: a box on the wall, a spring and an arm that shoots out. */
.wh-pusher { position: absolute; left: 0; top: 40%; width: 4.2cqw; height: 8cqw; }
.wh-pusher-box { position: absolute; left: 0; top: 0; bottom: 0; width: 1.6cqw; border-radius: 0 0.6cqw 0.6cqw 0; background: linear-gradient(90deg, #6d7686, #8f99aa); }
.wh-spring { position: absolute; left: 1.6cqw; top: 38%; width: 1.4cqw; height: 24%; background: repeating-linear-gradient(90deg, #9aa3b2 0 0.25cqw, transparent 0.25cqw 0.5cqw); }
.wh-ram { position: absolute; left: 1.6cqw; top: 30%; width: 2.6cqw; height: 40%; transform-origin: 0 50%; transform: scaleX(0.15); border-radius: 0.3cqw 0.8cqw 0.8cqw 0.3cqw; background: linear-gradient(#ff8b5c, #e2582d); }
.wh-dust { position: absolute; top: 48%; font: 3.6cqw/1 var(--emoji); opacity: 0; visibility: hidden; pointer-events: none; }

/* The cart: its bottom edge is the axle line, where the wheels' middles are. */
.wh-cart { position: absolute; left: 0; top: 0; z-index: 3; width: 16cqw; height: 10cqw; will-change: transform, translate; cursor: pointer; touch-action: manipulation; }
.wh-body { position: absolute; left: 0; right: 0; bottom: -0.8cqw; height: 4.6cqw; border: 0.3cqw solid #8a4b1f; border-radius: 0.6cqw 0.6cqw 1cqw 1cqw; background: linear-gradient(#e8664a, #c9482f); box-shadow: inset 0 -0.6cqw 0 rgb(0 0 0 / 0.12); }
.wh-plank { position: absolute; left: 8%; right: 8%; top: 30%; height: 0.35cqw; border-radius: 1px; background: rgb(255 255 255 / 0.45); }
.wh-teddy { position: absolute; left: 50%; bottom: 2.8cqw; transform: translateX(-50%); font: 5.4cqw/1 var(--emoji); }
.wh-wheel { position: absolute; z-index: 1; display: block; }
.wh-wheel.back { left: 19%; }
.wh-wheel.front { left: 81%; }
.wh-cart.no-wheels .wh-wheel { display: none; }
.wh-wheel-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wh-tyre { fill: #2a2f38; stroke: #12151b; stroke-width: 0.06; stroke-linejoin: round; }
.wh-rim { fill: #dfe4ea; }
.wh-hub { fill: #7a8494; }
.wh-spoke { stroke: #7a8494; stroke-width: 0.14; stroke-linecap: round; }
.wh-none { fill: none; stroke: #c4472f; stroke-width: 0.14; stroke-linecap: round; stroke-dasharray: 0.3 0.18; }

/* ---- Bridge ---- */

.bd-sky { position: absolute; inset: 0; background: linear-gradient(#cfe9ff, #f3f9ff 70%); }
.bd-scenery, .bd-span { position: absolute; inset: 0; width: 100%; height: 100%; }
.bd-bank { fill: #c79a62; stroke: #8a6236; stroke-width: 0.6; }
.bd-bank-mini { fill: #c79a62; }
.bd-grass { fill: #6cbf4a; }
.bd-river { fill: #5fb3e6; }
.bd-wave { fill: none; stroke: #e8f6ff; stroke-width: 0.8; stroke-linecap: round; }
.bd-fall { position: absolute; inset: 0; z-index: 2; cursor: pointer; touch-action: manipulation; }
.bd-pile { position: absolute; inset: 0; }
.bd-weight { position: absolute; left: 50%; font: 4.6cqw/1 var(--emoji); }
.bd-splash { position: absolute; left: 50%; top: 84%; z-index: 3; font: 7cqw/1 var(--emoji); pointer-events: none; }
.bd-count { position: absolute; left: 3%; top: 6%; z-index: 3; padding: 0.15em 0.6em; border-radius: 999px; background: rgb(255 255 255 / 0.9); box-shadow: 0 1px 4px rgb(29 36 51 / 0.15); font: 800 max(14px, 2.6cqw)/1.25 var(--ui); white-space: nowrap; }
.bd-empty { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); padding: 0.2em 0.8em; border: 2px dashed #8a6236; border-radius: 999px; background: rgb(255 255 255 / 0.85); color: var(--muted); font: 400 max(13px, 2.4cqw)/1.3 var(--book); white-space: nowrap; pointer-events: none; }
.bd-empty[hidden], .bd-count[hidden] { display: none; }

/* ---- iPad on its side: the results go to the right ---- */

@container (min-aspect-ratio: 3 / 2) {
  .lab-wheels .mo-in, .lab-bridge .mo-in { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "world side" "kit side" "note side"; align-content: start; }
  .bd-world { width: min(100%, (100dvh - 470px) * 2); }
  .wh-world { width: min(100%, (100dvh - 520px) * 2.5); }
}

/* ---- Phones: everything at its own height; the step scrolls ---- */

@media (max-width: 600px), (max-height: 500px) {
  /* The step scrolls, and the picture stays in sight while the buttons under it are tapped. */
  .wh-world, .bd-world { position: sticky; top: 0; z-index: 5; width: 100%; border-radius: 16px; }
  .lab-wheels .big, .lab-bridge .big { min-height: 52px; }
  .lab-wheels .wh-go, .lab-bridge .bd-add { min-width: 0; }
  .wh-icon { width: 34px; height: 34px; }
  .bd-icon { width: 56px; height: 24px; }
  .mo-row .wh-icon { width: 26px; height: 26px; }
  .mo-row .bd-icon { width: 46px; height: 20px; }
  .mo-kit .wh-set .card-emoji, .mo-kit .bd-design .card-emoji { min-height: 34px; }
}

/* A phone on its side: picture on the left, the rest on the right. */
@media (max-height: 500px) {
  .lab-wheels .mo-in, .lab-bridge .mo-in { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "world kit" "world note" "world side"; align-items: start; }
}
