/* Charte projets (reprise de capacity-erp) : jetons de couleur repris de capacity.fastodata.com
   (theme clair creme, theme sombre bleu nuit). */
:root {
  --spectre-1: #FFD800;
  --spectre-2: #FFAF00;
  --spectre-3: #FF8205;
  --spectre-4: #FA500F;
  --spectre-5: #E10500;
  --police: 'Geist', system-ui, sans-serif;
  --police-mono: 'Geist Mono', ui-monospace, monospace;
  --bg: #FFFAF0;
  --bg-2: #FCEBD5; /* fin du degrade de fond, tres leger */
  --surface: #FFFFFF;
  --line: #E6DCC8;
  --line-soft: #F1E9D8;
  --strong: #1A1714;
  --ink: #1A1714;
  --muted: #5E554A;
  --accent: #FA500F;
  --accent-text: #B23A00;
  --past: #F6EEDD;
  --warn-bg: #FFE8C7;
  --warn-ink: #5A2600;
  --ok-bg: #E3F1E7;
  --ok-ink: #173F28;
  --bad-bg: #FDE3DF;
  --bad-ink: #7A1408;
  --info-bg: #DCEBFF;
  --info-ink: #12376F;
  --sel: #FFF3DE;
  --on-ink: #FFFAF0;
  color-scheme: light;
}
/* sombre : choix explicite, ou reglage du systeme si aucun choix n'est memorise */
:root[data-theme="sombre"] {
  --bg: #12111F;
  --bg-2: #1E1A33;
  --surface: #26243F;
  --line: #3D3A5C;
  --line-soft: #2F2C4D;
  --strong: #5A5775;
  --ink: #F4F1EA;
  --muted: #A9A3BA;
  --accent-text: #F28C34;
  --past: #2F2C4D;
  --warn-bg: #3A2A14;
  --warn-ink: #FFE3BF;
  --ok-bg: #1F3A2C;
  --ok-ink: #CFEFDB;
  --bad-bg: #3A1C1A;
  --bad-ink: #FFD9D2;
  --info-bg: #1E2D4D;
  --info-ink: #CFE0FF;
  --sel: #34315A;
  --on-ink: #12111F;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --bg: #12111F;
    --bg-2: #1E1A33;
    --surface: #26243F;
    --line: #3D3A5C;
    --line-soft: #2F2C4D;
    --strong: #5A5775;
    --ink: #F4F1EA;
    --muted: #A9A3BA;
    --accent-text: #F28C34;
    --past: #2F2C4D;
    --warn-bg: #3A2A14;
    --warn-ink: #FFE3BF;
    --ok-bg: #1F3A2C;
    --ok-ink: #CFEFDB;
    --bad-bg: #3A1C1A;
    --bad-ink: #FFD9D2;
    --info-bg: #1E2D4D;
    --info-ink: #CFE0FF;
    --sel: #34315A;
    --on-ink: #12111F;
    color-scheme: dark;
  }
}
body { background: var(--bg); color: var(--ink); font-family: var(--police); }
input, select, textarea { background: var(--surface); color: var(--ink); border-color: var(--line); }
::placeholder { color: var(--muted); opacity: .8; }
html { scroll-padding-top: 90px; }

/* Illustration du chat : version claire ou sombre selon le theme. */
.hero-sombre { display: none; }
:root[data-theme="sombre"] .hero-clair { display: none; }
:root[data-theme="sombre"] .hero-sombre { display: block; }

/* Cartes (fond blanc + bordure) : coins arrondis. :where() = specificite
   nulle, un arrondi precise sur l'element reste prioritaire. */
:where(.bg-white.border) { border-radius: 12px; }

/* Orbes de fond : grandes taches floues et fixes, derriere tout le contenu,
   plus discretes en theme sombre. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38rem 38rem at 8% 18%, rgba(250, 80, 15, 0.10), transparent 70%),
    radial-gradient(34rem 34rem at 92% 72%, rgba(255, 175, 0, 0.10), transparent 70%),
    radial-gradient(30rem 30rem at 55% 105%, rgba(99, 102, 241, 0.08), transparent 70%);
  filter: blur(8px);
}
:root[data-theme="sombre"] body::before {
  background:
    radial-gradient(38rem 38rem at 8% 18%, rgba(250, 80, 15, 0.12), transparent 70%),
    radial-gradient(34rem 34rem at 92% 72%, rgba(255, 175, 0, 0.07), transparent 70%),
    radial-gradient(30rem 30rem at 55% 105%, rgba(99, 102, 241, 0.14), transparent 70%);
}

/* Volet Le Chat : glisse depuis la droite ; points d'attente en pixels ;
   bulles qui apparaissent ; immobile avec prefers-reduced-motion. */
.chat-panel { transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s ease; }
.chat-panel[data-open="false"] { transform: translateX(calc(100% + 1.5rem)); opacity: 0; pointer-events: none; }
.chat-typing { display: none; }
.chat-typing.htmx-request { display: flex; }
.chat-dot { width: 6px; height: 6px; display: inline-block; animation: chat-hop 1s infinite ease-in-out; }
.chat-dot:nth-child(2) { animation-delay: .15s; }
.chat-dot:nth-child(3) { animation-delay: .3s; }
@keyframes chat-hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
.chat-in { animation: chat-in .3s ease-out both; }
@keyframes chat-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-dot, .chat-in { transition: none; animation: none; }
}

/* Carte cliquable : au survol, elle se decolle de la page (monte, s'incline a
   peine vers l'avant, ombre portee qui s'etend). */
.lift { transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease, border-color .2s; transform-origin: 50% 100%; }
.lift:hover, .lift:focus-visible {
  transform: perspective(900px) translateY(-4px) rotateX(2deg);
  box-shadow: 0 1px 2px rgba(26,23,20,.06), 0 14px 28px -10px rgba(26,23,20,.22), 0 6px 0 -3px rgba(250,80,15,.12);
}
:root[data-theme="sombre"] .lift:hover, :root[data-theme="sombre"] .lift:focus-visible {
  /* en sombre une ombre ne se voit pas : halo orange a la place */
  box-shadow: 0 0 0 1px rgba(250,80,15,.35), 0 0 22px 2px rgba(250,80,15,.28), 0 14px 32px -8px rgba(250,80,15,.35);
}
@media (prefers-reduced-motion: reduce) { .lift { transition: border-color .2s; } .lift:hover, .lift:focus-visible { transform: none; } }

/* Boutons a la maniere de mistral.ai : coins arrondis, icone en pixels. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; padding: .55rem 1.1rem; border-radius: 8px; font-size: .9rem; font-weight: 500; line-height: 1.25; transition: background-color .2s, color .2s, transform .15s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: .7rem; height: .7rem; flex-shrink: 0; }
.btn-primary { background: #FA500F; color: #FFFFFF; }
.btn-primary:hover { background: #E10500; }
.btn-secondary { background: var(--btn-2, #E4E4E7); color: var(--muted); }
.btn-secondary:hover { color: var(--ink); background: var(--line); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; gap: .45rem; }
:root[data-theme="sombre"] { --btn-2: #34315A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) { --btn-2: #34315A; } }

/* Deroulant de la barre : depliage par la grille (0fr -> 1fr). */
[data-nav-panel] { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .28s cubic-bezier(.3,.7,.4,1), visibility 0s .28s; }
[data-nav-panel][data-open] { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .28s cubic-bezier(.3,.7,.4,1); }
[data-nav-panel] > div { min-height: 0; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { [data-nav-panel], [data-nav-panel][data-open] { transition: none; } }

/* Chat en pixels : clignement des yeux, queue qui balance, saut au survol. */
.pixel-cat { overflow: visible; transition: transform .25s cubic-bezier(.3,.7,.4,1.4); }
.pixel-cat:hover { transform: translateY(-4px); }
.pixel-cat .cat-blink { opacity: 0; animation: cat-blink 4.5s infinite; }
.pixel-cat .cat-tail-a { animation: cat-tail 1.8s steps(1, end) infinite; }
.pixel-cat .cat-tail-b { animation: cat-tail 1.8s steps(1, end) infinite reverse; }
@keyframes cat-blink { 0%, 90% { opacity: 0; } 91%, 95% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes cat-tail { 0% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .pixel-cat, .pixel-cat .cat-blink, .pixel-cat .cat-tail-a, .pixel-cat .cat-tail-b { animation: none; transition: none; }
  .pixel-cat .cat-tail-b { opacity: 0; }
}

/* Modale de confirmation (hx-confirm) : carte du theme, filet orange en haut. */
.confirm-dialog { width: min(26rem, calc(100vw - 2rem)); padding: 1.75rem 1.5rem 1.5rem; border: 1px solid var(--line); border-top: 4px solid #FA500F; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.confirm-dialog::backdrop { background: rgba(18,17,31,.55); backdrop-filter: blur(3px); }
.confirm-dialog[open] { animation: confirm-in .18s cubic-bezier(.3,.7,.4,1); }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .confirm-dialog[open] { animation: none; } }
.confirm-dialog .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
