/* =============================================================================
   NP FROMAGES — Composer un plateau (plateau.html)
   S'appuie sur style.css : couleurs, typographie, boutons, champs, filtres.
   ============================================================================= */

.pb { max-width: 1320px; margin: 0 auto; padding: clamp(36px, 5vw, 72px) var(--gutter) clamp(64px, 8vw, 120px); }
.pb-head { max-width: 780px; margin-bottom: clamp(28px, 4vw, 56px); }
.pb-head .h-lg { margin: 14px 0 20px; }
.pb-head .lede { max-width: 34em; }

/* Mise en page : étapes à gauche, plateau à droite (fixe pendant le défilement) */
.pb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .85fr);
  column-gap: clamp(32px, 4.5vw, 72px);
  align-items: start;
}
.pb-grid > * { min-width: 0; }
.pb-s1, .pb-s2, .pb-s3 { grid-column: 1; }
.pb-aside { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: 76px; padding-top: 28px; }

.pb-step { padding-block: 28px 36px; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.pb-step__title {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 22px;
  font-family: var(--serif); font-weight: 300;
  font-size: var(--fs-sub); line-height: 1; letter-spacing: -.03em;
  text-transform: uppercase;
}
.pb-step__title span { flex: none; font-family: var(--sans); font-weight: 500; font-size: 12px; letter-spacing: 0; color: var(--fg-muted); }

/* 1. Convives et formule */
.pb-guests { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.pb-guests output { min-width: 48px; font-size: 18px; }
.pb-formulas { display: flex; flex-wrap: wrap; gap: 8px; }
.pb-formulas .tag small { margin-left: 4px; font-size: 11px; text-transform: none; opacity: .75; }

/* 2. Liste des fromages */
.pb-tip { max-width: 60ch; margin-bottom: 18px; font-size: 14px; line-height: 1.5; color: var(--fg-muted); }
.pb-filters {
  display: flex; gap: 8px; margin-bottom: 16px;
  overflow-x: auto; scrollbar-width: none;
}
.pb-filters::-webkit-scrollbar { display: none; }
.pb-filters .tag { flex: none; }
.pb-list { border-top: 1px solid var(--line); }
.pb-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
  grid-template-areas: "img main price ctrl";
  align-items: center; gap: 6px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color .35s var(--ease);
}
.pb-item.is-selected { background: linear-gradient(90deg, rgba(212, 150, 83, .16), rgba(212, 150, 83, 0) 75%); }
.pb-item__img, .pb-item__ph { grid-area: img; width: 56px; height: 56px; border-radius: 50%; background: var(--linen); }
.pb-item__img { object-fit: cover; }
.pb-item__ph { display: grid; place-items: center; color: var(--walnut); font: 300 22px/1 var(--serif); text-transform: uppercase; }
.pb-item__main { grid-area: main; min-width: 0; }
.pb-item__name { font-family: var(--serif); font-weight: 300; font-size: 22px; line-height: 1; letter-spacing: -.02em; text-transform: uppercase; }
.pb-item__name em { text-transform: none; }
.pb-item__main .caption { margin-top: 5px; }
.pb-item__price { grid-area: price; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pb-item__price small { color: var(--fg-muted); }
.pb-item__ctrl { grid-area: ctrl; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pb-item .qty output { min-width: 60px; font-size: 13px; }
.pb-add {
  position: relative;
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px;
  border: 1px solid var(--fg); border-radius: var(--radius);
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.pb-add svg { width: 16px; height: 16px; }
.pb-add:hover { background: var(--onyx); color: var(--parchment); }
.pb-add[disabled] { opacity: .35; pointer-events: none; }
.pb-item.is-selected .pb-add { background: var(--onyx); border-color: var(--onyx); color: var(--parchment); font-size: 13px; }
.pb-status { padding-top: 16px; }
.pb-status.is-error { color: var(--fg); }

/* Le plateau */
.pb-board-wrap { position: relative; width: min(100%, 52vh, 440px); aspect-ratio: 1; margin: 0 auto; }
.pb-board { width: 100%; height: 100%; overflow: visible; }
.pb-board__empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 26%;
  font-family: var(--serif); font-size: clamp(18px, 1.6vw, 22px); line-height: 1.15; text-align: center;
  color: rgba(52, 34, 18, .72);
  pointer-events: none;
}
.pb-piece, .pb-marker { transition: transform .75s var(--ease-out), opacity .45s var(--ease); }

/* Rendu 3D (plateau-3d.js) : remplace le dessin à plat une fois chargé */
.pb-board-wrap.is-3d { aspect-ratio: 4 / 3; width: min(100%, 64vh, 520px); }
.pb-board-wrap.is-3d .pb-board { visibility: hidden; }
.pb-3d { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
@media (hover: hover) and (pointer: fine) {
  .pb-3d { cursor: grab; }
  .pb-3d:active { cursor: grabbing; }
}
.pb-tags { position: absolute; inset: 0; pointer-events: none; }
.pb-tag {
  position: absolute; top: 0; left: 0;
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--onyx); color: var(--parchment);
  font: 700 11px/1 var(--sans);
  box-shadow: 0 0 0 1.5px var(--parchment);
}
.pb-hint { margin-top: 8px; text-align: center; }
.pb-marker circle { fill: var(--onyx); stroke: var(--parchment); stroke-width: 1.5; }
.pb-marker text { font: 700 11px var(--sans); fill: var(--parchment); text-anchor: middle; }

.pb-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; margin-top: 18px; }
.pb-legend li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 24px; align-items: center; gap: 8px; min-height: 28px; font-size: 13px; }
.pb-legend__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-legend__qty { color: var(--fg-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pb-num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--onyx); color: var(--parchment); font-size: 11px; font-weight: 700; }
.pb-x { display: grid; place-items: center; width: 24px; height: 24px; color: var(--fg-muted); border-radius: var(--radius); }
.pb-x svg { width: 13px; height: 13px; }
.pb-x:hover { color: var(--fg); background: rgba(44, 44, 44, .08); }

.pb-totals {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.pb-totals b { display: block; margin-top: 5px; font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: lining-nums; }
.pb-chip { display: inline-block; margin-top: 7px; padding: 4px 7px 3px; border: 1px solid var(--saffron); border-radius: var(--radius); font-size: 11px; line-height: 1; text-transform: uppercase; }
.pb-chip.is-low { background: rgba(212, 150, 83, .22); }

.pb-fams { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.pb-fams li {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 9px 5px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  font-size: 11px; line-height: 1; text-transform: uppercase; color: var(--fg-muted);
}
.pb-fams li.is-on { border-style: solid; border-color: var(--saffron); color: var(--fg); }
.pb-fams li.is-on::before { content: "✓"; }
.pb-rebalance { margin-top: 12px; font-size: 12px; }
.pb-cta { width: 100%; margin-top: 20px; }
.pb-fine { margin-top: 10px; }

/* 3. Demande de devis (panneau sombre) */
.pb-order { margin-top: 12px; padding: clamp(24px, 3vw, 40px); border-top: 0; border-radius: var(--radius); }
.pb-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pb-form .field--full { grid-column: 1 / -1; }
.pb-submit { margin-top: 24px; }
.pb-note { min-height: 1.4em; margin-top: 14px; font-size: 14px; }
.pb-note.is-error { color: var(--saffron); }
.pb-legal { margin-top: 10px; }
.pb-legal .link-u { font-size: 12px; }
.pb-done { display: flex; flex-direction: column; gap: 14px; }
.pb-done__title { font-family: var(--serif); font-weight: 300; font-size: var(--fs-h-sm); line-height: .95; letter-spacing: -.03em; text-transform: uppercase; }
.pb-done__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 10px; }

/* Barre du téléphone (aperçu du plateau pendant le choix) */
.pb-bar { display: none; }

/* Animations du plateau désactivées sur téléphone, tablette ou « réduire les animations » */
@media (max-width: 899px), (hover: none) and (pointer: coarse), (prefers-reduced-motion: reduce) {
  .pb-piece, .pb-marker, .pb-item, .pb-add { transition: none; }
}

@media (max-width: 1080px) {
  .pb-grid { grid-template-columns: minmax(0, 1fr) minmax(300px, .9fr); }
  .pb-legend { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 899px) {
  .pb-grid { display: flex; flex-direction: column; align-items: stretch; }
  .pb-s1 { order: 1; }
  .pb-aside { order: 2; position: static; padding: 0 0 32px; }
  .pb-s2 { order: 3; }
  .pb-s3 { order: 4; }
  .pb-board-wrap { width: min(100%, 420px); }
  .pb-legend { grid-template-columns: minmax(0, 1fr); }

  .pb-item {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-areas: "img main ctrl" "img price ctrl";
    gap: 4px 12px;
  }
  .pb-item__img, .pb-item__ph { width: 48px; height: 48px; }
  .pb-item__name { font-size: 20px; }
  .pb-item__price { font-size: 13px; }
  .pb-item.is-selected { grid-template-areas: "img main add" "img price add" "qty qty qty"; }
  .pb-item.is-selected .pb-item__ctrl { display: contents; }
  .pb-item.is-selected .pb-add { grid-area: add; }
  .pb-item.is-selected .qty { grid-area: qty; justify-self: end; margin-top: 6px; }

  .pb-form__grid { grid-template-columns: minmax(0, 1fr); }
  .pb-order { margin-inline: calc(var(--gutter) * -1); border-radius: 0; }

  .pb-bar:not([hidden]) {
    position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 30;
    display: flex; align-items: center; gap: 12px;
    padding: 8px 8px 8px 8px;
    border-radius: 8px;
    background: var(--roast); color: var(--parchment);
  }
  .pb-bar__mini { width: 52px; height: 52px; flex: none; }
  .pb-bar__txt { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }
  .pb-bar__txt b { display: block; font-family: var(--serif); font-weight: 400; font-size: 18px; text-transform: uppercase; letter-spacing: -.01em; }
  .pb-bar__btn {
    display: inline-flex; align-items: center; gap: 8px; flex: none;
    padding: 12px 12px; border: 1px solid rgba(216, 203, 184, .4); border-radius: var(--radius);
    font-size: 12px; text-transform: uppercase;
  }
  .pb-bar__btn svg { width: 14px; height: 14px; }
  body.has-bar { padding-bottom: 84px; }
}
