/* Atelier Ferr : generateur d'images, page /design-tools/generateur-image-ia/.
   Reprend les jetons de brand.css (--brand, --ink, --line, --card...) plutot que
   de redefinir une palette : la page doit rester du meme site que les cinq
   autres outils. Portee limitee au prefixe .at- . */

.at {
  --at-rayon: 14px;
  max-width: 940px;
  margin: 0 auto;
  font-family: inherit;
  color: var(--ink, #141414);
}

.at-cadre {
  border: 1px solid var(--line, rgb(20 20 20 / 0.12));
  border-radius: var(--at-rayon);
  background: var(--surface, #fff);
  overflow: hidden;
}

.at-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, rgb(20 20 20 / 0.12));
  background: var(--surface-alt, #f7f7f8);
}

.at-tete-t { font-size: 15px; font-weight: 600; margin: 0; }

.at-solde {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted, #6a6a72);
}
.at-solde b { color: var(--ink, #141414); font-weight: 600; }

.at-corps { padding: 18px; }

/* ── Bascule verrou / atelier ─────────────────────────────────────────────── */
.at [data-vue] { display: none; }
.at[data-etat="verrou"]  [data-vue="verrou"],
.at[data-etat="atelier"] [data-vue="atelier"] { display: block; }

/* ── Formulaire ───────────────────────────────────────────────────────────── */
.at-champ { display: block; margin-bottom: 14px; }
.at-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.at-aide {
  font-weight: 400;
  color: var(--muted, #6a6a72);
}

.at-saisie,
.at-select,
.at-zone {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line, rgb(20 20 20 / 0.12));
  border-radius: 10px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  font-size: 15px;
}
.at-zone { min-height: 108px; resize: vertical; line-height: 1.45; }

.at-saisie:focus-visible,
.at-select:focus-visible,
.at-zone:focus-visible,
.at-bouton:focus-visible {
  outline: 2px solid var(--brand, #e4002b);
  outline-offset: 2px;
}

.at-rangee {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 640px) {
  .at-rangee { grid-template-columns: 1fr; }
}

/* ── Bouton ───────────────────────────────────────────────────────────────── */
.at-bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--brand, #e4002b);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background .18s var(--ease, ease);
}
.at-bouton:hover:not(:disabled) { background: var(--brand-600, #c10024); }
.at-bouton:disabled { opacity: .5; cursor: not-allowed; }

.at-bouton.is-fantome {
  background: transparent;
  color: var(--ink, #141414);
  border: 1px solid var(--line, rgb(20 20 20 / 0.12));
}
.at-bouton.is-fantome:hover:not(:disabled) { background: var(--card, #f4f4f5); }

.at-pied-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.at-cout {
  font-size: 13px;
  color: var(--muted, #6a6a72);
  font-variant-numeric: tabular-nums;
}
.at-cout b { color: var(--ink, #141414); font-weight: 600; }

/* ── Messages ─────────────────────────────────────────────────────────────── */
.at-msg {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
}
.at-msg[hidden] { display: none; }
.at-msg.is-erreur { background: rgb(228 0 43 / 0.08); color: var(--brand-600, #c10024); }
.at-msg.is-info   { background: var(--card, #f4f4f5); color: var(--muted, #6a6a72); }

/* ── Resultat ─────────────────────────────────────────────────────────────── */
.at-sortie { margin-top: 18px; }
.at-sortie[hidden] { display: none; }

.at-vignettes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.at-vignette {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card, #f4f4f5);
  border: 1px solid var(--line, rgb(20 20 20 / 0.12));
}
.at-vignette img { display: block; width: 100%; height: auto; }

/* Le squelette pendant l'attente : ratio conserve pour eviter le saut de page. */
.at-attente {
  border-radius: 12px;
  background: linear-gradient(100deg, #f0f0f1 30%, #e6e6e8 50%, #f0f0f1 70%);
  background-size: 220% 100%;
  animation: at-balayage 1.5s linear infinite;
}
@keyframes at-balayage {
  from { background-position: 180% 0; }
  to   { background-position: -20% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .at-attente { animation: none; }
}
