/* ============================================================
   ANIMA — carte « Ton profil » (jauge d'arrivée, js/profil/carte.js ; spec 2026-10-02-profil-arrivee § 4.4)
   Posée sous la tête de #/mon-profil, dans le langage de surface : filets et serif, pas de carte ni d'ombre. Un anneau
   « faits / total », le niveau en serif, les 4 paliers du micro-parcours, UNE prochaine action. Jamais bloquante.
   Préfixe de classes : pfc- (vérifié libre : git grep '\.pfc-' css/). Aucune couleur en dur : tokens de css/tokens.css.
   ============================================================ */

/* Valeur de l'anneau (0 → 1) : enregistrée comme nombre pour que la transition « monte » l'anneau. */
@property --pfc-p { syntax: '<number>'; inherits: false; initial-value: 0; }

.pfc {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.2rem 2.2rem;
  align-items: start; margin-top: clamp(.4rem, 1.4vw, 1rem); padding-block: 1.4rem 0.6rem;
  border-top: 1px solid var(--texte); border-bottom: 1px solid var(--ligne);
  --pfc-ton: var(--accent); --pfc-texte: var(--texte);
}
.pfc[data-ton="ok"] { --pfc-ton: var(--ok); --pfc-texte: var(--ok); }
.pfc[data-ton="alerte"] { --pfc-ton: var(--alerte); --pfc-texte: var(--alerte); }
.pfc[data-niveau="chargement"] { --pfc-texte: var(--texte-3); }

/* ---------- Anneau ---------- */
.pfc-anneau {
  --pfc-p: 0; position: relative; display: grid; place-items: center; flex: none;
  width: 5.6rem; aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(var(--pfc-ton) calc(var(--pfc-p) * 1turn), var(--ligne-2) 0);
  transition: --pfc-p .8s var(--ease);
}
.pfc-anneau::before { content: ''; position: absolute; inset: .5rem; border-radius: 50%; background: var(--bg-0); }
.pfc-anneau-n { position: relative; display: flex; align-items: baseline; font-family: var(--serif); line-height: 1; color: var(--texte); }
.pfc-anneau-n b { font-weight: 400; font-size: 1.9rem; }
.pfc-anneau-n small { font-family: var(--sans); font-size: .82rem; color: var(--texte-2); margin-left: .05rem; }

/* ---------- Corps : niveau, détail, action ---------- */
.pfc-corps { min-width: 0; }
.pfc-corps .kicker { margin-bottom: .45rem; }
.pfc-niveau { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(1.45rem, 2.4vw, 1.9rem); line-height: 1.1; color: var(--pfc-texte); overflow-wrap: anywhere; }
.pfc-detail { margin: .55rem 0 0; max-width: 42ch; font-size: .92rem; line-height: 1.5; color: var(--texte-2); }
.pfc-motif { margin: .5rem 0 0; max-width: 42ch; font-size: .88rem; line-height: 1.45; color: var(--texte); overflow-wrap: anywhere; }
.pfc-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.pfc-action, .pfc-reessayer { white-space: normal; text-align: left; }

/* ---------- Paliers ---------- */
.pfc-paliers { list-style: none; margin: 0; padding: 0; min-width: 0; border-top: 1px solid var(--ligne); }
.pfc-palier {
  display: grid; grid-template-columns: 1.3rem minmax(0, 1fr); gap: .15rem .75rem; align-items: start;
  padding: .7rem 0; border-bottom: 1px solid var(--ligne); font-size: .92rem; line-height: 1.4; color: var(--texte-2);
}
.pfc-paliers > .pfc-palier:last-child { border-bottom: 0; }
.pfc-puce {
  display: grid; place-items: center; width: 1.15rem; height: 1.15rem; margin-top: .12rem;
  border: 1.5px solid var(--ligne-2); border-radius: 50%; color: var(--bg-0);
}
.pfc-puce .ico { width: .7rem; height: .7rem; stroke-width: 2.4; }
.pfc-palier[data-etat="fait"] { color: var(--texte); }
.pfc-palier[data-etat="fait"] .pfc-puce { background: var(--pfc-ton); border-color: var(--pfc-ton); }
.pfc-palier[data-etat="suivant"] { color: var(--texte); }
.pfc-palier[data-etat="suivant"] .pfc-puce { border-color: var(--accent); border-width: 2px; }
.pfc-palier[data-etat="sans_objet"] { color: var(--texte-3); }
.pfc-palier[data-etat="sans_objet"] .pfc-puce { border-style: dashed; }
.pfc-palier-txt { min-width: 0; overflow-wrap: anywhere; }
.pfc-note { display: block; margin-top: .1rem; font-size: .78rem; color: var(--texte-3); }
.pfc-palier-lien { color: inherit; text-decoration: none; border-bottom: 1px solid var(--ligne-2); }
.pfc-palier-lien:is(:hover, :focus-visible) { color: var(--survol-texte); border-bottom-color: var(--survol-filet); }
.pfc-palier[data-etat="suivant"] .pfc-palier-lien { border-bottom-color: var(--accent); }

/* Case « Je n'ai pas encore de diplôme » : sous le palier « qualité », cible tactile de 44 px. */
.pfc-sans { grid-column: 2; display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; margin-top: .2rem; cursor: pointer; color: var(--texte); font-size: .88rem; }
.pfc-sans input { width: 1.15rem; height: 1.15rem; margin: 0; flex: none; accent-color: var(--accent); cursor: pointer; }

/* Lecteurs d'écran seulement (état du palier : fait, à faire, sans objet). */
.pfc-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- Pied : fiche enrichie (une fois), erreur, « Masquer » ---------- */
.pfc-bas { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: .4rem 1.6rem; border-top: 1px solid var(--ligne); }
.pfc-fiche { flex: 1 1 22rem; margin: 0; padding-top: .8rem; max-width: 62ch; font-size: .88rem; line-height: 1.5; color: var(--texte-2); }
.pfc-fiche b { font-weight: 600; color: var(--texte); }
.pfc-fiche-lien { color: var(--texte); border-bottom: 1px solid var(--accent); text-decoration: none; white-space: nowrap; }
.pfc-fiche-lien:is(:hover, :focus-visible) { color: var(--survol-texte); border-bottom-color: var(--survol-filet); }
.pfc-erreur { flex: 1 1 100%; margin: .5rem 0 0; font-size: .85rem; color: var(--critique); }
.pfc-masquer, .pfc-restaurer {
  min-height: 2.75rem; padding: 0 .1rem; border: 0; background: none; font: inherit; font-size: .8rem; color: var(--texte-3);
  text-decoration: underline; text-underline-offset: .2em; cursor: pointer;
}
.pfc-masquer:is(:hover, :focus-visible), .pfc-restaurer:is(:hover, :focus-visible) { color: var(--texte); }

/* Carte masquée : seulement le lien discret pour la ré-afficher, sans cadre. */
.pfc[data-masquee] { display: block; margin-top: .2rem; padding-block: 0; border: 0; }
.pfc[hidden] { display: none; }

/* ---------- Téléphone : l'anneau à côté du niveau, les paliers dessous, pleine largeur ---------- */
@media (max-width: 860px) {
  .pfc { grid-template-columns: auto minmax(0, 1fr); gap: 1rem 1.2rem; }
  .pfc-paliers { grid-column: 1 / -1; }
  .pfc-bas { justify-content: space-between; }
  .pfc-fiche { flex-basis: 100%; }
}
@media (max-width: 420px) {
  .pfc-anneau { width: 4.4rem; }
  .pfc-anneau::before { inset: .42rem; }
  .pfc-anneau-n b { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) { .pfc-anneau { transition: none; } }

/* ---------- Sur l'accueil (js/profil/carte.js, ctx.accueil ; brique B3b) : même carte, posée sous la tête de la page ----------
   Un peu d'air avant le premier volet ; sur téléphone des paliers plus serrés pour que « Tes séjours » ne parte pas trop bas.
   Jamais de bloc vide : la carte retirée (validé, rien à valider, indisponible) porte `hidden` (display: none, ci-dessus). */
.pfc-accueil { margin-bottom: clamp(1.1rem, 3vw, 2rem); }
.pfc-accueil[data-masquee] { margin-bottom: .6rem; }
@media (max-width: 860px) {
  .pfc-accueil { padding-top: 1.1rem; }
  .pfc-accueil .pfc-detail { margin-top: .4rem; }
  .pfc-accueil .pfc-palier { padding-block: .5rem; }
  .pfc-accueil .pfc-actions { margin-top: .8rem; }
}

/* ============================================================
   Anneau de progression autour de l'avatar de la barre du haut (js/profil/anneau.js ; spec 2026-10-02-profil-arrivee § 4.4,
   note du critère C1 : la jauge se voit PARTOUT). Le script ne pose que data-anneau / data-anneau-ton et --anneau-p (0 → 1) sur le
   bouton .top-avatar ; le dessin est ici (conic-gradient évidé par un masque). Aucune couleur en dur : tokens de css/tokens.css.
   Jamais bloquant : le clic de l'avatar est inchangé ; aucun anneau pour « validé », « complet sans objet », « indisponible ».
   ============================================================ */
@property --anneau-p { syntax: '<number>'; inherits: true; initial-value: 0; }

.top-avatar[data-anneau] {
  --anneau-ton: var(--accent);
  position: relative;
  transition: border-color .15s, --anneau-p .8s var(--ease);
}
.top-avatar[data-anneau-ton="info"] { --anneau-ton: var(--info); }      /* en attente : anneau plein, ton calme */
.top-avatar[data-anneau-ton="alerte"] { --anneau-ton: var(--alerte); }  /* une pièce à renvoyer */
.top-avatar[data-anneau]::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--anneau-ton) calc(var(--anneau-p) * 1turn), var(--ligne) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), currentColor calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), currentColor calc(100% - 3px));
}

@media (prefers-reduced-motion: reduce) { .top-avatar[data-anneau] { transition: border-color .15s; } }
