/* Commandes Villars Délices – charte : ardoise du logo, bleu cloche, rose « love ». Contrastes WCAG AA. */
@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url(fonts/barlow-400.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(fonts/barlow-600.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 700; font-display: swap; src: url(fonts/barlow-700.woff2) format("woff2"); }

:root {
  --ardoise: #3d4647;      /* 10,4:1 sur blanc */
  --ardoise-2: #515b5c;
  --texte: #2b2826;
  --texte-doux: #55514e;   /* 7,6:1 */
  --bleu: #c9dde3;
  --bleu-pale: #eaf2f4;
  --rose: #a8325a;         /* 6,3:1 sur blanc */
  --rose-pale: #fbeef2;
  --fond: #faf8f5;
  --blanc: #fff;
  --bord: #6f7677;         /* 4,7:1 : contour des champs */
  --bord-doux: #d9d6d2;
  --vert: #1d6b35;
  --vert-pale: #e8f4ec;
  --rouge: #b3261e;
  --rouge-pale: #fdecea;
  --orange-pale: #fff4e0;
  --focus: #a8325a;
  --rayon: 10px;
  --ombre: 0 1px 3px rgb(0 0 0 / .08), 0 4px 14px rgb(0 0 0 / .05);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 400 1.0625rem/1.55 Barlow, "Segoe UI", Arial, sans-serif;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ardoise); text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { color: var(--rose); text-decoration-thickness: 2px; }
h1, h2, h3 { color: var(--ardoise); line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); margin: 1.2rem 0 .6rem; }
h2 { font-size: 1.35rem; margin: 0 0 .6rem; }
h3 { font-size: 1.15rem; margin: 0 0 .25rem; }
p { margin: 0 0 .8rem; }
abbr[title] { text-decoration: none; color: var(--rose); font-weight: 700; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
main:focus, #erreurs:focus { outline: none; }

.sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.evitement { position: absolute; left: .5rem; top: -4rem; z-index: 100; background: var(--ardoise); color: #fff; padding: .6rem 1rem; border-radius: 0 0 6px 6px; font-weight: 600; }
.evitement:focus { top: 0; color: #fff; }
[hidden] { display: none !important; }

.conteneur { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.conteneur.large { max-width: 1400px; }

/* En-tête */
.entete { background: var(--blanc); border-bottom: 4px solid var(--bleu); }
.entete-in { display: flex; align-items: center; gap: 1rem; padding-top: .5rem; padding-bottom: .5rem; }
.logo img { width: auto; height: 64px; }
.entete-titre { margin: 0; font-weight: 600; font-size: 1.15rem; color: var(--ardoise); flex: 1; }
.entete-tel { font-weight: 700; white-space: nowrap; text-decoration: none; border: 2px solid var(--ardoise); border-radius: 999px; padding: .3rem .8rem; }
.entete-tel::before { content: "☎ "; }

/* Étapes */
.etapes { list-style: none; margin: 1.2rem 0 .5rem; padding: 0; display: flex; gap: .5rem; counter-reset: e; }
.etapes li { flex: 1; display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border-radius: var(--rayon); background: var(--blanc); border: 1px solid var(--bord-doux); color: var(--texte-doux); font-weight: 600; font-size: .98rem; }
.etapes li a { display: flex; gap: .5rem; align-items: center; color: inherit; }
.etapes .num { flex: none; display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--bleu-pale); color: var(--ardoise); font-weight: 700; }
.etapes .courante { background: var(--ardoise); color: #fff; border-color: var(--ardoise); }
.etapes .courante .num { background: #fff; }
.etapes .faite { color: var(--ardoise); }
.etapes .faite .num { background: var(--bleu); }
@media (max-width: 640px) {
  .etapes { gap: .3rem; }
  .etapes li { font-size: .85rem; padding: .45rem; flex-direction: column; text-align: center; gap: .25rem; }
  .etapes li a { flex-direction: column; gap: .25rem; }
  .entete-titre { font-size: 1rem; }
  .logo img { height: 52px; }
}

/* Messages */
.alerte { border-radius: var(--rayon); padding: .8rem 1rem; margin: 1rem 0; border-left: 6px solid var(--ardoise); background: var(--bleu-pale); }
.alerte p:last-child { margin-bottom: 0; }
.alerte-succes { background: var(--vert-pale); border-color: var(--vert); }
.alerte-erreur { background: var(--rouge-pale); border-color: var(--rouge); }
.alerte-attention { background: var(--orange-pale); border-color: #8a5a00; }
.erreurs { background: var(--rouge-pale); border: 2px solid var(--rouge); border-radius: var(--rayon); padding: 1rem 1.2rem; margin: 1rem 0; }
.erreurs h2 { color: var(--rouge); font-size: 1.2rem; }
.erreurs ul { margin: 0; padding-left: 1.2rem; }
.erreurs a { color: var(--rouge); font-weight: 600; }
.msg-erreur { color: var(--rouge); font-weight: 600; margin: .3rem 0 0; }
[aria-invalid="true"] { border-color: var(--rouge) !important; box-shadow: 0 0 0 1px var(--rouge); }

.intro { font-size: 1.15rem; }
.consigne, .aide, .aide-inline { color: var(--texte-doux); }
.aide { margin: .1rem 0 .35rem; font-size: .95rem; }
.aide-inline { font-weight: 400; font-size: .95rem; }

/* Produits */
.categorie { margin: 2rem 0; }
.categorie > h2 { font-size: 1.6rem; border-bottom: 3px solid var(--bleu); padding-bottom: .3rem; }
.produits { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.produit { background: var(--blanc); border: 1px solid var(--bord-doux); border-radius: var(--rayon); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--ombre); }
.produit img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bleu-pale); }
.produit-corps { padding: .8rem 1rem 1rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.produit.choisi { border-color: var(--ardoise); box-shadow: 0 0 0 2px var(--ardoise); }
.accroche { color: var(--texte-doux); font-style: italic; margin: 0; }
.prix { font-weight: 700; color: var(--rose); font-size: 1.2rem; margin: 0; }
.prix .mention { font-weight: 400; color: var(--texte-doux); font-size: .95rem; }
.description summary { cursor: pointer; color: var(--ardoise); font-weight: 600; text-decoration: underline; text-underline-offset: .15em; width: fit-content; }
.description p { margin: .4rem 0 0; font-size: .97rem; }
.declinaisons { border: 0; padding: 0; margin: .4rem 0 0; }
.declinaisons legend { font-weight: 700; color: var(--ardoise); padding: 0; margin-bottom: .2rem; }
.declinaisons .qte { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem 0; border-top: 1px dashed var(--bord-doux); flex-wrap: wrap; }
.declinaisons .qte label { flex: 1 1 8rem; font-weight: 400; }
.declinaisons .qte .msg-erreur { flex-basis: 100%; }
.qte { margin-top: auto; }
.produit-corps > .qte { padding-top: .5rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.qte label { font-weight: 600; }
.stepper { display: inline-flex; align-items: stretch; }
.stepper input { width: 3.6rem; text-align: center; font: inherit; font-weight: 700; font-size: 1.1rem; border: 2px solid var(--bord); border-radius: 0; padding: .35rem .2rem; background: #fff; color: var(--texte); -moz-appearance: textfield; appearance: textfield; min-height: 44px; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:only-child { border-radius: 8px; }
.pas { width: 44px; min-height: 44px; font: inherit; font-size: 1.4rem; font-weight: 700; line-height: 1; border: 2px solid var(--ardoise); background: var(--blanc); color: var(--ardoise); cursor: pointer; }
.pas.moins { border-radius: 8px 0 0 8px; border-right: 0; }
.pas.plus { border-radius: 0 8px 8px 0; border-left: 0; background: var(--ardoise); color: #fff; }
.pas:hover { background: var(--bleu); color: var(--ardoise); }
.pas:disabled { opacity: .45; cursor: not-allowed; }

.barre-panier { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; background: var(--blanc); border: 2px solid var(--ardoise); border-radius: var(--rayon) var(--rayon) 0 0; padding: .7rem 1rem; margin: 1.5rem -.25rem 0; box-shadow: 0 -4px 16px rgb(0 0 0 / .12); }
.barre-panier .resume { margin: 0; font-size: 1.05rem; }

/* Boutons */
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .6rem 1.4rem; font: inherit; font-weight: 700; font-size: 1.08rem; color: #fff; background: var(--ardoise); border: 2px solid var(--ardoise); border-radius: 999px; cursor: pointer; text-decoration: none; }
.bouton:hover { background: var(--rose); border-color: var(--rose); color: #fff; }
.bouton-second { background: var(--blanc); color: var(--ardoise); }
.bouton-second:hover { background: var(--bleu-pale); color: var(--ardoise); border-color: var(--ardoise); }
.bouton-valider { background: var(--rose); border-color: var(--rose); }
.bouton-valider:hover { background: var(--ardoise); border-color: var(--ardoise); }
.bouton-petit { min-height: 36px; padding: .25rem .9rem; font-size: .95rem; }
.bouton-danger { background: var(--rouge); border-color: var(--rouge); }
.lien { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.actions { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.5rem 0 2rem; }

/* Formulaires */
.groupe { border: 1px solid var(--bord-doux); border-radius: var(--rayon); background: var(--blanc); padding: 1rem 1.2rem 1.2rem; margin: 0 0 1.2rem; }
.groupe legend { padding: 0 .4rem; float: left; width: 100%; margin-bottom: .4rem; }
.groupe legend + * { clear: both; }
.groupe legend h2 { margin: 0; }
.champ { margin-bottom: .9rem; flex: 1 1 14rem; }
.champ label { display: block; font-weight: 600; margin-bottom: .2rem; }
.champ-ligne { display: flex; gap: 1rem; flex-wrap: wrap; }
.champ-cp { flex: 0 1 9rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number]:not(.stepper input), input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; color: var(--texte); background: #fff; border: 2px solid var(--bord); border-radius: 8px; padding: .55rem .7rem; min-height: 46px;
}
textarea { min-height: 6rem; resize: vertical; }
.choix { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.choix li { position: relative; display: flex; align-items: flex-start; gap: .6rem; background: var(--fond); border: 2px solid var(--bord-doux); border-radius: var(--rayon); padding: .7rem .9rem; }
.choix li:has(input:checked) { border-color: var(--ardoise); background: var(--bleu-pale); }
.choix input[type=radio], .choix input[type=checkbox] { position: relative; z-index: 1; flex: none; width: 1.35rem; height: 1.35rem; margin: .15rem 0 0; accent-color: var(--ardoise); }
.choix label { flex: 1; cursor: pointer; }
.choix label::after { content: ""; position: absolute; inset: 0; } /* toute la carte est cliquable */
.choix .desc { display: block; color: var(--texte-doux); margin-top: .15rem; }
.choix .desc span { display: block; margin-top: .2rem; }
.choix-dates { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.choix-dates .jour { font-weight: 700; }
.choix-ligne { grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); margin-bottom: .8rem; }
.piege { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Récapitulatif */
.recap { background: var(--blanc); border: 2px solid var(--bleu); border-radius: var(--rayon); padding: 1rem 1.2rem; margin: 1.2rem 0; }
.tableau { width: 100%; border-collapse: collapse; margin-bottom: .6rem; }
.tableau th, .tableau td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--bord-doux); vertical-align: top; }
.tableau thead th { background: var(--bleu-pale); color: var(--ardoise); }
.tableau tbody th { font-weight: 400; }
.tableau .num { text-align: right; white-space: nowrap; }
.tableau tfoot th, .tableau tfoot td { font-weight: 700; border-bottom: 0; font-size: 1.1rem; }
.recap-infos { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: .5rem 0 .8rem; }
.recap-infos dt { font-weight: 700; color: var(--ardoise); }
.recap-infos dd { margin: 0; }
.rappel { background: var(--blanc); border-radius: var(--rayon); padding: .6rem 1rem; border: 1px solid var(--bord-doux); }
.rgpd { font-size: .95rem; color: var(--texte-doux); }
.confirmation { background: var(--blanc); border-radius: var(--rayon); padding: 1.2rem 1.5rem; margin: 1.5rem 0 2rem; border-top: 6px solid var(--vert); box-shadow: var(--ombre); }
.numero { font-size: 1.2rem; }
.message-fermeture { font-size: 1.15rem; }

/* Pied */
.pied { margin-top: 2.5rem; background: var(--ardoise); color: #fff; padding: 1.2rem 0; font-size: .95rem; }
.pied a { color: #fff; }
.pied a:hover { color: var(--bleu); }
.pied p { margin: .2rem 0; }

/* ---------- Administration ---------- */
.admin .entete-in { flex-wrap: wrap; }
.admin .logo img { height: 52px; }
.menu-admin { flex: 1; }
.menu-admin ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
.menu-admin a, .menu-admin .lien { display: block; padding: .45rem .7rem; border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--ardoise); }
.menu-admin a[aria-current] { background: var(--ardoise); color: #fff; }
.menu-admin a:hover, .menu-admin .lien:hover { background: var(--bleu-pale); color: var(--ardoise); }
.admin h1 { margin-top: 1rem; }
.barre-outils { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-end; margin: .8rem 0 1rem; }
.barre-outils .champ { flex: 0 1 auto; margin: 0; }
.barre-outils select, .barre-outils input { min-width: 11rem; }
.carte { background: var(--blanc); border: 1px solid var(--bord-doux); border-radius: var(--rayon); padding: 1rem 1.2rem; margin-bottom: 1.2rem; box-shadow: var(--ombre); }
.carte h2 { font-size: 1.2rem; }
.table-scroll { overflow-x: auto; }
.admin .tableau { background: var(--blanc); font-size: .98rem; }
.admin .tableau td, .admin .tableau th { vertical-align: middle; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .88rem; font-weight: 700; background: var(--bleu-pale); color: var(--ardoise); border: 1px solid var(--ardoise-2); white-space: nowrap; }
.badge-nouvelle { background: var(--rose-pale); color: var(--rose); border-color: var(--rose); }
.badge-preparee { background: var(--orange-pale); color: #6b4500; border-color: #8a5a00; }
.badge-retiree { background: var(--vert-pale); color: var(--vert); border-color: var(--vert); }
.badge-annulee { background: #eee; color: #4a4a4a; border-color: #777; text-decoration: line-through; }
.badge-off { background: #eee; color: #4a4a4a; border-color: #777; }
.vignette { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }
.erreur-mail { color: var(--rouge); font-weight: 600; }
.ok-mail { color: var(--vert); }
.inline { display: inline; }
.case { display: flex; gap: .5rem; align-items: center; font-weight: 600; margin-bottom: .8rem; }
.case input { width: 1.3rem; height: 1.3rem; accent-color: var(--ardoise); }
.photo-actuelle { max-width: 260px; border-radius: 8px; margin-bottom: .5rem; }
.tot-prod td.num { font-size: 1.15rem; font-weight: 700; }
.connexion { max-width: 420px; margin: 3rem auto; }

@media print {
  .entete, .pied, .menu-admin, .barre-outils, .no-print, .bouton, form.no-print { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .carte { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .conteneur { max-width: none; padding: 0; }
  a { text-decoration: none; color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) {
  .bouton, .pas, .choix li, .produit, .groupe { border: 2px solid ButtonText; }
  .choix li:has(input:checked) { outline: 3px solid Highlight; }
}

/* Mobile : fiches produit horizontales, barre panier compacte */
.raccourcis { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.raccourcis a { display: inline-block; padding: .35rem .9rem; border: 2px solid var(--ardoise); border-radius: 999px; font-weight: 600; text-decoration: none; background: var(--blanc); }
.raccourcis a:hover { background: var(--bleu-pale); color: var(--ardoise); }
.categorie { scroll-margin-top: 1rem; }
.choix-dates { grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); }
@media (max-width: 600px) {
  .produit { display: grid; grid-template-columns: 96px 1fr; align-items: start; }
  .produit img { aspect-ratio: 1; width: 96px; height: 96px; margin: .8rem 0 0 .8rem; border-radius: 8px; }
  .produit-corps { padding: .8rem; min-width: 0; }
  .produit h3 { font-size: 1.08rem; }
  .barre-panier { flex-wrap: nowrap; padding: .5rem .7rem; gap: .5rem; }
  .barre-panier .resume { font-size: .95rem; line-height: 1.3; }
  .barre-panier .bouton { padding: .5rem 1rem; flex: none; }
  .choix-dates { grid-template-columns: 1fr 1fr; }
  .choix-dates li { padding: .55rem .6rem; }
}
.choix-heures { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.minimum { margin: 0; font-weight: 700; color: var(--ardoise); background: var(--bleu-pale); border-radius: 6px; padding: .15rem .5rem; width: fit-content; }

/* ---------- Lisibilité mobile ---------- */
.pu { display: block; font-size: .9rem; color: var(--texte-doux); }
@media (max-width: 600px) {
  body { line-height: 1.5; }
  .conteneur { padding: 0 .875rem; }
  h1 { font-size: 1.55rem; margin: 1rem 0 .5rem; }
  .entete-in { gap: .6rem; }
  .logo img { height: 48px; }
  .entete-titre { font-size: .95rem; line-height: 1.25; }
  .entete-tel { font-size: .95rem; padding: .3rem .65rem; }
  .intro { font-size: 1.05rem; }
  .alerte { padding: .75rem .9rem; }

  /* Fiche produit : photo à côté du nom et du prix, le reste sur toute la largeur. */
  .produit { display: grid; grid-template-columns: 84px 1fr; column-gap: .85rem; row-gap: .35rem; padding: .85rem; align-items: start; }
  .produit img { grid-column: 1; grid-row: 1 / span 3; width: 84px; height: 84px; margin: 0; border-radius: 8px; aspect-ratio: 1; }
  .produit-corps { display: contents; }
  .produit-corps > * { grid-column: 2; }
  .produit-corps > .minimum, .produit-corps > .description, .produit-corps > .qte, .produit-corps > .declinaisons { grid-column: 1 / -1; }
  .produit-corps > .minimum { margin-top: .2rem; }
  .produit-corps > .qte { padding-top: .4rem; border-top: 1px solid var(--bord-doux); margin-top: .2rem; }
  .produit h3 { font-size: 1.1rem; }
  .declinaisons { margin-top: .2rem; }
  .declinaisons .qte { flex-wrap: nowrap; padding: .45rem 0; }
  .declinaisons .qte label { flex: 1 1 auto; min-width: 0; }
  .declinaisons .qte.qte-err { flex-wrap: wrap; }

  /* Étape 2 : moins d'encadrements imbriqués. */
  .groupe { padding: .85rem .75rem 1rem; border-radius: 8px; }
  .groupe legend { padding: 0; }
  .groupe legend h2 { font-size: 1.15rem; }
  .choix { gap: .5rem; }
  .choix li { padding: .6rem .7rem; gap: .5rem; }
  .choix-dates, .choix-heures { grid-template-columns: 1fr 1fr; }
  .choix-dates .jour { display: block; }
  .choix-heures li { align-items: center; }
  .choix-heures label { white-space: nowrap; }
  .champ { flex-basis: 100%; }

  /* Récapitulatif : prix unitaire sous le nom au lieu d'une colonne. */
  .recap { padding: .85rem .75rem; }
  .tableau th, .tableau td { padding: .45rem .3rem; }
  .recap-infos { grid-template-columns: 1fr; gap: 0; }
  .recap-infos dd { margin-bottom: .45rem; }

  /* Boutons pleine largeur, action principale en premier. */
  .actions { flex-direction: column-reverse; gap: .7rem; }
  .actions .bouton { width: 100%; }
  .barre-panier .resume { font-size: .92rem; }
  .pied { font-size: .92rem; }
}
.champ-stock { max-width: 8rem; }
