:has()Panels of images that expand on click. Pure CSS — radio inputs + the :has() selector.
.panel { flex: 1 1 0; transition: flex 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.panel:has(:checked) { flex: 5 1 0; } /* the active panel takes 5× space */
.panel .content { opacity: 0; transition: opacity 0.4s 0.25s; }
.panel:has(:checked) .content { opacity: 1; }
@media (max-width: 720px) {
.gallery { flex-direction: column; height: auto; }
.panel { flex: 0 0 80px; width: 100%; }
.panel:has(:checked) { flex: 0 0 280px; }
}
Code playbook: vault/Topics/web-patterns.md § Pattern 5 (Image accordion with :has()). Compatibility: Safari 15.4+, Chrome 105+, Firefox 121+.