/* Zoom (js/arcade/zoom.js). Every class starts with .zm- */

.zm-wrap { position: relative; display: grid; gap: 8px; width: min(100%, 520px); margin: 0 auto; padding-bottom: 14px; }

/* ---------- HUD: the round she is on, the stars she can win, the score ---------- */
.zm-hud { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 14px; font: 700 14px var(--font-ui); color: var(--muted); }
.zm-hud b { color: var(--ink); font-size: 19px; }
.zm-stars { display: inline-flex; gap: 3px; }
.zm-star {
  --f: 0%; width: 24px; height: 24px;
  clip-path: polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 80% 94%, 50% 73%, 20% 94%, 31% 59%, 2% 37%, 38% 36%);
  background: linear-gradient(90deg, var(--sun) var(--f), var(--tile-shadow) var(--f));
}
.zm-star.zm-half { --f: 50%; }
.zm-star.zm-full { --f: 100%; animation: zm-pop 0.45s; }

/* ---------- where to zoom to ---------- */
.zm-goal { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 12px; min-height: 64px; padding: 2px 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); }
.zm-make { font: 700 22px/1.2 var(--font-read); color: var(--ink); }
.zm-target { display: inline-flex; align-items: center; font: 900 40px/1.2 var(--font-ui); color: var(--grape-d); letter-spacing: 0.02em; }
.zm-target.zm-pop { animation: zm-pop 0.45s; }
.zm-target sup { font-size: 0.6em; line-height: 1; align-self: flex-start; margin-left: 1px; }
.zm-thing { font: 700 28px/1.2 var(--font-read); letter-spacing: 0; text-align: center; }
.zm-unit { margin-left: 0.25em; font: 700 0.6em/1 var(--font-ui); color: var(--muted); }
/* a stacked fraction: 1 over 100 */
.zm-frac { display: inline-grid; justify-items: center; font-size: 0.62em; line-height: 1.05; vertical-align: middle; }
.zm-frac i { font-style: normal; padding: 0 4px; }
.zm-frac i + i { border-top: 3px solid currentColor; }

/* ---------- the zoom window ---------- */
.zm-win {
  position: relative; justify-self: center; width: min(100%, 290px, 36vh); aspect-ratio: 1; overflow: hidden;
  border: 5px solid var(--sky-d); border-radius: 28px; background: color-mix(in srgb, var(--sky) 14%, white); box-shadow: var(--shadow-soft);
}
.zm-win.zm-right { border-color: var(--green-d); background: color-mix(in srgb, var(--green) 18%, white); }
.zm-world { position: absolute; inset: 0; transform-origin: 50% 50%; }
.zm-layer { position: absolute; inset: 9%; }
.zm-svg { display: block; width: 100%; height: 100%; overflow: visible; stroke-linecap: round; stroke-linejoin: round; }
/* the smaller of two things in the window: a tenth of the size, in the middle of the bigger one */
.zm-small { transform: scale(0.1); }
/* a zoom step: the whole picture shrinks or grows ten times (quick first when shrinking, slow first when growing, so the zoom feels even) */
.zm-zoom-out { transition: transform 0.6s cubic-bezier(0.1, 0.75, 0.3, 1); }
.zm-zoom-in { transition: transform 0.6s cubic-bezier(0.7, 0, 0.9, 0.25); }
.zm-leave { animation: zm-leave 0.62s linear forwards; }
.zm-come { animation: zm-come 0.62s linear; }
@keyframes zm-leave { 0%, 80% { opacity: 1; } 100% { opacity: 0.25; } }
@keyframes zm-come { 0% { opacity: 0; } 15%, 100% { opacity: 1; } }

/* the drawings' colours: the tokens */
.zm-f-ink { fill: var(--ink); } .zm-s-ink { stroke: var(--ink); }
.zm-f-card { fill: var(--card); } .zm-s-card { stroke: var(--card); }
.zm-f-muted { fill: var(--muted); } .zm-s-muted { stroke: var(--muted); }
.zm-f-sun { fill: var(--sun); } .zm-s-sun { stroke: var(--sun); }
.zm-f-sky { fill: var(--sky); } .zm-s-sky { stroke: var(--sky); }
.zm-f-teal { fill: var(--teal); } .zm-s-teal { stroke: var(--teal); }
.zm-f-grape { fill: var(--grape); } .zm-s-grape { stroke: var(--grape); }
.zm-f-green { fill: var(--green); } .zm-s-green { stroke: var(--green); }
.zm-f-rose { fill: var(--rose); } .zm-s-rose { stroke: var(--rose); }
.zm-f-danger { fill: var(--danger); } .zm-s-danger { stroke: var(--danger); }

/* ---------- the readout: what the window shows, as a number with its zeros ---------- */
.zm-read { display: grid; justify-items: center; padding: 4px 12px 6px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); }
.zm-read.zm-right .zm-num { color: var(--green-d); animation: zm-pop 0.45s; }
.zm-read-top, .zm-read-dim { font: 700 15px/1.25 var(--font-read); color: var(--muted); text-align: center; }
.zm-read-mid { min-height: 58px; display: flex; align-items: center; justify-content: center; font: 900 40px/1.1 var(--font-ui); color: var(--ink); }
.zm-num { display: inline-flex; align-items: center; letter-spacing: 0.03em; }
.zm-z { font-style: normal; color: var(--grape-d); }
.zm-z.zm-new { display: inline-block; animation: zm-pop 0.5s; }
.zm-also { margin-left: 0.5em; font: 700 18px/1 var(--font-ui); color: var(--muted); }

/* ---------- the two zoom buttons ---------- */
.zm-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.zm-step {
  display: grid; justify-items: center; align-content: center; min-height: 68px; padding: 4px 6px 6px;
  border: 0; border-radius: 20px; font: inherit; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.zm-out { background: var(--sun); box-shadow: 0 5px 0 var(--sun-d); }
.zm-in { background: var(--sky); box-shadow: 0 5px 0 var(--sky-d); }
.zm-step:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--tile-shadow); }
.zm-step b { font: 900 32px/1.05 var(--font-ui); }
.zm-step small { font: 700 15px/1.1 var(--font-read); }
.zm-step.zm-off { opacity: 0.4; }

.zm-msg { min-height: 22px; margin: 0; text-align: center; font: 700 16px/1.35 var(--font-read); color: var(--ink); }
.zm-check { justify-self: center; min-width: 200px; }
.zm-check.zm-off { opacity: 0.45; }

/* a step that can't be made, and a Check that is not right yet: a little shake */
.zm-no { animation: zm-no 0.32s; }
@keyframes zm-no { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes zm-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: none; } }

/* iPad: bigger */
@media (min-width: 700px) {
  .zm-wrap { gap: 12px; }
  .zm-win { width: min(100%, 380px, 40vh); }
  .zm-target { font-size: 52px; }
  .zm-thing { font-size: 36px; }
  .zm-make { font-size: 28px; }
  .zm-read-mid { font-size: 50px; }
  .zm-msg { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .zm-star.zm-full, .zm-target.zm-pop, .zm-read.zm-right .zm-num, .zm-z.zm-new, .zm-no, .zm-leave, .zm-come { animation: none; }
  .zm-zoom-out, .zm-zoom-in { transition: none; }
}
