/* Lumen, l'intelligence artificielle de PSTM : bouton d'appel et fenêtre de conversation.
   Toutes les classes commencent par « lumen- » pour ne rien modifier du reste du site. */

.lumen {
    --l-nuit: #04224a;
    --l-bleu: #043264;
    --l-bleu-vif: #0b4a8f;
    --l-encre: #0f1d33;
    --l-texte: #23324a;
    --l-doux: #5e6e86;
    --l-filet: rgba(4, 50, 100, .1);
    --l-brume: #f3f6fa;
    --l-or: #e3a21a;
    --l-or-vif: #f6c445;
    --l-or-pale: #fff5da;
    --l-police: 'ITC', 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --l-police-forte: 'ITC-B', 'ITC', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --l-courbe: cubic-bezier(.2, .8, .2, 1);
    font-family: var(--l-police);
}
.lumen *, .lumen *::before, .lumen *::after { box-sizing: border-box; }
.lumen [hidden] { display: none !important; }
.lumen button { font-family: inherit; }
.lumen-masque {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Bouton d'appel ---------- */
.lumen-lanceur {
    position: fixed; right: 24px; bottom: calc(24px + var(--lumen-bandeau, 0px)); z-index: 1040;
    display: flex; align-items: center; gap: 12px;
    margin: 0; padding: 7px 24px 7px 7px;
    border: 1px solid rgba(4, 50, 100, .1); border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
    box-shadow: 0 14px 34px -10px rgba(4, 28, 62, .32), 0 2px 6px rgba(4, 28, 62, .08);
    color: var(--l-bleu); cursor: pointer; text-align: left;
    transition: transform .35s var(--l-courbe), box-shadow .35s var(--l-courbe), opacity .25s ease, bottom .3s ease;
}
.lumen-lanceur:hover { transform: translateY(-2px); box-shadow: 0 20px 42px -12px rgba(4, 28, 62, .38), 0 0 0 5px rgba(246, 196, 69, .16); }
.lumen-lanceur:focus-visible { outline: 3px solid var(--l-or); outline-offset: 3px; }
.lumen-lanceur__mascotte {
    position: relative; flex: none; display: grid; place-items: center;
    width: 50px; height: 50px; border-radius: 50%;
    background: radial-gradient(circle at 50% 40%, #0e4c8e 0%, var(--l-nuit) 72%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.lumen-lanceur__mascotte::before {
    content: ''; position: absolute; inset: -5px; border-radius: 50%;
    background: radial-gradient(circle, rgba(246, 196, 69, .55), rgba(246, 196, 69, 0) 68%);
    animation: lumen-respire 4.5s ease-in-out infinite;
}
.lumen-lanceur__mascotte picture, .lumen-lanceur__mascotte img { display: block; position: relative; width: 44px; height: 44px; }
.lumen-lanceur__texte { display: flex; flex-direction: column; line-height: 1.2; }
.lumen-lanceur__titre { font-size: 12px; letter-spacing: .02em; color: var(--l-doux); }
.lumen-lanceur__nom { font-family: var(--l-police-forte); font-size: 15.5px; color: var(--l-bleu); }
.lumen.est-ouvert .lumen-lanceur { opacity: 0; transform: scale(.92); pointer-events: none; }

/* Le bouton « haut de page » du site se place au-dessus de celui de Lumen */
html.lumen-present .scroll-top { bottom: calc(104px + var(--lumen-bandeau, 0px)) !important; right: 37px !important; transition: bottom .3s ease; }

/* ---------- Fenêtre ---------- */
html.lumen-bloque { overflow: hidden; }
html.lumen-bloque .pstm-bandeau-info { display: none !important; }
.lumen-voile {
    position: fixed; inset: 0; z-index: 1045;
    background: rgba(4, 20, 44, .42);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    opacity: 0; transition: opacity .3s ease;
}
.lumen-panneau {
    position: fixed; z-index: 1050; left: 50%; top: 50%;
    width: min(760px, calc(100vw - 48px)); height: min(780px, calc(100vh - 64px));
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 28px;
    box-shadow: 0 32px 80px -16px rgba(4, 22, 50, .45), 0 10px 28px -10px rgba(4, 22, 50, .22);
    color: var(--l-texte);
    opacity: 0; transform: translate(-50%, -47%) scale(.97);
    transition: opacity .3s ease, transform .5s var(--l-courbe);
}
.lumen-panneau::before {
    content: ''; position: absolute; top: 0; left: 12%; right: 12%; height: 2px;
    background: linear-gradient(90deg, rgba(246, 196, 69, 0), var(--l-or-vif), rgba(246, 196, 69, 0));
}
.lumen.est-ouvert .lumen-voile { opacity: 1; }
.lumen.est-ouvert .lumen-panneau { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.lumen-panneau:focus { outline: none; }

/* En-tête */
.lumen-entete {
    flex: none; display: flex; align-items: center; gap: 14px;
    padding: 18px 18px 16px 24px; border-bottom: 1px solid var(--l-filet);
}
.lumen-avatar { position: relative; flex: none; display: block; border-radius: 50%; }
.lumen-avatar img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; border-radius: 50%; }
.lumen-avatar--entete { width: 44px; height: 44px; box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(246, 196, 69, .45); }
.lumen-entete__texte { min-width: 0; }
.lumen-entete__nom {
    margin: 0; padding: 0; font-family: var(--l-police-forte); font-weight: normal;
    font-size: 19px; line-height: 1.15; letter-spacing: .01em; color: var(--l-encre);
}
.lumen-entete__role { display: flex; align-items: center; gap: 8px; margin: 3px 0 0; font-size: 13px; line-height: 1.3; color: var(--l-doux); }
.lumen-ia {
    flex: none; white-space: nowrap; display: inline-block; padding: 2px 7px 1px; border: 1px solid rgba(227, 162, 26, .4); border-radius: 999px;
    background: var(--l-or-pale); color: #7a5300;
    font-family: var(--l-police-forte); font-size: 10.5px; line-height: 1.4; letter-spacing: .08em;
}
.lumen-entete__actions { display: flex; gap: 4px; margin-left: auto; }
.lumen-icone {
    display: grid; place-items: center; width: 40px; height: 40px; margin: 0; padding: 0;
    border: 0; border-radius: 50%; background: transparent; color: var(--l-doux); cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.lumen-icone:hover { background: var(--l-brume); color: var(--l-bleu); }
.lumen-icone:focus-visible { outline: 2px solid var(--l-or); outline-offset: 1px; }
.lumen-icone svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* Fil de la conversation */
.lumen-fil {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column;
    padding: 4px 28px 20px; scrollbar-width: thin; scrollbar-color: rgba(4, 50, 100, .18) transparent;
}
.lumen-fil:focus { outline: none; }

/* Accueil */
.lumen-accueil { margin: auto 0; padding: 28px 8px 40px; text-align: center; }
.lumen.a-commence .lumen-accueil { display: none; }
.lumen-accueil__mascotte { position: relative; display: grid; place-items: center; width: 136px; height: 136px; margin: 0 auto 16px; }
.lumen-halo {
    position: absolute; inset: 0; border-radius: 50%;
    background: radial-gradient(circle at 50% 46%, rgba(246, 196, 69, .5) 0%, rgba(246, 196, 69, .16) 40%, rgba(246, 196, 69, 0) 70%);
    animation: lumen-respire 5s ease-in-out infinite;
}
.lumen-accueil__mascotte picture, .lumen-accueil__mascotte img { position: relative; display: block; width: 112px; height: 112px; }
.lumen-accueil__bonjour {
    margin: 0 0 8px; font-family: var(--l-police-forte); font-size: clamp(22px, 3.2vw, 28px);
    line-height: 1.2; letter-spacing: -.005em; color: var(--l-encre);
}
.lumen-accueil__texte { max-width: 33em; margin: 0 auto 28px; font-size: 15px; line-height: 1.6; color: var(--l-doux); }
.lumen-suggestions {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    max-width: 580px; margin: 0 auto; padding: 0; list-style: none;
}
.lumen-suggestions li { margin: 0; padding: 0; }
.lumen-suggestions button {
    display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 12px 16px 12px 12px;
    border: 1px solid var(--l-filet); border-radius: 16px; background: #fff;
    color: var(--l-texte); font-size: 14.5px; line-height: 1.3; text-align: left; cursor: pointer;
    transition: border-color .2s ease, box-shadow .25s ease, transform .25s var(--l-courbe);
}
.lumen-suggestions button:hover { border-color: rgba(4, 50, 100, .26); box-shadow: 0 8px 22px -12px rgba(4, 28, 62, .35); transform: translateY(-1px); }
.lumen-suggestions button:focus-visible { outline: 2px solid var(--l-or); outline-offset: 2px; }
.lumen-suggestions i {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px;
    background: var(--l-brume); color: var(--l-bleu); font-size: 17px; transition: background .2s ease, color .2s ease;
}
.lumen-suggestions button:hover i { background: var(--l-or-pale); color: #8a5a00; }

/* Messages */
.lumen-messages { display: flex; flex-direction: column; gap: 22px; margin: 0; padding: 18px 0 0; list-style: none; }
.lumen-messages > li { margin: 0; padding: 0; animation: lumen-apparait .4s var(--l-courbe) both; }
.lumen-messages > .lumen-message--visiteur {
    align-self: flex-end; max-width: 78%; padding: 11px 16px;
    border-radius: 20px 20px 6px 20px; background: var(--l-bleu); color: #fff;
    font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.lumen-message--lumen { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; align-items: start; }
.lumen-message--lumen .lumen-avatar { width: 32px; height: 32px; margin-top: 2px; }
.lumen-message--lumen .lumen-avatar::before {
    content: ''; position: absolute; inset: -7px; border-radius: 50%; opacity: 0;
    background: radial-gradient(circle, rgba(246, 196, 69, .8), rgba(246, 196, 69, 0) 70%);
    transition: opacity .6s ease;
}
.lumen-message--lumen.reflechit .lumen-avatar::before { opacity: 1; animation: lumen-allume 1.5s ease-in-out infinite; }
.lumen-message--lumen.ecrit .lumen-avatar::before { opacity: .65; }
.lumen-reponse { min-width: 0; padding-top: 3px; font-size: 15.5px; line-height: 1.68; color: var(--l-texte); overflow-wrap: anywhere; }
.lumen-reponse p { margin: 0 0 .75em; }
.lumen-reponse ul, .lumen-reponse ol { margin: .15em 0 .85em; padding-left: 1.25em; }
.lumen-reponse ul { list-style: disc outside; }
.lumen-reponse ol { list-style: decimal outside; }
.lumen-reponse li { display: list-item; list-style: inherit; margin: .3em 0; padding-left: .2em; }
.lumen-reponse ul li::marker { color: var(--l-or); }
.lumen-reponse ol li::marker { color: var(--l-doux); font-size: .92em; }
.lumen-reponse > :last-child { margin-bottom: 0; }
.lumen-reponse strong { font-family: var(--l-police-forte); font-weight: normal; color: var(--l-encre); }
.lumen-reponse a {
    color: var(--l-bleu); text-decoration: underline; text-decoration-thickness: 1px;
    text-decoration-color: rgba(4, 50, 100, .3); text-underline-offset: 3px; transition: color .2s, text-decoration-color .2s;
}
.lumen-reponse a:hover { color: var(--l-bleu-vif); text-decoration-color: var(--l-or); }
.lumen-curseur {
    display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%;
    background: var(--l-or); vertical-align: middle; animation: lumen-point 1s ease-in-out infinite;
}
.lumen-reflexion { display: inline-flex; align-items: center; gap: 10px; padding-top: 5px; font-size: 14.5px; color: var(--l-doux); }
.lumen-reflexion__points { display: inline-flex; gap: 4px; }
.lumen-reflexion__points span { width: 5px; height: 5px; border-radius: 50%; background: var(--l-or); animation: lumen-point 1.2s ease-in-out infinite; }
.lumen-reflexion__points span:nth-child(2) { animation-delay: .15s; }
.lumen-reflexion__points span:nth-child(3) { animation-delay: .3s; }
.lumen-coupe { color: var(--l-doux); font-size: 13.5px; }

/* Pages du site citées */
.lumen-liens { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.lumen-liens__titre { width: 100%; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--l-doux); }
.lumen-lien {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 12px 7px 14px;
    border: 1px solid transparent; border-radius: 999px; background: var(--l-brume);
    color: var(--l-bleu) !important; font-size: 13.5px; line-height: 1.3; text-decoration: none !important;
    transition: background .2s ease, border-color .2s ease, box-shadow .25s ease;
}
.lumen-lien span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lumen-lien svg { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--l-or); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lumen-lien:hover { background: #fff; border-color: rgba(4, 50, 100, .18); box-shadow: 0 6px 16px -10px rgba(4, 28, 62, .4); }

/* Notes (limites, erreurs) */
.lumen-messages > .lumen-note {
    align-self: center; max-width: 92%; padding: 10px 16px; border: 1px solid rgba(227, 162, 26, .32); border-radius: 14px;
    background: var(--l-or-pale); color: #6b4500; font-size: 13.5px; line-height: 1.5; text-align: center;
}

/* Saisie */
.lumen-saisie { flex: none; margin: 0; padding: 10px 22px 6px; }
.lumen-saisie__cadre {
    display: flex; align-items: flex-end; gap: 10px; padding: 7px 7px 7px 18px;
    border: 1px solid rgba(4, 50, 100, .16); border-radius: 24px; background: #fff;
    box-shadow: 0 2px 12px -6px rgba(4, 28, 62, .16); transition: border-color .2s ease, box-shadow .2s ease;
}
.lumen-saisie__cadre:focus-within { border-color: rgba(4, 50, 100, .42); box-shadow: 0 0 0 4px rgba(246, 196, 69, .22); }
.lumen-saisie textarea {
    flex: 1 1 auto; min-width: 0; min-height: 40px; max-height: 150px; margin: 0; padding: 8px 0;
    border: 0; outline: 0; resize: none; overflow-y: hidden; background: transparent; box-shadow: none;
    font-family: var(--l-police); font-size: 15.5px; line-height: 1.5; color: var(--l-encre);
}
.lumen-saisie textarea::placeholder { color: #8b99ae; opacity: 1; }
.lumen-saisie textarea:focus, .lumen-saisie textarea:focus-visible { outline: none !important; box-shadow: none !important; }
.lumen-envoyer {
    flex: none; display: grid; place-items: center; width: 42px; height: 42px; margin: 0; padding: 0;
    border: 0; border-radius: 50%; background: var(--l-bleu); color: #fff; cursor: pointer;
    transition: background .2s ease, transform .2s var(--l-courbe), opacity .2s ease;
}
.lumen-envoyer:not(:disabled):hover { background: var(--l-bleu-vif); transform: translateY(-1px); }
.lumen-envoyer:disabled { background: #cad4e1; cursor: default; }
.lumen-envoyer:focus-visible { outline: 2px solid var(--l-or); outline-offset: 2px; }
.lumen-envoyer svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lumen-envoyer__arret { display: none; }
.lumen.est-en-cours .lumen-envoyer { background: var(--l-encre); }
.lumen.est-en-cours .lumen-envoyer__fleche { display: none; }
.lumen.est-en-cours .lumen-envoyer__arret { display: block; fill: currentColor; stroke: none; }
.lumen-compteur { margin: 6px 8px 0; font-size: 12px; text-align: right; color: var(--l-doux); }
.lumen-compteur.est-limite { color: #a33a1c; }
.lumen-mention { flex: none; margin: 0; padding: 4px 32px 16px; font-size: 11.5px; line-height: 1.5; text-align: center; color: #7b8aa0; }
.lumen-mention a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.lumen-mention a:hover { color: var(--l-bleu); }

/* ---------- Animations ---------- */
@keyframes lumen-respire { 0%, 100% { opacity: .35; transform: scale(.94); } 50% { opacity: .95; transform: scale(1.06); } }
@keyframes lumen-allume { 0%, 100% { opacity: .45; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes lumen-point { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@keyframes lumen-apparait { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Petits écrans : plein écran ---------- */
@media (max-width: 640px) {
    .lumen-lanceur { right: 16px; bottom: calc(16px + var(--lumen-bandeau, 0px)); padding: 6px; }
    .lumen-lanceur__texte { display: none; }
    .lumen-lanceur__mascotte { width: 52px; height: 52px; }
    html.lumen-present .scroll-top { bottom: calc(88px + var(--lumen-bandeau, 0px)) !important; right: 22px !important; }
    .lumen-panneau {
        inset: 0; left: 0; top: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0;
        transform: translateY(24px); box-shadow: none;
    }
    .lumen.est-ouvert .lumen-panneau { transform: none; }
    .lumen-panneau::before { left: 0; right: 0; }
    .lumen-entete { padding: calc(12px + env(safe-area-inset-top)) 10px 12px 16px; }
    .lumen-entete__role { font-size: 12.5px; }
    .lumen-fil { padding: 4px 16px 16px; }
    .lumen-accueil { padding-top: 20px; }
    .lumen-accueil__mascotte { width: 112px; height: 112px; }
    .lumen-accueil__mascotte picture, .lumen-accueil__mascotte img { width: 92px; height: 92px; }
    .lumen-suggestions { grid-template-columns: 1fr; }
    .lumen-messages > .lumen-message--visiteur { max-width: 88%; }
    .lumen-saisie { padding: 8px 12px 4px; }
    .lumen-saisie textarea { font-size: 16px; }
    .lumen-mention { padding: 2px 16px calc(10px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
    .lumen *, .lumen *::before, .lumen *::after { animation: none !important; transition: none !important; }
}
@media print { .lumen { display: none !important; } }

/* ---------- Invitation de la page d'accueil (hors de .lumen : couleurs écrites en clair) ---------- */
.lumen-invitation {
    position: relative; display: flex; align-items: center; gap: 22px;
    max-width: 1000px; margin: 0 auto 56px; padding: 20px 20px 20px 24px; overflow: hidden;
    border-radius: 24px; background: linear-gradient(120deg, #04224a 0%, #0a3a74 100%); color: #fff;
    box-shadow: 0 22px 50px -24px rgba(4, 28, 62, .6);
}
.lumen-invitation::before {
    content: ''; position: absolute; left: -40px; top: 50%; width: 220px; height: 220px; transform: translateY(-50%);
    background: radial-gradient(circle, rgba(246, 196, 69, .38), rgba(246, 196, 69, 0) 65%); pointer-events: none;
}
.lumen-invitation__mascotte { position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(246, 196, 69, .35); }
.lumen-invitation__mascotte img { display: block; width: 100%; height: 100%; border-radius: 50%; }
.lumen-invitation__texte { position: relative; min-width: 0; }
.lumen-invitation__titre { margin: 0; font-family: 'ITC-B', 'ITC', system-ui, sans-serif; font-size: 21px; line-height: 1.25; color: #fff; }
.lumen-invitation__sous { margin: 5px 0 0; font-family: 'ITC', system-ui, sans-serif; font-size: 15px; line-height: 1.5; color: rgba(255, 255, 255, .8); }
.lumen-invitation__bouton {
    position: relative; flex: none; display: inline-flex; align-items: center; gap: 10px; margin: 0 0 0 auto; padding: 14px 22px;
    border: 0; border-radius: 999px; background: #fff; color: #043264; cursor: pointer;
    font-family: 'ITC-B', 'ITC', system-ui, sans-serif; font-size: 15.5px; line-height: 1.2;
    transition: background .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease;
}
.lumen-invitation__bouton svg { width: 18px; height: 18px; fill: none; stroke: #e3a21a; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lumen-invitation__bouton:hover { background: #fff5da; transform: translateY(-1px); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .45); }
.lumen-invitation__bouton:focus-visible { outline: 3px solid #f6c445; outline-offset: 3px; }
@media (max-width: 760px) {
    .lumen-invitation { flex-wrap: wrap; gap: 16px; margin: 0 16px 40px; padding: 20px; }
    .lumen-invitation__texte { flex: 1 1 200px; }
    .lumen-invitation__bouton { width: 100%; justify-content: center; margin-left: 0; }
}
@media print { .lumen-invitation { display: none !important; } }
