/* ==========================================================================
   myClim.be : style.css (feuille de style partagée par toutes les pages)

   Sommaire
   1. Variables
   2. Polices (Manrope auto-hébergée)
   3. Reset
   4. Base
   5. Composants
   6. Mises en page
   7. Utilitaires
   8. Responsive (mobile-first, min-width) et animations
   ========================================================================== */


/* 1. VARIABLES
   ========================================================================== */
:root {
  --forest: #123D2E;      /* texte principal, ronds tél./e-mail, focus */
  --leaf: #7CB342;        /* aplats et survols uniquement, jamais du texte */
  --leaf-text: #4A7C15;   /* texte vert (contraste 4,6:1 sur --cream) */
  --cream: #F6F5F0;       /* fond de page */
  --muted: #52605A;       /* textes secondaires */
  --brand: #55D400;       /* vert du logo : aplats et pictogrammes uniquement, jamais en texte */

  --gutter: 1.25rem;      /* marge latérale des pages (augmentée en responsive) */
}


/* 2. POLICES
   Fichiers à envoyer dans le dossier fonts/. Sans eux, la police système prend le relais.
   ========================================================================== */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/manrope-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/manrope-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('fonts/manrope-800.woff2') format('woff2');
}


/* 3. RESET
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body,
h1,
p {
  margin: 0;
}

[hidden] {
  display: none;
}

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


/* 4. BASE
   ========================================================================== */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  background: var(--cream);
  color: var(--forest);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Focus : contour toujours visible au clavier.
   Safari < 15.4 ne connaît pas :focus-visible : il garde alors le contour de :focus. */
:focus {
  outline: 3px solid var(--forest);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Éléments focalisés par script ou par le lien d'évitement : pas de contour sur le bloc entier */
[tabindex="-1"]:focus {
  outline: none;
}


/* 5. COMPOSANTS
   ========================================================================== */

/* Lien d'évitement */
.skip {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: .75rem 1rem;
  border-radius: .5rem;
  background: var(--forest);
  color: #FFFFFF;
  font-weight: 600;
}

.skip:focus {
  top: 1rem;
}

/* En-tête */
.entete {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .5rem;
  padding-top: max(.5rem, env(safe-area-inset-top));
  padding-bottom: .5rem;
  background: var(--cream); /* fond opaque de repli */
}

@supports ((-webkit-backdrop-filter: blur(4px)) or (backdrop-filter: blur(4px))) {
  .entete {
    background: rgba(246, 245, 240, .95);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
}

.entete__logo {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  border-radius: .5rem;
}

.entete__logo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 5rem;
  object-fit: contain;
}

/* Téléphone : rond seul sur mobile, numéro seul à partir de 640 px */
.entete__tel {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  border-radius: .5rem;
  font-size: .875rem;
  font-weight: 600;
}

.entete__tel:hover {
  color: var(--leaf-text);
}

.entete__tel-texte {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Rond d'icône */
.rond {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--forest);
  color: #FFFFFF;
}

.rond svg {
  width: 1.5rem;
  height: 1.5rem;
}

.rond--compact {
  width: 2.75rem;
  height: 2.75rem;
}

.rond--compact svg {
  width: 1.25rem;
  height: 1.25rem;
}

.rond--lime {
  background: var(--brand);
  color: var(--forest);
}

.carte:hover .rond,
.entete__tel:hover .rond {
  background: var(--leaf);
  color: var(--forest);
}

.carte:hover .rond--lime {
  background: var(--forest);
  color: #FFFFFF;
}

/* Textes d'introduction */
.accroche {
  margin: 0 0 .5rem;
  font-weight: 600;
  color: var(--leaf-text);
}

.accroche__suite {
  display: block;
  font-weight: 400;
  color: var(--muted);
}

/* Lien vers le devis : zone cliquable portée à 44 px de haut sans modifier la mise en page */
.lien-devis {
  padding: .625rem 0;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .2em;
  -webkit-text-decoration-color: rgba(74, 124, 21, .4);
  text-decoration-color: rgba(74, 124, 21, .4);
}

.lien-devis:hover {
  color: var(--forest);
  -webkit-text-decoration-color: var(--forest);
  text-decoration-color: var(--forest);
}

.titre {
  margin: 0 0 1rem;
  font-size: 1.875rem;
  line-height: 1.2;
  font-weight: 800;
  text-wrap: balance;
}

.titre--page {
  margin-bottom: .75rem;
  letter-spacing: -.01em;
}

.intro {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
}

.intro--page {
  margin-bottom: 2rem;
}

/* Lien souligné dans un texte */
.lien {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.lien:hover {
  color: var(--forest);
}

/* Cartes de contact */
.contacts {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}

.contacts__liste {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.carte {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.5rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, .7);
}

.carte:hover {
  background: #FFFFFF;
}

.carte__corps {
  min-width: 0;
}

.carte__libelle {
  display: block;
  font-size: .875rem;
  color: var(--muted);
}

.carte__valeur {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Formulaire */
.champ {
  margin-top: 1.375rem;
}

.champ__label {
  display: block;
  margin-bottom: .375rem;
  font-weight: 600;
}

/* Phrase d'aide placée entre l'étiquette et le champ */
.champ__aide {
  margin: -.125rem 0 .5rem;
  font-size: .875rem;
  color: var(--muted);
}

.champ__facultatif {
  font-weight: 400;
  color: var(--muted);
}

/* Taille de police de 16 px minimum : évite le zoom automatique sur iOS */
.champ__saisie {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-height: 3rem;
  margin: 0;
  padding: .8125rem .875rem;
  border: 1px solid var(--muted);
  border-radius: .75rem;
  background-color: #FFFFFF;
  box-shadow: none;
  color: var(--forest);
  font-family: inherit;
  font-size: 16px;
  font-size: max(16px, 1rem);
  line-height: 1.4;
}

.champ__saisie::placeholder {
  color: var(--muted);
  opacity: 1;
}

.champ__saisie:focus {
  border-color: var(--forest);
}

/* La flèche est un SVG intégré : une variable CSS n'y fonctionne pas, la couleur #123D2E (--forest) y est écrite en %23123D2E */
.champ__saisie--liste {
  padding-right: 2.625rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23123D2E' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 14px 9px;
}

.champ__saisie--texte {
  min-height: 9.5rem;
  resize: vertical;
}

.case {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-top: 1.5rem;
}

.case__saisie {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: .625rem 0 0;
  accent-color: var(--forest);
}

.case__label {
  display: block;
  min-height: 2.75rem;
  padding: .5rem 0;
  font-size: .95rem;
  color: var(--muted);
}

.bouton {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-height: 3.25rem;
  margin: 1.875rem 0 0;
  padding: .875rem 2rem;
  border: 0;
  border-radius: 999px;
  background: var(--forest);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 16px;
  font-size: max(16px, 1rem);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bouton:hover {
  background: var(--leaf);
  color: var(--forest);
}

.bouton:disabled {
  opacity: .6;
  cursor: wait;
}

/* Messages de retour : la nature du message est dite par le texte, pas seulement par la couleur */
.message {
  margin: 0 0 1.5rem;
  padding: .875rem 1.125rem;
  border-left: 4px solid var(--leaf-text);
  border-radius: .75rem;
  background: #FFFFFF;
}

.message--erreur {
  border-left-color: var(--forest);
}

/* Confirmation d'envoi : avion en papier au début de la phrase.
   :not([hidden]) évite que display: flex n'annule l'attribut hidden. */
.message--ok:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.icone-envoi {
  flex: none;
  width: 3.95rem;
  height: 2rem;
}

.icone-envoi__ombre {
  fill: var(--leaf-text);
}

.icone-envoi__clair {
  fill: var(--brand);
}

.icone-envoi__debut {
  stop-color: var(--leaf-text);
}

.icone-envoi__fin {
  stop-color: var(--forest);
}

/* Texte éditorial (mentions légales) */
.prose h2 {
  margin: 2rem 0 0;
  font-size: 1.375rem;
  line-height: 1.3;
  font-weight: 800;
  scroll-margin-top: 8rem; /* l'en-tête collant ne masque pas le titre après un lien d'ancre */
}

.prose h3 {
  margin: 1.5rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.4;
  font-weight: 800;
}

.prose p,
.prose ul {
  margin: .75rem 0 0;
}

.prose ul {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: .375rem;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.prose a:hover {
  color: var(--leaf-text);
}

/* Pied de page */
.pied {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(18, 61, 46, .1);
  font-size: .875rem;
  color: var(--muted);
  text-align: center;
}

.pied__lien {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  text-decoration: underline;
  text-underline-offset: .2em;
}

.pied__lien:hover {
  color: var(--forest);
}


/* 6. MISES EN PAGE
   ========================================================================== */

/* Marges latérales communes, avec prise en compte des encoches (iPhone en paysage) */
.entete,
.principal,
.contenu,
.pied {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* Accueil : texte + contacts */
/* Le bloc est placé en haut de la zone disponible (et non centré verticalement),
   le pied de page reste en bas grâce à flex: 1 0 auto. */
.principal {
  -webkit-box-flex: 1;
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  align-items: center;
  gap: 2rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
}

.principal > * {
  min-width: 0;
}

.texte {
  max-width: 36rem;
  margin: 0 auto;
  text-align: center;
}

/* Page à colonne unique (formulaire) */
.contenu {
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding-top: 1.5rem;
  padding-bottom: 4rem;
}

/* Page de texte (mentions légales) : colonne plus large */
.contenu--texte {
  max-width: 52rem;
}


/* 7. UTILITAIRES
   ========================================================================== */

/* Champ piège anti-robot : hors écran, ignoré par les lecteurs d'écran (aria-hidden dans le HTML) */
.piege {
  position: absolute;
  top: auto;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}


/* 8. RESPONSIVE (mobile-first) ET ANIMATIONS
   ========================================================================== */

/* Tablettes et plus */
@media (min-width: 640px) {
  :root {
    --gutter: 2rem;
  }

  .entete__logo img {
    height: 7rem;
  }

  .entete__tel-rond {
    display: none;
  }

  .entete__tel-texte {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .titre {
    font-size: 2.25rem;
  }

  .titre--page {
    font-size: 2.5rem;
  }

  .pied {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 1.5rem;
  }

  .bouton {
    display: inline-block;
    width: auto;
  }
}

/* Ordinateurs */
@media (min-width: 768px) {
  :root {
    --gutter: 3rem;
  }

  .entete {
    padding-top: 1rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: 1rem;
  }

  .principal {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    padding-top: 3rem;
    padding-top: clamp(2rem, 7vh, 5rem); /* repli : la ligne au-dessus pour les vieux navigateurs */
    padding-bottom: 3rem;
  }

  .texte {
    margin: 0;
    text-align: left;
  }

  .accroche {
    margin-bottom: 1rem;
  }

  .titre {
    margin-bottom: 1.5rem;
    font-size: 3rem;
  }

  .titre--page {
    margin-bottom: .75rem;
    font-size: 2.5rem;
  }

  .intro {
    font-size: 1.125rem;
  }

  .contacts {
    max-width: none;
    margin: 0;
  }
}

/* Écrans bas (téléphone en paysage, petits portables) : en-tête plus compact et non collant */
@media (max-height: 600px) {
  .entete {
    position: static;
  }

  .entete__logo img {
    height: 5rem;
  }

  .principal {
    padding-top: 1rem;
  }
}

/* Animations : seulement si l'utilisateur ne demande pas de les réduire */
@media (prefers-reduced-motion: no-preference) {
  .entete__tel,
  .carte,
  .rond,
  .bouton {
    transition: background-color .2s, color .2s;
  }

  .lien-devis {
    transition: color .2s, text-decoration-color .2s;
  }
}
