/* =========================================================
   Configurateurs (collier, puis licol, rênes, longe)
   Mobile : aperçu fixé sous l'en-tête, étapes en dessous.
   Large écran : aperçu à gauche, étapes à droite.
   ========================================================= */

.cfg { --cfg-accent: var(--teal); --cfg-accent-soft: var(--teal-soft); --cfg-sticky-h: 180px; }
.theme-chien .cfg { --cfg-accent: var(--chien); --cfg-accent-soft: var(--chien-soft); }
.theme-cheval .cfg { --cfg-accent: var(--cheval); --cfg-accent-soft: var(--cheval-soft); }

.cfg-intro { padding-block: 20px 12px; }
.cfg-intro h1 { font-size: clamp(1.6rem, 6vw, 2.6rem); margin-bottom: 4px; }
.cfg-intro p { margin: 0; color: var(--muted); }
.breadcrumb { font-size: 0.85rem; margin-bottom: 8px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

/* ---------- Aperçu ---------- */

.cfg-preview {
  position: sticky; top: calc(var(--header-h) + 1px); z-index: 30;
  background: var(--paper); border-bottom: 1px solid var(--line);
  padding: 8px var(--gutter) 10px; margin-inline: calc(var(--gutter) * -1);
}

.cfg-stage { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #f3eee6; }
.cfg-stage svg { width: 100%; height: auto; aspect-ratio: 730 / 220; }
.cfg-stage.is-shuffling svg { animation: cfg-wiggle 0.45s ease; }
@keyframes cfg-wiggle {
  0%, 100% { transform: none; }
  25% { transform: rotate(-1deg) scale(1.01); }
  60% { transform: rotate(0.8deg) scale(1.01); }
}

.cfg-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.cfg-price { margin-left: auto; text-align: right; line-height: 1.1; }
.cfg-price strong { display: block; font-size: 1.25rem; font-weight: 800; }
.cfg-price small { color: var(--muted); font-size: 0.75rem; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--white);
  font: inherit; font-size: 0.88rem; font-weight: 700; color: var(--ink); cursor: pointer;
}
.chip-btn svg { width: 18px; height: 18px; }
.chip-btn:hover { border-color: var(--ink); }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }

.cfg-progress { height: 4px; background: var(--line); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.cfg-progress span { display: block; height: 100%; background: var(--cfg-accent); border-radius: 2px; transition: width 0.3s ease; }

/* ---------- Étapes ---------- */

.cfg-steps { padding-block: 16px 8px; scroll-margin-top: calc(var(--header-h) + var(--cfg-sticky-h) + 8px); }

.cfg-stepper { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.cfg-stepper button {
  width: 100%; display: grid; justify-items: center; gap: 4px; padding: 6px 2px;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-size: 0.72rem; font-weight: 600; color: var(--muted);
}
.cfg-stepper .num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--white); font-size: 0.85rem; font-weight: 800; color: var(--muted);
}
.cfg-stepper .is-done .num { background: var(--cfg-accent-soft); border-color: var(--cfg-accent-soft); color: var(--cfg-accent); }
.cfg-stepper [aria-current="step"] { color: var(--ink); }
.cfg-stepper [aria-current="step"] .num { background: var(--cfg-accent); border-color: var(--cfg-accent); color: var(--white); }

.cfg-step h2 { font-size: 1.4rem; margin-bottom: 4px; }
.cfg-step h2:focus { outline: none; }
.cfg-step > p { color: var(--muted); }
.cfg-step fieldset { border: 0; padding: 0; margin: 0 0 24px; min-width: 0; }
.cfg-step legend { font-weight: 800; font-size: 1.02rem; margin-bottom: 10px; padding: 0; }

.cfg-nav { display: flex; gap: 10px; margin-top: 24px; }
.cfg-nav .btn { flex: 1; }
.cfg-nav .btn--ghost { flex: 0 0 auto; }

/* ---------- Mesure ---------- */

.neck { display: grid; gap: 16px; align-items: center; }
.neck-figure { max-width: 220px; margin: 0 auto; }
.input-unit { position: relative; }
.input-unit input { padding-right: 48px; font-size: 1.2rem; font-weight: 700; }
.input-unit span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.field-msg { font-size: 0.9rem; margin: 0; }
.field-msg--warn { color: var(--warning); background: var(--warning-soft); padding: 10px 12px; border-radius: var(--radius-sm); }
.field-msg--ok { color: var(--teal-dark); }
@media (min-width: 600px) { .neck { grid-template-columns: 200px 1fr; } }

/* ---------- Cartes d'option ---------- */

.options { display: grid; gap: 12px; }
.options--2 { grid-template-columns: 1fr 1fr; }

.option {
  position: relative; display: flex; flex-direction: column; cursor: pointer;
  background: var(--white); border: 2px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s;
}
.option:hover { border-color: #cfc6b8; }
.option:has(input:checked) { border-color: var(--cfg-accent); box-shadow: 0 0 0 3px var(--cfg-accent-soft); }
.option:has(input:focus-visible) { outline: 3px solid var(--cfg-accent); outline-offset: 2px; }
.option img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.option-body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.option-title { font-weight: 800; }
.option-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
.option-price { font-size: 0.85rem; font-weight: 700; color: var(--cfg-accent); }
.option-badge {
  justify-self: start; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--cfg-accent); color: var(--white); margin-bottom: 2px;
}

/* Mesures sur mesure du licol */
.custom-measures { display: grid; gap: 16px; margin-top: 16px; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.custom-measures img { border-radius: var(--radius-sm); max-width: 180px; justify-self: center; }
@media (min-width: 600px) { .custom-measures img { max-width: 100%; } }
.custom-measures .measure-dot { display: inline-block; vertical-align: middle; margin: 0 6px 0 0; }
@media (min-width: 600px) { .custom-measures { grid-template-columns: 220px 1fr; align-items: start; } }
.option-check {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  display: none; place-items: center; background: var(--cfg-accent); color: var(--white);
}
.option-check svg { width: 16px; height: 16px; }
.option:has(input:checked) .option-check { display: grid; }

.option--row { flex-direction: row; align-items: center; gap: 12px; padding: 12px; }
.option--row .option-body { padding: 0; flex: 1; }
.option--row img { flex: none; width: 56px; height: 56px; aspect-ratio: 1; object-fit: contain; border-radius: var(--radius-sm); background: var(--white); border: 1px solid var(--line); }
.option--row .option-check { position: static; flex: none; }
.option-icon { flex: none; width: 56px; height: 56px; border-radius: var(--radius-sm); background: #f3eee6; display: grid; place-items: center; }
.option-icon svg { width: 44px; height: 44px; }

/* ---------- Couleurs ---------- */

.zones { display: grid; gap: 8px; margin-bottom: 16px; }
.zone {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer;
  background: var(--white); border: 2px solid var(--line); border-radius: var(--radius-sm);
}
.zone:has(input:checked) { border-color: var(--cfg-accent); box-shadow: 0 0 0 3px var(--cfg-accent-soft); }
.zone:has(input:focus-visible) { outline: 3px solid var(--cfg-accent); outline-offset: 2px; }
.zone-dot { width: 32px; height: 32px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 15%); }
.zone-text { display: grid; line-height: 1.25; }
.zone-text strong { font-size: 0.95rem; }
.zone-text span { font-size: 0.85rem; color: var(--muted); }
@media (min-width: 600px) { .zones { grid-template-columns: repeat(3, 1fr); } }

.palette-title { font-weight: 800; margin: 0 0 10px; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.swatch { position: relative; display: block; aspect-ratio: 1; cursor: pointer; }
.swatch span[aria-hidden] {
  position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 15%); transition: transform 0.12s;
}
.swatch:hover span[aria-hidden] { transform: scale(1.08); }
.swatch:has(input:checked) span[aria-hidden] { box-shadow: inset 0 0 0 1px rgb(0 0 0 / 15%), 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.swatch:has(input:focus-visible) span[aria-hidden] { outline: 3px solid var(--cfg-accent); outline-offset: 5px; }
.palette-current { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
.palette-more { margin: 12px 0 0; font-size: 0.85rem; color: var(--muted); }

/* Onglets de familles : défilement horizontal sur téléphone */
.families {
  display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(var(--gutter) * -1) 12px;
  padding: 2px var(--gutter) 6px; scrollbar-width: none;
}
.families::-webkit-scrollbar { display: none; }
.family { position: relative; flex: none; cursor: pointer; } /* garde le bouton radio masqué dans le défilement */
.family span {
  display: block; padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--white); font-size: 0.82rem; font-weight: 700; white-space: nowrap;
}
.family:has(input:checked) span { background: var(--ink); border-color: var(--ink); color: var(--white); }
.family:has(input:focus-visible) span { outline: 3px solid var(--cfg-accent); outline-offset: 2px; }
@media (min-width: 900px) { .families { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; } }

/* ---------- Récapitulatif ---------- */

.summary { display: grid; gap: 0; margin: 0 0 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.summary div:last-child { border-bottom: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; text-align: right; display: flex; align-items: center; gap: 8px; }
.summary .dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 15%); }

.price-table { width: 100%; margin-bottom: 8px; }
.price-table td { padding: 6px 0; border: 0; }
.price-table td:last-child { text-align: right; white-space: nowrap; }
.price-table .total td { border-top: 2px solid var(--ink); padding-top: 10px; font-weight: 800; font-size: 1.15rem; }

.recap-actions { display: grid; gap: 10px; margin-top: 16px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 16px; z-index: 80; transform: translateX(-50%);
  width: min(440px, calc(100% - 32px)); padding: 14px 16px; border-radius: var(--radius);
  background: var(--ink); color: var(--white); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.toast[hidden] { display: none; }
.toast p { margin: 0; flex: 1; min-width: 180px; }
.toast a { color: var(--white); font-weight: 700; }

/* ---------- Large écran ---------- */

@media (min-width: 900px) {
  .cfg-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: start; }
  .cfg-preview {
    top: calc(var(--header-h) + 24px); margin: 0; padding: 16px;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
  }
  .cfg-steps { padding-top: 0; scroll-margin-top: calc(var(--header-h) + 24px); }
}
