/* ==========================================================================
   Base du site public — remise à zéro, typographie, rythme, boutons, liens,
   blocs documentaires. Chargée par app/(public)/layout.tsx, après tokens.css.
   Le design ne décore pas, il documente : peu de cadres, beaucoup d'air,
   la hiérarchie portée par la taille et la graisse.
   ========================================================================== */

/* ---------- Remise à zéro ----------
   Le site public ne charge pas Tailwind (app/globals.css est réservé au CRM).
   Cette remise à zéro reprend, règle pour règle, ce dont les composants publics
   dépendaient dans la preflight de Tailwind v3 : marges nulles, listes sans puces,
   liens et boutons nus, bordures « 0 solid » (une seule largeur suffit pour tracer
   un filet), médias en bloc. Spécificité minimale : tout composant la surcharge. */
*,
::before,
::after {
  box-sizing: border-box;
  border: 0 solid var(--line);
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  line-height: inherit;
}

hr {
  height: 0;
  color: inherit;
  border-top-width: 1px;
}

abbr:where([title]) {
  text-decoration: underline dotted;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;
  font-weight: inherit;
}

a {
  color: inherit;
  text-decoration: inherit;
}

b,
strong {
  font-weight: 600; /* deux graisses seulement (§2) : jamais de 700 synthétisé */
}

small {
  font-size: 80%;
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

table {
  text-indent: 0;
  border-color: inherit;
  border-collapse: collapse;
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-feature-settings: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

button,
select {
  text-transform: none;
}

button,
input:where([type='button'], [type='reset'], [type='submit']) {
  -webkit-appearance: button;
  background-color: transparent;
  background-image: none;
}

button,
[role='button'] {
  cursor: pointer;
}

:disabled {
  cursor: default;
}

:-moz-ui-invalid {
  box-shadow: none;
}

::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
  height: auto;
}

[type='search'] {
  -webkit-appearance: textfield;
  outline-offset: -2px;
}

::-webkit-search-decoration {
  -webkit-appearance: none;
}

summary {
  display: list-item;
}

blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
  margin: 0;
}

fieldset {
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

ol,
ul,
menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

dialog {
  padding: 0;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  opacity: 1;
  color: var(--ink-60);
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  vertical-align: middle;
}

img,
video {
  max-width: 100%;
  height: auto;
}

[hidden]:where(:not([hidden='until-found'])) {
  display: none;
}

/* ---------- Page ---------- */
.site {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern', 'liga', 'calt';
  min-height: 100vh;
}

html:has(.site) {
  background: var(--paper);
  /* Seule source du décalage des ancres : Lenis et la transition de page la lisent ici */
  scroll-padding-top: calc(var(--header-h) + var(--s-6));
}

.site ::selection {
  background: var(--teal-100);
  color: var(--navy-900);
}

/* Chiffres tabulaires : les prix s'alignent dans une colonne de cartes (§2).
   Pas sur les références (« AMI-2410 ») : les chiffres tabulaires y créent des trous. */
.num,
.price,
.data-table {
  font-variant-numeric: tabular-nums lining-nums;
}

/* ---------- Titres — casse de phrase, deux graisses seulement ----------
   :where() ramène ces règles au poids d'un simple sélecteur d'élément : la classe
   d'un composant (.flow__q, .sheet__title…) l'emporte seule. N'écrivez jamais « .site .x ». */
.h1,
:where(.site) h1 {
  font-size: var(--fs-h1);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--navy-900);
  text-wrap: balance;
}

.h2,
:where(.site) h2 {
  font-size: var(--fs-h2);
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--navy-900);
  text-wrap: balance;
}

.h3,
:where(.site) h3 {
  font-size: var(--fs-h3);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--navy-900);
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--ink);
  max-width: 58ch;
  text-wrap: pretty;
}

.muted {
  color: var(--ink-60);
}

.meta {
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--ink-60);
}

.eyebrow {
  display: block;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.4;
  color: var(--clay-700);
  margin-bottom: var(--s-3);
}

.prose {
  max-width: var(--reading-max);
}

.prose p + p {
  margin-top: var(--s-4);
}

/* Aucun mot seul en fin de paragraphe. :where() garde le poids d'un sélecteur d'élément :
   les règles de titre (balance) et de composant l'emportent toujours. */
:where(.site) p,
:where(.site) li {
  text-wrap: pretty;
}

/* ---------- Mise en page ---------- */
.wrap {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Page entièrement en colonne de lecture (mentions, confidentialité) : colonne centrée */
.wrap--reading {
  max-width: calc(var(--reading-max) + 2 * var(--gutter));
}

/* Bloc de lecture DANS une page alignée à gauche (garantie, FAQ, texte) :
   largeur de lecture, mais sur l'axe gauche du .wrap — jamais centré (un seul axe par page) */
.measure {
  max-width: var(--reading-max);
}

.section {
  padding-block: var(--section-y);
}

.section--sand {
  background: var(--sand);
}

.section--flush-top {
  padding-top: 0;
}

/* Section d'une ligne (renvoi vers une autre page) : demi-respiration */
.section--tight {
  padding-block: calc(var(--section-y) / 2);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  /* Ligne de base commune : le lien .more (44 px, texte centré) s'aligne sur le texte du titre */
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3) var(--s-8);
  margin-bottom: var(--head-gap);
}

.section-head > :first-child {
  max-width: 60ch;
}

.section-head p {
  margin-top: var(--s-2);
  color: var(--ink-60);
}

.page-top {
  padding-top: calc(var(--header-h) + var(--s-6));
}

@media (min-width: 900px) {
  .page-top {
    padding-top: calc(var(--header-h) + var(--s-12));
  }
}

/* Panneau blanc cerclé d'un filet : formulaire, carte de contact, canal.
   Un seul dessin pour toutes les surfaces de ce type. */
.panel {
  background: var(--white);
  box-shadow: 0 0 0 1px var(--line);
  border-radius: var(--radius);
  padding: var(--s-6);
}

@media (min-width: 900px) {
  .panel {
    padding: var(--s-8);
  }
}

/* ---------- Liens ----------
   Un seul soulignement pour tout le site : 1 px, décalé de 3 px (§2). */
.link {
  color: var(--teal-700);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease-out);
}

.link:hover {
  color: var(--teal-800);
}

/* Lien autonome (« Voir tous les biens ») : texte seul, souligné qui s'affirme au survol.
   C'est l'alternative unique à côté d'un bouton principal (une action dominante par bloc). */
.more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  color: var(--teal-700);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--teal-700) 35%, transparent);
  text-underline-offset: 3px;
  transition:
    color var(--dur-fast) var(--ease-out),
    text-decoration-color var(--dur-fast) var(--ease-out);
}

.more:hover {
  color: var(--teal-800);
  text-decoration-color: currentColor;
}

/* ---------- Boutons (§2) — une action par bloc, libellés-verbes, jamais de flèche ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--control-h);
  padding: 0 var(--s-6);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--fs-control);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Action principale : marine, texte blanc 9,6:1 */
.btn--primary {
  background: var(--navy-700);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--navy-900);
}

/* Action secondaire : cadre discret, jamais en concurrence avec la principale */
.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--navy-900);
}

.btn--ghost:hover {
  border-color: var(--navy-700);
  background: var(--white);
}

/* Sur fond marine */
.btn--light {
  background: var(--white);
  color: var(--navy-900);
}

.btn--light:hover {
  background: var(--navy-100);
}

/* WhatsApp — vert officiel, non restylé */
.btn--wa {
  background: var(--whatsapp);
  color: var(--whatsapp-ink);
}

.btn--wa:hover {
  background: var(--whatsapp-hover);
}

.btn--sm {
  min-height: var(--control-h-sm);
  padding: 0 var(--s-4);
  font-size: var(--fs-ui);
}

.btn--block {
  width: 100%;
}

/* Sur téléphone, l'action principale d'un formulaire ou d'une carte prend toute la largeur */
@media (max-width: 639px) {
  .btn--block-sm {
    width: 100%;
  }
}

/* Bouton-texte : action secondaire d'un formulaire ou d'une liste (« Modifier », « Retour »,
   « Tout effacer »). Même soulignement que .link, cible tactile de 44 px. */
.btn--text {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--teal-700);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.btn--text:hover {
  color: var(--teal-800);
}

/* Variante effacée : action d'échappement qui ne doit pas attirer l'œil */
.btn--text-quiet {
  color: var(--ink-60);
}

.btn--text-quiet:hover {
  color: var(--ink);
}

/* ---------- Focus visible — jamais outline: none ----------
   Couleur portée par --focus (tokens.css) : --teal-700 sur les fonds clairs.
   Les surfaces marine redéfinissent le token ; leurs descendants en héritent.
   Un élément marine posé sur fond clair (bouton principal, carte) garde --teal-700 :
   avec le décalage de 2 px, son anneau se dessine sur le fond de la page. */
.site :focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.ftr,
.mmenu,
.hdr.is-menu-open,
.lb,
.srv-cta,
.brief--dark {
  --focus: var(--focus-on-dark);
}

/* ---------- Bloc documentaire (garantie, honoraires, vérification) ---------- */
.doc {
  background: var(--clay-100);
  border-top: 1px solid var(--clay-700);
  border-bottom: 1px solid var(--clay-700);
  border-radius: 0;
  color: var(--navy-900);
  padding: var(--s-8) var(--s-6);
}

@media (min-width: 900px) {
  .doc {
    padding: var(--s-12);
  }
}

.doc__ref {
  display: block;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--clay-700);
  margin-bottom: var(--s-2);
}

.doc__title {
  font-size: var(--fs-h3);
  line-height: 1.3;
  color: var(--navy-900);
  margin-bottom: var(--s-3);
}

.doc p {
  max-width: 64ch;
}

.doc__note {
  margin-top: var(--s-4);
  font-size: var(--fs-small);
  color: var(--navy-900);
  opacity: 0.8;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: var(--s-3) var(--s-4) var(--s-3) 0;
  border-bottom: 1px solid color-mix(in srgb, var(--clay-700) 22%, transparent);
}

.doc th {
  font-weight: 600;
}

/* Dernière ligne du corps sans filet (le bloc a le sien) ; l'en-tête garde le sien */
.doc tbody tr:last-child th,
.doc tbody tr:last-child td {
  border-bottom: 0;
}

/* Chiffre d'emphase — terre cuite, grandes tailles uniquement */
.figure {
  display: block;
  font-size: var(--fs-figure);
  line-height: 1.05;
  font-weight: 600;
  color: var(--clay-500);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.02em;
}

/* ---------- Étiquettes ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--s-2);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: var(--fs-micro);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--navy-900);
  white-space: nowrap;
}

.badge--emphasis {
  background: var(--clay-100);
  color: var(--clay-700);
}

/* ---------- Liste à coches (preuves, papiers, engagements) ---------- */
.ticks {
  display: grid;
  gap: var(--s-2);
  list-style: none;
}

.ticks li {
  position: relative;
  padding-left: 28px;
}

.ticks li::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 0.42em;
  width: 12px;
  height: 7px;
  border-left: 1.5px solid var(--success);
  border-bottom: 1.5px solid var(--success);
  rotate: -45deg;
}

/* ---------- Liste numérotée (étapes, pièces à fournir) ----------
   Chiffres simples (1, 2, 3) en --clay-700 : 5,43:1 sur paper, 5,03 sur sand.
   Numéro positionné à part : le texte de la ligne peut mêler liens et mots sans se fragmenter. */
.numlist {
  display: grid;
  list-style: none;
  counter-reset: num;
}

.numlist li {
  position: relative;
  padding: var(--s-3) 0 var(--s-3) var(--s-8);
  border-bottom: 1px solid var(--line);
  counter-increment: num;
}

.numlist li::before {
  content: counter(num);
  position: absolute;
  left: 0;
  top: var(--s-3);
  font-weight: 600;
  color: var(--clay-700);
  font-variant-numeric: tabular-nums;
}

/* ---------- Donnée manquante — visible uniquement en mode recette (NEXT_PUBLIC_SHOW_MISSING=1) ----------
   Jamais en production : un composant qui n'a pas sa donnée omet l'élément. */
.missing {
  display: inline;
  padding: 0 6px;
  border: 1px dashed var(--ink-30);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--ink-30) 12%, transparent);
  color: var(--ink-60);
  font-size: 0.88em;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.missing-block {
  display: block;
  padding: var(--s-4) var(--s-6);
  border: 1px dashed var(--ink-30);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--ink-30) 10%, transparent);
  color: var(--ink-60);
  font-size: var(--fs-small);
}

.missing-block strong {
  color: var(--ink);
}

/* Aperçu avec biens fictifs sur un build de production (NEXT_PUBLIC_DEMO_DATA=1) */
/* En bas à gauche, au-dessus de la barre collante éventuelle : ne masque jamais un titre */
.demo-flag {
  position: fixed;
  left: var(--s-3);
  bottom: calc(var(--sticky-h) + var(--s-3) + env(safe-area-inset-bottom));
  /* Sous les feuilles, pop-ups et menus : ne masque jamais un bouton d'action */
  z-index: calc(var(--z-sticky-contact) - 1);
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--clay-700);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0.9;
  pointer-events: none;
}

/* ---------- Lenis (défilement doux, pointeur fin uniquement) ---------- */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

/* ---------- Divers ---------- */
/* L'attribut hidden gagne toujours, même sur un élément stylé en grid ou flex */
.site [hidden]:not([hidden='until-found']) {
  display: none !important;
}

.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;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: calc(var(--z-transition) + 1);
  background: var(--navy-900);
  color: var(--white);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--s-4);
}

/* Découpage du titre en lignes (balisage conservé dans les pages ; aucune animation). */
.reveal-line,
.reveal-line > span {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .site *,
  .site *::before,
  .site *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
