/*
 * Low-specificity field and native choice-control contract.
 * Component styles may retain layout ownership while inheriting this visual base.
 */
:root {
  --storefront-field-background: var(--storefront-color-surface, #fff);
  --storefront-field-border: var(--storefront-color-field-border, #c7c7c7);
  --storefront-field-color: var(--storefront-color-ink, #232323);
  --storefront-field-focus: var(--storefront-color-field-border, #c7c7c7);
  --storefront-field-error: var(--storefront-color-error, #d93333);
  --storefront-field-disabled: var(--storefront-color-surface, #fff);
}

body.storefront-field-system
  :where(
    input.input-text,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea
  ):where(:not(.qty):not(.wc-block-components-quantity-selector__input)) {
  box-sizing: border-box;
  min-height: var(--storefront-field-height, 44px);
  padding: var(--storefront-field-padding, 10px 15px);
  border: 1px solid var(--storefront-field-border);
  border-radius: var(--storefront-field-radius, 0);
  outline: 0;
  background: var(--storefront-field-background);
  box-shadow: none;
  color: var(--storefront-field-color);
  font: 400 13px/22px var(--storefront-font-ui, "Montserrat", Arial, sans-serif);
  letter-spacing: 0.02em;
  transition: var(--storefront-field-transition, border-color 300ms ease, background-color 300ms ease);
}

body.storefront-field-system textarea {
  height: auto;
  min-height: 120px;
  resize: vertical;
}

body.storefront-field-system
  :where(
    input.input-text,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea
  ):where(:not(.qty):not(.wc-block-components-quantity-selector__input)):focus {
  border-color: var(--storefront-field-focus);
  outline: 0;
  box-shadow: none;
}

body.storefront-field-system
  :where(
    input.input-text,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea
  ):where(:disabled, [disabled], [readonly]) {
  background: var(--storefront-field-disabled);
  cursor: auto;
  opacity: 1;
}

body.storefront-field-system
  :where(
    input.input-text,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea
  ):where([aria-invalid="true"], .has-error),
body.storefront-field-system .woocommerce-invalid :where(input, select, textarea) {
  border-color: var(--storefront-field-error);
}

body.storefront-field-system :where(input, textarea)::placeholder {
  color: var(--storefront-color-placeholder, #868686);
  opacity: 1;
}

body.storefront-field-system select {
  appearance: none;
  width: 100%;
  height: 45px;
  min-height: 45px;
  padding: 11px 15px 10px;
  border: 0;
  border-radius: 0;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000000' viewBox='0 0 24 24'%3E%3Cpath d='M 7 10 L 12 15 L 17 10 Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 20px 20px;
  box-shadow: 0 0 0 1px var(--storefront-field-border);
  transition: box-shadow var(--storefront-duration-short, 100ms) ease;
}

body.storefront-field-system select:hover {
  box-shadow: 0 0 0 2px var(--storefront-field-border);
}

body.storefront-field-system select:focus {
  outline: none;
}

body.storefront-field-system select:is([aria-invalid="true"], .has-error),
body.storefront-field-system .woocommerce-invalid select {
  box-shadow: 0 0 0 1px var(--storefront-field-error);
}

body.storefront-field-system :where(input[type="checkbox"], input[type="radio"]) {
  accent-color: #000;
  appearance: none;
  box-sizing: border-box;
  padding: 0;
  vertical-align: middle;
  background: #fff;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 300ms ease-out, border-color 300ms ease-out;
}

body.storefront-field-system :where(input[type="checkbox"]) {
  width: 15px;
  height: 15px;
  border: 1px solid #dbdbdb;
  border-radius: 0;
}

body.storefront-field-system :where(input[type="checkbox"]):checked {
  border-color: #000;
  background: #000 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8 3 3 7-7' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center / 13px 13px no-repeat;
}

body.storefront-field-system :where(input[type="radio"]) {
  width: 16px;
  height: 16px;
  border: 1px solid #cecece;
  border-radius: 50%;
  transition-duration: 50ms;
}

body.storefront-field-system :where(input[type="radio"]):checked {
  background: radial-gradient(circle at center, #000 0 4px, #fff 4px);
}

body.storefront-field-system :where(input[type="checkbox"], input[type="radio"]):disabled {
  opacity: 1;
  cursor: auto;
}

body.storefront-field-system :where(input[type="checkbox"], input[type="radio"]):focus-visible {
  outline: none;
  outline-offset: 0;
}
