/* Week 05 sketches: the mechanics every sketch shares, so each file only carries its look.
   Everything happens inside the list: .stage holds one scrolling .level, and an item with
   .is-open shows its .sub, which opens by growing its grid row from 0 to its content. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; text-align: inherit; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; }

/* Each list keeps its own width (--w, set per sketch) instead of stretching to the window.
   In a window narrower than that, the whole list shrinks as one picture (--fit, set by the
   script) rather than reflowing, so what is seen in the small preview is the real layout. */
:root { --w: 360px; --fit: 1; }
body { position: relative; }
.stage { position: absolute; left: 50%; top: 0; width: var(--w); height: calc(100% / var(--fit)); overflow: hidden;
  transform: translateX(-50%) scale(var(--fit)); transform-origin: 50% 0; }
.level { position: absolute; inset: 0; overflow-y: auto; scrollbar-width: none; }
.level::-webkit-scrollbar { display: none; }

.sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .34s cubic-bezier(.2, .8, .2, 1); }
.sub > * { overflow: hidden; min-height: 0; }
.is-open > .sub { grid-template-rows: 1fr; }

.back-pill { position: fixed; left: 12px; bottom: 12px; z-index: 9; font: 12px/1 system-ui, sans-serif; color: #fff; background: rgba(20, 20, 20, .72); padding: 8px 12px; border-radius: 999px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .sub { transition: none; }
}
