/*
 * La certification « AI Native – SDR » (ECL-45) — deux écrans dans un fichier,
 * parce qu'ils disent la même chose : la page `/certification` (dans la
 * coquille) et le CERTIFICAT public (`/certificate/:code`, rendu par le
 * serveur, imprimable).
 *
 * Trois règles, au-dessus du design system et jamais contre lui :
 *
 *  - **le jaune de la marque reste la marque.** Le sceau du certificat porte le
 *    `--primary` ; seul le `[AI]` du logo va chercher `--brand-yellow`
 *    (`scripts/check-css.js` le vérifie) ;
 *  - aucune couleur littérale, aucun `!important` : tout passe par les jetons
 *    de `dashboard.css`, qui portent déjà le thème sombre ;
 *  - **l'impression est le format de sortie du certificat** : A4 PAYSAGE, fond
 *    blanc, encre noire, aucune ombre — le navigateur fait le PDF, il n'y a pas
 *    de générateur côté serveur.
 */

/* ====================================================================== */
/* La page « Ma certification »                                            */
/* ====================================================================== */

.cert-body { display: flex; flex-direction: column; gap: var(--space-4); }

.cert-head { display: flex; flex-direction: column; gap: var(--space-2); }
.cert-kicker {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cert-name { margin: 0; font-family: var(--font-display); font-size: 1.6rem; }
.cert-issuer { margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.cert-state { margin: 0; font-weight: 600; color: var(--primary); }

.cert-level { display: flex; flex-direction: column; gap: var(--space-3); }
.cert-level-head { display: flex; align-items: center; gap: var(--space-3); }
.cert-level-head h3 { margin: 0; flex: 1; min-width: 0; }

.cert-conditions-title {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cert-conditions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.cert-condition {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.cert-condition-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.cert-condition-label { flex: 1; min-width: 0; font-weight: 500; }
.cert-condition-count { font-variant-numeric: tabular-nums; color: var(--text-muted); }
/* Un contenu exigé absent de la base : un ÉTAT, donc une couleur sémantique. */
.cert-unresolved { color: var(--danger); margin: 0; }

.cert-missing { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }

.cert-actions { display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.cert-code {
  margin: 0;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}

/* La carte de l'accueil, du portfolio et de l'écran coach. */
.cert-card-state { margin: 0; font-weight: 600; }
.cert-team { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }

/* ====================================================================== */
/* Le certificat public, et son impression                                 */
/* ====================================================================== */

.certificate-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.certificate {
  /* A4 paysage : le rapport de la feuille, pour que l'écran montre ce qui
   * sortira de l'imprimante. */
  width: 100%;
  max-width: 1040px;
  aspect-ratio: 297 / 210;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6);
  text-align: center;
  background: var(--surface);
  border: 2px solid var(--navy);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.certificate-head { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.certificate-head .brand-name { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; }

.certificate-kicker {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.certificate-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
}
.certificate-level { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--primary); }
.certificate-issuer { margin: 0; color: var(--text-muted); }

.certificate-rule { width: 120px; margin: var(--space-3) 0; border: 0; border-top: 2px solid var(--primary); }

.certificate-awarded { margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.certificate-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
}
.certificate-date { margin: 0; }

.certificate-code { margin: var(--space-3) 0 0; display: flex; flex-direction: column; gap: var(--space-1); }
.certificate-code dt {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.certificate-code dd {
  margin: 0;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  letter-spacing: 0.12em;
  font-size: 1rem;
}

.certificate-foot { margin-top: var(--space-4); font-size: 0.75rem; color: var(--text-muted); }
.certificate-foot p { margin: 0; }

.certificate-unknown { aspect-ratio: auto; gap: var(--space-3); }

/* Le téléphone : la feuille cesse d'être une feuille, le texte reste lisible. */
@media (max-width: 600px) {
  .certificate-page { padding: var(--space-3); }
  .certificate { aspect-ratio: auto; padding: var(--space-5) var(--space-4); }
}

/*
 * L'IMPRESSION. C'est ici que le certificat devient un PDF : A4 paysage, sans
 * fond coloré ni ombre (une bordure s'imprime, une ombre gaspille de l'encre),
 * et la note « imprime cette page » disparaît — elle n'a plus de sens sur le
 * papier.
 */
@page { size: A4 landscape; margin: 10mm; }

@media print {
  .certificate-page { min-height: auto; padding: 0; background: transparent; }
  .certificate {
    max-width: none;
    width: 100%;
    aspect-ratio: auto;
    height: 180mm;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    break-inside: avoid;
  }
  .certificate-print-hint { display: none; }
}
