/* =========================================================
   TRUST DIASPORA — design tokens
   Palette : sceau/pont — indigo institutionnel + or de sceau
   sur fond sable. Inspiré des tampons officiels et des
   teintures indigo du Sahel, pas du "cream + terracotta" IA.
   Type : Fraunces (display, avec caractère) + Work Sans (corps)
   + IBM Plex Mono (tampons, statuts, métadonnées)
   ========================================================= */

:root {
  --sand: #efe6d6;
  --sand-deep: #e2d5bc;
  --card: #fbf8f2;
  --ink: #241d15;
  --muted: #8a7c68;
  --indigo: #1b3a52;
  --indigo-deep: #10222f;
  --clay: #a8461f;
  --clay-deep: #833618;
  --gold: #c99a3e;
  --gold-soft: #e4c988;
  --green: #3f7a4e;
  --red: #a8402f;
  --border: #ddd0b4;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(27, 58, 82, 0.08);
  --shadow-lift: 0 10px 24px rgba(27, 58, 82, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--sand);
  background-image:
    radial-gradient(circle at 100% 0%, rgba(201, 154, 62, 0.08), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(27, 58, 82, 0.05), transparent 40%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* ---------- Header / marque ---------- */
header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--indigo);
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-logo .seal { flex-shrink: 0; animation: sealIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.brand-word {
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--sand);
  letter-spacing: 0.01em;
}
.brand-word em { font-style: italic; color: var(--gold-soft); font-weight: 500; }

header.top a, header.top button.ghost {
  color: var(--sand);
  border-color: rgba(239, 230, 214, 0.35);
}
header.top button.ghost:hover { background: rgba(239, 230, 214, 0.1); }

@keyframes sealIn {
  0% { opacity: 0; transform: scale(0.4) rotate(-25deg); }
  60% { opacity: 1; transform: scale(1.08) rotate(4deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* ---------- Typographie ---------- */
h1 {
  font-family: "Fraunces", serif;
  font-size: 1.6rem;
  font-weight: 600;
  margin: 18px 0 4px;
  letter-spacing: -0.01em;
}
h2 {
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 26px 0 10px;
}
p.muted { color: var(--muted); font-size: 0.92rem; }

.tagline {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-soft);
  opacity: 0.9;
}

/* ---------- Entrée en scène ---------- */
.wrap > h1, .wrap > p.muted:first-of-type {
  animation: riseIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Cartes ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  animation: cardIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

label { display: block; font-size: 0.85rem; margin: 10px 0 4px; color: var(--muted); font-weight: 500; }
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(27, 58, 82, 0.12);
}
textarea { resize: vertical; min-height: 70px; }

/* ---------- Boutons ---------- */
button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--clay);
  color: var(--sand);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
button:hover { background: var(--clay-deep); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(0.97); box-shadow: none; }
button.secondary { background: transparent; color: var(--indigo); border: 1px solid var(--indigo); }
button.secondary:hover { background: rgba(27, 58, 82, 0.06); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
button.danger { background: var(--red); }
button.danger:hover { background: #872f22; }
button.success { background: var(--green); }
button.success:hover { background: #2f5f3b; }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button {
  flex: 1; background: var(--card); color: var(--ink);
  border: 1px solid var(--border); font-weight: 600;
}
.tabs button.active { background: var(--indigo); color: var(--sand); border-color: var(--indigo); }

/* ---------- Badges de statut (tampon) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}
.badge.pending { background: #eee6d6; color: #8a7c68; border-color: var(--border); }
.badge.submitted { background: #fbeed0; color: #9c6b1a; border-color: #eed7a3; animation: pulseRing 1.8s ease-in-out infinite; }
.badge.approved { background: #dcefe0; color: var(--green); border-color: #b9dcc0; }
.badge.paid { background: #dbe6ee; color: var(--indigo); border-color: #b9cddd; }
.badge.rejected { background: #f6dcda; color: var(--red); border-color: #edbcb7; }

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(156, 107, 26, 0.25); }
  50% { box-shadow: 0 0 0 5px rgba(156, 107, 26, 0); }
}

/* ---------- Listes projet / étapes ---------- */
.milestone-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--card);
  display: block;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  animation: cardIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.milestone-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--gold); }
.milestone-item .title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.milestone-item .title-row strong { font-family: "Fraunces", serif; font-size: 1.02rem; font-weight: 600; }

.proof-item { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 10px; }
.proof-item img, .proof-item video { max-width: 100%; border-radius: 8px; margin-top: 6px; display: block; }
.proof-item .meta { font-family: "IBM Plex Mono", monospace; font-size: 0.75rem; color: var(--muted); }

.comment { background: var(--sand-deep); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 0.9rem; animation: cardIn 0.3s ease both; }
.comment .who { font-weight: 700; font-size: 0.75rem; color: var(--indigo); font-family: "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.04em; }

.error-msg { color: var(--red); font-size: 0.88rem; margin-top: 8px; }
.empty { color: var(--muted); font-style: italic; padding: 20px 0; text-align: center; }

/* ---------- Animation "coup de tampon" à la validation ---------- */
.stamp-fx {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 999;
}
.stamp-fx svg {
  animation: stampDown 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
}
@keyframes stampDown {
  0% { opacity: 0; transform: scale(2.6) rotate(-8deg); }
  55% { opacity: 1; transform: scale(0.92) rotate(-8deg); }
  70% { transform: scale(1.04) rotate(-8deg); }
  100% { opacity: 0; transform: scale(1) rotate(-8deg); }
}

footer.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: none;
}

/* ---------- Bannière notifications ---------- */
#notifBanner {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  max-width: 616px;
  margin: 0 auto;
  background: var(--indigo);
  color: var(--sand);
  border: 1px solid var(--indigo-deep);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lift);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
  animation: riseIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
#notifBanner div { display: flex; gap: 8px; }
#notifBanner div > * { flex: 1; }
#notifBanner button#notifEnableBtn { background: var(--gold); color: var(--indigo-deep); }
#notifBanner button#notifEnableBtn:hover { background: var(--gold-soft); }
#notifBanner button.ghost { color: var(--sand); border-color: rgba(239, 230, 214, 0.4); }
