A pricing card that is still a radio
CaveatA selectable pricing card needs a real input type="radio", not a click handler on a rectangle. The shared name makes these choices exclusive; the wrapping label makes the whole card clickable. Press Tab to enter the group and use the arrow keys to change plans. :has(:checked) paints the selected label, while the browser keeps the checked state and form value. Use a different group name for every independent chooser on the same page.
FallbackKeep the radio visible. Without :has(), the border stays plain but the dot, label and keyboard interaction still work. A coloured card is only a selection: it does not buy a subscription. Submit the value with a form and validate the plan and price on the server. For the same parent-selector idea in validation, see the wrapper that reads its input. Reference: MDN documentation.
<fieldset class="d-plans">
<legend>Choose your workspace</legend>
<label>
<input type="radio" name="wc-plan"
value="solo" checked>
<span><strong>Solo</strong>
<small>1 seat</small></span>
<b>$9<small> / month</small></b>
</label>
<label>
<input type="radio" name="wc-plan"
value="studio">
<span><strong>Studio</strong>
<small>5 seats</small></span>
<b>$29<small> / month</small></b>
</label>
</fieldset>
.d-plans {
border: 0; padding: 0; margin: 0;
width: 100%; max-width: 22rem;
color: var(--paper, #e6eaf1);
}
.d-plans legend { margin-bottom: .8rem; }
.d-plans label {
display: flex; align-items: center; gap: .8rem;
padding: 1rem; margin-top: .6rem;
border: 2px solid #64748b;
border-radius: .6rem; cursor: pointer;
}
.d-plans input { accent-color: #6fa8dc; }
.d-plans span { flex: 1; min-width: 0; }
.d-plans strong, .d-plans span small {
display: block;
}
.d-plans small { font-size: .75rem; }
.d-plans label:has(:checked) {
border-color: #6fa8dc;
background: rgb(111 168 220 / .14);
}
.d-plans label:has(:focus-visible) {
outline: 2px solid currentColor;
outline-offset: 3px;
}