/* Caméléon : adoptTheme() (bundles.js) remplit les variables --tb-* à 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.
   Sélecteurs à deux classes : ils passent devant les règles génériques des thèmes. */
.bq {
  --tb-line: color-mix(in srgb, currentColor 20%, transparent);
  --tb-tint: color-mix(in srgb, currentColor 4%, transparent);
  display: grid;
  gap: 1.5em;
  margin: 1.25em 0;
  font-family: inherit;
  line-height: 1.45;
}

.bq .bq-tiers {
  display: grid;
  gap: 0.625em;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.bq .bq-title {
  display: block;
  float: none;
  width: auto;
  margin: 0 0 0.25em;
  padding: 0;
  font-family: var(--tb-label-font, inherit);
  font-size: var(--tb-label-size, 0.9375em);
  font-weight: var(--tb-label-weight, 600);
  color: var(--tb-label-fg, inherit);
  letter-spacing: var(--tb-label-spacing, normal);
  text-transform: var(--tb-label-transform, none);
  line-height: 1.4;
}

/* Paliers : une carte par choix, au style des pastilles de variantes du thème. */
.bq .bq-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.875em;
  box-sizing: border-box;
  min-height: max(3.5em, 44px);
  margin: 0;
  padding: 0.75em 1.125em;
  color: var(--tb-pill-fg, inherit);
  background: var(--tb-pill-bg, transparent);
  border: var(--tb-pill-border, 1px solid var(--tb-line));
  border-radius: min(var(--tb-pill-radius, 0.625em), 1.5em);
  box-shadow: var(--tb-pill-shadow, none);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.bq .bq-option:hover {
  border-color: color-mix(in srgb, currentColor 55%, transparent);
}

.bq .bq-option:has(input:checked) {
  color: var(--tb-pill-on-fg, inherit);
  background: var(--tb-pill-on-bg, var(--tb-tint));
  border: var(--tb-pill-on-border, 1px solid currentColor);
  box-shadow: var(--tb-pill-on-shadow, inset 0 0 0 1px currentColor);
}

/* Le contour reprend l'encre de la page : il reste visible sur une carte en inversé. */
.bq .bq-option:has(input:focus-visible) {
  outline: 2px solid var(--tb-ink, currentColor);
  outline-offset: 3px;
}

/* Pastille radio dessinée : l'input natif est invisible mais couvre la carte, focusable et cliquable. */
.bq .bq-option::before {
  content: "";
  flex: none;
  box-sizing: border-box;
  width: 1.125em;
  height: 1.125em;
  border: 1.5px solid color-mix(in srgb, currentColor 60%, transparent);
  border-radius: 50%;
  transition: border 0.15s;
}

.bq .bq-option:has(input:checked)::before {
  border: 0.34em solid currentColor;
}

.bq .bq-option input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
}

.bq .bq-option__label {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375em 0.625em;
  min-width: 0;
  font-weight: 500;
}

.bq .bq-option__price {
  margin-inline-start: auto;
  font-family: var(--tb-total-font, inherit);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bq .bq-badge {
  display: inline-block;
  margin: 0;
  padding: 0.25em 0.625em;
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
  background: color-mix(in srgb, currentColor 10%, transparent);
  border: 0;
  border-radius: 999px;
}

/* Lots et mix & match : un encadré discret, au rayon des champs du thème. */
.bq .bq-bundle,
.bq .bq-mix {
  min-width: 0;
  padding: 1.25em;
  border: 1px solid var(--tb-line);
  border-radius: min(var(--tb-input-radius, 0.75em), 1em);
}

.bq .bq-bundle .bq-title,
.bq .bq-mix .bq-title {
  margin-bottom: 1em;
}

.bq .bq-items,
.bq .bq-mix__list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bq .bq-items {
  gap: 1em;
}

.bq .bq-item {
  display: flex;
  align-items: center;
  gap: 1em;
  margin: 0;
}

.bq .bq-item__image {
  flex: none;
  width: 4em;
  height: 4em;
  object-fit: cover;
  background: var(--tb-tint);
  border: 1px solid var(--tb-line);
  border-radius: min(var(--tb-input-radius, 0.5em), 0.5em);
}

.bq .bq-item__body {
  display: grid;
  flex: 1;
  gap: 0.5em;
  min-width: 0;
}

.bq .bq-item__title {
  font-weight: 500;
  line-height: 1.35;
}

/* Sélecteur de variante : le style du champ de quantité du thème, avec un chevron dessiné. */
.bq .bq-select {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 22em;
  min-height: max(var(--tb-input-h, 2.75em), 24px);
  margin: 0;
  padding: 0.5em 2.5em 0.5em max(var(--tb-input-pad, 0.875em), 0.75em);
  font-family: var(--tb-input-font, inherit);
  font-size: var(--tb-input-size, inherit);
  line-height: 1.4;
  color: var(--tb-input-fg, inherit);
  background-color: var(--tb-input-bg, transparent);
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.25em) 50%, calc(100% - 0.9em) 50%;
  background-size: 0.35em 0.35em;
  background-repeat: no-repeat;
  border: var(--tb-input-border, 1px solid color-mix(in srgb, currentColor 55%, transparent));
  border-radius: var(--tb-input-radius, 0.5em);
  box-shadow: var(--tb-input-shadow, none);
  cursor: pointer;
  appearance: none;
}

.bq .bq-select:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.bq .bq-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.625em;
  margin: 1.25em 0 1em;
  padding: 1em 0 0;
  border-top: 1px solid var(--tb-line);
  font-family: var(--tb-total-font, inherit);
  font-variant-numeric: tabular-nums;
}

.bq .bq-total s {
  font-size: 0.9375em;
  opacity: 0.6;
}

.bq .bq-total strong {
  margin-inline-start: auto;
  font-size: 1.25em;
  font-weight: 600;
  color: var(--tb-total-fg, inherit);
}

.bq .bq-add {
  width: 100%;
  margin: 0;
}

/* Repli du bouton à spécificité nulle : la classe .button du thème, si elle existe, l'emporte. */
:where(.bq) :where(.bq-add) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 3.25em;
  padding: 0.75em 1.5em;
  font: inherit;
  font-weight: 600;
  color: var(--tb-paper, Canvas);
  background: var(--tb-ink, CanvasText);
  border: 0;
  border-radius: var(--tb-input-radius, 0.5em);
  cursor: pointer;
}

:where(.bq) :where(.bq-add):hover {
  opacity: 0.88;
}

:where(.bq) :where(.bq-add):focus-visible {
  outline: 2px solid var(--tb-ink, currentColor);
  outline-offset: 3px;
}

.bq .bq-add:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.bq .bq-mix__list li {
  display: flex;
  gap: 0.75em;
  margin: 0;
  padding: 0.75em 0;
  border-top: 1px solid var(--tb-line);
}

.bq .bq-mix__list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.bq .bq-mix__list li:last-child {
  padding-bottom: 0;
}

.bq .bq-message {
  margin: 0.75em 0 0;
  font-size: 0.9375em;
}

.bq .bq-message:empty {
  display: none;
}

.bq .bq-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;
}
