/* Pulsion Studio : estimateur de projet (estimer.html → /estimer-mon-projet/).
   S'ajoute à experience.css, pages.css et structure.css (champs, consentement, portes) ; ne contient que les composants propres à l'estimateur.
   Généré avec la source par outils/source-estimateur.py ; comportement : js/estimateur.js. */

/* Sans script, l'estimateur ne peut pas avancer : un message le remplace */
html:not(.js) .estimateur { display: none; }
.est-noscript { max-width: 640px; margin-inline: auto; color: var(--muted); text-align: center; }
.estimateur [hidden] { display: none !important; }

/* =====================================================================
   Cadre : une grande carte claire, centrée
   ===================================================================== */
.estimateur {
  max-width: 980px; margin-inline: auto; padding: clamp(22px, 4vw, 52px);
  border-radius: 32px; border: 1px solid transparent; color: var(--fg);
  background: var(--card-fill) padding-box, var(--card-edge) border-box; box-shadow: var(--card-shadow);
  scroll-margin-top: 96px;
}

/* ---------- Progression ---------- */
.est-progress { display: flex; flex-direction: column; gap: 10px; margin-bottom: clamp(26px, 3vw, 38px); }
.est-step { font-size: .875rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.est-bar { height: 6px; border-radius: 99px; background: rgba(0, 91, 245, .12); overflow: hidden; }
.est-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--blue-bright)); transition: width .45s var(--ease); }

/* ---------- Écrans ---------- */
.est-screen { display: flex; flex-direction: column; gap: 22px; }
.est-screen.is-entering { animation: est-in .38s var(--ease) both; }
@keyframes est-in { from { opacity: 0; transform: translateY(12px); } }
.est-question {
  font-family: var(--font-title); font-weight: 500; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem);
  line-height: 1.1; letter-spacing: -0.035em; text-wrap: balance; color: var(--fg);
}
.est-question:focus { outline: none; }
.est-q { min-width: 0; margin: 0; padding: 0; border: 0; }
.est-q + .est-q { margin-top: 10px; }
.est-legend { margin-bottom: 12px; padding: 0; font-weight: 600; font-size: 1.05rem; color: var(--fg); }
.est-hint { margin: -4px 0 14px; font-size: .9rem; color: var(--muted); }
.est-q:not(:has(legend)) .est-hint { margin-top: -10px; }

/* ---------- Cartes de réponse ---------- */
.est-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.est-options--larges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.est-options--grandes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.est-option {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 13px 16px; /* même hauteur qu'un champ texte (retour de Loïs du 27 octobre) */
  border-radius: 18px; border: 1px solid rgba(10, 10, 35, .14); background: var(--white); color: var(--ink);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .25s ease;
}
/* Le vrai bouton radio ou case à cocher couvre toute la carte : clic, toucher et clavier passent par lui */
.est-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.est-option-mark {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--field-line); background: var(--white); transition: border-color .2s ease, background-color .2s ease;
}
.est-option input[type="checkbox"] ~ .est-option-mark { border-radius: 7px; }
.est-option-mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .2s var(--ease); }
.est-option input[type="checkbox"] ~ .est-option-mark::after {
  width: 11px; height: 6px; border-radius: 0; background: none; border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg) scale(0);
}
.est-option-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.est-option-title { font-weight: 600; font-size: 1rem; line-height: 1.5; }
.est-option-desc { color: var(--muted); font-size: .95rem; line-height: 1.45; text-wrap: pretty; }

.est-option:hover { border-color: var(--blue); }
.est-option:has(input:checked) { border-color: var(--blue); background: rgba(0, 91, 245, .06); box-shadow: inset 0 0 0 1px var(--blue); }
.est-option:has(input:checked) .est-option-mark { border-color: var(--blue); background: var(--blue); }
.est-option:has(input:checked) .est-option-mark::after { transform: scale(1); }
.est-option input[type="checkbox"]:checked ~ .est-option-mark::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.est-option:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 3px; }

/* Grandes cartes : les quatre besoins */
.est-option--grande { flex-direction: column; align-items: flex-start; gap: 10px; min-height: 168px; padding: 24px 26px; border-radius: 22px; }
.est-option--grande .est-option-mark { position: absolute; top: 22px; right: 22px; }
.est-option-num { font-family: var(--font-serif); font-style: italic; font-size: 1.35rem; line-height: 1; color: var(--blue); }
.est-option--grande .est-option-title { padding-right: 30px; font-family: var(--font-title); font-weight: 500; font-size: clamp(1.2rem, 1.1rem + .4vw, 1.4rem); letter-spacing: -0.02em; line-height: 1.2; }

/* Réponse manquante */
.est-q.is-missing .est-option { border-color: #c4314b; }
.est-error { color: #b3261e; font-size: .95rem; font-weight: 500; }
.est-error:empty { display: none; }

/* ---------- Navigation ---------- */
.est-questions { display: flex; flex-direction: column; gap: 22px; }
.est-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 24px; border-top: 1px solid var(--line); }
.est-back { gap: 8px; padding-inline: 20px 24px; }
.est-back.is-off { visibility: hidden; }
.est-next-btn { margin-left: auto; }
.est-next-btn .arrow, .est-back .arrow { transition: transform .3s var(--ease); }
.est-next-btn:hover .arrow { transform: translateX(4px); }
.est-back:hover .arrow { transform: translateX(-4px); }

/* =====================================================================
   Résultat
   ===================================================================== */
.est-result { gap: 28px; }
.est-result-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 20px; align-items: start; }
.est-subhead { font-family: var(--font-title); font-weight: 500; font-size: 1.2rem; letter-spacing: -0.02em; color: var(--fg); }

/* ---------- Estimation : carte sombre ---------- */
.est-estimate {
  display: flex; flex-direction: column; gap: 16px; padding: clamp(24px, 3vw, 36px);
  border-radius: 26px; border: 1px solid transparent; color: var(--fg);
  background: var(--card-fill) padding-box, var(--card-edge) border-box; box-shadow: var(--card-shadow);
}
.est-estimate .eyebrow { color: var(--muted); }
.est-offer { font-family: var(--font-title); font-weight: 500; font-size: 1.25rem; letter-spacing: -0.02em; line-height: 1.25; }
.est-amount {
  font-family: var(--font-title); font-weight: 500; font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.3rem);
  line-height: 1.05; letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .22em; margin-bottom: -.16em;
}
.est-amount-note { color: var(--muted); font-size: .95rem; }
.est-tag {
  align-self: flex-start; display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px;
  border: 1px dashed #f5b400; color: #f5b400; font-size: .75rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
[data-mode="light"] .est-tag { color: #7a5000; border-color: #b98200; }
[data-mode="light"] [data-mode="dark"] .est-tag { color: #f5b400; border-color: #f5b400; }

/* Plusieurs postes (accompagnement, produit) : une ligne chacun, pas de somme */
.est-lines { display: flex; flex-direction: column; }
.est-line { display: flex; flex-direction: column; gap: 4px; padding-block: 14px; border-top: 1px solid var(--line); }
.est-line:first-child { border-top: 0; padding-top: 0; }
.est-line-label { font-weight: 600; }
.est-line-amount { font-family: var(--font-title); font-weight: 500; font-size: 1.4rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.est-line-meta { display: flex; margin-top: 2px; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--muted); font-size: .9rem; }

/* Détail d'un total (site : base et suppléments) */
.est-detail { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.est-detail li { display: flex; justify-content: space-between; gap: 16px; }
.est-detail li span:last-child { color: var(--fg); white-space: nowrap; font-variant-numeric: tabular-nums; }

.est-explain { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; line-height: 1.6; text-wrap: pretty; }
.est-explain strong { color: var(--fg); font-weight: 600; }
.est-orient { padding: 14px 16px; border-radius: 16px; background: rgba(61, 123, 255, .14); color: var(--fg); font-size: .95rem; line-height: 1.6; text-wrap: pretty; }

/* ---------- Récapitulatif modifiable ---------- */
.est-recap { display: flex; flex-direction: column; gap: 10px; }
.est-recap .est-hint { margin: 0 0 4px; }
.est-recap-list { display: flex; flex-direction: column; gap: 8px; }
.est-recap-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 14px; width: 100%;
  padding: 12px 16px; border-radius: 14px; border: 1px solid rgba(10, 10, 35, .12); background: var(--white); color: var(--ink);
  text-align: left; cursor: pointer; transition: border-color .2s ease, background-color .2s ease;
}
.est-recap-q { grid-column: 1; font-size: .8rem; color: var(--muted); }
.est-recap-a { grid-column: 1; font-weight: 600; font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.est-recap-edit { grid-column: 2; grid-row: 1 / span 2; font-size: .85rem; font-weight: 600; color: var(--blue); }
.est-recap-item:hover { border-color: var(--blue); background: rgba(0, 91, 245, .04); }
.est-recap-item:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Ce qui suit, portes ---------- */
.est-next { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.est-next p { color: var(--muted); text-wrap: pretty; }
.est-doors { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.est-doors .door { padding: clamp(22px, 2.6vw, 34px); }
.est-optional { font-weight: 400; color: var(--muted); }
.est-field-error { color: #b3261e; font-size: .875rem; font-weight: 500; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #b3261e; }
.est-send .btn { align-self: flex-start; }

.est-confirm { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 18px; border: 1px solid var(--blue); background: rgba(0, 91, 245, .05); }
.est-confirm:focus { outline: none; }
.est-confirm-title { font-family: var(--font-title); font-weight: 500; font-size: 1.3rem; letter-spacing: -0.02em; }
.est-confirm p:not(.est-confirm-title) { color: var(--muted); overflow-wrap: anywhere; }

.est-restart { text-align: center; }
.est-link {
  min-height: 32px; padding: 4px 8px; border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: .95rem; text-decoration: underline; text-underline-offset: 4px;
}
.est-link:hover { color: var(--blue); }

/* =====================================================================
   Écrans étroits
   ===================================================================== */
@media (max-width: 900px) {
  .est-result-grid, .est-doors { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .estimateur { border-radius: 24px; padding: 22px 18px; }
  .est-options, .est-options--grandes, .est-options--larges { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .est-option--grande { min-height: 0; padding: 20px; gap: 8px; }
  .est-option--grande .est-option-mark { top: 18px; right: 18px; }
  .est-nav .btn { padding-inline: 18px; }
}

/* ---------- Mouvement réduit : ni glissement ni animation de la barre ---------- */
@media (prefers-reduced-motion: reduce) {
  .est-screen.is-entering { animation: none; }
  .est-bar span, .est-option, .est-option-mark, .est-option-mark::after, .est-next-btn .arrow, .est-back .arrow { transition: none; }
}
