/* Caméléon : adoptTheme() remplit les variables --po-* à partir des éléments du thème
   (quantité, pastilles de variantes, libellés, prix). Sans elles (aperçu admin, thème inconnu),
   repli neutre basé sur currentColor. Tailles en em : Dawn met la racine à 10px. */
.po-fields { display: grid; gap: 1.25em; margin: 1.25em 0; --po-error: #b3261e; }
.po-fields[hidden], .po-fields .po-field[hidden] { display: none; }
.po-fields .po-field { display: block; min-width: 0; margin: 0; padding: 0; border: 0; }

.po-fields .po-label {
  display: block; float: none; width: auto; margin: 0 0 0.5em; padding: 0;
  font-family: var(--po-label-font, inherit); font-size: var(--po-label-size, 0.9375em);
  font-weight: var(--po-label-weight, 500); color: var(--po-label-fg, inherit);
  letter-spacing: var(--po-label-spacing, normal); text-transform: var(--po-label-transform, none);
  line-height: 1.4;
}
.po-fields .po-required { color: inherit; }

.po-fields .po-input {
  display: block; box-sizing: border-box; width: 100%; max-width: 100%; margin: 0;
  min-height: var(--po-input-h, 2.75em);
  padding: 0.5em max(var(--po-input-pad, 0.875em), 0.75em);
  font-family: var(--po-input-font, inherit); font-size: var(--po-input-size, inherit); line-height: 1.4;
  color: var(--po-input-fg, inherit); background: var(--po-input-bg, transparent);
  border: var(--po-input-border, 1px solid color-mix(in srgb, currentColor 40%, transparent));
  border-radius: var(--po-input-radius, 6px); box-shadow: var(--po-input-shadow, none);
}
.po-fields textarea.po-input { min-height: 6em; resize: vertical; }
.po-fields .po-input:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.po-fields .po-choices { display: flex; flex-wrap: wrap; gap: 0.5em; }
.po-fields .po-choice, .po-fields .po-swatch { position: relative; display: inline-flex; cursor: pointer; }
/* Input natif invisible mais toujours focusable et cliquable : il couvre la pastille. */
.po-fields .po-choice input, .po-fields .po-swatch input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
  opacity: 0; cursor: pointer; appearance: none; z-index: 1;
}
.po-fields .po-pill {
  display: inline-flex; align-items: center; box-sizing: border-box; min-height: max(2.5em, 24px);
  padding: var(--po-pill-pad, 0.5em 1em);
  font-size: var(--po-pill-size, 0.9375em); font-weight: var(--po-pill-weight, inherit);
  letter-spacing: var(--po-pill-spacing, normal); line-height: var(--po-pill-lh, 1.2);
  color: var(--po-pill-fg, inherit); background: var(--po-pill-bg, transparent);
  border: var(--po-pill-border, 1px solid color-mix(in srgb, currentColor 30%, transparent));
  border-radius: var(--po-pill-radius, 6px); box-shadow: var(--po-pill-shadow, none);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.po-fields .po-choice:hover input:not(:checked) + .po-pill { border-color: currentColor; }
.po-fields .po-choice input:checked + .po-pill {
  color: var(--po-pill-on-fg, var(--po-paper, Canvas)); background: var(--po-pill-on-bg, var(--po-ink, CanvasText));
  border: var(--po-pill-on-border, 1px solid currentColor);
  box-shadow: var(--po-pill-on-shadow, inset 0 0 0 1px currentColor);
}
.po-fields .po-choice input:focus-visible + .po-pill,
.po-fields .po-swatch input:focus-visible + .po-swatch-color {
  outline: 2px solid var(--po-pill-fg, currentColor); outline-offset: 3px;
}

.po-fields .po-swatch { border-radius: 50%; }
.po-fields .po-swatch-color {
  display: block; width: max(2em, 28px); height: max(2em, 28px); border-radius: 50%;
  border: var(--po-pill-border, 1px solid color-mix(in srgb, currentColor 25%, transparent));
  box-sizing: border-box;
}
.po-fields .po-swatch input:checked + .po-swatch-color {
  outline: 2px solid var(--po-pill-fg, currentColor); outline-offset: 2px;
}

/* Classe doublée : passe devant les règles de thème du genre `.product__info p[aria-live]`. */
.po-fields .po-count.po-count, .po-fields .po-total.po-total { text-decoration: none; }
.po-fields .po-count { margin: 0.375em 0 0; font-size: 0.85em; opacity: 0.75; }
.po-fields .po-error { margin: 0.375em 0 0; color: var(--po-error); font-size: 0.875em; }
.po-fields .po-error[hidden] { display: none; }
.po-fields .po-input[aria-invalid="true"] { border-color: var(--po-error); box-shadow: 0 0 0 1px var(--po-error); }
.po-fields input[aria-invalid="true"] + .po-pill { border-color: var(--po-error); }

/* Ligne discrète, dans la police et la couleur du prix du thème ; on neutralise tout
   soulignement hérité du thème (text-decoration, bordure ou pseudo-élément). */
.po-fields .po-total {
  margin: 0; padding: 0; border: 0; background: none; box-shadow: none; text-decoration: none;
  font-family: var(--po-total-font, inherit); color: var(--po-total-fg, inherit); font-size: 0.9375em;
}
.po-fields .po-total::before, .po-fields .po-total::after { content: none; }
.po-fields .po-total:empty { display: none; }

.po-fields .po-visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
