/*
 * Scènes des moments d'usage (atelier.js) : chacune rejoue en petit un écran de l'app, avec ses formes et ses jetons
 * (rayons de 12 et 16 px, bordures, pastilles, police des données). Le déroulé est dans atelier.js.
 */

.step-scene { position: relative; display: grid; justify-items: center; align-content: center; gap: 12px; min-width: 0; min-height: 320px; font-size: 13px; }
.step-scene p { margin: 0; }
.step-scene [hidden] { display: none !important; }
.step-scene svg { flex-shrink: 0; }
/* Apparitions : montée douce ; retour au début de la boucle sans trajet à l'envers. */
.step-scene [data-at]:not([data-swap]), .step-scene [data-until]:not([data-swap]) { opacity: 0; translate: 0 10px; transition: opacity 380ms var(--ease), translate 380ms var(--ease); }
.step-scene [data-at].is-in, .step-scene [data-until].is-in { opacity: 1; translate: 0 0; }
.step-scene.is-reset, .step-scene.is-reset * { transition: none !important; }
.step-scene .pill { transition: background-color 300ms, color 300ms; }
.step-scene .avatar { width: 20px; height: 20px; font-size: 10px; }
.sc-card { width: min(100%, 400px); padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-surface); box-shadow: var(--shadow-soft); }
.sc-card-title { font-size: 15px; font-weight: 600; }

/* ---------- Demande : le fil d'arrivée, l'email (ArrivalCard), puis les cartes (CardTile) ---------- */
.scene-request { justify-items: stretch; gap: 14px; width: min(100%, 420px); margin-inline: auto; }
.sc-inbox { display: grid; gap: 10px; min-height: 196px; align-content: start; }
.sc-inbox-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.sc-inbox-head svg { width: 18px; height: 18px; color: var(--text-muted); }
.sc-inbox-head b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bg-raised); font-size: 11.5px; font-weight: 700; color: var(--text-secondary); transition: background-color 300ms, color 300ms; }
.scene-request[data-phase="2"] .sc-inbox-head b, .scene-request[data-phase="3"] .sc-inbox-head b { background: var(--accent); color: var(--text-on-accent); }
/* L'email qui arrive, encore fermé. */
.sc-letter { display: grid; justify-items: center; gap: 6px; padding: 22px 0 18px; color: var(--fg-accent); }
.sc-letter svg { width: 64px; height: 64px; stroke-width: 1.1; }
.sc-letter small { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
@media (prefers-reduced-motion: no-preference) {
  .sc-letter:not([hidden]) svg { animation: sc-letter-in 900ms var(--ease) both; }
  .sc-mail:not([hidden]) { animation: sc-unfold 520ms var(--ease) both; }
}
@keyframes sc-letter-in { 0% { opacity: 0; translate: 60px -50px; rotate: 18deg; scale: .7; } 70% { opacity: 1; translate: 0 4px; rotate: -3deg; scale: 1.02; } 100% { translate: 0 0; rotate: 0deg; scale: 1; } }
@keyframes sc-unfold { from { opacity: 0; scale: .92; translate: 0 -8px; } }
/* L'email ouvert, comme dans le fil : De, Objet, Reçu, puis le texte. */
.sc-mail { position: relative; overflow: hidden; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-surface); box-shadow: var(--shadow-soft); text-align: left; }
.sc-mail-head { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.sc-mail-head > svg { width: 14px; height: 14px; margin-top: 3px; color: var(--text-muted); }
.sc-mail dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1px 10px; min-width: 0; font-size: 12.5px; }
.sc-mail dt { color: var(--text-muted); }
.sc-mail dd { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-mail dd span { margin-left: 4px; color: var(--text-muted); }
.sc-mail-text { padding: 9px 12px 11px; font-size: 12.5px; color: var(--text-secondary); }
/* L'assistant lit l'email : un trait de lumière le parcourt. */
/* Le trait de lecture parcourt tout l'email puis s'éteint en bas : rien ne remonte quand il disparaît. */
.sc-scan { position: absolute; left: 0; right: 0; top: -36px; height: 36px; background: linear-gradient(transparent, var(--accent-soft)); border-bottom: 1px solid var(--accent); pointer-events: none; }
.step-scene .sc-scan { opacity: 0; translate: none; transition: none; }
.step-scene .sc-scan.is-in { animation: sc-scan 1.4s ease-in-out both; }
@keyframes sc-scan { 0% { top: -36px; opacity: 1; } 85% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
.sc-assist { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--fg-accent); }
.sc-assist svg { width: 16px; height: 16px; }
.sc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* Carte du tableau (CardTile) : projet, titre, puis pièces jointes, checklist et participants. */
.sc-tile { display: flex; flex-direction: column; min-width: 0; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-surface); text-align: left; }
.sc-tile .sc-tile-mission { display: flex; align-items: center; gap: 6px; min-width: 0; margin-bottom: 12px; font-size: 11.5px; line-height: 1.4; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-id { display: inline-grid; place-items: center; flex-shrink: 0; width: 16px; height: 16px; border-radius: 5px; font-size: 7.5px; font-weight: 800; color: var(--avatar-ink); }
.sc-tile-title { font-size: 13.5px; font-weight: 500; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-tile-meta { display: flex; align-items: center; gap: 10px; min-height: 20px; margin-top: auto; padding-top: 18px; font-size: 11.5px; color: var(--text-muted); }
.sc-tile-meta > span { display: inline-flex; align-items: center; gap: 3px; }
.sc-tile-meta svg { width: 13px; height: 13px; }
.sc-tile-people { margin-left: auto; }
.sc-tile-people .avatar + .avatar { margin-left: -5px; box-shadow: 0 0 0 2px var(--bg-surface); }
.sc-tile[data-s="done"] .sc-tile-title { color: var(--text-secondary); }

/* ---------- Offre et facturation : offre signée, engagement, échéances en pastilles (UiSteps) ---------- */
.scene-billing { gap: 0; }
.sc-bill { display: grid; gap: 6px; }
.sc-bill-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-muted); }
.sc-bill-title { font-size: 15px; font-weight: 600; }
.sc-bill-title span { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.sc-state { transition: background-color 300ms, color 300ms; }
.sc-state[data-s="pending"] { background: var(--bg-teal); color: var(--fg-teal); }
.sc-state[data-s="planned"] { background: var(--bg-raised); color: var(--text-secondary); }
.sc-state[data-s="due"] { background: var(--bg-warning); color: var(--fg-warning); }
.sc-state[data-s="invoiced"] { background: var(--bg-teal); color: var(--fg-teal); }
.sc-state[data-s="paid"] { background: var(--bg-positive); color: var(--fg-positive); }
/* Le fil qui relie l'offre au projet qu'elle crée. */
.sc-bill-link { width: 1px; height: 22px; background: var(--border-strong); }
.sc-bill-project { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sc-bill-project > i { width: 10px; height: 10px; border-radius: 50%; background: #c6b1ff; }
.sc-bill-project b { font-size: 15px; font-weight: 600; }
.sc-bill-project em { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-style: normal; font-size: 12px; font-weight: 600; color: var(--fg-accent); }
.sc-bill-project em svg { width: 14px; height: 14px; }
/* Convenu, facturé, encaissé : les tuiles de l'engagement. */
.sc-bill-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.sc-bill-tile { display: grid; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--bg-sunken); }
.sc-bill-tile small { font-size: 11.5px; color: var(--text-muted); }
.sc-bill-tile b { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
/* Échéancier : chaque échéance large selon sa part du total, avec son montant et son état. */
.sc-bill-plan { display: flex; gap: 6px; margin-top: 12px; }
.sc-bill-plan > div { display: grid; justify-items: start; gap: 3px; min-width: 0; }
.sc-bill-bar { justify-self: stretch; height: 6px; margin-bottom: 6px; border-radius: 999px; background: var(--bg-raised); transition: background-color 400ms; }
.sc-bill-bar[data-s="due"] { background: var(--fg-warning); }
.sc-bill-bar[data-s="invoiced"] { background: color-mix(in srgb, var(--accent) 45%, var(--bg-raised)); }
.sc-bill-bar[data-s="paid"] { background: var(--accent); }
.sc-bill-plan b { font-size: 13px; font-weight: 600; }
.sc-bill-plan small { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.sc-bill-plan .pill { margin-top: 4px; }

/* ---------- Projet : le tableau, cartes qui changent de colonne ---------- */
.sc-board { --gap: 8px; --pad: 7px; --row: 78px; position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); width: min(100%, 470px); height: calc(42px + 3 * var(--row) + 8px); }
.sc-col { border-radius: 16px; border: 1px solid var(--border); background: var(--bg-sunken); }
.sc-col-head { display: flex; align-items: center; gap: 6px; padding: 10px 11px; font-size: 12.5px; font-weight: 600; }
.sc-col-head b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bg-raised); font-size: 10.5px; color: var(--text-secondary); }
.sc-board .sc-tile {
  position: absolute;
  top: calc(40px + var(--r) * var(--row));
  left: calc(var(--c) * ((100% - 2 * var(--gap)) / 3 + var(--gap)) + var(--pad));
  width: calc((100% - 2 * var(--gap)) / 3 - 2 * var(--pad));
  padding: 11px 12px;
  transition: left 600ms cubic-bezier(.5, 0, .2, 1), top 520ms var(--ease), rotate 300ms, scale 300ms, box-shadow 300ms, border-color 300ms;
}
.sc-board .sc-tile-meta { margin-top: 0; padding-top: 10px; }
/* Soulevée pendant le trajet, comme sous le doigt. */
.sc-board .sc-tile.is-moving { z-index: 2; rotate: -2.5deg; scale: 1.05; border-color: var(--border-strong); box-shadow: var(--shadow-pop); }

/* ---------- Temps : le compteur en rouleaux (UiClock), le retour d'absence ---------- */
.float { border-radius: 16px; border: 1px solid var(--border); background: var(--bg-surface); box-shadow: var(--shadow-lift); }
.scene-sub { color: var(--text-muted); font-size: 13.5px; }
.scene-clock { display: flex; align-items: center; gap: 16px; font-family: var(--font-display); font-weight: 500; font-size: clamp(52px, 7.4vw, 84px); line-height: 1; letter-spacing: -0.03em; transition: opacity 300ms; }
.scene-clock > i { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.sc-roll { display: inline-flex; font-variant-numeric: tabular-nums; }
.sc-digit { position: relative; display: inline-block; overflow: hidden; height: 1.1em; line-height: 1.1em; }
.sc-digit > span { display: block; }
.sc-digit > .is-in { animation: sc-roll-in 300ms ease-out both; }
.sc-digit > .is-out { position: absolute; inset: 0 0 auto; animation: sc-roll-out 300ms ease-out both; }
@keyframes sc-roll-in { from { transform: translateY(100%); opacity: 0; } }
@keyframes sc-roll-out { to { transform: translateY(-100%); opacity: 0; } }
.scene-time[data-phase="2"] .scene-clock { opacity: .45; }
.scene-time[data-phase="2"] .scene-clock > i { animation: none; background: var(--fg-warning); box-shadow: none; }
.scene-away { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding: 10px 14px; font-weight: 600; }
.scene-away svg { width: 16px; height: 16px; color: var(--fg-warning); }
.scene-away .pill { transition: background-color 200ms, color 200ms, scale 200ms; }
.scene-away .is-pressed { background: var(--accent); color: var(--text-on-accent); scale: .94; }

/* ---------- Livraison : le flux du site (DeliveryFlows) ---------- */
.scene-delivery { gap: 14px; }
.sc-flow-site { justify-self: start; font-family: var(--font-display); font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
.sc-flow { display: flex; align-items: stretch; width: 100%; }
.sc-comp { display: flex; flex-direction: column; justify-content: center; flex-shrink: 0; width: 92px; padding: 10px; border-radius: 12px; border: 1px dashed var(--border-strong); }
.sc-comp b { font-size: 12.5px; font-weight: 600; }
.sc-comp span, .sc-node b { font-family: var(--font-mono); }
.sc-comp span { font-size: 11px; color: var(--text-muted); }
.sc-node { display: flex; flex-direction: column; flex-shrink: 0; width: 176px; overflow: hidden; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-raised); transition: box-shadow 700ms; }
.sc-node > p { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 0; font-size: 12px; color: var(--text-muted); }
.sc-node > b { padding: 6px 14px 0; font-size: 14px; font-weight: 500; line-height: 1.3; }
.sc-node > small { padding: 4px 14px 13px; font-size: 12px; line-height: 1.4; color: var(--text-muted); }
.sc-node-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--fg-positive); }
.sc-node[data-s="behind"] .sc-node-dot { background: var(--fg-warning); }
.sc-node[data-s="behind"] > small { color: var(--fg-warning); }
.sc-node[data-s="running"] .sc-node-dot { background: var(--accent); }
.sc-node[data-s="running"] > small { color: var(--fg-accent); }
.sc-node[data-s="flash"] { box-shadow: 0 0 0 2px var(--fg-positive); }
@media (prefers-reduced-motion: no-preference) {
  .sc-node[data-s="running"] .sc-node-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: sc-ping 1s cubic-bezier(0, 0, .2, 1) infinite; }
  .sc-node[data-s="flash"] { animation: sc-flash 1.6s ease-out 1 both; }
}
@keyframes sc-ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }
@keyframes sc-flash { 0% { box-shadow: 0 0 0 2px var(--fg-positive); } 100% { box-shadow: 0 0 0 0 transparent; } }
/* « Mettre en production », accroché sous le nœud du staging. */
.sc-promote { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: auto; padding: 4px 8px; background: var(--accent); color: var(--text-on-accent); font-size: 11.5px; font-weight: 600; white-space: nowrap; transition: filter 160ms, box-shadow 200ms; }
.sc-promote svg { width: 13px; height: 13px; }
.sc-promote.is-soft { background: var(--accent-soft); color: var(--fg-accent); font-weight: 500; }
.sc-promote.is-pressed { filter: brightness(.88); box-shadow: inset 0 0 0 2px rgb(0 0 0 / .18); }
/* Flèche : pleine si l'environnement est à jour, en pointillés sinon ; pendant la livraison, un point la parcourt. */
.sc-arrow { position: relative; flex: 1; min-width: 60px; color: var(--text-muted); }
.sc-arrow-line { position: absolute; left: 0; right: 8px; top: 50%; border-top: 1px solid var(--border-strong); }
.sc-arrow[data-s="behind"] .sc-arrow-line { border-top-style: dashed; }
.sc-arrow[data-s="running"] { color: var(--fg-accent); }
.sc-arrow[data-s="running"] .sc-arrow-line { border-color: var(--accent); }
.sc-arrow > svg { position: absolute; right: -2px; top: 50%; width: 16px; height: 16px; translate: 0 -50%; }
.sc-arrow-dot { position: absolute; top: 50%; left: 0; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); opacity: 0; }
@media (prefers-reduced-motion: no-preference) { .sc-arrow[data-s="running"] .sc-arrow-dot { animation: sc-flow-x 1.3s ease-in-out infinite; } }
@keyframes sc-flow-x { from { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { left: calc(100% - 14px); opacity: 0; } }
.sc-arrow-label { position: absolute; left: 4px; right: 10px; bottom: 50%; margin-bottom: 9px; font-family: var(--font-mono); font-size: 10.5px; line-height: 1.4; text-align: center; text-wrap: balance; }
.sc-touch { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-surface); box-shadow: var(--shadow-soft); font-size: 12px; font-weight: 600; }
.sc-touch svg { width: 16px; height: 16px; color: var(--fg-accent); }
@media (max-width: 560px) {
  .sc-flow { flex-direction: column; align-items: stretch; }
  .sc-comp, .sc-node { width: 100%; }
  .sc-arrow { min-height: 52px; }
  .sc-arrow-line { left: 22px; right: auto; top: 0; bottom: 8px; border-top: 0; border-left: 1px solid var(--border-strong); }
  .sc-arrow[data-s="behind"] .sc-arrow-line { border-left-style: dashed; }
  .sc-arrow[data-s="running"] .sc-arrow-line { border-color: var(--accent); }
  .sc-arrow > svg { left: 15px; right: auto; top: auto; bottom: -2px; translate: 0 0; rotate: 90deg; }
  .sc-arrow-label { left: 40px; right: 0; top: 50%; bottom: auto; margin: -7px 0 0; text-align: left; }
  .sc-arrow-dot { left: 20px; top: 0; margin-top: 0; }
  @media (prefers-reduced-motion: no-preference) { .sc-arrow[data-s="running"] .sc-arrow-dot { animation-name: sc-flow-y; } }
}
@keyframes sc-flow-y { from { top: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { top: calc(100% - 14px); opacity: 0; } }

/* ---------- Client : son choix de l'IA, puis son espace ---------- */
/* Choix de l'IA, comme AiChoice : un domaine par ligne, Non / Suisse / Performante. */
.sc-ai { display: grid; align-content: center; gap: 10px; width: min(100%, 440px); justify-self: center; text-align: left; }
.sc-ai-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.sc-ai ul { display: grid; gap: 6px; }
.sc-ai-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-surface); }
[data-theme="dark"] .sc-ai-row { border-color: transparent; background: var(--bg-raised); }
.sc-ai-icon { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 10px; background: var(--accent-soft); color: var(--fg-accent); }
.sc-ai-icon svg { width: 17px; height: 17px; }
.sc-ai-label { display: grid; flex: 1; min-width: 0; }
.sc-ai-label b { font-size: 13px; font-weight: 600; }
.sc-ai-seg { display: inline-flex; flex-shrink: 0; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg-hover); }
[data-theme="dark"] .sc-ai-seg { background: var(--bg-canvas); }
.sc-ai-seg i { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--text-muted); transition: background-color 250ms, color 250ms; }
.sc-ai-seg svg { width: 11px; height: 11px; }
.sc-ai-row[data-s="0"] .sc-ai-seg i:nth-child(1) { background: var(--bg-raised); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-strong); }
.sc-ai-row[data-s="1"] .sc-ai-seg i:nth-child(2) { background: #e3242b; color: #fff; }
.sc-ai-row[data-s="2"] .sc-ai-seg i:nth-child(3) { background: var(--accent); color: var(--text-on-accent); }

/* L'espace du client : ce qui l'attend, puis son projet. */
.sc-space { display: grid; align-content: center; gap: 10px; width: min(100%, 380px); justify-self: center; text-align: left; }
.sc-space-date { font-size: 12px; color: var(--text-muted); }
.sc-space-name { margin-top: -4px; font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.sc-space-label { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.sc-space-card { display: grid; justify-items: start; gap: 8px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-surface); box-shadow: var(--shadow-soft); }
.sc-space-card .pill svg { width: 12px; height: 12px; }
.sc-space-card b { font-size: 13.5px; font-weight: 500; }
.sc-space-card strong { font-family: var(--font-display); font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.sc-space-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--fg-accent); }
.sc-space-link svg { width: 15px; height: 15px; }
.sc-space-card.is-row { display: flex; align-items: center; gap: 10px; }
.sc-space-card.is-row > i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.sc-space-card.is-row > span { display: grid; }
.sc-space-card.is-row small { font-size: 12px; color: var(--fg-accent); }

@media (prefers-reduced-motion: no-preference) {
  .scene-clock > i, .sc-space-card.is-row > i { animation: scene-pulse 2.4s ease-in-out infinite; }
}
@keyframes scene-pulse { 50% { box-shadow: 0 0 0 10px transparent; } }

/* Client : le choix de l'IA et l'espace se superposent dans la même case ; celui qui est masqué garde sa place,
   la scène garde la hauteur du plus grand et ne saute pas au passage de l'un à l'autre. */
.scene-client > .sc-ai, .scene-client > .sc-space { grid-area: 1 / 1; }
.scene-client > [hidden] { display: grid !important; visibility: hidden; }
