/* Socle des démonstrations de la deuxième série : comportements visuels communs (photos en fondu, tiroir
   latéral, champs, étapes). Chaque site garde son identité dans sa propre feuille : couleurs, polices,
   formes. Variables attendues : --kit-bg, --kit-fg, --kit-surface, --kit-line, --kit-accent, --muted. */

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--kit-bg);
  color: var(--kit-fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg {
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3,
h4 {
  text-wrap: balance;
  margin: 0;
}
p,
li {
  text-wrap: pretty;
}
[hidden] {
  display: none !important;
}

/* ---------- Photos ---------- */
.ph {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--ph-fond, var(--kit-line));
}
.ph img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.motion .ph img {
  opacity: 0;
  transform: scale(1.035);
  transition:
    opacity 0.8s var(--kit-ease),
    transform 1.4s var(--kit-ease);
}
.motion .ph img.is-loaded {
  opacity: 1;
  transform: none;
}

/* ---------- Tiroir latéral (panier, fiche) : une fenêtre qui glisse depuis la droite ---------- */
dialog.kit-dialog.tiroir {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  width: min(440px, 100vw);
  max-width: 100vw;
  border-radius: 0;
  transform: translateX(24px);
  display: flex;
  flex-direction: column;
}
dialog.kit-dialog.tiroir:not([open]) {
  display: none;
}
dialog.kit-dialog.tiroir.is-open {
  transform: none;
}

/* ---------- Champs ---------- */
.champ {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.champ > span,
.champ > label {
  font-weight: 600;
  font-size: 0.92rem;
}
.champ input,
.champ select,
.champ textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: var(--champ-rayon, 10px);
  border: 1px solid var(--champ-bord, var(--kit-line));
  background: var(--champ-fond, var(--kit-surface));
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.champ textarea {
  min-height: 110px;
  resize: vertical;
}
.champ input:focus,
.champ select:focus,
.champ textarea:focus {
  outline: none;
  border-color: var(--kit-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kit-accent) 28%, transparent);
}
.champ small {
  color: var(--muted);
  font-size: 0.84rem;
}
.champ .erreur {
  color: var(--erreur, #b3261e);
  font-size: 0.86rem;
  font-weight: 600;
}
[data-theme="dark"] .champ .erreur {
  color: var(--erreur-sombre, #ff8a80);
}

/* ---------- Choix en pastilles (radios ou cases déguisées) ---------- */
.pastilles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}
.pastilles legend {
  font-weight: 600;
  margin-bottom: 8px;
  padding: 0;
}
.pastille {
  position: relative;
}
.pastille input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.pastille span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--pastille-rayon, 999px);
  border: 1px solid var(--kit-line);
  background: var(--kit-surface);
  font-size: 0.92rem;
  font-weight: 500;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
  cursor: pointer;
}
.pastille input:checked + span {
  background: var(--pastille-choisie, var(--kit-fg));
  border-color: var(--pastille-choisie, var(--kit-fg));
  color: var(--pastille-choisie-texte, var(--kit-bg));
}
.pastille input:focus-visible + span {
  outline: 2px solid var(--kit-accent);
  outline-offset: 3px;
}
.pastille input:disabled + span {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ---------- Quantité ---------- */
.quantite {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--kit-line);
  border-radius: 999px;
  background: var(--kit-surface);
}
.quantite button {
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
}
.quantite button:disabled {
  opacity: 0.35;
  cursor: default;
}
.quantite output {
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- Indicateur d'étapes ---------- */
.etapes-fil {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 6px;
  counter-reset: etape;
}
.etapes-fil li {
  flex: 1;
  min-width: 0;
  counter-increment: etape;
  font-size: 0.82rem;
  color: var(--muted);
  padding-top: 10px;
  border-top: 3px solid var(--kit-line);
  transition:
    border-color 0.3s ease,
    color 0.3s ease;
}
.etapes-fil li::before {
  content: counter(etape) ". ";
  font-variant-numeric: tabular-nums;
}
.etapes-fil li[aria-current="step"],
.etapes-fil li.is-fait {
  border-top-color: var(--kit-accent);
  color: var(--kit-fg);
}
.etapes-fil li[aria-current="step"] {
  font-weight: 700;
}
@media (max-width: 640px) {
  .etapes-fil li span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .etapes-fil li[aria-current="step"] span {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
  }
}

/* ---------- Divers ---------- */
.tnum {
  font-variant-numeric: tabular-nums;
}
.sr-seul {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
