/* ==========================================================================
   NSDA design system: checkbox and radio button (13 Nov 2026). One component for the whole site and the team page.
   Put the class on the real <input> (it stays a real checkbox or radio for keyboards and screen readers):
     <label class="choice"><input type="checkbox" class="ds-check"> <span>Words</span></label>
     <label class="choice"><input type="radio" class="ds-radio" name="x"> <span>Words</span></label>
   A button that acts as a checkbox (the team page's Paid) uses <span class="ds-check is-checked"> inside it.

   Size: 24px box (6px corners) or 24px circle, inside a 44px tap area (the label).
   States, on light grounds (Ivory, Neutral 50):
     Rest            1.5px Soft line, Ivory fill
     Hover           1.5px Gold ink line, Neutral 50 fill (the same hover as the text fields)
     Focus           2px Gold ink line + the soft gold glow (the same focus as the text fields)
     Checked         House fill, Gold tick (checkbox) or Gold dot (radio): the same pair as the choice chips
     Checked hover   Ash fill (one step lighter than House)
     Mixed           House fill, Gold dash (a checkbox that heads a list with some ticked)
     Error           2px Error red line (always with words beside it)
     Disabled        Linen fill, Neutral 300 line, no hover; checked shows a Neutral 400 fill with an Ivory mark
   On dark grounds (.on-dark, e.g. the team sign-in on House): Neutral 200 fill, no line at rest; checked is Gold with a House tick.
   The tick draws in (150ms); with reduced motion it simply appears.
   ========================================================================== */
.choice { display: inline-flex; align-items: flex-start; gap: var(--space-12); min-height: 44px; padding: 10px 0; cursor: pointer; }
.choice > span { padding-top: 0; }

.ds-check, .ds-radio {
  flex: none; position: relative; display: inline-block; width: 24px; height: 24px; margin: 0; padding: 0; border: 0;
  border-radius: 6px; background: var(--ivory) center / 16px 16px no-repeat; box-shadow: inset 0 0 0 1.5px var(--soft);
  appearance: none; -webkit-appearance: none; cursor: pointer; vertical-align: middle;
  transition: background-color 150ms var(--ease-standard), box-shadow 150ms var(--ease-standard);
}
.ds-radio { border-radius: 50%; }

/* Hover and focus: the text fields' own states */
.ds-check:hover, .ds-radio:hover, .choice:hover .ds-check, .choice:hover .ds-radio, button:hover > .ds-check, .ds-check.is-hover, .ds-radio.is-hover { background-color: var(--neutral-50); box-shadow: inset 0 0 0 1.5px var(--gold-ink); }
.ds-check:focus-visible, .ds-radio:focus-visible, .ds-check.is-focus, .ds-radio.is-focus { outline: none; box-shadow: inset 0 0 0 2px var(--gold-ink), 0 0 0 4px rgba(217, 184, 114, 0.4); }

/* Checked: House with a Gold mark */
.ds-check:checked, .ds-check.is-checked, .ds-check:indeterminate, .ds-check.is-mixed, .ds-radio:checked {
  background-color: var(--house); box-shadow: none;
}
.ds-check:checked, .ds-check.is-checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23D9B872' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' stroke-dasharray='16' stroke-dashoffset='0'/%3E%3C/svg%3E");
  animation: ds-tick 150ms var(--ease-standard);
}
.ds-check:indeterminate, .ds-check.is-mixed {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' fill='none' stroke='%23D9B872' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.ds-radio:checked { background-image: radial-gradient(circle, var(--gold) 0 4.5px, transparent 5px); background-size: 100% 100%; }
@keyframes ds-tick { from { background-size: 4px 4px; } to { background-size: 16px 16px; } }

/* Large variant (21 Nov 2026): 36px box (8px corners), mark 24px, for the corner of a photo thumbnail. Put it in a 76px tap area (60px on phones). */
.ds-check--lg { width: 36px; height: 36px; border-radius: 8px; background-size: 24px 24px; }
.ds-check--lg.is-checked, .ds-check--lg:checked { animation-name: ds-tick-lg; }
@keyframes ds-tick-lg { from { background-size: 6px 6px; } to { background-size: 24px 24px; } }

.ds-check:checked:hover, .ds-check.is-checked:hover, .ds-radio:checked:hover,
.choice:hover .ds-check:checked, .choice:hover .ds-radio:checked, button:hover > .ds-check.is-checked, .ds-check:checked.is-hover, .ds-radio:checked.is-hover { background-color: var(--ash); box-shadow: none; }
.ds-check:checked:focus-visible, .ds-radio:checked:focus-visible { box-shadow: 0 0 0 4px rgba(217, 184, 114, 0.5); }

/* Error: a 2px red line, words beside it say what to fix */
.ds-check[aria-invalid="true"], .ds-radio[aria-invalid="true"], .is-invalid .ds-check, .is-invalid .ds-radio { box-shadow: inset 0 0 0 2px var(--error); }

/* Disabled: plainly off */
.ds-check:disabled, .ds-radio:disabled { background-color: var(--linen); box-shadow: inset 0 0 0 1.5px var(--neutral-300); cursor: not-allowed; }
.ds-check:disabled:checked, .ds-radio:disabled:checked { background-color: var(--neutral-400); box-shadow: none; }
.ds-check:disabled:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23F4EFE6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ds-radio:disabled:checked { background-image: radial-gradient(circle, var(--ivory) 0 4.5px, transparent 5px); }
.choice:has(:disabled) { cursor: not-allowed; color: var(--soft); }

/* On dark grounds: a light box, Gold when checked with a House mark */
.on-dark .ds-check, .on-dark .ds-radio { background-color: var(--neutral-200); box-shadow: none; }
.on-dark .ds-check:hover, .on-dark .ds-radio:hover, .on-dark .choice:hover .ds-check, .on-dark .choice:hover .ds-radio { background-color: var(--neutral-100); box-shadow: none; }
.on-dark .ds-check:focus-visible, .on-dark .ds-radio:focus-visible { box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 4px rgba(217, 184, 114, 0.35); }
.on-dark .ds-check:checked, .on-dark .ds-check.is-checked, .on-dark .ds-radio:checked { background-color: var(--gold); }
.on-dark .ds-check:checked, .on-dark .ds-check.is-checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%230B0A09' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.on-dark .ds-radio:checked { background-image: radial-gradient(circle, var(--house) 0 4.5px, transparent 5px); }
.on-dark .ds-check:checked:hover, .on-dark .ds-check.is-checked:hover, .on-dark .choice:hover .ds-check:checked, .on-dark .ds-radio:checked:hover { background-color: var(--gold-300); }

/* Large variant on a photo: a House frame (2px, outside the box) and a soft shadow so it shows on any picture, light or dark. Empty is Ivory, ticked is Gold with a House tick. */
.on-dark .ds-check--lg, .on-dark .ds-check--lg:hover, .on-dark .ds-check--lg.is-checked, .on-dark .ds-check--lg.is-checked:hover, .on-dark .ds-check--lg:checked, .on-dark .ds-check--lg:checked:hover { box-shadow: 0 0 0 2px var(--house), 0 3px 12px rgba(0, 0, 0, 0.5); }
.on-dark .ds-check--lg { background-color: var(--ivory); }
.on-dark .ds-check--lg:hover { background-color: var(--neutral-100); }

@media (prefers-reduced-motion: reduce) { .ds-check, .ds-radio { animation: none !important; transition: none; } }
