// =============================================================================
// Styles shared by the profile-journey field components (HouseNameField,
// DietSelect, AllergySelect) — used both by the signup wizard's steps
// (pages/onboarding/) and the settings pages (PreferencesPage,
// HouseholdSettingsPage, under pages/settings/). Field styling only
// (label/input/select/checkbox) — the surrounding page/card layout belongs
// to each consuming page's own .scss, same split as features/auth/
// auth-form.scss vs. LoginPage/SignupPage.
// =============================================================================

// No `@use` of the theme partial needed — every token below is a runtime
// CSS custom property, see global.scss.

label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-top: var(--space-sm);
}

// Excludes checkbox/radio — those get their own deliberate, fixed-size
// appearance from global.scss instead of stretching to the field width
// like a text/select input (this used to bleed onto them unscoped, which
// is why they used to render oversized and misaligned with their label).
input:not([type="checkbox"]):not([type="radio"]),
select {
  width: 100%;
  padding: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
}

.field-error {
  color: var(--color-error);
  font-size: var(--font-size-xs);
  margin: 0;
}

// Checkbox grid for allergens/intolerances — a grid of tappable rows reads
// better than a native multi-select listbox, especially on the narrow
// viewport this app is eventually embedded into via Capacitor (see
// AllergySelect.tsx).
.allergy-select {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--space-xs) var(--space-md);
  // Reset the browser's default fieldset chrome (border/padding) — the
  // grid above is styling enough, this shouldn't look like a boxed panel.
  margin: var(--space-sm) 0 0;
  padding: 0;
  border: none;

  legend {
    grid-column: 1 / -1;
    padding: 0;
    font-size: var(--font-size-sm);
    font-weight: 600;
  }

  // The option row's own look (bordered "card", checked state, checkmark)
  // is entirely global.scss's — this only overrides what doesn't fit a
  // grid cell: the block/margin-top label rule above (this wraps an inline
  // checkbox + text pair, not a field caption above an input) and the
  // heavier default label weight (checked rows re-bold themselves via
  // global.scss; unchecked ones should read as plain body text).
  &__option {
    margin-top: 0;
    font-weight: 400;
    font-size: var(--font-size-base);
  }
}
