/* ==========================================================================
   QORSEC — Score de sécurité du domaine : styles propres à l'outil
   (complète /assets/css/site.css ; préfixe .sd-)
   ========================================================================== */

/* ---------- mise en page : la colonne implicite de .tool-main (grille « auto ») ne doit pas
   s'élargir à la largeur intrinsèque d'un enregistrement DNS ou d'un nom long (débordement à 390 px). */
.tool-main > .tool-panel, .tool-main > .sd-results { min-width: 0; }

/* ---------- saisie */
.sd-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.sd-form__label { font-weight: 700; font-size: .92rem; }
.sd-input {
  display: flex; gap: 8px; padding: 6px; border-radius: 12px;
  background: var(--white); border: 1px solid var(--border-strong);
  transition: border-color var(--t, .2s), box-shadow var(--t, .2s);
}
.sd-input:focus-within { border-color: var(--blue-600); box-shadow: 0 0 0 4px rgba(29, 78, 216, .14); }
.sd-input__prefix { display: flex; align-items: center; padding-left: 10px; color: var(--ink-400); font-family: var(--mono); font-size: .9rem; }
.sd-input input {
  flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; color: var(--ink-900);
  font-family: var(--mono); font-size: 1.02rem;
}
.sd-input input::placeholder { color: var(--ink-400); }
.sd-input .btn { min-height: 46px; }
.sd-input .btn[disabled] { opacity: .7; cursor: progress; }
.sd-input:has(input[aria-invalid="true"]) { border-color: var(--red-700); }
.sd-form__error { margin: 0; min-height: 1.2em; font-size: .86rem; font-weight: 600; color: var(--red-700); }
.sd-form__error:empty { min-height: 0; }
.sd-example, .sd-linkbtn {
  padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--blue-600);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.sd-example:hover, .sd-linkbtn:hover { color: var(--blue-700); }
/* Zone tactile de 44 px sans changer l'interligne du texte d'aide */
@media (pointer: coarse), (max-width: 760px) { .sd-example { display: inline-flex; align-items: center; min-height: 44px; margin-block: -11px; vertical-align: middle; } }
@media (max-width: 520px) {
  .sd-input__prefix { display: none; }
  .sd-input .btn { padding-inline: 14px; }
}

/* ---------- progression */
.sd-progress__head { display: flex; align-items: center; gap: 14px; }
.sd-progress__head > .tool-spinner { width: 26px; height: 26px; color: var(--cyan-700); border-width: 3px; }
.sd-progress__title { font-size: 1.2rem; margin: 0 0 2px; }
.sd-progress__head p { margin: 0; overflow-wrap: anywhere; }
.sd-progress__bar { margin: 18px 0 14px; }
.sd-progress__bar > span { transition: width .4s var(--ease-out, ease-out); }
.sd-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 18px; }
.sd-step { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: .92rem; color: var(--fg-subtle); }
.sd-step__icon { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border-strong); font-size: .72rem; font-weight: 800; }
.sd-step__icon .tool-spinner { width: 14px; height: 14px; }
.sd-step--running { color: var(--fg); font-weight: 600; }
.sd-step--running .sd-step__icon { border-color: transparent; color: var(--cyan-700); }
.sd-step--done { color: var(--fg-muted); }
.sd-step--done .sd-step__icon { background: var(--green-700); border-color: var(--green-700); color: #fff; }

/* ---------- en-tête du résultat */
.sd-head h2 { overflow-wrap: anywhere; }
.sd-domain { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.sd-grade-label { margin: 0 0 4px; font-weight: 700; }
.sd-counts { margin: 0 0 4px; font-size: .93rem; }
.sd-small { margin: 6px 0 0; font-size: .84rem; color: var(--fg-subtle); overflow-wrap: anywhere; }
.sd-scale { margin: 6px 0 18px; }
.sd-scale.gauge--a { --g: #15803d; } .sd-scale.gauge--b { --g: #0f766e; } .sd-scale.gauge--c { --g: #0369a1; }
.sd-scale.gauge--d { --g: #b45309; } .sd-scale.gauge--e { --g: #b84d06; } .sd-scale.gauge--f { --g: #b91c1c; }
.sd-method .sd-scale span:nth-child(1) { --g: #15803d; } .sd-method .sd-scale span:nth-child(2) { --g: #0f766e; }
.sd-method .sd-scale span:nth-child(3) { --g: #0369a1; } .sd-method .sd-scale span:nth-child(4) { --g: #b45309; }
.sd-method .sd-scale span:nth-child(5) { --g: #b84d06; } .sd-method .sd-scale span:nth-child(6) { --g: #b91c1c; }
.sd-method .sd-scale span { color: #fff; background: var(--g); border-color: transparent; }
.sd-alert { margin: 0 0 12px; }
.sd-alert p { overflow-wrap: anywhere; }

/* ---------- priorités */
.sd-prio { margin: 4px 0 8px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--paper-50); border: 1px solid var(--border); }
.sd-prio h3 { font-size: 1.02rem; margin: 0; }
.sd-prio__list { margin: 10px 0 0; padding-left: 1.3em; display: grid; gap: 6px; }
.sd-prio__list li { padding-left: 2px; }
.sd-prio__list li::marker { font-weight: 800; color: var(--cyan-700); }
.sd-prio__list a { font-weight: 700; color: var(--fg); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.sd-prio__list a:hover { text-decoration-color: currentColor; }
.sd-gain { margin-left: 10px; font-size: .8rem; font-weight: 700; color: var(--cyan-700); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- groupes et contrôles */
.sd-group { margin-top: 22px; }
.sd-group__title { margin: 0 0 2px; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-subtle); }
.sd-check { border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--header-h, 72px) + 16px); }
.sd-check:last-child { border-bottom: 0; }
.sd-check .check-row { border-bottom: 0; padding-bottom: 10px; }
.sd-check .check-row__title { margin: 0; font-size: 1rem; letter-spacing: -.01em; line-height: 1.35; }
.sd-check .check-row__detail { font-size: .92rem; line-height: 1.55; }
.sd-check__meta { display: grid; justify-items: end; gap: 4px; text-align: right; }
.sd-st { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 800; white-space: nowrap; border: 1px solid; }
.sd-st--pass { color: var(--green-700); background: rgba(34, 197, 94, .08); border-color: rgba(21, 128, 61, .25); }
.sd-st--warn { color: var(--orange-700); background: rgba(220, 94, 9, .07); border-color: rgba(184, 77, 6, .28); }
.sd-st--fail { color: var(--red-700); background: rgba(220, 38, 38, .07); border-color: rgba(185, 28, 28, .28); }
.sd-st--info { color: var(--cyan-700); background: rgba(14, 165, 233, .07); border-color: rgba(3, 105, 161, .25); }
.sd-pts { font-size: .8rem; font-weight: 700; color: var(--fg-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sd-pts--muted { font-weight: 600; color: var(--fg-subtle); }

.sd-more { margin: 0 0 14px 34px; }
.sd-more > summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: .86rem; font-weight: 700; color: var(--blue-600); border-radius: 6px; padding: 2px 0;
}
.sd-more > summary::-webkit-details-marker { display: none; }
.sd-more > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s; margin-right: 2px; }
.sd-more[open] > summary::before { transform: rotate(45deg); }
.sd-more > summary:hover { color: var(--blue-700); }
.sd-more__body { padding: 8px 0 2px; }

.sd-findings { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.sd-f { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: .9rem; color: var(--fg-muted); line-height: 1.5; overflow-wrap: anywhere; }
.sd-f__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan-700); transform: translateY(-1px); }
.sd-f--pass .sd-f__dot { background: var(--green-700); }
.sd-f--warn .sd-f__dot { background: var(--orange-600); }
.sd-f--fail .sd-f__dot { background: var(--red-700); }

.sd-block { margin: 10px 0; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--white); }
.sd-block__head, .sd-record__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--paper-50); border-bottom: 1px solid var(--border);
  font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-subtle);
}
.sd-block__head span, .sd-record__head span { overflow-wrap: anywhere; }
.sd-code {
  margin: 0; padding: 10px 12px; font-size: .82rem; line-height: 1.55; color: var(--ink-900);
  white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto;
}
.sd-tree { list-style: none; margin: 0; padding: 10px 12px; font-size: .84rem; }
.sd-tree ul { list-style: none; margin: 4px 0 4px 8px; padding-left: 14px; border-left: 1px dashed var(--border-strong); }
.sd-tree li { margin: 3px 0; overflow-wrap: anywhere; }
.sd-tag { display: inline-block; padding: 0 7px; border-radius: 99px; font-size: .72rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); color: var(--fg-muted); white-space: nowrap; }
.sd-tag--n { color: var(--cyan-700); }
.sd-tag--bad { color: var(--red-700); border-color: rgba(185, 28, 28, .3); }

.sd-fix { margin-top: 12px; padding: 14px 16px; border-radius: var(--r-md); background: #f2f6ff; border: 1px solid rgba(29, 78, 216, .18); }
.sd-fix__title { display: block; font-size: .86rem; color: var(--blue-700); margin-bottom: 2px; }
.sd-fix p { margin: 0; font-size: .92rem; color: var(--ink-700); overflow-wrap: anywhere; }
.sd-fix .sd-block, .sd-record { margin: 10px 0 0; }
.sd-record { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--white); overflow: hidden; }
.sd-record__grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0; padding: 10px 12px; font-size: .86rem; }
.sd-record__grid dt { font-weight: 700; color: var(--fg-subtle); }
.sd-record__grid dd { margin: 0; min-width: 0; }
.sd-record__grid code { word-break: break-all; color: var(--ink-900); }
.sd-copy { min-height: 30px; padding: 4px 12px; text-transform: none; letter-spacing: 0; }

@media (max-width: 600px) {
  .sd-check .check-row { grid-template-columns: 22px minmax(0, 1fr); }
  .sd-check__meta { grid-column: 2; justify-items: start; text-align: left; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .sd-more { margin-left: 0; }
  .sd-head { gap: 16px; }
  .sd-gain { display: block; margin: 0; }
}

/* ---------- méthode */
.sd-table td, .sd-table th[scope="row"] { font-size: .9rem; }
.sd-table th[scope="row"] { white-space: nowrap; color: var(--fg); font-size: .9rem; letter-spacing: 0; text-transform: none; background: transparent; }
@media (max-width: 760px) {
  .sd-table, .sd-table tbody, .sd-table tr, .sd-table td, .sd-table th[scope="row"] { display: block; }
  .sd-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sd-table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .sd-table td, .sd-table th[scope="row"] { padding: 2px 0; border: 0; text-align: left; }
  .sd-table td.num { font-weight: 700; color: var(--cyan-700); }
  .sd-table td.num::after { content: " pts"; }
  .sd-table tr:last-child td.num::after { content: ""; }
  .sd-table caption { display: block; }
}
.sd-method__notes h3 { margin-bottom: 10px; }

/* ---------- mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  .sd-more > summary::before, .sd-progress__bar > span { transition: none; }
  .sd-progress .tool-spinner { animation-duration: 2.4s; }
}

/* ---------- impression */
@media print {
  .sd-results { break-inside: auto !important; }
  .sd-check { break-inside: avoid; }
  .sd-more > summary { display: none; }
  .sd-more { margin-left: 34px; }
  .sd-code { max-height: none; overflow: visible; }
  .sd-fix { background: #fff !important; border-color: #bbb !important; }
  .sd-copy, .sd-example, .sd-linkbtn { display: none !important; }
  .sd-prio { background: #fff; border-color: #bbb; }
  .sd-scale span.is-current { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .check-row__icon, .sd-f__dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- état vide : aperçu de ce qui sera contrôlé (reprend le barème de la section Méthode) */
.sd-preview { width: 100%; max-width: 640px; margin-top: 14px; padding-top: 18px; border-top: 1px solid var(--border); }
.sd-preview__title { margin: 0 0 10px; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); }
.sd-preview__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 520px) { .sd-preview__list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sd-preview__list li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm, 8px); background: var(--white);
}
.sd-preview__k { font-weight: 700; font-size: .9rem; color: var(--fg); }
.sd-preview__v { font-family: var(--mono); font-size: .82rem; font-weight: 700; color: var(--cyan-700); }
.sd-preview__note { margin: 12px 0 0; font-size: .84rem; color: var(--fg-subtle); }
@media print { .sd-preview { display: none; } }
