/* LEADCRÉATIF — page « Diagnostic gratuit » (diagnostic-gratuit.html + assets/js/diagnostic.js).
   Complète style.css : formulaires, onglets et boutons du site sont réutilisés tels quels. */

.diag [hidden], #diag-impression[hidden] { display: none !important; }
.diag .section-head { margin-bottom: clamp(32px, 4vw, 56px); }
.diag__app { position: relative; max-width: 940px; }
.diag__note { margin: 12px 0; color: rgba(255, 255, 255, .7); }

/* Cartes de l'outil */
.diag__carte {
  display: flex; flex-direction: column; gap: 22px;
  padding: clamp(20px, 3.2vw, 40px);
  border: 1px solid var(--line-inv);
  background: rgba(255, 255, 255, .02);
}
.diag__etape { display: flex; align-items: center; gap: 10px; color: rgba(255, 255, 255, .55); }
.diag__intro { max-width: 60ch; font-size: var(--t-body-sm); line-height: 1.4; color: rgba(255, 255, 255, .65); }
.diag__alt { margin: 0; font-size: var(--t-caption); color: rgba(255, 255, 255, .55); }
.diag__alt .link, .diag__resume .link { color: var(--fog); }
.diag .form__note.is-erreur { color: #ff9b7a; }
.diag__carte.is-busy button[type="submit"], .diag__carte.is-busy .diag__fiche { opacity: .5; pointer-events: none; }
.diag__carte.is-busy .form__note { animation: diagPulse 1s ease-in-out infinite alternate; }
@keyframes diagPulse { from { opacity: .45; } to { opacity: 1; } }

.diag__chargement { display: flex; align-items: center; gap: 12px; padding: 28px 0; color: rgba(255, 255, 255, .55); }
.diag__spin {
  flex: none; display: inline-block;
  width: 12px; height: 12px;
  border: 1.5px solid rgba(255, 255, 255, .25);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: diagTourne .8s linear infinite;
}
@keyframes diagTourne { to { transform: rotate(360deg); } }

/* Choix de la fiche Google */
.diag__fiches { display: flex; flex-direction: column; border-bottom: 1px solid var(--line-inv); }
.diag__fiche {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 20px; row-gap: 4px;
  width: 100%; padding: 18px 4px;
  border-top: 1px solid var(--line-inv);
  text-align: left; color: var(--fog);
  transition: background-color .4s, padding .6s var(--ease-decisive);
}
.diag__fiche:hover, .diag__fiche:focus-visible { background: rgba(255, 255, 255, .04); padding-left: 14px; }
.diag__fiche:focus-visible { outline: 2px solid var(--ember); outline-offset: -2px; }
.diag__fiche-nom { grid-column: 1; font-size: var(--t-sub); line-height: 1.15; letter-spacing: -0.02em; }
.diag__fiche-info { grid-column: 1; color: rgba(255, 255, 255, .5); text-transform: none; letter-spacing: 0; }
.diag__fiche-fleche { grid-column: 2; grid-row: 1 / span 2; color: var(--ember); font-size: 22px; }

/* Résumé de la fiche lue sur Google */
.diag__resume { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-left: 2px solid var(--ember); background: rgba(255, 255, 255, .03); }
.diag__resume-nom { font-size: var(--t-sub); line-height: 1.15; letter-spacing: -0.02em; }
.diag__resume-info { color: rgba(255, 255, 255, .5); text-transform: none; letter-spacing: 0; }
.diag__resume-avis { color: rgba(255, 255, 255, .75); }
.diag__resume .diag__alt { margin-top: 6px; }

/* Questionnaire */
.q__groupe { margin: 18px 0 2px; color: var(--ember); }
.q__groupe:first-child { margin-top: 0; }
.q { margin: 0; padding: 18px 0 20px; border: 0; border-top: 1px solid var(--line-inv); min-width: 0; }
.q legend { float: left; width: 100%; margin: 0 0 14px; padding: 0; font-size: var(--t-body-sm); line-height: 1.35; letter-spacing: -0.015em; color: var(--fog); }
.q__num { display: inline-block; min-width: 34px; color: rgba(255, 255, 255, .4); }
.q__choix { clear: both; }
.q .chip span { padding: 10px 15px; }
.q.is-manquant legend { color: #ff9b7a; }
.q.is-manquant .chip span { border-color: rgba(255, 100, 54, .6); }
.diag__quiz-foot { position: sticky; bottom: 0; z-index: 2; margin: 0 calc(clamp(20px, 3.2vw, 40px) * -1) calc(clamp(20px, 3.2vw, 40px) * -1); padding: 16px clamp(20px, 3.2vw, 40px); border-top: 1px solid var(--line-inv); background: rgba(22, 22, 22, .94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* Analyse du site en cours */
.diag__etapes { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.diag__etapes li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .35); transition: color .5s; }
.diag__etapes li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1px solid currentColor; transition: background-color .5s, border-color .5s; }
.diag__etapes li.is-cours { color: var(--fog); }
.diag__etapes li.is-cours::before { border-color: var(--ember); background: var(--ember); animation: diagPulse .7s ease-in-out infinite alternate; }
.diag__etapes li.is-fait { color: rgba(255, 255, 255, .7); }
.diag__etapes li.is-fait::before { border-color: var(--fog); background: var(--fog); }
.diag__barre { position: relative; height: 2px; overflow: hidden; background: var(--line-inv); }
.diag__barre span { position: absolute; inset: 0 auto 0 0; width: 35%; background: var(--ember); animation: diagBarre 1.6s var(--ease-settle) infinite; }
@keyframes diagBarre { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

/* ---------- Résultat ---------- */
.res { display: flex; flex-direction: column; gap: clamp(28px, 3.6vw, 44px); padding: clamp(20px, 3.2vw, 40px); border: 1px solid var(--line-inv); background: rgba(255, 255, 255, .02); }
.res__tete { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: clamp(20px, 3.5vw, 44px); }
.res__jauge { position: relative; width: clamp(128px, 15vw, 168px); aspect-ratio: 1; }
.res__jauge svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.res__fond, .res__arc { fill: none; stroke-width: 7; }
.res__fond { stroke: rgba(255, 255, 255, .1); }
.res__arc { stroke: var(--ember); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1.2s var(--ease-decisive); }
.res__score { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 30%; font: 700 clamp(44px, 5vw, 60px)/1 var(--f-display); letter-spacing: -0.01em; color: var(--fog); }
.res__score small { margin-left: 2px; font: 500 var(--t-micro)/1 var(--f-mono); letter-spacing: 0; color: rgba(255, 255, 255, .45); }
.res__intro { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.res__sujet { color: rgba(255, 255, 255, .5); overflow-wrap: anywhere; }
.res__verdict { font-size: var(--t-h-sm); font-weight: 500; line-height: 1.02; letter-spacing: -0.035em; color: var(--fog); outline: none; }
.res__bilan { max-width: 52ch; color: rgba(255, 255, 255, .65); }
.res__attente { display: inline-flex; align-items: center; gap: 10px; color: rgba(255, 255, 255, .55); text-transform: none; letter-spacing: 0; }

.res__cats { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.res__cat { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr) 64px; align-items: center; gap: 16px; }
.res__cat-nom { color: rgba(255, 255, 255, .7); }
.res__cat-val { text-align: right; color: var(--fog); }
.res__barre { position: relative; height: 4px; overflow: hidden; border-radius: 4px; background: rgba(255, 255, 255, .1); }
.res__barre i { position: absolute; inset: 0; border-radius: inherit; background: var(--fog); transform: scaleX(var(--v, 0)); transform-origin: 0 50%; animation: diagBarreRes 1.2s var(--ease-decisive) both; }
@keyframes diagBarreRes { from { transform: scaleX(0); } }

.res__titre { margin-bottom: 14px; color: var(--ember); }
.res__prio ol { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line-inv); }
.res__prio li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; padding: 18px 0; border-top: 1px solid var(--line-inv); }
.res__prio-num { font: 700 clamp(30px, 3vw, 40px)/.9 var(--f-display); color: var(--ember); }
.res__prio-titre { margin-bottom: 6px; font-size: var(--t-sub); line-height: 1.15; letter-spacing: -0.02em; color: var(--fog); }
.res__prio-texte { max-width: 62ch; color: rgba(255, 255, 255, .62); }

.res__liste { display: flex; flex-direction: column; gap: 30px; }
.res__groupe .res__titre { color: rgba(255, 255, 255, .5); }
.chk { border-top: 1px solid var(--line-inv); }
.res__groupe .chk:last-child { border-bottom: 1px solid var(--line-inv); }
.chk summary {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 14px 2px;
  list-style: none; cursor: pointer;
}
.chk summary::-webkit-details-marker { display: none; }
.chk summary:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.chk__txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chk__titre { font-size: var(--t-body-sm); line-height: 1.25; color: var(--fog); }
.chk__val { font-size: var(--t-caption); line-height: 1.35; color: rgba(255, 255, 255, .5); overflow-wrap: anywhere; }
.chk__etat { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: rgba(255, 255, 255, .5); }
.chk__etat::after { content: "+"; font-size: 16px; line-height: 1; color: rgba(255, 255, 255, .4); transition: transform .5s var(--ease-decisive); }
.chk[open] .chk__etat::after { transform: rotate(45deg); }
.chk__corps { display: flex; flex-direction: column; gap: 10px; padding: 0 2px 18px 38px; max-width: 78ch; font-size: var(--t-caption); line-height: 1.5; color: rgba(255, 255, 255, .62); }
.chk__corps strong { font-weight: 500; color: var(--fog); }
.chk__note { color: rgba(255, 255, 255, .5); font-style: italic; }
.chk__note .link { font-style: normal; color: var(--fog); }

.chk__ic {
  position: relative; display: grid; place-items: center;
  width: 22px; height: 22px;
  border: 1.5px solid rgba(255, 255, 255, .3); border-radius: 50%;
  font: 600 12px/1 var(--f-mono); color: var(--onyx);
}
.chk__ic::before { content: ""; }
.chk[data-etat="ok"] .chk__ic { border-color: var(--fog); background: var(--fog); }
.chk[data-etat="ok"] .chk__ic::before { content: "✓"; }
.chk[data-etat="partiel"] .chk__ic { border-color: var(--ember); color: var(--ember); }
.chk[data-etat="partiel"] .chk__ic::before { content: "!"; }
.chk[data-etat="ko"] .chk__ic { border-color: var(--ember); background: var(--ember); color: var(--white); }
.chk[data-etat="ko"] .chk__ic::before { content: "✕"; }
.chk[data-etat="inconnu"] .chk__ic { border-style: dashed; border-color: rgba(255, 255, 255, .55); color: rgba(255, 255, 255, .8); }
.chk[data-etat="inconnu"] .chk__ic::before { content: "?"; }
.chk[data-etat="na"] .chk__ic { border-color: rgba(255, 255, 255, .15); color: rgba(255, 255, 255, .35); }
.chk[data-etat="na"] .chk__ic::before { content: "–"; }
.chk[data-etat="attente"] .chk__ic { border-color: rgba(255, 255, 255, .2); border-top-color: var(--ember); animation: diagTourne .8s linear infinite; }
.chk[data-etat="ok"] .chk__etat { color: rgba(255, 255, 255, .7); }
.chk[data-etat="partiel"] .chk__etat { color: #ff9b7a; }
.chk[data-etat="ko"] .chk__etat { color: var(--ember); }
.chk[data-etat="na"] .chk__titre { color: rgba(255, 255, 255, .55); }

.res__suite {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid rgba(255, 100, 54, .35);
  background: rgba(255, 100, 54, .06);
}
.res__suite-titre { margin-bottom: 8px; font-size: var(--t-sub); line-height: 1.1; letter-spacing: -0.025em; color: var(--fog); }
.res__suite-txt p:not(.res__suite-titre) { max-width: 58ch; color: rgba(255, 255, 255, .65); }
.res__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.res__refaire { margin: 0 6px; font-size: var(--t-caption); color: rgba(255, 255, 255, .7); }

/* Détail verrouillé : aperçu flouté du détail, recouvert par le formulaire de coordonnées */
.res__verrou { position: relative; }
.res__apercu {
  max-height: 360px; overflow: hidden;
  filter: blur(5px); opacity: .5;
  pointer-events: none; -webkit-user-select: none; user-select: none;
  -webkit-mask-image: linear-gradient(#000, transparent 88%); mask-image: linear-gradient(#000, transparent 88%);
}
.verrou {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 18px;
  margin-top: -250px;
  padding: clamp(20px, 3.2vw, 36px);
  border: 1px solid rgba(255, 255, 255, .18);
  background: var(--onyx);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.verrou__titre { font-size: var(--t-sub); line-height: 1.1; letter-spacing: -0.025em; color: var(--fog); }
.verrou__texte { max-width: 60ch; margin-top: -6px; font-size: var(--t-body-sm); line-height: 1.4; color: rgba(255, 255, 255, .65); }
.verrou__mention { max-width: 64ch; font-size: 13px; line-height: 1.5; letter-spacing: 0; color: rgba(255, 255, 255, .5); }
.verrou__mention .link { color: rgba(255, 255, 255, .8); }
.verrou__piege { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.verrou .field.is-invalide::after { transform: scaleX(1); }
.verrou .field.is-invalide input { border-bottom-color: var(--ember); }
.verrou .field.is-invalide label { color: #ff9b7a; }
.verrou.is-busy button[type="submit"] { opacity: .5; pointer-events: none; }
.verrou.is-busy .form__note { animation: diagPulse 1s ease-in-out infinite alternate; }
.verrou .form__note { max-width: 44ch; }

.res__envoi {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  margin-bottom: 26px; padding: 14px 18px;
  border-left: 2px solid var(--ember); background: rgba(255, 255, 255, .03);
  font-size: var(--t-caption); line-height: 1.45; color: rgba(255, 255, 255, .8);
  outline: none;
}
.res__envoi-ic { color: var(--ember); font-weight: 600; }
.res__envoi--echec .res__envoi-ic { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border: 1px solid currentColor; border-radius: 50%; font-size: .8em; }
.res__envoi-autre { color: rgba(255, 255, 255, .7); }
.res__envoi-note { color: rgba(255, 255, 255, .55); }

.res--echec { gap: 16px; }
.res--probleme .res__verdict::before { content: ""; display: inline-block; width: .32em; height: .32em; margin-right: .3em; border-radius: 50%; background: var(--ember); vertical-align: .15em; }
.res--echec .res__actions { margin-top: 8px; }

/* Sections suivantes */
.sd__grid.diag-points { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sd-steps.diag-suite { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.diag-suite__cta { margin-top: clamp(36px, 5vw, 64px); }

@media (max-width: 1080px) {
  .sd-steps.diag-suite { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 699px) {
  .res__tete { grid-template-columns: 1fr; justify-items: start; }
  .res__cat { grid-template-columns: minmax(0, 1fr) 56px; row-gap: 8px; }
  .res__cat-nom { grid-column: 1 / -1; }
  .res__prio li { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .chk summary { grid-template-columns: 22px minmax(0, 1fr); }
  .chk__etat { grid-column: 2; justify-self: start; }
  .chk__corps { padding-left: 2px; }
  .res__refaire { margin-left: 0; }
  .res__apercu { max-height: 240px; }
  .verrou { margin-top: -150px; }
}
@media (max-width: 560px) {
  .sd__grid.diag-points, .sd-steps.diag-suite { grid-template-columns: 1fr; }
  .diag .tabs { display: flex; }
}

/* ---------- Impression / PDF : seule la copie du résultat est imprimée ---------- */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; height: auto !important; overflow: visible !important; }
  body > *:not(#diag-impression) { display: none !important; }
  #diag-impression { display: block !important; color: #161616; font: 11pt/1.4 "Inter Tight", Arial, sans-serif; }
  #diag-impression * { color: #161616 !important; background: none !important; box-shadow: none !important; animation: none !important; transition: none !important; }
  .imp__tete { margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid #999; font-size: 9pt; }
  .imp__pied { margin-top: 20px; padding-top: 8px; border-top: 1px solid #999; font-size: 9pt; }
  #diag-impression .res { border: 0; padding: 0; gap: 18px; }
  #diag-impression .res__tete { grid-template-columns: 110px 1fr; }
  #diag-impression .res__jauge { width: 110px; }
  #diag-impression .res__fond { stroke: #ddd !important; }
  #diag-impression .res__arc { stroke: #ff6436 !important; }
  #diag-impression .res__score { font-size: 38px; }
  #diag-impression .res__barre { background: #e5e5e5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #diag-impression .res__barre i { background: #161616 !important; animation: none !important; }
  #diag-impression .res__titre, #diag-impression .res__prio-num, #diag-impression .chk[data-etat="ko"] .chk__etat { color: #d9481c !important; }
  #diag-impression .chk, #diag-impression .res__prio li, #diag-impression .res__prio ol { border-color: #ccc !important; break-inside: avoid; }
  #diag-impression .chk__ic { border-color: #161616 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #diag-impression .chk[data-etat="ok"] .chk__ic { background: #161616 !important; color: #fff !important; }
  #diag-impression .chk[data-etat="ko"] .chk__ic { background: #ff6436 !important; border-color: #ff6436 !important; color: #fff !important; }
  #diag-impression .chk__etat::after { display: none; }
  #diag-impression .chk__corps { padding-bottom: 10px; font-size: 9.5pt; }
  #diag-impression .res__attente { display: none; }
}
