/* Shared wireframe controls, styled with the brand-book type and palette. */
.primary-link, .secondary-link, .ghost-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--control-height);
  padding: calc(0.75rem - 1px) calc(1.5rem - 1px);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 500;
  line-height: var(--leading-small);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-link {
  background: var(--action-background);
  color: var(--color-white);
}

.primary-link:hover {
  background: var(--action-hover);
}

.secondary-link {
  border-color: var(--link-color);
  background: var(--surface);
  color: var(--link-color);
}

.secondary-link:hover {
  background: var(--surface-tint);
}

.ghost-link {
  background: transparent;
  color: var(--link-color);
  text-decoration: underline;
}

:is(.primary-link, .secondary-link, .ghost-link):is(:disabled, [aria-disabled="true"]) {
  border-color: var(--color-border);
  background: var(--surface-muted);
  color: var(--color-slate);
  cursor: not-allowed;
}

/* Use native disabled on buttons; aria-disabled links also need activation blocked. */
.form-control {
  width: 100%;
  min-height: var(--control-height);
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.form-control::placeholder {
  color: var(--color-slate);
  opacity: 1;
}

.form-control[aria-invalid="true"] {
  border-color: var(--color-error);
}

.field-error {
  color: var(--color-error);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.form-control:disabled {
  background: var(--surface-muted);
  color: var(--color-slate);
  opacity: 1;
  cursor: not-allowed;
}

/* Native radio groups with the wireframe's pill-shaped choices. */
.choice-chip {
  position: relative;
  cursor: pointer;
}

.choice-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-chip span {
  display: block;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--link-color);
  font-size: var(--text-caption);
  font-weight: 400;
  line-height: var(--leading-caption);
}

.choice-chip input:checked + span,
.choice-chip[aria-pressed="true"] span {
  border-color: var(--link-color);
  background: var(--action-background);
  color: var(--color-white);
}

button.choice-chip {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
}

.choice-chip input:focus-visible + span {
  outline: 3px solid var(--color-sky-blue);
  outline-offset: 3px;
}

.choice-chip:has(input:disabled) {
  cursor: not-allowed;
}

.choice-chip input:disabled + span {
  background: var(--surface-tint);
  color: var(--color-slate);
}
