/* ==========================================================================
   AmiraBou — base : remise à zéro, typographie, utilitaires, boutons, liens,
   focus, surfaces du navigateur et composants de formulaire.
   Règle : aucun style sur les éléments nus input / select / label / textarea
   (les calculateurs gardent leurs propres champs) ; les formulaires du site
   utilisent les classes .form-*.
   ========================================================================== */

/* ---------- Remise à zéro ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ---------- Typographie de base ---------- */
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--navy-800);
  margin: 0;
  text-wrap: balance;
  /* Chiffres alignés dans les titres (« 1re », « 2e ») : ceux de Cormorant descendent sinon. */
  font-variant-numeric: lining-nums;
}

p {
  margin: 0;
  text-wrap: pretty;
}

/* Un élément marqué hidden reste masqué, même si une classe lui donne un affichage
   (ex. lien « Aller à l'envoi » de la barre de progression, avant la fin du questionnaire). */
[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

/* ---------- Surfaces du navigateur ---------- */
::selection {
  background: var(--gold-soft);
  color: var(--navy-900);
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
::-webkit-scrollbar-track {
  background: var(--paper);
}
::-webkit-scrollbar-thumb {
  background: var(--navy-600);
  border: 3px solid var(--paper);
  border-radius: 8px;
}

/* Focus : anneau plein 2px, décalé 3px (Contrasting Ring Rule). L'anneau suit l'arrondi de
   l'élément (bouton en pilule, carte) ; les liens texte reçoivent un petit arrondi.
   Navy sur clair ; or dans les zones navy (voir aussi composants.css). */
:focus-visible {
  outline: 2px solid var(--navy-800);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
.on-navy :focus-visible {
  outline-color: var(--gold);
}

/* ---------- Utilitaires ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.num {
  font-variant-numeric: lining-nums tabular-nums;
}

/* Lien d'évitement */
.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 100;
  background: var(--white);
  color: var(--navy-800);
  padding: 12px 18px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
}

/* ---------- Boutons (pilules ; les boutons pleins se soulèvent légèrement au survol) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: 600 var(--fs-label) / 1.2 var(--sans);
  letter-spacing: 0.005em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--dur-color) var(--ease-out),
    border-color var(--dur-color) var(--ease-out),
    color var(--dur-color) var(--ease-out),
    box-shadow var(--dur-lift) var(--ease-out),
    translate var(--dur-lift) var(--ease-out);
}
.btn svg {
  flex: none;
}
/* Or : action principale, sur navy seulement */
.btn-gold {
  background: var(--gold);
  color: var(--navy-900);
  box-shadow: 0 8px 20px -12px rgba(195, 160, 99, 0.7);
}
.btn-gold:hover {
  background: var(--gold-bright);
  box-shadow: 0 14px 28px -14px rgba(212, 179, 122, 0.85);
  translate: 0 -2px;
}
/* Navy : action principale sur papier ou blanc */
.btn-navy {
  background: var(--navy-800);
  color: var(--white);
  box-shadow: 0 8px 20px -12px rgba(26, 54, 95, 0.55);
}
.btn-navy:hover {
  background: var(--navy-700);
  box-shadow: 0 14px 28px -14px rgba(26, 54, 95, 0.6);
  translate: 0 -2px;
}
.btn:active {
  translate: 0 0;
}
/* Contour : action secondaire sur papier ou blanc */
.btn-outline {
  border-color: var(--navy-800);
  color: var(--navy-800);
  background: transparent;
}
.btn-outline:hover {
  background: var(--navy-800);
  color: var(--white);
}
/* Fantôme : action secondaire sur navy */
.btn-ghost {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--white);
  background: transparent;
}
.btn-ghost:hover {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}
/* Pleine largeur (formulaires, cartes) */
.btn-block {
  width: 100%;
}
/* Désactivé ou en cours d'envoi */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Liens d'action en texte ----------
   Bloc en ligne (et non boîte flexible) : quand le texte passe sur deux lignes, l'icône suit
   le dernier mot au lieu de partir au bord droit. Le rembourrage donne une zone de toucher
   d'au moins 44px de haut. */
.text-link {
  display: inline-block;
  padding-block: 10px;
  font-weight: 600;
  color: var(--navy-800);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color var(--dur-color) var(--ease-out);
}
.text-link:hover {
  text-decoration-color: currentColor;
}
.text-link svg {
  display: inline-block;
  margin-left: 8px;
  vertical-align: -0.2em;
}
/* Variante sur navy : libellé blanc, soulignement or à 70 % */
.text-link--on-navy,
.on-navy .text-link {
  padding-block: 12px;
  color: var(--white);
  text-decoration-color: rgba(195, 160, 99, 0.7);
  text-underline-offset: 0.3em;
}
.text-link--on-navy:hover,
.on-navy .text-link:hover {
  text-decoration-color: var(--gold);
}

/* ---------- Marqueur « à confirmer » ---------- */
.todo {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px dashed currentColor;
  border-radius: var(--radius-sm);
  font: 600 0.7rem/1.4 var(--sans);
  letter-spacing: 0.02em;
  color: var(--gold-ink);
  vertical-align: middle;
  white-space: nowrap;
}
.on-navy .todo {
  color: var(--gold);
}

/* ---------- Bandes et têtes de section ---------- */
.section {
  padding-block: var(--space-section);
}
.section-head {
  max-width: 44rem;
  margin-bottom: var(--space-section-head);
}
.section-head h2 {
  font-size: var(--fs-headline);
}
/* Trait or sous les titres de section (fonds clairs). Il se dessine de gauche à droite quand
   le bloc apparaît au défilement (js/mouvement.js) ; sans JavaScript, il est simplement affiché. */
.section-head h2::after,
.split-head h2::after,
.services-head h2::after,
.faq-aside h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  margin-top: 18px;
  border-radius: 2px;
  background: var(--gold);
  transform-origin: left center;
}
.section-head p {
  margin-top: 1.1rem;
  font-size: var(--fs-lead);
  color: var(--muted);
  max-width: 38rem;
}

/* Fond clair alterné */
.bg-paper {
  background: var(--paper);
}
.bg-white {
  background: var(--white);
}

/* Bande navy */
.on-navy {
  background: var(--navy-800);
  color: var(--white);
}
.on-navy h1,
.on-navy h2,
.on-navy h3 {
  color: var(--white);
}
.on-navy ::selection {
  background: var(--gold);
  color: var(--navy-900);
}

/* ==========================================================================
   Formulaires (réutilisables par le futur portail client)
   ========================================================================== */
.form {
  display: grid;
  gap: 20px;
}

.form-row {
  display: grid;
  gap: 20px;
}
@media (min-width: 600px) {
  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.form-label {
  font: 600 var(--fs-label) / 1.4 var(--sans);
  color: var(--ink);
}
/* « (facultatif) » : gris, graisse normale, jamais d'astérisque */
.form-label .form-optional {
  font-weight: 400;
  color: var(--muted);
}

.form-hint {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

.form-input,
.form-textarea,
.form-select {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 13px 14px;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: 400 1rem/1.5 var(--sans);
  caret-color: var(--gold-ink);
  transition: border-color var(--dur-color) var(--ease-out);
}
.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: var(--navy-600);
}
.form-input:focus-visible,
.form-textarea:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--navy-800);
  outline-offset: 3px;
  border-color: var(--navy-800);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
.form-textarea {
  min-height: 160px;
  resize: vertical;
}
.form-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%230f2342' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px 20px;
  cursor: pointer;
}

/* Erreur : bordure et message en rouge sombre */
.form-input[aria-invalid="true"],
.form-textarea[aria-invalid="true"],
.form-select[aria-invalid="true"] {
  border-color: var(--error);
}
.form-error {
  font: 600 0.875rem/1.45 var(--sans);
  color: var(--error);
}
.form-error:empty {
  display: none;
}

/* Case à cocher (consentement) */
.form-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.form-check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--navy-800);
  cursor: pointer;
}
.form-check .form-check-label {
  font-size: var(--fs-label);
  line-height: 1.5;
  color: var(--ink);
  cursor: pointer;
}
.form-check a {
  font-weight: 600;
  color: var(--navy-800);
  text-decoration-color: var(--gold);
}
.form-check a:hover {
  text-decoration-color: currentColor;
}
.form-check .form-error {
  grid-column: 2;
}
.form-check input[type="checkbox"][aria-invalid="true"] {
  outline: 1px solid var(--error);
  outline-offset: 2px;
}
.form-check input[type="checkbox"][aria-invalid="true"]:focus-visible {
  outline: 2px solid var(--navy-800);
  outline-offset: 3px;
}

/* Champ piège anti-robots : hors écran, jamais visible */
.form-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Zone d'état annoncée (aria-live="polite") */
.form-status {
  padding: 14px 0;
  border-top: 1px solid var(--gold);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
}
.form-status:empty {
  padding: 0;
  border-top-color: transparent;
}
.form-status a {
  font-weight: 600;
  color: var(--navy-800);
  text-decoration-color: var(--gold);
}

/* Note de confidentialité (icône bouclier + texte) */
.form-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}
.form-note svg {
  flex: none;
  margin-top: 1px;
  color: var(--gold-ink);
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
