/* Tableau de bord Phoenix — tokens de la section 11.1 + direction « Sanctuaire doré » (Annexe I).
   Règles retenues : jamais d'or en petit texte, texte vert forêt sur crème, un seul effet
   brillant visible par écran (le CTA principal), mouvement désactivable. */

@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/fonts/cormorant-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Palette centrale (11.1) */
  --phx-ink: #1d1d1b;
  --phx-cream: #fdfaf2;
  --phx-sable: #f5edda;
  --phx-peche: #fbeee0;
  --phx-forest-900: #263725;
  --phx-forest-700: #3d563a;
  --phx-vegetal: #b0b43e;
  --phx-gold: #ecaa47;
  --phx-terracotta: #b4593e;
  --phx-navy: #213a76;
  --phx-red: #ca1431;
  --phx-border: #e3d7b6;
  --or-texte: var(--phx-terracotta);

  --espace-1: 0.25rem;
  --espace-2: 0.5rem;
  --espace-3: 0.75rem;
  --espace-4: 1rem;
  --espace-6: 1.5rem;
  --espace-8: 2rem;
  --rayon-md: 1rem;
  --rayon-lg: 1.75rem;
  --rayon-pill: 999px;
  --ombre: 0 18px 40px -24px rgba(38, 55, 37, 0.45);
  --contenu-max: 84rem;

  --font-ui: "Montserrat", "Avenir Next", "Segoe UI", Arial, sans-serif;
  --font-titre: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font-ui);
  color: var(--phx-forest-900);
  background:
    radial-gradient(120% 80% at 12% -10%, var(--phx-peche) 0%, transparent 55%),
    radial-gradient(100% 70% at 100% 0%, #fdf3e2 0%, transparent 50%),
    var(--phx-cream);
  background-attachment: fixed;
  line-height: 1.55;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Texture feuillage — 5 % d'opacité, jamais sous du texte dense */
.texture-feuillage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'><g fill='none' stroke='%23263725' stroke-width='1.2'><path d='M40 380C120 300 140 200 110 60'/><path d='M110 200c60-30 110-10 150 40'/><path d='M110 140c50-24 96-6 128 34'/><path d='M110 260c56-28 104-8 138 36'/><path d='M380 40c-80 80-100 180-70 320'/><path d='M310 220c-60-30-110-10-150 40'/></g></svg>");
  background-size: 420px 420px;
  animation: derive 40s linear infinite alternate;
}
@keyframes derive {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-24px, 16px, 0); }
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--espace-4);
  align-items: center;
  justify-content: space-between;
  padding: var(--espace-6) clamp(1rem, 4vw, 3rem) var(--espace-4);
  max-width: var(--contenu-max);
  margin: 0 auto;
}
.topbar-identite { display: flex; align-items: center; gap: var(--espace-4); }
.embleme { width: 56px; height: 56px; object-fit: contain; }
.kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--phx-forest-700);
}
.topbar h1 {
  font-family: var(--font-titre);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.05;
  margin: 0.1rem 0 0;
}
.topbar-actions { display: flex; flex-wrap: wrap; gap: var(--espace-2); align-items: center; }

/* --------------------------------------------------------------- boutons */

.btn {
  min-height: 44px;
  padding: 0 1.15rem;
  border-radius: var(--rayon-pill);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible { outline: 3px solid var(--phx-gold); outline-offset: 2px; }
.btn-primary { background: var(--phx-forest-900); color: #fdfaf2; position: relative; overflow: hidden; }
.btn-primary:hover { background: var(--phx-forest-700); transform: translateY(-1px); }
.btn-ghost { background: rgba(255, 253, 247, 0.75); border-color: var(--phx-border); color: var(--phx-forest-900); }
.btn-ghost:hover { border-color: var(--phx-gold); }
.btn-fermer { min-width: 44px; justify-content: center; padding: 0; }

/* Un seul effet brillant par écran : le CTA principal (règle d'orfèvre I.3) */
.sheen::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 60%;
  background: linear-gradient(100deg, transparent, rgba(236, 170, 71, 0.55), transparent);
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen {
  0%, 72% { transform: translateX(0); }
  92%, 100% { transform: translateX(320%); }
}

.menu { position: relative; }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  background: #fffdf7;
  border: 1px solid var(--phx-border);
  border-radius: var(--rayon-md);
  box-shadow: var(--ombre);
  padding: var(--espace-2);
  min-width: 13rem;
  z-index: 10;
}
.menu-item {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 0.6rem;
  color: var(--phx-forest-900);
  text-decoration: none;
  font-size: 0.92rem;
}
.menu-item:hover { background: var(--phx-sable); }

/* ----------------------------------------------------------------- page */

.page {
  position: relative;
  z-index: 1;
  max-width: var(--contenu-max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem) 5rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--espace-4);
  margin: var(--espace-4) 0 var(--espace-8);
}
.stat {
  background: rgba(255, 253, 247, 0.8);
  border: 1px solid var(--phx-border);
  border-radius: var(--rayon-lg);
  padding: var(--espace-4) var(--espace-6);
}
.stat-large { grid-column: span 2; }
.stat-valeur {
  font-family: var(--font-titre);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1;
  margin: 0;
  font-weight: 600;
}
.stat-valeur-texte { font-size: 1.05rem; font-weight: 600; margin: 0.35rem 0 0; }
.glow { text-shadow: 0 0 34px rgba(236, 170, 71, 0.55); }
.stat-label {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--phx-forest-700);
}

.filtres {
  display: flex;
  flex-wrap: wrap;
  gap: var(--espace-3);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--espace-6);
}
.champ-recherche { flex: 1 1 20rem; }
.champ-recherche input {
  width: 100%;
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: var(--rayon-pill);
  border: 1px solid var(--phx-border);
  background: #fffdf7;
  font: inherit;
  color: inherit;
}
.champ-recherche input:focus-visible { outline: 3px solid var(--phx-gold); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--espace-2); }
.chip {
  min-height: 44px;
  padding: 0 1rem;
  border-radius: var(--rayon-pill);
  border: 1px solid var(--phx-border);
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  color: var(--phx-forest-700);
  cursor: pointer;
}
.chip.is-actif { background: var(--phx-forest-900); color: #fdfaf2; border-color: var(--phx-forest-900); }
.chip:focus-visible { outline: 3px solid var(--phx-gold); outline-offset: 2px; }

/* ---------------------------------------------------------------- cartes */

.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: var(--espace-4);
}
.vide { color: var(--phx-forest-700); }

.carte {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--espace-3);
  padding: var(--espace-6);
  background: #fffdf7;
  border: 1px solid var(--phx-border);
  border-radius: var(--rayon-lg);
  box-shadow: var(--ombre);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.carte:hover { transform: translateY(-3px); border-color: var(--phx-gold); }
/* L'arche Phoenix, forme identitaire (Annexe I.2) */
.carte::before {
  content: "";
  position: absolute;
  top: -1px;
  left: var(--espace-6);
  width: 3.2rem;
  height: 1.6rem;
  border: 1px solid var(--phx-gold);
  border-bottom: none;
  border-radius: 3.2rem 3.2rem 0 0;
  opacity: 0.65;
}
.carte-tete { display: flex; justify-content: space-between; gap: var(--espace-3); align-items: flex-start; }
.carte h3 {
  font-family: var(--font-titre);
  font-size: 1.6rem;
  line-height: 1.15;
  margin: 0.4rem 0 0;
  font-weight: 600;
}
.carte .chemin { font-size: 0.72rem; color: var(--phx-forest-700); margin: 0.15rem 0 0; word-break: break-all; }
.carte p.desc { margin: 0; font-size: 0.92rem; color: var(--phx-forest-700); }

.badges { display: flex; flex-wrap: wrap; gap: var(--espace-2); }
.badge {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: var(--rayon-pill);
  border: 1px solid var(--phx-border);
  color: var(--phx-forest-900);
  background: var(--phx-sable);
}
.badge[data-univers="oasis"] { background: #eef0db; border-color: var(--phx-vegetal); }
.badge[data-univers="fondation"] { background: #e8eef8; border-color: var(--phx-navy); color: var(--phx-navy); }
.badge[data-statut="archive"] { background: #efe9e2; color: #5b4a41; }
.badge[data-statut="pause"] { background: #f7e6dd; color: var(--phx-terracotta); border-color: var(--phx-terracotta); }

.meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.8rem; color: var(--phx-forest-700); }
.meta b { font-weight: 700; color: var(--phx-forest-900); }
.git { font-size: 0.76rem; color: var(--phx-forest-700); border-top: 1px dashed var(--phx-border); padding-top: var(--espace-2); }
.git .dirty { color: var(--phx-terracotta); font-weight: 700; }
.carte-actions { display: flex; flex-wrap: wrap; gap: var(--espace-2); margin-top: auto; padding-top: var(--espace-2); }
.carte-actions .btn { font-size: 0.85rem; padding: 0 0.9rem; }

/* Horizon au phénix, avant le pied de page (Annexe I.4) */
.horizon {
  height: 90px;
  background:
    radial-gradient(closest-side at 50% 100%, rgba(236, 170, 71, 0.45), transparent 70%),
    linear-gradient(to top, rgba(38, 55, 37, 0.12), transparent);
  border-radius: 100% 100% 0 0 / 100% 100% 0 0;
  margin-top: -3rem;
  pointer-events: none;
}

/* -------------------------------------------------------------- panneau */

.panneau {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(46rem, 100%);
  background: var(--phx-cream);
  border-left: 1px solid var(--phx-border);
  box-shadow: -30px 0 60px -40px rgba(38, 55, 37, 0.6);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: var(--espace-6) clamp(1rem, 3vw, 2rem) max(var(--espace-6), env(safe-area-inset-bottom));
  overflow-y: auto;
}
.panneau[hidden] { display: none; }
.panneau-tete { display: flex; justify-content: space-between; gap: var(--espace-4); align-items: flex-start; }
.panneau-tete h2 { font-family: var(--font-titre); font-size: 2rem; margin: 0.2rem 0; font-weight: 600; }
.panneau .chemin { font-size: 0.76rem; color: var(--phx-forest-700); margin: 0; word-break: break-all; }

.onglets { display: flex; gap: var(--espace-2); margin: var(--espace-4) 0; border-bottom: 1px solid var(--phx-border); }
.onglet {
  min-height: 44px;
  padding: 0 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-weight: 600;
  color: var(--phx-forest-700);
  cursor: pointer;
}
.onglet.is-actif { color: var(--phx-forest-900); border-bottom-color: var(--phx-gold); }
.onglet:focus-visible { outline: 3px solid var(--phx-gold); outline-offset: -3px; }

.fil { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; font-size: 0.85rem; margin-bottom: var(--espace-3); }
.fil button {
  background: none; border: none; font: inherit; font-size: 0.85rem;
  color: var(--or-texte); cursor: pointer; padding: 0.35rem 0.2rem; text-decoration: underline;
}
.fil span { color: var(--phx-forest-700); }

.barre-actions { display: flex; flex-wrap: wrap; gap: var(--espace-2); align-items: center; margin: var(--espace-3) 0; }

.zone-depot {
  border: 2px dashed var(--phx-border);
  border-radius: var(--rayon-lg);
  padding: var(--espace-6);
  text-align: center;
  color: var(--phx-forest-700);
  font-size: 0.92rem;
  background: rgba(245, 237, 218, 0.4);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.zone-depot p { margin: 0; }
.zone-depot.actif { border-color: var(--phx-gold); background: var(--phx-peche); color: var(--phx-forest-900); }

.liste-fichiers { list-style: none; margin: var(--espace-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.ligne {
  display: flex;
  align-items: center;
  gap: var(--espace-3);
  padding: 0.55rem 0.75rem;
  border-radius: var(--rayon-md);
  border: 1px solid transparent;
}
.ligne:hover { background: #fffdf7; border-color: var(--phx-border); }
.ligne .icone { font-size: 1.1rem; width: 1.5rem; text-align: center; flex: none; }
.ligne .nom { flex: 1 1 auto; min-width: 0; word-break: break-word; font-size: 0.92rem; }
.ligne .nom button {
  background: none; border: none; font: inherit; color: var(--phx-forest-900);
  cursor: pointer; padding: 0; text-align: left;
}
.ligne .nom button:hover { color: var(--or-texte); text-decoration: underline; }
.ligne .poids { flex: none; font-size: 0.78rem; color: var(--phx-forest-700); font-variant-numeric: tabular-nums; }
.ligne .actions { flex: none; display: flex; gap: 0.25rem; }
.ligne .actions a, .ligne .actions button {
  min-height: 36px; min-width: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--rayon-pill); border: 1px solid var(--phx-border); background: #fffdf7;
  color: var(--phx-forest-900); text-decoration: none; font-size: 0.78rem; padding: 0 0.6rem; cursor: pointer;
}
.ligne .actions a:hover, .ligne .actions button:hover { border-color: var(--phx-gold); }
.ligne.exclu .nom { opacity: 0.55; }

/* ------------------------------------------------------------ formulaires */

.formulaire { display: flex; flex-direction: column; gap: var(--espace-4); }
.formulaire label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; }
.formulaire input, .formulaire select, .formulaire textarea {
  font: inherit;
  font-weight: 400;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  border-radius: var(--rayon-md);
  border: 1px solid var(--phx-border);
  background: #fffdf7;
  color: inherit;
}
.formulaire textarea { min-height: 6rem; resize: vertical; }
.formulaire input:focus-visible, .formulaire select:focus-visible, .formulaire textarea:focus-visible {
  outline: 3px solid var(--phx-gold); outline-offset: 1px;
}
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--espace-4); }
.note { font-size: 0.82rem; color: var(--or-texte); }

dialog {
  border: 1px solid var(--phx-border);
  border-radius: var(--rayon-lg);
  background: var(--phx-cream);
  color: inherit;
  padding: var(--espace-8);
  width: min(34rem, 92vw);
  box-shadow: var(--ombre);
}
dialog::backdrop { background: rgba(38, 55, 37, 0.45); }
dialog h2 { font-family: var(--font-titre); font-size: 1.9rem; margin: 0; font-weight: 600; }

/* --------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(30rem, 92vw);
}
.toast {
  padding: 0.8rem 1.1rem;
  border-radius: var(--rayon-md);
  background: var(--phx-forest-900);
  color: #fdfaf2;
  font-size: 0.9rem;
  box-shadow: var(--ombre);
}
.toast.erreur { background: var(--phx-red); }
.toast.progres { background: var(--phx-forest-700); }

@media (max-width: 640px) {
  .stat-large { grid-column: span 2; }
  .topbar-actions .btn { flex: 1 1 auto; justify-content: center; }
  .panneau { width: 100%; }
}

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