/* =========================================================================
   LanorTrad — L'atelier : jauge d'avancement du prochain chapitre.
   Utilisé sur la fiche série, le planning et l'accueil (version compacte).
   ========================================================================= */

.atl {
  position: relative; overflow: hidden;
  padding: 18px 20px 16px; margin-bottom: 22px;
  border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line);
  --accent: #a855f7;
}
.atl::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.atl.is-done { border-color: color-mix(in srgb, #22c55e 40%, var(--line)); }
.atl.is-done::before { background: #22c55e; }

/* — Entête : série (optionnelle), chapitre, étape en cours — */
.atl-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.atl-serie { display: flex; align-items: center; gap: 10px; min-width: 0; }
.atl-serie img { width: 46px; height: 64px; object-fit: cover; border-radius: 9px; flex-shrink: 0; }
.atl-serie-t { font-family: var(--font-display); font-weight: 700; font-size: .96rem; line-height: 1.25; }
.atl-serie:hover .atl-serie-t { color: var(--accent); filter: brightness(1.3); }
.atl-id { min-width: 0; }
.atl-eyebrow {
  display: block; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--txt-mut); font-weight: 700;
}
.atl-id strong { font-family: var(--font-display); font-size: 1.08rem; }
.atl-badge {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  font-family: var(--font-display); font-size: .78rem; font-weight: 700;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
}
.atl-badge i { font-style: normal; font-size: .72rem; color: var(--txt-mut); font-weight: 600; }

/* — Jauge — */
.atl-track {
  position: relative; height: 8px; margin-top: 14px; border-radius: 999px;
  background: var(--line-strong); overflow: hidden;
}
.atl-track i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, var(--indigo)), var(--accent));
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: width .9s var(--ease);
}
/* Petit reflet qui balaie la jauge : « ça travaille en ce moment ». */
.atl:not(.is-done) .atl-track i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%);
  animation: atl-sweep 2.6s var(--ease) infinite;
}
@keyframes atl-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.atl.is-done .atl-track i { background: linear-gradient(90deg, #16a34a, #4ade80); box-shadow: 0 0 14px rgba(34, 197, 94, .45); }

/* — Les 6 étapes — */
.atl-steps { display: flex; list-style: none; margin: 16px 0 0; padding: 0; }
.atl-step { position: relative; flex: 1; min-width: 0; text-align: center; }
/* Trait de liaison vers l'étape précédente */
.atl-step::before {
  content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px;
  background: var(--line-strong);
}
.atl-step:first-child::before { display: none; }
.atl-step.done::before, .atl-step.now::before { background: color-mix(in srgb, var(--accent) 65%, transparent); }
.atl-dot {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: 32px; height: 32px; margin: 0 auto; border-radius: 50%; font-size: .82rem;
  background: var(--bg-2); border: 2px solid var(--line-strong); color: var(--txt-mut);
  transition: border-color .3s, box-shadow .3s, transform .3s var(--ease-back);
}
.atl-step.done .atl-dot {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  color: var(--accent); filter: brightness(1.25); font-weight: 800;
}
.atl-step.now .atl-dot {
  border-color: var(--accent); transform: scale(1.14);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 16%, transparent);
}
.atl-step.todo .atl-dot { opacity: .55; }
.atl-lbl { display: block; margin-top: 8px; font-size: .73rem; color: var(--txt-mut); line-height: 1.25; }
/* Deux libellés : le complet, et un raccourci pour les blocs étroits. */
.atl-lbl b { font-weight: inherit; }
.atl-lbl i { display: none; font-style: normal; }
.atl-step.now .atl-lbl { color: var(--txt); font-weight: 700; }
.atl-step.done .atl-lbl { color: var(--txt-soft); }
.atl.is-done .atl-step.now .atl-dot { border-color: #4ade80; box-shadow: 0 0 0 5px rgba(34, 197, 94, .18); }

/* — Textes sous la frise — */
.atl-desc { margin-top: 14px; font-size: .9rem; color: var(--txt-soft); }
.atl-note {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: .86rem; color: var(--txt-soft);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.atl-late {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: .86rem; color: var(--txt-soft);
  background: color-mix(in srgb, #f59e0b 10%, transparent);
  border-left: 2px solid color-mix(in srgb, #f59e0b 55%, transparent);
}
.atl-foot { margin-top: 10px; font-size: .78rem; color: var(--txt-mut); }
.atl-go {
  display: inline-block; margin-top: 12px; font-family: var(--font-display);
  font-weight: 700; font-size: .86rem; color: #4ade80;
}
.atl-go:hover { text-decoration: underline; }

/* — Grille de blocs (planning) — */
.atl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.atl-grid .atl { margin-bottom: 0; height: 100%; }

/* Bloc étroit (grille du planning) mais frise encore horizontale : on bascule
   sur les libellés courts, sinon « Pages trouvées » déborde de sa colonne. */
.atl { container-type: inline-size; }
@media (min-width: 641px) {
  @container (max-width: 430px) {
    .atl-lbl b { display: none; }
    .atl-lbl i { display: inline; }
  }
}

/* — Version compacte (accueil, calendrier hebdo) — */
.atl-mini { display: inline-flex; align-items: center; gap: 8px; min-width: 0; --accent: #a855f7; }
.atl-mini-bar { width: 54px; height: 5px; border-radius: 999px; background: var(--line-strong); overflow: hidden; flex-shrink: 0; }
.atl-mini-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); filter: brightness(1.2); }
.atl-mini-lbl { font-size: .72rem; color: var(--txt-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atl-mini.is-done .atl-mini-bar i { background: #4ade80; }
.atl-mini.is-done .atl-mini-lbl { color: #4ade80; }

/* — Du retard : ambre, jamais rouge —
   Le rouge dit « erreur, quelque chose est casse ». Ici rien n'est casse :
   des benevoles ont du retard sur leur temps libre. L'ambre le signale sans
   en faire un incident, et se distingue nettement du vert d'une sortie. */
.atl.is-late { border-color: color-mix(in srgb, #f59e0b 40%, var(--line)); }
.atl.is-late::before { background: #f59e0b; }
.atl.is-late .atl-eyebrow { color: #fbbf24; }
.atl-mini.is-late .atl-mini-bar i { background: #f59e0b; }
.atl-mini.is-late .atl-mini-lbl { color: #fbbf24; }
/* Dans une cellule du calendrier, la jauge passe sous le titre de la série. */
.pl-cell .atl-mini { margin: -4px 0 8px; padding: 0 8px; }
/* La jauge allonge la cellule : l'œil d'aperçu reste calé sur la vignette. */
.pl-cell.has-atl .peek-over,
.pl-cell.has-atl .peek-over:hover { top: 20px; transform: none; }
.pl-cell.has-atl .peek-over:hover, .pl-cell.has-atl .peek-over:focus-visible { transform: scale(1.08); }
.rel .rel-atl { margin-top: 6px; }

/* Chapô de la section « À l'atelier » (planning) */
.atl-intro { max-width: 62ch; margin: -6px 0 18px; color: var(--txt-soft); font-size: .95rem; }

/* — Mobile : la frise se redresse à la verticale — */
@media (max-width: 640px) {
  .atl-steps { flex-direction: column; align-items: stretch; }
  .atl-step { display: flex; align-items: center; gap: 10px; text-align: left; padding: 3px 0; }
  .atl-step::before { top: auto; bottom: 50%; left: 15px; width: 2px; height: 100%; }
  .atl-dot { margin: 0; flex-shrink: 0; }
  .atl-lbl { margin-top: 0; font-size: .82rem; }
  .atl-badge { margin-left: 0; }
}

/* Mode léger : on garde la jauge, on coupe l'animation qui tourne en boucle. */
html[data-perf="lite"] .atl-track i::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .atl-track i::after { display: none; }
  .atl-track i, .atl-dot { transition: none; }
}
