/* Flami — configurateur de devis */
.cfg-main { padding-top: calc(var(--header-h) + clamp(28px, 5vw, 56px)); padding-bottom: clamp(64px, 9vw, 120px); }
.cfg-intro { max-width: var(--wrap); }
.cfg-intro h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
.cfg-intro p { color: var(--brun-doux); font-size: 1.15rem; max-width: 38em; margin-top: 14px; }

.cfg {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px); align-items: start; margin-top: clamp(28px, 4vw, 48px);
}

/* ---------- Aperçu ---------- */
.cfg-preview { position: sticky; top: calc(var(--header-h) + 16px); }
.stage {
  position: relative; width: 100%; aspect-ratio: 9 / 7; overflow: hidden;
  border-radius: 999px 999px 28px 28px;
  background:
    radial-gradient(120% 80% at 50% 92%, rgba(184, 138, 92, 0.18), transparent 60%),
    linear-gradient(180deg, #EFE6D8 0%, #E6DACA 100%);
  box-shadow: 0 0 0 10px var(--cire), 0 0 0 11px var(--meche);
}
.scene { position: absolute; left: 0; top: 0; width: 900px; height: 700px; transform-origin: 0 0; }
.scene::after { /* table */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 96px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0)); border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.pot-img {
  position: absolute; z-index: 2; max-width: none;
  filter: drop-shadow(0 18px 18px rgba(58, 40, 28, 0.22));
  transition: opacity 260ms var(--ease-out), transform 480ms var(--ease-out), left 480ms var(--ease-out), top 480ms var(--ease-out), width 480ms var(--ease-out), height 480ms var(--ease-out);
}
.pot-img.swap { opacity: 0; transform: translateY(10px) scale(0.98); }

/* marquage sur le pot */
.mark {
  position: absolute; z-index: 3; display: grid; place-items: center; text-align: center;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  transition: opacity 260ms var(--ease-out), left 480ms var(--ease-out), top 480ms var(--ease-out), width 480ms var(--ease-out), height 480ms var(--ease-out);
  --ink: #3B2A20;
}
.mark.hidden { opacity: 0; }
.mark-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25em; width: 100%; height: 100%; padding: 10%; box-sizing: border-box; }
.mark-name { font-family: var(--serif); font-weight: 600; line-height: 1; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); overflow-wrap: anywhere; }
.mark-sub { font-family: var(--serif); font-style: italic; color: var(--ink); line-height: 1.1; }
.mark-logo { max-width: 78%; max-height: 52%; object-fit: contain; }

.mark[data-style="etiquette"] { background: #FBF7EF; border-radius: 10%; box-shadow: 0 1px 2px rgba(58, 40, 28, 0.18), inset 0 0 0 1px rgba(58, 40, 28, 0.08); }
.mark[data-style="etiquette"] .mark-inner { outline: 2px solid var(--ink); outline-offset: -9%; border-radius: 10%; }
.mark[data-style="serigraphie"] .mark-name, .mark[data-style="serigraphie"] .mark-sub { mix-blend-mode: multiply; }
.mark[data-style="serigraphie"] .mark-logo { mix-blend-mode: multiply; }
.mark[data-style="gravure"] .mark-name, .mark[data-style="gravure"] .mark-sub { color: rgba(96, 82, 70, 0.62); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); }
.mark[data-style="gravure"] .mark-logo { filter: grayscale(1) contrast(0.9); opacity: 0.55; mix-blend-mode: multiply; }

/* gravure sur le couvercle bambou */
.lid-engrave {
  position: absolute; z-index: 4; left: 0; top: 0; width: 300px; height: 300px; transform-origin: 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 12px; box-sizing: border-box;
  transition: opacity 260ms var(--ease-out);
}
.lid-engrave .mark-name { white-space: pre; overflow-wrap: normal; line-height: 1.05; font-size: 48px; color: rgba(66, 34, 12, 0.86); mix-blend-mode: multiply; text-shadow: 0 1.5px 0 rgba(255, 228, 190, 0.35); letter-spacing: 0.04em; }
.lid-engrave .mark-logo { max-height: 60%; filter: grayscale(1) sepia(1) saturate(1.6) brightness(0.55); mix-blend-mode: multiply; opacity: 0.8; }

/* packaging */
.box {
  position: absolute; z-index: 1; left: 64px; bottom: 74px; width: 250px; height: 300px;
  border-radius: 4px; background: #C9A57E;
  box-shadow: inset -18px 0 24px rgba(0, 0, 0, 0.08), 0 18px 30px -12px rgba(58, 40, 28, 0.35);
  display: grid; place-items: center; transition: background-color 300ms var(--ease-out), opacity 300ms var(--ease-out);
}
.box[hidden] { display: grid; opacity: 0; pointer-events: none; }
.box-lid { position: absolute; left: -6px; right: -6px; top: -4px; height: 56px; border-radius: 4px; background: inherit; filter: brightness(0.94); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08); }
.box-brand { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.92); padding: 0 18px; text-align: center; line-height: 1.1; overflow-wrap: anywhere; opacity: 0; transition: opacity 300ms var(--ease-out); }
.box[data-style="perso"] .box-brand { opacity: 1; }
.box[data-style="standard"]::after { content: ""; position: absolute; left: 50%; top: 56px; bottom: 0; width: 26px; transform: translateX(-50%); background: rgba(255, 255, 255, 0.22); }

.preview-note { font-size: 0.88rem; color: var(--brun-doux); margin: 22px 0 0; text-align: center; }

.summary { margin: 22px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; font-size: 0.95rem; }
.summary > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--meche); }
.summary dt { color: var(--brun-doux); }
.summary dd { margin: 0; text-align: right; font-weight: 400; }
.summary .sum-qty { grid-column: 1 / -1; border-bottom: 0; }
.summary .sum-qty dd { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; }

/* ---------- Formulaire ---------- */
.cfg-form { display: flex; flex-direction: column; gap: 14px; }
.step { border: 0; margin: 0; padding: 26px 0 30px; border-top: 1px solid var(--meche); min-width: 0; }
.step legend { display: flex; align-items: center; gap: 14px; padding: 0; margin-bottom: 18px; font-family: var(--serif); font-size: 1.7rem; font-weight: 500; color: var(--brun); }
.step-n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--caramel); font-family: var(--serif); font-size: 1.1rem; color: var(--caramel-fonce); flex: none; }
.label { display: block; font-size: 0.92rem; font-weight: 400; margin-bottom: 8px; }
.opt { color: var(--brun-doux); font-weight: 300; font-size: 0.85rem; }
.help { font-size: 0.88rem; color: var(--brun-doux); margin: 8px 0 0; }
.field-error { color: #8C2F1B; font-size: 0.9rem; margin: 6px 0 0; }
.sub-choice { margin-top: 18px; overflow: hidden; transition: opacity 300ms var(--ease-out); }
.sub-choice[hidden] { display: none; }

/* cartes d'option */
.cards { display: grid; gap: 12px; }
.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; gap: 4px; cursor: pointer;
  padding: 16px 16px 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--meche);
  transition: border-color 220ms var(--ease-out), background-color 220ms var(--ease-out), transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}
.card:hover { border-color: #C4B097; transform: translateY(-2px); }
.card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.card img { width: 100%; height: 92px; object-fit: contain; margin-bottom: 8px; }
.card-title { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; line-height: 1.15; }
.card-sub { font-size: 0.86rem; color: var(--brun-doux); line-height: 1.35; }
.card:has(input:checked) { border-color: var(--brun); background: #fff; box-shadow: 0 0 0 1px var(--brun), 0 10px 24px -14px rgba(58, 40, 28, 0.4); }
.card:has(input:checked)::after {
  content: ""; position: absolute; top: 12px; right: 12px; width: 12px; height: 12px; background: var(--caramel);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.card:has(input:focus-visible) { outline: 2px solid var(--caramel-fonce); outline-offset: 3px; }
.card.is-disabled { opacity: 0.45; }

/* boutons segmentés */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 999px; background: var(--lin); }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; padding: 6px 10px;
  border-radius: 999px; text-align: center; font-size: 0.98rem; line-height: 1.15;
  transition: background-color 250ms var(--ease-out), color 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
}
.seg-opt small { font-size: 0.76rem; color: var(--brun-doux); transition: color 250ms var(--ease-out); }
.seg-opt:hover span { background: rgba(255, 255, 255, 0.5); }
.seg-opt input:checked + span { background: var(--brun); color: var(--cire); box-shadow: 0 6px 14px -8px rgba(58, 40, 28, 0.6); }
.seg-opt input:checked + span small { color: #D9CAB6; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--caramel-fonce); outline-offset: 2px; }

/* champs */
.color-row { display: flex; align-items: center; gap: 12px; }
input[type="color"] { width: 56px; min-height: 50px; padding: 4px; cursor: pointer; }
.color-hint { font-size: 0.92rem; color: var(--brun-doux); }
.upload {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; padding: 14px 18px; cursor: pointer;
  border: 1.5px dashed #C4B097; border-radius: 16px; background: rgba(255, 255, 255, 0.4); text-align: center;
  transition: border-color 220ms var(--ease-out), background-color 220ms var(--ease-out);
}
.upload:hover, .upload:focus-within { border-color: var(--caramel-fonce); background: #fff; }
.upload input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.upload.has-file { border-style: solid; border-color: var(--brun); }

/* quantité */
.qty { display: flex; align-items: center; gap: 10px; }
.qty input { width: 120px; text-align: center; font-family: var(--serif); font-size: 1.6rem; font-weight: 500; }
.qty-btn {
  width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--brun); background: transparent; color: var(--brun);
  font-size: 1.4rem; cursor: pointer; transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 150ms var(--ease-out);
}
.qty-btn:hover { background: var(--brun); color: var(--cire); }
.qty-btn:active { transform: scale(0.94); }
.qty-unit { color: var(--brun-doux); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  min-height: 44px; min-width: 64px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--meche); background: rgba(255, 255, 255, 0.45);
  font: inherit; color: var(--brun); cursor: pointer; transition: border-color 200ms var(--ease-out), background-color 200ms var(--ease-out);
}
.chip:hover, .chip.on { border-color: var(--brun); background: #fff; }

.send { padding-top: 26px; border-top: 1px solid var(--meche); }
.btn-wa { min-height: 58px; font-size: 1.02rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .cfg { grid-template-columns: 1fr; }
  .cfg-preview { position: relative; top: 0; max-width: 560px; width: 100%; margin-inline: auto; }
  .cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .cards-3 { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .cards-3.cards-text { grid-template-columns: 1fr; }
  .card { padding: 12px 10px; }
  .card img { height: 70px; }
  .card-title { font-size: 1.1rem; }
  .seg-4 { grid-auto-flow: row; grid-template-columns: 1fr 1fr; border-radius: 22px; }
  .summary { grid-template-columns: 1fr; }
  .stage { box-shadow: 0 0 0 6px var(--cire), 0 0 0 7px var(--meche); }
}
@media (prefers-reduced-motion: reduce) {
  .pot-img, .mark, .card, .seg-opt span { transition: none !important; }
}
.lid-engrave[hidden], .mark-name[hidden], .mark-sub[hidden], .mark-logo[hidden] { display: none !important; }
