/* ═══════════════════════════════════════════════════════════════════════════
   Bilantis : pages métier (lot 3, gabarit établi sur la page des peintres, corrigé le 27.11.2026
   par « gabarit-2 », cahier 7.2).
   Chargée après site.css par 'css_files' => ['site-metier'] (rendu : site_metier_page() de
   includes/site_metiers.php ; mode d'emploi : PROJET/lot-3/GABARIT-METIER.md).
   Chaque règle des pages métier est préfixée par .pg-metier (posée sur <main>) : la feuille ne
   change rien ailleurs. Seule exception, la grille des métiers (.metiers-grille, en fin de
   feuille) : elle sert aussi à la page « tous les métiers » et ne dépend d'aucune classe de page.
   Les composants communs (.intro-h1, .intro-lead, .intro-plan, .acct, .brief, .facts, .rangees,
   .etapes, .faq, .final, .compte, .suite, .dbl, .eqs) viennent de site.css et ne sont qu'ajustés.
     début ............ .m-debut, .m-haut (titre | offre / texte | offre), .m-titre, .m-texte,
                        .m-lead-2 (seconde phrase, masquée sur téléphone), .m-demo
     offre type ....... .m-offre, .m-offre-tete, .m-offre-k, .m-offre-c, .m-offre-t, .m-table,
                        .m-chap, .m-u, .m-sous, .m-ttc, .m-ttc-in, .m-montant, .m-offre-note ;
                        .m-tout (détail sur téléphone)
     preuve ........... .m-preuve, .m-preuve-texte, .m-preuve-image
     captures ......... .m-y1 (bas du cadrage fixé sur une ligne du document : --y1, --y1-m),
                        .m-bureau (capture masquée sur téléphone)
     en bref .......... .m-plans, .m-groupe, .m-plan-tete, .m-faits (faits rangés par plan)
     rangées .......... .m-plan (une ligne discrète : lien du module, précédé du plan s'il n'est pas Start)
     déroulé .......... .m-deroule (étapes | grande photo), .m-ref, .m-photo
     autres métiers ... .m-autres-head ; la grille : .metiers-grille (sans .pg-metier)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Début : titre et texte à gauche, l'offre type à droite ─────────────────────── */
.pg-metier .m-haut {
    display: grid; grid-template-columns: minmax(0, 4.5fr) minmax(0, 7.5fr);
    grid-template-areas: "titre offre" "texte offre";
    grid-template-rows: auto 1fr;
    gap: 20px clamp(28px, 4.4vw, 64px); align-items: start;
    padding-top: clamp(14px, 1.8vw, 24px); padding-bottom: clamp(40px, 5vw, 64px);
}
.pg-metier .m-titre { grid-area: titre; min-width: 0; }
.pg-metier .m-texte { grid-area: texte; min-width: 0; }
.pg-metier .m-offre { grid-area: offre; min-width: 0; }
.pg-metier .m-debut .acct { margin-bottom: 14px; }
.pg-metier .m-debut .intro-h1 { font-size: clamp(32px, 2.95vw, 43px); line-height: 1.04; max-width: 17ch; hyphens: manual; overflow-wrap: break-word; }
.pg-metier .m-debut .intro-lead { margin-bottom: 20px; }
.pg-metier .m-debut .cta-row { align-items: center; gap: 4px 16px; }
.pg-metier .m-demo { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; font-size: 14px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
.pg-metier .m-demo:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

/* ── L'offre type : vrai texte, montants calculés par le rendu ───────────────────── */
.pg-metier .m-offre {
    margin: 0; display: flex; flex-direction: column;
    background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius);
    box-shadow: var(--shadow-card); overflow: hidden;
}
.pg-metier .m-offre-tete { padding: 12px 16px 10px; }
.pg-metier .m-offre-k { margin: 0 0 2px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; font-size: 12.5px; font-weight: 700; color: var(--accent); }
.pg-metier .m-offre-c { font-weight: 400; color: var(--ink-3); }
.pg-metier .m-offre-t { margin: 0; font-weight: 700; font-size: 15px; line-height: 1.3; color: var(--ink); text-wrap: balance; }
.pg-metier .m-table {
    width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.3;
    font-variant-numeric: tabular-nums lining-nums;
}
.pg-metier .m-table th, .pg-metier .m-table td { padding: 6px 8px; text-align: left; vertical-align: baseline; font-weight: 400; }
.pg-metier .m-table tr > :first-child { padding-left: 16px; }
.pg-metier .m-table tr > :last-child { padding-right: 16px; }
.pg-metier .m-table .n { text-align: right; white-space: nowrap; }
.pg-metier .m-table thead th { background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; padding-block: 7px; white-space: nowrap; }
.pg-metier .m-table .c-no { width: 2.6em; color: var(--ink-3); }
.pg-metier .m-table thead .c-no { color: var(--on-accent); }
.pg-metier .m-table tbody > tr > * { border-top: 1px solid var(--rule); }
.pg-metier .m-table tbody th { color: var(--ink); text-wrap: pretty; }
.pg-metier .m-chap > * { background: var(--paper-2); font-weight: 700; color: var(--ink); }
.pg-metier .m-chap th { font-weight: 700; }
.pg-metier .m-chap .c-no { color: var(--ink); }
.pg-metier .m-u { color: var(--accent); font-weight: 700; }
.pg-metier .m-table .c-q { width: 5.6em; }
.pg-metier .m-table .c-pu { width: 4.6em; }
.pg-metier .m-table tr > .n:last-child { width: 6em; }
.pg-metier .m-sous > * { padding-block: 4px; font-size: 13.5px; color: var(--ink-2); text-align: right; }
.pg-metier .m-table tfoot tr:first-child > * { border-top: 1px solid var(--ink); padding-top: 9px; }
.pg-metier .m-ttc > td { padding-top: 8px; padding-bottom: 10px; }
/* « Total TTC      CHF 10'339.77 » : le libellé, puis le montant sous le double trait comptable du
   site (.dbl). Rien entre les deux (cahier 7.2, point 1). */
.pg-metier .m-ttc-in { display: flex; justify-content: flex-end; align-items: baseline; gap: 6px 18px; flex-wrap: wrap; }
.pg-metier .m-ttc-l { font-weight: 700; font-size: 16px; color: var(--ink); }
.pg-metier .m-montant { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 1.9vw, 27px); line-height: 1.1; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.pg-metier .m-montant .dbl { padding-bottom: 3px; }
.pg-metier .m-offre-note { order: 3; margin: 0; padding: 8px 16px 11px; border-top: 1px solid var(--rule); font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
/* Détail de l'offre sur téléphone (sans script) : <details> vide placé APRÈS le tableau dans le
   code comme à l'écran (ordre du clavier, relecture du 27.11.2026) ; le tableau se replie par
   :has(). Masqué au-delà de 600 px. */
.pg-metier .m-tout { display: none; }

/* ── La preuve : comment l'offre se saisit (un chapitre et ses lignes). Le texte s'aligne sur le
   haut de la capture, qui finit sur une ligne du document (cadre entier, pas de bord coupé). ── */
.pg-metier .m-preuve {
    display: grid; grid-template-columns: minmax(0, 4.5fr) minmax(0, 7.5fr); gap: 18px clamp(28px, 4.4vw, 64px);
    align-items: start; padding-bottom: clamp(40px, 5vw, 64px);
}
.pg-metier .m-preuve-texte { min-width: 0; padding-top: 6px; }
.pg-metier .m-preuve-texte .label { margin-bottom: 8px; }
.pg-metier .m-preuve-texte p { color: var(--ink-2); max-width: 42ch; margin: 0 0 10px; text-wrap: pretty; }
.pg-metier .m-preuve-texte .cap { margin: 0; }
.pg-metier .m-preuve-image { margin: 0; min-width: 0; }

/* ── Cadrage des captures fini sur une ligne du document (clé 'y1' de 'crop') : la hauteur du cadre
   suit la largeur affichée, si bien que le bas tombe toujours sur la même ligne du fichier ; hmax
   reste un plafond. Variables posées sur la figure par site_metier_capture() : --y1, --y1-m. ── */
@supports (width: 1cqw) {
    .pg-metier .m-y1 .cadre-vue { height: min(calc(var(--_hi) * (var(--y1, 1) - var(--_y0))), var(--_hmax)); }
}

/* ── En bref : les faits rangés par plan. Un en-tête par plan (« Plan Start, CHF 29 par mois » ;
   « Plan Pro, CHF 49 par mois : tout le plan Start, plus »), puis ses faits ; le double trait
   comptable ne ferme que le dernier groupe (cahier, partie 8.2). ─────────────────────────────── */
.pg-metier .m-plans { display: grid; gap: 28px; min-width: 0; }
.pg-metier .m-groupe { min-width: 0; }
.pg-metier .m-plan-tete {
    margin: 0 0 9px; font-family: var(--text); font-size: 14.5px; font-weight: 400; line-height: 1.45;
    letter-spacing: 0; color: var(--ink-2); font-variant-numeric: tabular-nums lining-nums; text-wrap: pretty;
}
.pg-metier .m-plan-tete b { font-weight: 700; color: var(--ink); }
.pg-metier .m-faits div:last-child { border-bottom: 0; }
.pg-metier .m-groupe:last-child .m-faits div:last-child { border-bottom: 3px double var(--ink); }
/* Sous les faits d'un plan : le lien du module qui les détaille (comptabilité et TVA, salaires, chantiers). */
.pg-metier .m-plan-suite { margin: 8px 0 0; font-size: 13.5px; line-height: 1.5; }
.pg-metier .m-plan-suite a { color: var(--accent); font-weight: 700; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.pg-metier .m-plan-suite a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
.pg-metier .m-groupe:last-child .m-plan-suite { margin-top: 12px; }

/* Légende facultative d'une capture de rangée ('legende') : dit d'où vient l'image quand ce n'est
   pas le chantier de la page (« Rapport de régie de démonstration, sur un autre chantier. »). */
.pg-metier .rangee-image .m-cap-note { margin: 10px auto 0; max-width: var(--wmax, none); font-size: 13px; line-height: 1.5; color: var(--ink-3); text-wrap: pretty; }

/* ── Rangées : sous les puces, une seule ligne discrète, sans pastille : « Inclus dès le plan
   Start, CHF 29 par mois » puis le lien du module, petit (cahier 7.2, point 4). ──────────── */
.pg-metier .rangee-texte .m-plan {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px;
    margin: 16px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-3); font-variant-numeric: tabular-nums lining-nums;
}
.pg-metier .m-plan a { color: var(--accent); font-weight: 700; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.pg-metier .m-plan a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
/* Un PDF dans une rangée : marge de la feuille réduite, pour garder son texte à 9 px ou plus. */
.pg-metier .rangee-image .docs { padding: 12px; }

/* ── Déroulé : quatre étapes en deux colonnes, la grande photo à côté ─────────────── */
.pg-metier .m-deroule { display: grid; grid-template-columns: var(--grille-inv); gap: 32px var(--grille-gap); align-items: start; }
/* --sans-image : variante de secours, si la photo du métier manque (aucune page ne s'en sert aujourd'hui). */
.pg-metier .m-deroule--sans-image { grid-template-columns: minmax(0, 1fr); }
.pg-metier .m-deroule .etapes { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: clamp(28px, 3vw, 40px); }
.pg-metier .m-deroule--sans-image .etapes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pg-metier .m-ref { margin: 14px 0 0; font-size: 13.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }
.pg-metier .m-photo { margin: 0; min-width: 0; }
.pg-metier .m-photo img { display: block; width: 100%; height: auto; background: var(--wall); }
.pg-metier .m-photo figcaption { margin-top: 12px; font-size: 15px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }

/* ── Les autres métiers : en-tête de la section (la grille vient de .metiers-grille) ─────── */
.pg-metier .m-autres-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 24px; }
.pg-metier .m-autres-head .h2 { margin-bottom: 0; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 1079px) {
    .pg-metier .m-haut { grid-template-columns: minmax(0, 1fr); grid-template-areas: "titre" "texte" "offre"; grid-template-rows: none; }
    .pg-metier .m-debut .intro-h1 { font-size: clamp(32px, 4.6vw, 46px); max-width: 22ch; }
    .pg-metier .m-texte { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 clamp(24px, 4vw, 48px); align-items: start; }
    .pg-metier .m-texte .intro-lead { grid-row: 1 / span 2; }
    .pg-metier .m-offre { max-width: 760px; }
    .pg-metier .m-preuve { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
}
@media (max-width: 860px) {
    .pg-metier .m-texte { display: block; }
    .pg-metier .m-preuve, .pg-metier .m-deroule { grid-template-columns: minmax(0, 1fr); }
    .pg-metier .m-preuve-texte { padding-top: 0; }
    .pg-metier .m-photo { max-width: 560px; }
    .pg-metier .m-deroule--sans-image .etapes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Téléphone (cahier 4.1, point 3) : H1, une phrase, bouton plein et ligne de prix, puis le début
   de l'offre réduite : chapitres avec leur sous-total, lignes du premier chapitre, total ; le
   détail complet s'ouvre sous le tableau (<details>, sans script). */
@media (max-width: 600px) {
    .pg-metier .m-haut { gap: 16px; padding-top: 8px; padding-bottom: 36px; }
    .pg-metier .m-debut .acct { display: none; }
    .pg-metier .m-debut .intro-h1 { font-size: 31px; line-height: 1.06; max-width: none; }
    .pg-metier .m-lead-2 { display: none; }
    .pg-metier .m-debut .intro-lead { margin-bottom: 16px; }
    .pg-metier .m-debut .cta-row .btn { flex: 0 1 auto; }
    .pg-metier .m-offre { margin-inline: calc(var(--gutter) * -1); border-radius: 0; border-inline: 0; }
    .pg-metier .m-offre-tete { padding: 10px var(--gutter) 8px; }
    .pg-metier .m-offre-c { display: none; }
    .pg-metier .m-table { font-size: 14px; }
    .pg-metier .m-table .c-no, .pg-metier .m-table .c-pu { display: none; }
    .pg-metier .m-table th, .pg-metier .m-table td { padding: 6px 6px; }
    .pg-metier .m-table tr > :nth-child(2) { padding-left: var(--gutter); }
    .pg-metier .m-table tr > :last-child { padding-right: var(--gutter); }
    .pg-metier .m-table .c-q, .pg-metier .m-table tr > .n:last-child { width: auto; }
    .pg-metier .m-sous > * { padding-block: 3px; }
    .pg-metier .m-ttc-in { gap: 4px 14px; }
    .pg-metier .m-ttc-l { font-size: 15px; }
    .pg-metier .m-montant { font-size: 22px; }
    .pg-metier .m-offre-note { padding: 8px var(--gutter) 10px; }
    .pg-metier .m-tout { display: block; border-top: 1px solid var(--rule); }
    .pg-metier .m-tout summary {
        display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 var(--gutter);
        font-weight: 700; font-size: 15px; color: var(--accent); cursor: pointer; list-style: none;
    }
    .pg-metier .m-tout summary::-webkit-details-marker { display: none; }
    .pg-metier .m-tout summary::after { content: "+"; font-size: 18px; line-height: 1; }
    .pg-metier .m-tout[open] summary::after { content: "\2212"; }
    .pg-metier .m-tout .m-tout-f, .pg-metier .m-tout[open] .m-tout-o { display: none; }
    .pg-metier .m-tout[open] .m-tout-f { display: inline; }
    /* Fermé : seules les lignes du premier chapitre ; les autres chapitres gardent leur sous-total. */
    .pg-metier .m-offre:has(> .m-tout:not([open])) .m-table tbody:not(:first-of-type) > tr:not(.m-chap) { display: none; }
    .pg-metier .m-preuve { padding-bottom: 36px; }
    .pg-metier .m-preuve-image { margin-inline: calc(var(--gutter) * -1); }
    .pg-metier .m-preuve-image .browser { border-radius: 0; border-inline: 0; }
    .pg-metier .m-photo { margin-inline: calc(var(--gutter) * -1); max-width: none; }
    .pg-metier .m-photo figcaption { padding-inline: var(--gutter); }
    /* Captures : 'tel' => false les masque ; y1-m fixe le bas du cadrage du téléphone. */
    .pg-metier .m-bureau { display: none; }
    @supports (width: 1cqw) {
        .pg-metier .m-y1 .cadre-vue { height: min(calc(var(--_hi) * (var(--y1-m, var(--y1, 1)) - var(--_y0))), var(--_hmax)); }
    }
}
@media (max-width: 480px) {
    .pg-metier .m-deroule .etapes, .pg-metier .m-deroule--sans-image .etapes { grid-template-columns: minmax(0, 1fr); }
}

/* ═══ Grille des métiers : site_metiers_grille() (includes/site_metiers.php) ═══════════════════
   Pour les pages métier et la page « tous les métiers ». AUCUNE dépendance à une classe de page :
   il suffit de charger 'css_files' => ['site-metier'].
   <ul class="metiers-grille [metiers-grille--compacte]"><li><a href="…">
     <span class="metiers-grille-img"><img …></span>
     <span|h3 class="metiers-grille-n"><span>Nom</span><span class="eqs">…</span></span|h3>
     <span class="metiers-grille-l">Ligne du métier.</span></a></li>…</ul>
   Par défaut : photo 4:3 au-dessus du nom, quatre colonnes (deux à 860 px et moins).
   --compacte : petite photo (96 x 72) à gauche du nom et de la ligne, quatre colonnes, puis deux
   (1079 px et moins), puis une (600 px et moins). */
.metiers-grille {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 32px) clamp(14px, 2vw, 24px);
}
.metiers-grille > li { min-width: 0; }
.metiers-grille a { display: grid; gap: 9px; color: var(--ink); text-decoration: none; }
.metiers-grille-img { display: block; overflow: hidden; aspect-ratio: 4 / 3; background: var(--wall); border-radius: 3px; }
.metiers-grille-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.metiers-grille-n {
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0;
    border-top: 1px solid var(--ink); padding-top: 9px;
    font-family: var(--display); font-weight: 700; font-size: clamp(16px, 1.5vw, 19px); line-height: 1.15; letter-spacing: -.015em; color: var(--ink);
}
.metiers-grille-n .eqs { color: var(--accent); font-size: 14px; flex: none; align-self: center; }
.metiers-grille-l { color: var(--ink-2); font-size: 14.5px; line-height: 1.45; margin-top: -4px; }
.metiers-grille a:hover .metiers-grille-n > span:first-child { text-decoration: underline; color: var(--accent-hover); }
.metiers-grille a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
/* Compacte : la photo à gauche, petite ; le nom sans filet ni petit signe égal ; la ligne dessous. */
.metiers-grille--compacte { gap: 18px clamp(14px, 2vw, 24px); }
.metiers-grille--compacte a { grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 4px 14px; align-items: start; }
.metiers-grille--compacte .metiers-grille-img { grid-row: 1 / span 2; }
.metiers-grille--compacte .metiers-grille-n { border-top: 0; padding-top: 2px; font-size: 16px; justify-content: flex-start; }
.metiers-grille--compacte .metiers-grille-n .eqs { display: none; }   /* la photo porte déjà le signe égal */
.metiers-grille--compacte .metiers-grille-l { margin-top: 0; font-size: 14px; }
@media (max-width: 1079px) {
    .metiers-grille--compacte { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .metiers-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .metiers-grille--compacte { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}
@media (max-width: 480px) {
    .metiers-grille { gap: 18px 12px; }
    .metiers-grille-n { font-size: 16px; }
    .metiers-grille-l { font-size: 14px; }
}

/* Téléphone : l'image d'une rangée va d'un bord à l'autre ; sa légende garde la gouttière. */
@media (max-width: 600px) {
    .pg-metier .rangee-image .m-cap-note { padding-inline: var(--gutter); }
}
