/* ============================================================
   Fabrique - OUTILS (tools.css)
   Hub /outils + pages outils (calculateurs, convertisseurs, lookup).
   Fluide (tokens clamp), piloté par [data-accent], zéro pixel fixe.
   ============================================================ */

/* Le hub /outils réutilise .hub-grid + .hubcard (design system, components.css).
   Aucune carte propre aux outils ici : pas de doublon, pas de barre d'accent. */

/* ---------- PAGE OUTIL : en-tête compact + ATELIER form | résultat ----------
   Flux fluide : en-tête sobre, puis on remplit à gauche et le résultat
   s'affiche en direct juste à droite ; la reco arrive en pleine largeur dessous. */
.section--tool { padding-top: var(--space-md); padding-bottom: var(--space-2xl); }

/* Une page d outil, une seule verticale. Mesure des bords avant : le panneau
   de calcul allait de 95 a 1331, le texte « En bref » de 233 a 1193 - deux
   alignements sur la meme page, et c est ce decrochement qui se voyait. Tout
   passe a la largeur de lecture : le panneau y tient largement ses deux
   colonnes, et le texte reste lisible. */
/* + 44 px : le conteneur porte 22 px de padding de chaque cote, et c est sa
   BOITE INTERIEURE qui doit valoir la largeur de lecture. Sans ce calcul, le
   panneau se retrouvait 22 px en dedans du texte au lieu d etre aligne. */
.section--tool > .container,
.tool-hero > .container { max-width: calc(var(--lecture) + 44px); }

/* ---- Bandeau d en-tete d outil ----
   La page ouvrait sur un titre en texte brut colle sous le fil d Ariane. Elle
   recoit le meme traitement que les hubs et les articles. */
/* Le fond, le filet et le rembourrage viennent de la declaration commune
   des bandeaux de page, dans article.css. Ne pas les redeclarer ici. */
.tool-head { display: flex; align-items: flex-start; gap: clamp(14px, 1.6vw, 22px); max-width: 60rem; }
.tool-head__text { display: flex; flex-direction: column; gap: var(--space-2xs); min-width: 0; }
/* Meme tuile pleine que partout ailleurs sur le site. */
.tool-head__ico {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 16px; margin-top: 4px;
  background: linear-gradient(150deg,
    var(--acc, var(--brand)),
    color-mix(in srgb, var(--acc, var(--brand)) 74%, #000));
  color: #fff;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--acc, var(--brand)) 28%, transparent);
}
.tool-head__ico .ico { width: 28px; height: 28px; }
@media (max-width: 620px) {
  .tool-head__ico { width: 44px; height: 44px; border-radius: 13px; }
  .tool-head__ico .ico { width: 23px; height: 23px; }
}
.tool-head__title { font-size: var(--fs-hero); line-height: 1.12; color: var(--ink); }
.tool-head__lead { font-size: var(--fs-base); color: var(--text); line-height: 1.5; }

/* Atelier : UN SEUL bloc (carte ombrée à coins arrondis) qui contient TOUT -
   formulaire, résultat ET modèles recommandés. Séparations par simples filets. */
/* Le calculateur reprend le vocabulaire visuel des cartes du site : un filet
   d'accent en tete, comme `.pcard--star` porte son anneau. L'accent vient de
   `data-accent`, declare par chaque outil dans data/tools.js - le meme
   mecanisme que les cartes produit et la navigation. Sans cela le bloc restait
   un rectangle gris sur fond gris, seul element neutre d'un site qui ne l'est
   pas. */
.tool-work {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tool-work__top {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
}
/* Le cote SAISIE se centre verticalement. Il ne contient souvent que deux
   champs, alors que le cote resultat en fait le double de haut : ~250 px de
   vide s ouvraient sous les champs, mesures sur le calculateur de densite. */
.tool-work__side { padding: var(--space-lg); min-width: 0; }
/* Les deux panneaux commencent EN HAUT, pour que leurs deux etiquettes soient
   sur la meme ligne. Le centrage vertical avait ete pose pour combler un vide
   sous les champs ; il decalait « Votre situation » de 110 px sous « Votre
   resultat », et deux titres qui ne s alignent pas se voient plus qu un vide. */
.tool-work__side--in { display: flex; flex-direction: column; justify-content: flex-start; }
/* Le cote RESULTAT porte un voile de l'accent : c'est la que se pose l'oeil
   apres avoir rempli le formulaire, il doit se distinguer de la saisie. */
.tool-work__side--out {
  display: flex; flex-direction: column; justify-content: center;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--acc, var(--brand)) 6%, transparent), transparent 220px);
}
.tool-work__label { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-sm); }
.tool-work__side--out .tool-work__label { color: var(--acc, var(--brand)); }
/* Reco À L'INTÉRIEUR du bloc : pleine largeur, séparée par un filet du haut */
.tool-work .tool-reco { margin-top: 0; padding: var(--space-lg); border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .tool-work__top { grid-template-columns: 1fr; }
  .tool-work__side--out { border-left: none; border-top: 1px solid var(--line); justify-content: flex-start; }
}

/* Variante "Que dit la loi" : contrôle slim en haut + résultat pleine largeur */
.tool-controls { max-width: 34rem; margin-bottom: var(--space-lg); }
.tool-controls .tool-form { padding: var(--space-md); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.tool-app { min-width: 0; }

/* Formulaire : grille nue (le panneau de l'atelier fournit le cadre) */
.tool-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--space-md);
}
.tool-field { display: flex; flex-direction: column; gap: var(--space-2xs); }
.tool-field__label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink); }
.tool-field__unit { font-weight: 600; color: var(--muted); }
.tool-field__num { position: relative; display: flex; align-items: center; }
.tool-field__input {
  width: 100%;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
select.tool-field__input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23687a72' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  background-size: .7rem;
  padding-right: calc(var(--space-md) * 2 + .7rem);
  cursor: pointer;
}
.tool-field__num .tool-field__input { padding-right: 3.2rem; }
.tool-field__suffix {
  position: absolute;
  right: var(--space-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}
.tool-field__input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .15);
}
.tool-field__help { font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }

/* ---------- Résultat chiffré (dans le panneau de droite) ---------- */
.tool-result { min-width: 0; }
/* Variante large : employee par les outils dont la mise en page est `wide`
   (le moteur de decision), ou le resultat occupe toute la largeur au lieu
   d etre une colonne a cote de la saisie. Elle etait citee dans le HTML sans
   exister ici - trouvee par le controle des classes fantomes. */
.tool-result--wide { width: 100%; }
.tool-figure {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  text-align: center;
  padding: var(--space-sm) 0 var(--space-md);
}
.tool-figure__big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-3xl);
  line-height: 1;
  color: var(--acc);
}
.tool-figure__head { font-size: var(--fs-md); font-weight: 700; color: var(--ink); line-height: 1.25; }
.tool-figure__sub { font-size: var(--fs-sm); color: var(--muted); }
.tool-notes {
  margin-top: var(--space-sm);
  display: grid;
  gap: var(--space-xs);
  list-style: none;
}
.tool-notes li {
  position: relative;
  padding-left: 1.6rem;
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.5;
}
.tool-notes li::before {
  content: "";
  position: absolute;
  left: 0; top: .5em;
  width: .55rem; height: .55rem;
  border-radius: 50%;
  background: var(--acc);
}

/* ---------- "Que dit la loi" : rendu riche ---------- */
.law { display: flex; flex-direction: column; gap: var(--space-lg); }

/* Verdict : bandeau statut + grande stat vitesse */
.law__verdict {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(130% 160% at 0% 0%, rgba(var(--acc-rgb), .14), transparent 60%),
    var(--surface);
  border: 1px solid rgba(var(--acc-rgb), .25);
  box-shadow: var(--shadow-sm);
}
.law__verdict-main { flex: 1 1 16rem; min-width: 0; }
.law__statut { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--acc); }
.law__verdict-txt { font-family: var(--font-display); font-size: var(--fs-lg); line-height: 1.2; color: var(--ink); margin-top: var(--space-2xs); }
.law__speed {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius); background: rgba(var(--acc-rgb), .10);
}
.law__speed-num { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl); line-height: 1; color: var(--acc); }
.law__speed-lbl { font-size: var(--fs-2xs); color: var(--muted); margin-top: .3em; max-width: 12rem; }

/* Règles en cartes (icône + label + pastille statut + détail) */
.law__rules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-sm);
}
.lrule {
  display: flex; gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.lrule__ico {
  flex: none;
  display: inline-grid; place-items: center;
  width: 2.2rem; height: 2.2rem;
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
}
.lrule__body { min-width: 0; }
.lrule__top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs); }
.lrule__label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink); }
.lrule__detail { font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; margin-top: var(--space-2xs); }

/* Pastilles de statut (couleur sémantique) */
.lr-pill { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .02em; padding: .2em .6em; border-radius: 999px; white-space: nowrap; }
.lr-pill--req  { color: #B23A26; background: rgba(201, 80, 58, .13); }
.lr-pill--no   { color: #B23A26; background: rgba(201, 80, 58, .13); }
.lr-pill--rec  { color: #9A6512; background: rgba(201, 138, 43, .16); }
.lr-pill--ok   { color: #178455; background: rgba(31, 163, 104, .14); }
.lr-pill--info { color: var(--muted); background: var(--bg-alt); }

/* Équipement + sanctions */
.law__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: var(--space-md); }
.law__block { padding: var(--space-lg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.law__h { font-family: var(--font-display); font-size: var(--fs-md); color: var(--ink); margin-bottom: var(--space-sm); }
.law__equip { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.law__equip li { font-size: var(--fs-xs); color: var(--text); background: var(--bg-alt); border-radius: var(--radius-sm); padding: .4em .7em; }
.law__sanctions { list-style: none; display: grid; gap: 0; }
.law__sanctions li {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-md);
  padding: var(--space-sm) 0; border-top: 1px solid var(--line);
}
.law__sanctions li:first-child { border-top: none; }
.law__sanc-k { font-size: var(--fs-sm); color: var(--text); }
.law__sanc-v { font-size: var(--fs-sm); font-weight: 700; color: #B23A26; white-space: nowrap; }

/* Checklist conformité */
.law__check { padding: var(--space-lg); background: rgba(var(--acc-rgb), .06); border: 1px solid rgba(var(--acc-rgb), .2); border-radius: var(--radius); }
.law__checklist { list-style: none; display: grid; gap: var(--space-xs); }
.law__checklist li { position: relative; padding-left: 1.7rem; font-size: var(--fs-sm); color: var(--ink); line-height: 1.45; }
.law__checklist li::before {
  content: "\2713"; position: absolute; left: 0; top: 0;
  width: 1.2rem; height: 1.2rem; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; color: var(--on-accent); background: var(--acc); border-radius: 50%;
}

.tool-lookup__warn {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--ink);
  background: rgba(var(--acc-rgb), .08);
  border: 1px solid rgba(var(--acc-rgb), .22);
  border-radius: var(--radius-sm);
}

/* ---------- Reco produit ---------- */
.tool-reco { margin-top: var(--space-lg); }
.tool-reco__head { margin-bottom: var(--space-sm); }
.tool-reco__eyebrow { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--acc); }
.tool-reco__title { font-family: var(--font-display); font-size: var(--fs-lg); color: var(--ink); line-height: 1.15; }

/* Contenu éditorial sous l'outil : même alignement que l'outil, largeur lisible */
/* ALIGNEMENT SUR LE CALCULATEUR.

   Le bloc interactif occupe toute la largeur du `.container` (1160 px) ; la
   prose etait plafonnee a 64rem (1024 px). Resultat visible a l'oeil : le
   texte sous l'outil s'arretait avant son bord droit, comme un bloc mal pose.
   Deux largeurs differentes dans une meme colonne se voient toujours.

   La longueur de ligne reste maitrisee par `.tool-prose p`, qui limite les
   PARAGRAPHES : c'est la lisibilite du texte qui compte, pas celle des titres
   ni des listes, et cela evite d'avoir a retrecir tout le bloc.

   CORRECTION (vue en CAPTURE, invisible a tout test de HTML). Limiter les
   seuls paragraphes ne suffisait pas : la FAQ, elle, courait jusqu'au bord du
   conteneur (`main:has(.tool-work) .faq { max-width: none }`, components.css).
   Deux bords droits differents dans la meme colonne, avec 400 px de vide a
   droite des paragraphes - le defaut qu'on voulait corriger, deplace d'un
   cran.

   Le bloc editorial est desormais UNE colonne unique a la mesure du reste du
   site (`.article-body` = 820 px), CENTREE comme sur toutes les pages
   d'article. Cale a gauche, elle laissait un vide asymetrique qui se lit comme
   un defaut ; centree, les marges sont egales et la page se lit comme un
   article, ce qu'elle est. */
.tool-prose { max-width: var(--lecture); margin-inline: auto; }
.tool-prose > p,
.tool-prose > ul,
.tool-prose > ol,
.tool-prose > .faq { max-width: var(--lecture); margin-inline: 0; }
/* La largeur des autres blocs de ces pages est alignee dans moteur.css. */
.tool-prose > h2 { font-size: var(--fs-lg); color: var(--ink); margin: var(--space-xl) 0 var(--space-sm); }
.tool-prose > h2:first-child { margin-top: 0; }
.tool-prose p { font-size: var(--fs-base); line-height: 1.6; color: var(--text); margin-bottom: var(--space-sm); }
.tool-prose .faq { margin-top: var(--space-xs); }
.tool-reco__note { font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--space-md); line-height: 1.5; }
/* La reco réutilise la grille .pgrid + la carte canonique .pcard (components.css).
   Aucune carte propre aux outils : tailles et disposition homogènes avec le site. */
.tool-work .tool-reco .pgrid--3 { gap: var(--space-md); }

.tool-cross { margin-top: var(--space-md); text-align: center; }

/* ---------- Mobile : compact ---------- */
@media (max-width: 560px) {
  .law__verdict { padding: var(--space-md); }
  .law__speed { width: 100%; }
}

/* Titre de groupe de la grille outils ({{TOOLS_HUB}} regroupe par categorie). */
.tools-group { margin-top: var(--space-xl); }
.tools-group:first-child { margin-top: 0; }

/* ============================================================
   Calculateur (.calc) : composant central des pages "calculateur"
   (BTU clim, volume/dosage/debit piscine, PAC, spa, barbecue,
   pergola...). Markup : .calc__card > .calc__field (label + input
   ou .calc__opts>.calc__opt en radios) > .calc__result. Style pur :
   aucune dependance au JS (calcul via script inline par page).
   ============================================================ */
.calc__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow-sm); margin: 26px 0; }
.calc__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.calc__row .calc__field { margin-bottom: 0; }
.calc__field { margin-bottom: 18px; }
.calc__field > label { display: block; font-weight: 700; color: var(--ink); font-size: .92rem; margin-bottom: 8px; }
.calc__field input[type="number"], .calc__field input[type="text"], .calc__field select { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font: inherit; font-size: 1rem; transition: border-color .15s ease, box-shadow .15s ease; }
.calc__field input:focus, .calc__field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.calc__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.calc__opt { position: relative; cursor: pointer; }
.calc__opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.calc__opt span { display: inline-flex; align-items: center; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .9rem; font-weight: 600; transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
.calc__opt:hover span { border-color: var(--brand); color: var(--brand-dark); }
.calc__opt input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand); }
.calc__opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }
.calc__hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.calc__result { margin-top: 22px; padding: 22px; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--line); }
.calc__btu { font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; color: var(--brand-dark); line-height: 1.12; }
.calc__btu small { display: block; font-family: var(--font); font-size: .9rem; font-weight: 500; color: var(--text); margin-top: 4px; }
.calc__advice { margin-top: 12px; color: var(--text); font-size: .95rem; line-height: 1.55; }
.calc__advice:empty { display: none; }
.calc__list { margin: 10px 0 0; padding-left: 20px; color: var(--text); }
.calc__out { font-weight: 800; color: var(--brand-dark); }
.calc__cta { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 560px) { .calc__row { grid-template-columns: 1fr; } }

/* MAILLAGE SORTANT D'UNE PAGE D'OUTIL (bloc « Pour aller plus loin »).
   Une page d'outil recevait des liens (encart .tool-callout des articles) sans
   jamais en emettre : cul-de-sac de maillage. La liste est volontairement
   sobre - titre lisible, resume en gris dessous - pour rester une aide a la
   navigation et non une seconde grille de cartes qui concurrencerait la reco
   produit juste au-dessus. */
.tool-related { list-style: none; margin: 0; padding: 0; max-width: var(--lecture); }
.tool-related li { padding: var(--space-sm) 0; border-bottom: 1px solid var(--line); }
.tool-related li:last-child { border-bottom: 0; }
.tool-related a { font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.tool-related a:hover { color: var(--brand-dark); }
.tool-related__desc { display: block; margin-top: 4px; font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
