/* ═══════════════════════════════════════════════════════════════════
   DOT CHECK — Canvas-based checkbox styling
   Part of the Dot Language design system.
   Tokens: --color-action, --ri-ink-*, --ri-space-*, --ri-radius-*, --ri-ease-out
   ═══════════════════════════════════════════════════════════════════ */

.dot-check {
  display: inline-flex;
  align-items: center;
  gap: var(--ri-space-2, 8px);
  cursor: pointer;
  min-height: 44px; /* touch target */
  padding: var(--ri-space-2, 8px) var(--ri-space-3, 12px);
  border-radius: var(--ri-radius-md, 8px);
  transition: background 150ms var(--ri-ease-out, cubic-bezier(0, 0, 0.2, 1));
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dot-check:hover {
  background: var(--color-action-soft, rgba(59, 117, 88, 0.07));
}

.dot-check--disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

/* Hidden native checkbox for a11y (focus, keyboard, form submission) */
.dot-check__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus ring on the label when input is focused */
.dot-check:has(.dot-check__input:focus-visible) {
  outline: 2px solid var(--color-action, #3B7558);
  outline-offset: 2px;
}

/* Canvas element */
.dot-check__canvas {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Label text */
.dot-check__label {
  font-family: var(--ri-font-body, 'DM Sans', -apple-system, sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--ri-ink-700, #3D3730);
  transition: color 200ms var(--ri-ease-out, cubic-bezier(0, 0, 0.2, 1));
}

/* Checked state — text stays normal color */
.dot-check--checked .dot-check__label {
  color: var(--ri-ink-700, #3D3730);
}

/* Unchecked state — muted text with strikethrough */
.dot-check--unchecked .dot-check__label {
  color: var(--ri-ink-400, #9B9289);
  text-decoration: line-through;
  text-decoration-color: var(--ri-ink-300, #B5ADA5);
}


/* ─── Dark mode ───────────────────────────────────────────────────
   Hover tint needs to be visible on dark backgrounds.          ── */
[data-theme="dark"] .dot-check:hover {
  background: var(--color-action-soft, rgba(86, 159, 122, 0.14));
}

/* ─── Reduced Motion ──────────────────────────────────────────────
   No transition delays; canvas animation snaps (handled in JS). ── */
@media (prefers-reduced-motion: reduce) {
  .dot-check {
    transition-duration: 1ms;
  }

  .dot-check__label {
    transition-duration: 1ms;
  }
}
