/* ================================================================
   styles.css — Batiscan Estimateur de devis (wizard multi-étapes)
   Identité Batiscan : vert #14532d, accent doré #b8860b.
   Mobile-first. Zéro dépendance externe. Aucune police CDN.
   ================================================================ */

/* ── Custom properties ────────────────────────────────────────── */
:root {
  --bg:           #f4f5f7;
  --surface:      #ffffff;
  --ink:          #1a2230;
  --ink-soft:     #5b6573;
  --line:         #dfe3e8;
  --brand:        #14532d;
  --brand-2:      #1e7a45;
  --brand-light:  #e9f3ec;
  --accent:       #b8860b;
  --danger:       #b3261e;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(20,34,48,.07), 0 6px 20px rgba(20,34,48,.06);
  --shadow-sm:    0 1px 4px rgba(20,34,48,.08);
  --transition:   .22s ease;
}

/* ── Motion preference ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration:  0ms !important;
  }
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 1rem;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* ── Wrapper ──────────────────────────────────────────────────── */
.wizard-wrapper {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(20,34,48,.04), var(--shadow);
}

/* ── Header collant ───────────────────────────────────────────── */
.wizard-header {
  padding: 14px 20px 12px;
  border-bottom: 1.5px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.logo {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--brand);
}

.baseline {
  font-size: .72rem;
  color: var(--ink-soft);
  text-align: right;
  line-height: 1.3;
}

/* Barre de progression */
.progress-track {
  height: 5px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--brand-2);
  border-radius: 99px;
  width: 20%;
  transition: width var(--transition);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.step-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-2);
}

.step-label.done {
  color: var(--accent);
}

/* ── Step sections ────────────────────────────────────────────── */
.step {
  padding: 28px 20px 36px;
  flex: 1;
  /* transition animée */
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--transition), transform var(--transition);
}

.step.hidden {
  display: none;
}

.step.entering {
  opacity: 0;
  transform: translateY(14px);
}

/* ── Titres ───────────────────────────────────────────────────── */
.step-eyebrow {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 6px;
}

.step-eyebrow .q-num {
  color: var(--ink-soft);
  font-weight: 400;
  margin-right: 3px;
}

h2 {
  font-size: clamp(1.15rem, 4.5vw, 1.4rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 20px;
  line-height: 1.25;
  letter-spacing: -.01em;
}

.step-hint {
  font-size: .83rem;
  color: var(--ink-soft);
  margin-top: -12px;
  margin-bottom: 16px;
  line-height: 1.45;
}

/* ── Option grid ──────────────────────────────────────────────── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.options-grid.single-col {
  grid-template-columns: 1fr;
}

/* ── Option cards — radio & checkbox ──────────────────────────── */
.option-card {
  position: relative;
}

/* Masquer l'input natif mais garder l'accessibilité */
.option-card input[type="radio"],
.option-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.option-card label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  min-height: 52px;
  position: relative;
  user-select: none;
}

.option-card label:hover {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(30,122,69,.12);
}

/* Ring focus visible sur le label quand l'input est focus */
.option-card input:focus-visible + label {
  outline: 2.5px solid var(--brand-2);
  outline-offset: 2px;
}

/* État sélectionné */
.option-card input:checked + label {
  border-color: var(--brand-2);
  background: var(--brand-light);
}

/* Checkmark affiché en ::after */
.option-card input:checked + label::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: .78rem;
  font-weight: 800;
  color: var(--brand-2);
}

/* Texte de la carte */
.card-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-main {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.card-sub {
  font-size: .75rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* Carte sélectionnée → texte principal en brand */
.option-card input:checked + label .card-main {
  color: var(--brand);
}

/* ── Validation vide (prestations) ────────────────────────────── */
.options-grid.needs-selection .option-card label {
  border-color: var(--danger);
}

.select-hint {
  font-size: .8rem;
  color: var(--danger);
  margin-top: -16px;
  margin-bottom: 14px;
  display: none;
}

.select-hint.visible { display: block; }

/* ── Boutons ──────────────────────────────────────────────────── */
.step-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: .86rem;
  cursor: pointer;
  padding: 8px 0;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-back:hover { color: var(--ink); }
.btn-back:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 3px;
  border-radius: 2px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: .95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform .1s;
  min-height: 50px;
  letter-spacing: .01em;
}

.btn-primary:hover { background: var(--brand-2); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:focus-visible {
  outline: 2.5px solid var(--brand-2);
  outline-offset: 3px;
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.btn-full { width: 100%; margin-top: 6px; }

/* ── Étape résultat ───────────────────────────────────────────── */

/* Bloc résultat — fidèle au proto */
.result-block {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--brand);
  padding: 24px 22px;
  margin-bottom: 24px;
}

.result-eyebrow {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.result-price {
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.02em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.breakdown-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.breakdown-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  font-size: .83rem;
  color: var(--ink-soft);
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.breakdown-item:last-child { border-bottom: none; }

.breakdown-item span:last-child {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  margin-left: 12px;
}

.result-disclaimer {
  margin-top: 14px;
  padding: 10px 13px;
  background: #fbfaf6;
  border-radius: 6px;
  font-size: .76rem;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.45;
}

/* ── Bloc contact ─────────────────────────────────────────────── */
.contact-block {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--line);
  padding: 22px 20px;
  margin-bottom: 20px;
}

.contact-block h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.contact-intro {
  font-size: .85rem;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-field label {
  font-size: .83rem;
  font-weight: 600;
  color: var(--ink);
}

.form-field input[type="text"] {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 48px;
  outline: none;
  appearance: none;
}

.form-field input[type="text"]:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(30,122,69,.12);
}

.form-field input[type="text"]:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 1px;
}

.field-error {
  font-size: .78rem;
  color: var(--danger);
  line-height: 1.3;
}

.field-error.hidden { display: none; }

/* Message de confirmation */
.confirmation-msg {
  display: none;
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--brand-light);
  border: 1.5px solid var(--brand-2);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--brand);
  font-weight: 600;
  line-height: 1.45;
}

.confirmation-msg.visible { display: block; }
.confirmation-msg a { color: var(--brand); }

/* Erreur serveur */
.server-error {
  font-size: .85rem;
  color: var(--danger);
  margin-top: 10px;
  padding: 10px 13px;
  background: rgba(179,38,30,.06);
  border-radius: 6px;
  border: 1px solid rgba(179,38,30,.2);
}

.server-error.hidden { display: none; }

/* ── Footer ───────────────────────────────────────────────────── */
.wizard-footer {
  padding: 20px;
  border-top: 1.5px solid var(--line);
  font-size: .73rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.6;
  margin-top: auto;
}

.wizard-footer strong { color: var(--ink); }
.wizard-footer a { color: var(--ink-soft); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 380px) {
  .options-grid { grid-template-columns: 1fr; }
  .result-price { font-size: 1.7rem; }
}

@media (min-width: 420px) {
  .options-grid.cols2 { grid-template-columns: 1fr 1fr; }
}

/* ── Utility ──────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
